Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 3d flying alladin rug
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: Sat Aug 02, 2008 7:59 pm   Post subject: 3d flying alladin rug

originally started as 3d graph program...
    View.Set ("graphics")
    View.Set ("offscreenonly")

    colorback (120)

    const depth := 10

    function divi (x, y : real) : real
    if y = 0 then
    result 9999999
    else
    result (x / y)
    end if
    end divi

    procedure drawdot3d (x, y, z : real, c : int)
    drawdot (round (divi (x, z / depth) + maxx / 2), round (divi (y, z / depth) + maxy / 2), c)
    end drawdot3d

    procedure drawline3d (x1, y1, z1, x2, y2, z2 : real, c : int)
    drawline (round (divi (x1, z1 / depth) + maxx / 2), round (divi (y1, z1 / depth) + maxy / 2), round (divi (x2, z2 / depth) + maxx / 2), round (divi (y2, z2 / depth) + maxy / 2), c)

    end drawline3d
    var x, y, y2, xt, yt : real := 0
    const scale := 40
    const detail := 1000
    const maxX := 30



    cls
    %Draw.Line (0, maxy div 2, maxx, maxy div 2, 11)
    %Draw.Line (maxx div 2, maxy, maxx div 2, 0, 11)
    procedure grid (scale : int)
    for j : 1 .. 60 by scale
    %Draw.Line (0, j, maxx, j, 18)
    %drawline3d (-1000, j, 100, 1000, j, 100, 11)
    drawline3d (-3000, -400, j, 3000, -400, j, 11)
    drawline3d ((j - 25) * 40, -400, 1, (j - 25) * 40, -400, 60, 11)
    %drawline3d (-1000, j, 100, 1000, j, 100, 11)
    %drawline3d (j, -1000, 100, j, 1000, 100, 11)

    %Draw.Line ((maxx div 2) - 1, j, (maxx div 2) + 1, j, grey)
    end for
    end grid
    xt := -maxx
    yt := 0
    color (white)
    /*for xf : -maxX * detail .. maxX * detail
    x := xf / detail
    %y:=((x**3)-(6*(x**2))+(11*(x))-6)
    %y := divi((x**2)-(12*x)+12,(((2*x)-4)*(x-6)))
    y := divi (1, x + 3) + 2
    %y:=3*x

    Draw.Line (round (xt * scale) + (maxx div 2), round (yt * scale) + (maxy div 2), round ((x) * scale) + (maxx div 2), round (y * scale) + (maxy div 2), 14)
    xt := x
    yt := y
    end for*/
    var xx : int := 0
    for m : 1 .. 1000
    grid (2)
    for xxx : 0 .. 360
    xx := 360 - xxx
    y := sind (xx + (5 * m)) * 40
    y2 := sind ((xx + (5 * m)) + 120) * 40
    %drawdot3d ((xx / 10) - 200, y, 10 + ((xx / 30) + (m / 9)), 14)
    %drawdot3d (y + 200, (xx / 10) + 200, 10 + ((xx / 30) + (m / 9)), 14)
    drawline3d ((xx / 10) - 200, y - 500, 10 + ((xx / 30) + (m / 7)), 200 + (xx / 10) - 200, y2 - 500, 10 + ((xx / 30) + (m / 7)), 15 + ((xx div 30) mod 16))
    %drawline3d ((xx / 10) + 300, y - 300, 10 + ((xx / 30) + (m / 9)), y + 200, (xx / 10) - 300, 10 + ((xx / 30) + (m / 9)), 15 + ((xx div 30) mod 16))
    end for
    View.Update
    cls
    end for
Sponsor
Sponsor
Sponsor
sponsor
Homer_simpson




PostPosted: Sat Aug 02, 2008 8:22 pm   Post subject: Re: 3d flying alladin rug

some serious wind =p
    View.Set ("graphics")
    View.Set ("offscreenonly")

    colorback (120)

    const depth := 10
    proc rotate (OriginX, OriginY : real, var secondpartX, secondpartY : real, Rotaion : real)
    var tempx := (((OriginX - secondpartX) * cosd (Rotaion)) + ((OriginY - secondpartY) * sind (Rotaion)))
    var tempy := (((OriginY - secondpartY) * cosd (Rotaion)) - ((OriginX - secondpartX) * sind (Rotaion)))
    secondpartY := OriginY - tempy
    secondpartX := OriginX - tempx
    end rotate

    function divi (x, y : real) : real
    if y = 0 then
    result 9999999
    else
    result (x / y)
    end if
    end divi

    procedure drawdot3d (x, y, z : real, c : int)
    drawdot (round (divi (x, z / depth) + maxx / 2), round (divi (y, z / depth) + maxy / 2), c)
    end drawdot3d

    procedure drawline3d (x1, y1, z1, x2, y2, z2 : real, c : int)
    drawline (round (divi (x1, z1 / depth) + maxx / 2), round (divi (y1, z1 / depth) + maxy / 2), round (divi (x2, z2 / depth) + maxx / 2), round (divi (y2, z2 / depth) + maxy / 2), c)

    end drawline3d
    var x, y, y2, xt, yt, xx1, xx2, yy1, yy2, zz1, zz2 : real := 0
    const scale := 40
    const detail := 1000
    const maxX := 30



    cls
    %Draw.Line (0, maxy div 2, maxx, maxy div 2, 11)
    %Draw.Line (maxx div 2, maxy, maxx div 2, 0, 11)
    procedure grid (scale : int)
    for j : 1 .. 60 by scale
    %Draw.Line (0, j, maxx, j, 18)
    %drawline3d (-1000, j, 100, 1000, j, 100, 11)
    drawline3d (-3000, -400, j, 3000, -400, j, 11)
    drawline3d ((j - 25) * 40, -400, 1, (j - 25) * 40, -400, 60, 11)
    %drawline3d (-1000, j, 100, 1000, j, 100, 11)
    %drawline3d (j, -1000, 100, j, 1000, 100, 11)

    %Draw.Line ((maxx div 2) - 1, j, (maxx div 2) + 1, j, grey)
    end for
    end grid
    xt := -maxx
    yt := 0
    color (white)
    /*for xf : -maxX * detail .. maxX * detail
    x := xf / detail
    %y:=((x**3)-(6*(x**2))+(11*(x))-6)
    %y := divi((x**2)-(12*x)+12,(((2*x)-4)*(x-6)))
    y := divi (1, x + 3) + 2
    %y:=3*x

    Draw.Line (round (xt * scale) + (maxx div 2), round (yt * scale) + (maxy div 2), round ((x) * scale) + (maxx div 2), round (y * scale) + (maxy div 2), 14)
    xt := x
    yt := y
    end for*/
    var xx : int := 0
    for m : 1 .. 1000
    grid (2)
    for xxx : 0 .. 360
    xx := 360 - xxx
    y := sind (xx + (5 * m)) * 40
    y2 := sind ((xx + (5 * m)) + 120) * 40
    xx1 := (xx / 10) - 200
    yy1 := y - 300
    zz1 := 10 + ((xx / 30) + (m / 7))
    xx2 := 200 + (xx / 10) - 200
    yy2 := y2 - 300
    zz2 := 10 + ((xx / 30) + (m / 7))
    %drawdot3d ((xx / 10) - 200, y, 10 + ((xx / 30) + (m / 9)), 14)
    %drawdot3d (y + 200, (xx / 10) + 200, 10 + ((xx / 30) + (m / 9)), 14)
    rotate (xx1, yy1, xx2, yy2, m*4)
    drawline3d (xx1, yy1, zz1, xx2, yy2, zz2, 15 + ((xx div 30) mod 16))
    %drawline3d ((xx / 10) - 200, y - 500, 10 + ((xx / 30) + (m / 7)), 200 + (xx / 10) - 200, y2 - 500, 10 + ((xx / 30) + (m / 7)), 15 + ((xx div 30) mod 16))
    %drawline3d ((xx / 10) + 300, y - 300, 10 + ((xx / 30) + (m / 9)), y + 200, (xx / 10) - 300, 10 + ((xx / 30) + (m / 9)), 15 + ((xx div 30) mod 16))
    end for
    View.Update
    cls
    end for
SNIPERDUDE




PostPosted: Sun Aug 03, 2008 7:46 am   Post subject: RE:3d flying alladin rug

Really good actually, wasn't expecting that.

Next time use code tags please.
Insectoid




PostPosted: Sun Aug 03, 2008 10:50 am   Post subject: RE:3d flying alladin rug

I believe your first 2 lines can be condensed into 1.

code:

View.Set ("graphics, offscreenonly")


Other than that, you really know your 3D!
SNIPERDUDE




PostPosted: Sun Aug 03, 2008 9:03 pm   Post subject: RE:3d flying alladin rug

This example really reminds me of
the runescape 3D model...
Insectoid




PostPosted: Mon Aug 04, 2008 8:00 am   Post subject: RE:3d flying alladin rug

Runescape actually got a huge graphics update recently. It now looks like it was made by 10-year-olds instead of 9-year-olds. (My brother is a member, and runescape is 90% of the stuff he talks about, so I hear these things)
SNIPERDUDE




PostPosted: Mon Aug 04, 2008 9:33 am   Post subject: RE:3d flying alladin rug

lmao, I still have an account.

Play when I'm bored to tears.
The new graphics update (when in full HD)
doesn't look too sh*ty. The old graphics did.
apomb




PostPosted: Mon Aug 04, 2008 11:06 am   Post subject: RE:3d flying alladin rug

Homer Simpson is Back!? Holy Hell!
Sponsor
Sponsor
Sponsor
sponsor
Aziz




PostPosted: Tue Aug 05, 2008 9:23 am   Post subject: RE:3d flying alladin rug

Holy hell is right. 1.9k posts makes one feel humbled =/
agnivohneb




PostPosted: Tue Aug 05, 2008 7:19 pm   Post subject: Re: RE:3d flying alladin rug

insectoid @ Mon Aug 04, 2008 8:00 am wrote:
Runescape actually got a huge graphics update recently. It now looks like it was made by 10-year-olds instead of 9-year-olds. (My brother is a member, and runescape is 90% of the stuff he talks about, so I hear these things)
My Bro is a member too and I hate hearing it all.
But back on topic, good program! Smile
SNIPERDUDE




PostPosted: Tue Aug 05, 2008 9:16 pm   Post subject: Re: RE:3d flying alladin rug

insectoid @ Mon Aug 04, 2008 8:00 am wrote:
Runescape actually got a huge graphics update recently. It now looks like it was made by 10-year-olds instead of 9-year-olds. (My brother is a member, and runescape is 90% of the stuff he talks about, so I hear these things)


Man, that just makes me feel like a pretty bad programmer if a 9 or 10 year old
can do 3D and I can't Razz
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 11 Posts ]
Jump to:   


Style:  
Search: