#1✎ 102dfrost2could someone make a DEF block for perspective projection, please
Posted
#2✎ 282spaceturtlesVideo GamesI like to play video games!HobbiesAvatar BlockI didn't change my avatar for 30 days.WebsiteIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthDEF DRAW_WIRE_RECTPRISM
GLINE 200-8,120-8,200+8,120-8,#RED
GLINE 200-8,120+8,200+8,120+8,#RED
GLINE 200-8,120-8,200-8,120+8,#RED
GLINE 200+8,120-8,200+8,120+8,#RED
GLINE 200-4,120-4,200+4,120-4,RGB(90,0,0)
GLINE 200-4,120+4,200+4,120+4,RGB(90,0,0)
GLINE 200-4,120-4,200-4,120+4,RGB(90,0,0)
GLINE 200+4,120-4,200+4,120+4,RGB(90,0,0)
GLINE 200-8,120-8,200-4,120-4,RGB(175,0,0)
GLINE 200+8,120-8,200+4,120-4,RGB(175,0,0)
GLINE 200-8,120+8,200-4,120+4,RGB(175,0,0)
GLINE 200+8,120+8,200+4,120+4,RGB(175,0,0)
END
Draws a tiny red "cube" shape. You can see the lines get darker making it look like it has depth
Posted
Edited
by spaceturtles
#3✎ 102dfrost2i want a function:
DEF PERSPECTIVE X,Y,Z OUT X2,Y2
'code
END
Posted
#4✎ 165NathanielSpring 2017 Contest WinnerI won the SmileBASIC Source Spring 2017 Contest!Programming ContestStaff Pick"Your program is one of our favorites!" - StaffAchievementsHelperReceived for being very helpful around SmileBASIC SourceAchievementsDEF PERSPECTIVE X,Y,Z,VP OUT X2,Y2
X2=X/(Z-VP)
Y2=Y/(Z-VP)
END
VP is the vanishing point distance. No "z" value should be bigger than this number and this number should be consistent for all calculations.
Posted
Edited
by Nathaniel
#6✎ 165NathanielSpring 2017 Contest WinnerI won the SmileBASIC Source Spring 2017 Contest!Programming ContestStaff Pick"Your program is one of our favorites!" - StaffAchievementsHelperReceived for being very helpful around SmileBASIC SourceAchievementsThis is the function I usually use for two-axis rotation.
DEF ROT_3D X,Y,Z,A1,A2 OUT X3,Y3,Z3
VAR W=SIN(RAD(A1)),W2=SIN(RAD(A2))
VAR H=COS(RAD(A1)),H2=COS(RAD(A2))
VAR Z2=Z*H-X*W
X3=Z*W+X*H
Y3=Y*H2-Z2*W2
Z3=Y*W2+Z2*H2
END
It's also faster if you calculate all the sin/cos calculation before you calculate all the point's locations.
Posted
#7✎ 475random_godIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthZelda Is Awesome!I love The Legend Of Zelda!Express YourselfVideo GamesI like to play video games!HobbiesCool.
Posted