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: Select all
DIM SHARED Xrotate!, Yrotate!, Zrotate!
DIM SHARED Perspective%
DIM SHARED X.scene%, Y.scene%, Z.scene%
DIM SHARED X2D!, Y2D!
DIM SHARED ScreenOffX!, ScreenOffY!
Code: Select all
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