Hello everyone!
I am working on a game in ICE (which I only decided to learn just recently, since it is on-calc as opposed to C or C++), and I am trying to write a super simple 3D engine for it. I am using the basic perspective projection formula, where Px,y,z is the coordinates of the point to be rendered, Cx,y,z is the coordinates of the camera (no rotation taken into account due to the complexities of sin( and cos( in ICE and just the general complexities of trying to integrate rotation into a 3D engine in the first place), and Sx,y is the position the point is rendered on-screen, (Px-Cx)/(Pz-Cz) = Sx for the X position and (Py-Cx)/(Pz-Cz) = Sy. Once I can get it to plot the lines correctly, I plan to use flood fill to make fancy filled polygons (no textures, of course). However, that is the problem: it appears to not be doing the math correctly. After literal hours of going over the code and sending to the calculator innumerable times, I'm stumped. Essentially, I need someone else to figure this out. L1 is a list of the x positions of the points, L2 is y positions, and L3 is the z positions. It needs a complete rewrite, but if anyone can supply even a snippet of code that takes the positions from the lists, does the math (correctly!), and can output screen positions that work for the TI-84 Plus CE, thank you. I need it. If you want to see my code, here:
Code:
Also, if you recognize me from the Argon IDE thing, let's just say it's on hold until I can figure out ICE.
I should also mention that the numbers that appear on-screen are for my debugging. You probably shouldn't even try to run the code anyway, it would be faster for you to write something new than try to understand my code.
I am working on a game in ICE (which I only decided to learn just recently, since it is on-calc as opposed to C or C++), and I am trying to write a super simple 3D engine for it. I am using the basic perspective projection formula, where Px,y,z is the coordinates of the point to be rendered, Cx,y,z is the coordinates of the camera (no rotation taken into account due to the complexities of sin( and cos( in ICE and just the general complexities of trying to integrate rotation into a 3D engine in the first place), and Sx,y is the position the point is rendered on-screen, (Px-Cx)/(Pz-Cz) = Sx for the X position and (Py-Cx)/(Pz-Cz) = Sy. Once I can get it to plot the lines correctly, I plan to use flood fill to make fancy filled polygons (no textures, of course). However, that is the problem: it appears to not be doing the math correctly. After literal hours of going over the code and sending to the calculator innumerable times, I'm stumped. Essentially, I need someone else to figure this out. L1 is a list of the x positions of the points, L2 is y positions, and L3 is the z positions. It needs a complete rewrite, but if anyone can supply even a snippet of code that takes the positions from the lists, does the math (correctly!), and can output screen positions that work for the TI-84 Plus CE, thank you. I need it. If you want to see my code, here:
Code:
AVERTEX3
σyL₁,1,5,5,10,10,5
σyL₂,1,1,10,10,1,1
σyL₃,1,10,20,10,20,10
100→CX
100→CY
100→CZ
10→V
det(0
det(9,1
det(20,0
det(21,255
det(22,0
det(2,255
Repeat getKey(9)
det(5,0
For(I,0,3,1
*{L₁+I}*V→SX
*{L₂+I}*V→SY
*{L₃+I}*V→SZ
*{L₁+I+1}*V→SP
*{L₂+I+1}*V→SQ
*{L₃+I+1}*V→SR
det(19,100,10+10*I
det(16,SX,3
det(19,100,60+10*I
det(16,SY,3
SZ-CZ→SZ
((SX+CX)/SZ)→SX
((SY+CY)/SZ)→SY
SR-CZ→SR
((SP+CX)/SR)→SP
((SQ+CY)/SR)→SQ
det(19,150,10+10*I
det(16,SX,3
det(19,150,60+10*I
det(16,SY,3
det(19,150,60+10*I
det(16,SY,3
det(30,SX,SY,SP,SQ
End
det(19,10,10
det(16,CX,3
det(19,10,20
det(16,CY,3
det(19,10,30
det(16,CZ,3
det(10
If getKey(4):CX+1→CX:End
If getKey(1):CX-1→CX:End
If getKey(3):CZ+1→CZ:End
If getKey(2):CZ-1→CZ:End
End
det(1
Also, if you recognize me from the Argon IDE thing, let's just say it's on hold until I can figure out ICE.
I should also mention that the numbers that appear on-screen are for my debugging. You probably shouldn't even try to run the code anyway, it would be faster for you to write something new than try to understand my code.