Fix bug : ALWAYS init your vetors to 0!
This commit is contained in:
parent
78b38a19f1
commit
6eb1760552
@ -1,5 +1,4 @@
|
|||||||
// Hello free cycles !
|
// Hello free cycles !
|
||||||
// Let's win some CPU cycles back
|
|
||||||
//
|
//
|
||||||
// Ref : /psyq/DOCS/Devrefs/Inlinref.pdf, p.18
|
// Ref : /psyq/DOCS/Devrefs/Inlinref.pdf, p.18
|
||||||
// /psyq/psx/sample/scea/GTE
|
// /psyq/psx/sample/scea/GTE
|
||||||
@ -87,7 +86,7 @@ void display(void)
|
|||||||
// Wait for drawing
|
// Wait for drawing
|
||||||
DrawSync(0);
|
DrawSync(0);
|
||||||
// Wait for vsync
|
// Wait for vsync
|
||||||
VSync(0);
|
VSync(1);
|
||||||
// Flip DISP and DRAW env
|
// Flip DISP and DRAW env
|
||||||
PutDispEnv(&disp[db]);
|
PutDispEnv(&disp[db]);
|
||||||
PutDrawEnv(&draw[db]);
|
PutDrawEnv(&draw[db]);
|
||||||
@ -102,7 +101,8 @@ void display(void)
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
long p, flag, OTz;
|
long p, flag, OTz;
|
||||||
SVECTOR rotVector, rotVector4 = {0}; // Initialize rotation vector {x, y, z}
|
SVECTOR rotVector = {0};
|
||||||
|
SVECTOR rotVector4 = {0}; // Initialize rotation vector {x, y, z} - ALWAYS !
|
||||||
VECTOR transVector = {0, 0, CENTERX, 0}; // Initialize translation vector {x, y, z}
|
VECTOR transVector = {0, 0, CENTERX, 0}; // Initialize translation vector {x, y, z}
|
||||||
SVECTOR vertPos[4] = {
|
SVECTOR vertPos[4] = {
|
||||||
{ 0, -32, 0, 0 }, // Vert 1
|
{ 0, -32, 0, 0 }, // Vert 1
|
||||||
@ -135,8 +135,7 @@ int main(void)
|
|||||||
// Draw on the left part of the screen
|
// Draw on the left part of the screen
|
||||||
transVector.vx = -CENTERX/2;
|
transVector.vx = -CENTERX/2;
|
||||||
// Increment rotation angle on Y axis
|
// Increment rotation angle on Y axis
|
||||||
rotVector.vy += 8;
|
rotVector.vy += 1;
|
||||||
//~ rotVector.vx -= 4 ;
|
|
||||||
// Find rotation matrix from vector, store in
|
// Find rotation matrix from vector, store in
|
||||||
RotMatrix_gte(&rotVector, &workMatrix);
|
RotMatrix_gte(&rotVector, &workMatrix);
|
||||||
// Ditto for translation
|
// Ditto for translation
|
||||||
@ -177,8 +176,8 @@ int main(void)
|
|||||||
// Set matrices - Move to right of screen
|
// Set matrices - Move to right of screen
|
||||||
transVector.vx = CENTERX/2;
|
transVector.vx = CENTERX/2;
|
||||||
// Increment rot on X/Y axis
|
// Increment rot on X/Y axis
|
||||||
rotVector4.vy -= 8 ;
|
rotVector4.vy -= 1 ;
|
||||||
rotVector4.vx -= 4 ;
|
rotVector4.vx -= 1 ;
|
||||||
// Set matrices
|
// Set matrices
|
||||||
RotMatrix_gte(&rotVector4, &workMatrix);
|
RotMatrix_gte(&rotVector4, &workMatrix);
|
||||||
TransMatrix(&workMatrix, &transVector);
|
TransMatrix(&workMatrix, &transVector);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user