#1✎ 132DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strengthcould someone make a DEF block for perspective projection, please
Posted
#2✎ 302spaceturtlesVideo 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✎ 132DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strengthi want a function:
DEF PERSPECTIVE X,Y,Z OUT X2,Y2
'code
END
Posted
#4✎ 170NathanielFinal(?) Contest WinnerI won the (possibly) final SmileBASIC Source Contest! October 2018Programming ContestScholarReceived for knowing a great deal about programming topicsAchievementsHelperReceived 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
#5✎ 132DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming Strengthwhat about rotation?
Posted
#6✎ 170NathanielFinal(?) Contest WinnerI won the (possibly) final SmileBASIC Source Contest! October 2018Programming ContestScholarReceived for knowing a great deal about programming topicsAchievementsHelperReceived 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✎ 522random_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
#8✎ 132DFrostExpert ProgrammerProgramming no longer gives me any trouble. Come to me for help, if you like!Programming StrengthSo I could pass XYZ into ROT_3D and use the output in PERSPECTIVE?
Posted