Dark Bit Factory & Gravity
PROGRAMMING => Freebasic => Topic started by: Shockwave on January 30, 2007
-
I've been asked by someone to make an intro for a group which I will not be able to post on this forum, had an idea to make a better version of my boxtunnel and have glenze vectors or something like that flying out of the tunnel.
Just as a gift, I've attahed a rar including the source code for the tunnel part of it. It will look completely different when it's done but the source may be useful to some so here it is..
-
That's a nice tunnel, run smoothly here :goodpost:
-
Thanks for sharing man. Cool stuff.
-
My pleasure :)
-
Totally awesome. Thanks for sharing and adding code.
inc karma
-
Thanks Benny :)
-
thanks a lot for your help shockie!
-
YW...
This is how it looks at the moment..
-
:clap:
-
looks great
-
Shockwave
that sure is some fast code . . . it draws so fast on my machine! I don't understand exactly how the routine works but I will check it out and have a looksee!!
Drew
ps Karma up+ for the code!
-
The tunnel is using an interesting dodge to keep the speed up and eliminate the need for any sorting or z buffer. essentially all I have done is to create a series of diminishing squares, these are treated as 3D points, but in fact it's no more involved than writing a 3D starfield. You see, the tunnel never actually moves, I just add a variable to it, the variable moves forward and when it's advanced by one square it is re-set. This means that the tunnel is always drawn from back to front. Then it is a matter of adding some sine and cos to each layer of the tunnel to make it bend, in the full version it rotates, but a simple rotation around one axis is not hard.
X = COS(theta) * XX - SIN(theta) * YY
Y = COS(theta) * YY + SIN(theta) * XX
Theta is just a posh way of saying rotation angle.