Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] 3d box from scratch!

Author
Message
Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 3rd Dec 2009 02:26
Well, i was bored again, so i decided to create a 3d rotating box from scratch. I know that it's extremely pointless. this code is basically a wireframe view at

make object box 1,1,2,1
do
yrotate camera 0, camera angle y(0)+mousemovex()
xrotate camera 0, camera angle x(0)+mousemovey()
sync
loop




Here it is, and since it uses d3d_line, I'll upload the .exe attached (it has no media, so you can just say open from the web browser).


The code is a bit... wierd. this is due to two things. One is that functions can't return user defined types, or accept them as arguments, so i had to make a bunch of global variables just to return numbers. The other is that i decided to write my own code for matrix multiplication. I figure that using the ones built into DBP would be cheating

use the arrowkeys to rotate the box, mouse move to look around.

The shading on the lines (why i used d3d_line) is to give the user a sense of depth. Without it, the shapes can play some wierd tricks on your mind. One second it can look like a 3d box, the next a bunch of wierd stretchy lines. I actually thought i had coded something horribly wrong before i realized it was my sense of depth that was off. If you want to see how it looks without shading, look behind you (in the program o'course ).

I do think there is one error with translations though. I can't really seem to get movement to work, but i haven't really tried to debug it.

Attachments

Login to view attachments
Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 8th Dec 2009 06:25
yknow... It really wouldn't be too hard to expand this to 4 dimensions...


>

Login to post a reply

Server time is: 2024-04-20 03:14:21
Your offset time is: 2024-04-20 03:14:21