Qbasic4.5 Codes 04: 3D to 2D Conversion. [My year 2000 opin]

Discuss popular GCS tools like ZZT, Megazeux and Adventure Game Studio, as well as programming and other topics related to game design.
Post Reply
User avatar
Experienced Member
Experienced Member
Posts: 84
Joined: Mon Mar 20, 2006 7:15 pm
Location: Next to you, if not then who

Qbasic4.5 Codes 04: 3D to 2D Conversion. [My year 2000 opin]

Post by NeonAmd64 »

Fact: All 3D worlds are based on division: without it the 3D worlds will be no longer exist. B)

Description: The code will convert 3D basic parameters into a 2D basic position.

Caution: :no:
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 ScreenOffX!, ScreenOffY!
This is the code:

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!

Finished...... :)

It was a very long journey. hehehe :laugh:

So If explanation is needed then please standup :laugh: .. Nooo.. I am joking.. just ask me. :)

Like to see some example then goto:
I am living in a black metal and I hope I die for a principle. And of course you still don't know me….
Words are coded in the two sentences above, don't try to decode it.
Post Reply