Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: boot2490 on March 02, 2012, 10:36:00 pm
-
So, guys, I made a mode seven engine on my TI 83+ that I plan to later port to AXE and make into a Mario Kart game.
It reads from matrix A. Matrix A, being 5x4, contains coordinates for five lines, each row being X1,Y1, X2, Y2. The lines must be within 0 to 94 and 0 to 62.
Reading those lines, it first draws the lines on the screen normally, then after you press enter, it flattens them à la mode seven. The closer the "Perspective Factor" is to 62, the more intense the perspective transformation is. The closer to numbers upwards to about 4000, the more it is like top-down.
Here are some screenies, which show a few different perspective factors and how they transform the same image. Tested on a TI 83+ BE.
(http://img.removedfromgame.com/imgs/trans1.gif)
(http://img.removedfromgame.com/imgs/trans2.gif)
(http://img.removedfromgame.com/imgs/trans3.gif)
And here is the program, and the sample matrix used during testing.
-
you know that you can store values to the xmin/xmax/ymin/ymax variables in order to force change the screen dimensions for a program, yes?
-
Yeah, I'll do that. I was too lazy to put it in.
-
Updated!!! It works now.
-
Updated! I accidentally uploaded an old version.
-
Also, please don't triple or double post, especially not in so short a time period. There are rules about this, if you click "rules" at the top.
-
Looks nice, but I definitively can't wait to see rotation in action. And yeah no double posting (although the first post in the triple-post was fine, due to being yesterday)
-
I was surprised how well this works. I hope that these concepts are used for a game, though it may have to be done in ASM for speed.
-
If I remember he's planning to use Axe, which might provide quite good speed. It would definitively need to be optimized, though.
-
It didn't completely work for me when drawing, but that's maybe because I am using TI-84+ OS 2.41 on WabbitEmu.
-
This looks nice, I think it wouldn't be excessively hard in Axe, I mean just look at HappyBobJr's mode 7 game.
-
Mario Kart is on hold until further notice, as I am finalizing the actual mode seven engine, which I will be making a topic for before the week is over.
-
Take it one step at a time, I think what you have done so far is quite good. Just keep at it, and eventually you should be able to piece things together. ;)
-
If I understand correctly of what we were talking before. You want to move a point(X1,Y1) for a certain degrees(R) to a certain direction.
This means your line (X1,Y1,X2,Y2) will move that degree too.
Lets say (X2,Y2) = (0,0) then
And (X1,X2) is for now (5,5) The length of this line is then sqr(5^2+5^2).
The 'slope' of that would be 5/5=1
That means tan^-1(5/5)=45 (note that tan^-1(x) here isn't the same as tan(x)^-1 but that this is arctan).
Now you want to rotate the line, lets say 90° to the left. That means 45°-90°=(-45°)
solve(5^2+5^2=x^2 + (tan(-45)x)^2,x) gives x=5*cos(-45)*sqr(2) or x=-5*cos(-45)*sqr(2) (I don't know if the z80 calcs have the solve function but mine ti-89 does).
To know if you have to use - or not at the beginning you can check like this: tan(-45)*1=-1 so you use -
-5*cos(-45)*sqr(2)=-5=X1
tan(-45)*-5=5=Y1
With these new coordinates you can draw your new line at (-5,5,0,0) which is the other line but just rotated 90° to the left.
So I hope this can help a bit.
(Also thank you Jim for helping me with the solve( function)
-
By the way since some Axe coders do not check project topics nor any other part of the forums, feel free to ask help in the Axe language section if you need any for Mode 7 or to convert your BASIC code into Axe. Of course OmnomIRC sometimes does the job, but most of the time people have OmnomIRC disabled on their computer to avoid distraction.
-
Is the topic for the Mode Seven Engine here somewhere?
Also I'm not sure but does this work ok on a TI-84+?
1300 posts!
-
I will make new topics for everything once I get some progress. But for now, research paper :D