NeonAmd64 Experienced Member

 Joined: 20 Mar 2006 Posts: 84 Location: Next to you, if not then who
|
Posted: Fri Apr 14, 2006 11:48 am
Post subject: Qbasic4.5 Codes 04: 3D to 2D Conversion. [My year 2000 opin] |
|
|
Fact: All 3D worlds are based on division: without it the 3D worlds will be no longer exist.
Description: The code will convert 3D basic parameters into a 2D basic position.
Caution:
The code will acquire you to specify the perspective [angle] of the lens.[Default Value is 220 or 1024]
This will only convert 3D into 2D without drawing anything.
Here is the code:
This will make the arrays and the variables that are required:
| Code: | DIM SHARED Xrotate!, Yrotate!, Zrotate!
DIM SHARED Perspective%
DIM SHARED X.scene%, Y.scene%, Z.scene%
DIM SHARED X2D!, Y2D!
DIM SHARED ScreenOffX!, ScreenOffY! |
This is the code:
| Code: | SUB D3D.D2D (X3D!, Y3D!, Z3D!)
X2D! = (((X3D! + X.scene%) * perspective%) / (Z3D! + Z.scene%))+ ScreenOffX!
Y2D! = (((Y3D! + Y.scene%) * perspective%) / (Z3D! + Z.scene%))+ ScreenOffY!
END SUB
|
Finished......
It was a very long journey. hehehe
So If explanation is needed then please standup .. Nooo.. I am joking.. just ask me.
Like to see some example then goto:
http://neonamd64.atspace.com/qbas.html |
|