I haven’t posted in a while so I thought I’d just throw up a little graphics demo to show what I’ve been playing around with. Since I’ve never used C or ASM until Ben asked me to create our first translation patch I’ve been trying to overcome those small hurdles by experimenting as much as I can and bulding a small base of functions that can be used to create something bigger.
I think everyone hear should be able to tell what this demo is.
IT’S JUST A DEMO, DON’T READ INTO THIS ANYMORE THAN THAT :).
But hopefully it’s a start of better things to come.
Thanks.
Attachments:
Greg Stevens wrote:
Here is the Arwing able to be rotated around all 3 axis.
This is looking really good. I hope that the next demo lets us push a button to shoot lasers and that the next demo after that one lets us shoot an enemy that is in the distance and that the next demo after that one lets us earn points by shooting multiple enemies that attack you and that the next demo after that one lets you play a whole level and that… well, you can see where I’m going with this. 😉
I’ll check out the double lines. I didn’t notice them but I wouldn’t be surprised. I’m not using exact calculations since I’m using only integer math. I have allowed some error into the routines to hopefully give better speed throughout the whole rendering process. I’m shooting for good, fast, and fun not necessesarily perfect and polished. I’ve tried to use division very sparingly and use right shifts instead. This is very fast but forces you to round up anything that would have been between 1 and 0 so there is some error there for sure. I’m also experimenting with a clipping routine that doesn’t use division so that is actually probably causing the double lines as it hits the minimum z value. As for the coordinates I store them in a simple signed int array. I’m currently using triangles only and the coordinates are stored in counter-clockwise fashion to allow for dot and cross product calculations that I may implement later on. Each coordinate is just an offset from a “center” or “root” point. That point is the center for all rotations and transformations. I’m using a left handed system so the z axis increases as it goes into the screen or away from you. My Y axis is currently inverted so it increases going down (I’ll have to change that at some point) and the x axis is normal increasing from left to right.
Here is the actual array. I only store the coordinates here. The other couple variable are currently stored in a struct that has a pointer to this data.
#define STARFOXSHIPDATASIZE 9*22 /*********************************************** All triangles need to be drawn counter-clockwise based on looking at them from the front. (Very Important) or culling won't work right ************************************************/ const s32 starFoxShipData[STARFOXSHIPDATASIZE]={ /************************ Nose of ship 4 triangles ************************/ 0,-5,10, -5,-2,10, 0,-2,40, 0,-5,10, 5,-2,10, 0,-2,40, -5,-2,10, 0,-2,40, 0,0,10, 5,-2,10, 0,0,10, 0,-2,40, /************************* Cockpit 12 triangles (6 squares) *************************/ 0,-5,10, -5,-2,10, -5,-2,0, 0,-5,10, -5,-2,0, 0,-5,0, -5,-2,10, 0,0,0, -5,-2,0, -5,-2,10, 0,0,10, 0,0,0, 0,-5,10, 0,-5,0, 5,-2,0, 0,-5,10, 5,-2,0, 5,-2,10, 0,0,10, 5,-2,0, 0,0,0, 0,0,10, 5,-2,10, 5,-2,0, 0,-5,0, -5,-2,0, 0,-2,0, -5,-2,0, 0,0,0, 0,-2,0, 0,0,0, 5,-2,0, 0,-2,0, 5,-2,0, 0,-5,0, 0,-2,0, /*********************** left wing 3 triangles ***********************/ -5,-2,10, -40,-2,-10, -5,-2,0,//top -8,-2,10, -8,-2,0, -8,-10,-10,//left side -8,-2,0, -8,-2,10, -8,10,-10,//left side /*********************** right wing 3 triangles ***********************/ 5,-2,10, 40,-2,-10, 5,-2,0,//top 8,-2,10, 8,-2,0, 8,-10,-10, //left side 8,-2,0, 8,-2,10, 8,10,-10, //left side };
Greg Stevens schrieb:
I did notice that the virtual boy automatically wraps coordinates to the other side of the screen if they go outside the screen bounds. Maybe there is an obvious reason as to why but I thought it would only do that for BGMaps and Worlds if the OVR[something] flag was set. So if any object goes off the right side of the screen it automatically appears on the left hand side without having to do any special coding. I’m actually going to have to do coding to remove that “feature” if I can’t find a flag or register that is causing that to happen.
Hey Greg, I’m experiencing a similar issue, did you find a way to disable the “feature” without having to turn off the WORLD?