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:

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.
Cool project! What version of the C toolchain are you using?
Also, it may not be working if you deal with floats or negative numbers, due to ICE not supporting them
Let's just say I dislike ICE now because C is so much better for speed and Celtic CE is so much better for little projects. C is always going to excel at math compared to ICE.
Haha yeah don't even try ICE for something that does any amount of math (and any floats/negative numbers whatsoever) or if it's even slightly graphics intensive. I'd recommend porting it to C while it's still small, I personally find C really fun and easier than something like TI basic or ICE. Hope to see how it turns out Very Happy
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement