Closes #4: Switch to GTE inline rendering functions
This commit is contained in:
parent
800be60cb6
commit
6e9ef23a2c
@ -17,7 +17,7 @@ typedef struct{
|
|||||||
int pan, panv;
|
int pan, panv;
|
||||||
int tilt, tiltv;
|
int tilt, tiltv;
|
||||||
int rol;
|
int rol;
|
||||||
VECTOR pos;
|
SVECTOR pos;
|
||||||
SVECTOR rot;
|
SVECTOR rot;
|
||||||
SVECTOR dvs;
|
SVECTOR dvs;
|
||||||
MATRIX mat;
|
MATRIX mat;
|
||||||
@ -27,4 +27,4 @@ void getCameraXZ(int * x, int * z, int actorX, int actorZ, int angle, int distan
|
|||||||
void getCameraXZY(int * x, int * z, int * y, int actorX, int actorZ, int actorY, int angle, int angleX, int distance);
|
void getCameraXZY(int * x, int * z, int * y, int actorX, int actorZ, int actorY, int angle, int angleX, int distance);
|
||||||
void getCameraZY( int * z, int * y, int actorZ, int actorY, int angleX, int distance);
|
void getCameraZY( int * z, int * y, int actorZ, int actorY, int angleX, int distance);
|
||||||
void applyCamera(CAMERA * cam);
|
void applyCamera(CAMERA * cam);
|
||||||
void setCameraPos(CAMERA * camera, VECTOR pos, SVECTOR rot);
|
void setCameraPos(CAMERA * camera, SVECTOR pos, SVECTOR rot);
|
||||||
|
BIN
include/defines
Normal file
BIN
include/defines
Normal file
Binary file not shown.
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
// Ordering table
|
// Ordering table
|
||||||
#define OT2LEN 8
|
#define OT2LEN 8
|
||||||
#define OTLEN 768
|
#define OTLEN 4096
|
||||||
#define PRIMBUFFLEN 4096 * sizeof(POLY_GT4) // Maximum number of POLY_GT3 primitives
|
#define PRIMBUFFLEN 4096 * sizeof(POLY_GT4) // Maximum number of POLY_GT4 primitives
|
||||||
|
|
||||||
// Fog
|
// Fog
|
||||||
#define FOG_NEAR 2300
|
#define FOG_NEAR 2300
|
||||||
|
@ -18,6 +18,7 @@ long drawQuad(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
|
|||||||
void set4VertexLerPos(MESH * mesh, long t);
|
void set4VertexLerPos(MESH * mesh, long t);
|
||||||
void set4Prism(POLY_GT4 * poly4, MESH * mesh, DRAWENV * draw, char * db, int i);
|
void set4Prism(POLY_GT4 * poly4, MESH * mesh, DRAWENV * draw, char * db, int i);
|
||||||
void set4Tex(POLY_GT4 * poly4, MESH * mesh, DRAWENV * draw, long t, int i);
|
void set4Tex(POLY_GT4 * poly4, MESH * mesh, DRAWENV * draw, long t, int i);
|
||||||
|
int set4Subdiv(MESH * mesh, POLY_GT4 * poly4, u_long * ot, long t, int i, char ** nextpri);
|
||||||
long interpolateQuad(POLY_GT4 * poly4, MESH * mesh, long t, long * Flag);
|
long interpolateQuad(POLY_GT4 * poly4, MESH * mesh, long t, long * Flag);
|
||||||
//2D drawing
|
//2D drawing
|
||||||
void drawBG(CAMANGLE * camPtr, char ** nextpri, u_long * otdisc, char * db);
|
void drawBG(CAMANGLE * camPtr, char ** nextpri, u_long * otdisc, char * db);
|
||||||
|
@ -30,3 +30,21 @@
|
|||||||
((v)->vx << 12) >> 8, \
|
((v)->vx << 12) >> 8, \
|
||||||
((v)->vy << 12) >> 8, \
|
((v)->vy << 12) >> 8, \
|
||||||
((v)->vz << 12) >> 8
|
((v)->vz << 12) >> 8
|
||||||
|
|
||||||
|
// GTE Macros
|
||||||
|
|
||||||
|
#define gte_RotAverageNclip4(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12) \
|
||||||
|
{ gte_ldv3(r1,r2,r3); \
|
||||||
|
gte_rtpt(); \
|
||||||
|
gte_stflg(r11); \
|
||||||
|
gte_nclip(); \
|
||||||
|
gte_stopz(r12); \
|
||||||
|
gte_stsxy3(r5,r6,r7); \
|
||||||
|
\
|
||||||
|
gte_ldv0(r4); \
|
||||||
|
gte_rtps(); \
|
||||||
|
gte_stsxy(r8); \
|
||||||
|
\
|
||||||
|
gte_stdp(r9); \
|
||||||
|
gte_avsz4(); \
|
||||||
|
gte_stotz(r10); }
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <libgpu.h>
|
#include <libgpu.h>
|
||||||
#include <libapi.h>
|
#include <libapi.h>
|
||||||
#include <libcd.h>
|
#include <libcd.h>
|
||||||
|
#include <inline_n.h>
|
||||||
|
#include <gtemac.h>
|
||||||
#include "../include/defines.h"
|
#include "../include/defines.h"
|
||||||
#include "../custom_types.h"
|
#include "../custom_types.h"
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "level0.h"
|
#include "level0.h"
|
||||||
|
|
||||||
CVECTOR level0_BGc = { 92, 218, 216, 0 };
|
CVECTOR level0_BGc = { 135, 232, 230, 0 };
|
||||||
|
|
||||||
VECTOR level0_BKc = { 88, 4, 0, 0 };
|
VECTOR level0_BKc = { 174, 174, 174, 0 };
|
||||||
|
|
||||||
CAMPOS level0_camPos_Camera = {
|
CAMPOS level0_camPos_Camera = {
|
||||||
{ -770,459,623 },
|
{ -770,459,623 },
|
||||||
|
@ -1323,7 +1323,7 @@ VANIM level1_modelCylindre_anim = {
|
|||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
1,
|
0,
|
||||||
{
|
{
|
||||||
//Frame 0
|
//Frame 0
|
||||||
{ 3,35,47 },
|
{ 3,35,47 },
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "../include/psx.h"
|
||||||
#include "../include/camera.h"
|
#include "../include/camera.h"
|
||||||
#include "../include/math.h"
|
#include "../include/math.h"
|
||||||
|
|
||||||
@ -22,12 +23,12 @@ void getCameraZY( int * z, int * y, int actorZ, int actorY, int angleX, int dist
|
|||||||
void applyCamera( CAMERA * cam ) {
|
void applyCamera( CAMERA * cam ) {
|
||||||
VECTOR vec; // Vector that holds the output values of the following instructions
|
VECTOR vec; // Vector that holds the output values of the following instructions
|
||||||
RotMatrix_gte(&cam->rot, &cam->mat); // Convert rotation angle in psx units (360° == 4096) to rotation matrix)
|
RotMatrix_gte(&cam->rot, &cam->mat); // Convert rotation angle in psx units (360° == 4096) to rotation matrix)
|
||||||
ApplyMatrixLV(&cam->mat, &cam->pos, &vec); // Multiply matrix by vector pos and output to vec
|
gte_ApplyMatrix(&cam->mat, &cam->pos, &vec); // Multiply matrix by vector pos and output to vec
|
||||||
TransMatrix(&cam->mat, &vec); // Apply transform vector
|
TransMatrix(&cam->mat, &vec); // Apply transform vector
|
||||||
SetRotMatrix(&cam->mat); // Set Rotation matrix
|
gte_SetRotMatrix(&cam->mat); // Set Rotation matrix
|
||||||
SetTransMatrix(&cam->mat); // Set Transform matrix
|
gte_SetTransMatrix(&cam->mat); // Set Transform matrix
|
||||||
};
|
};
|
||||||
void setCameraPos( CAMERA * camera, VECTOR pos, SVECTOR rot ) {
|
void setCameraPos( CAMERA * camera, SVECTOR pos, SVECTOR rot ) {
|
||||||
camera->pos = pos;
|
camera->pos = pos;
|
||||||
camera->rot = rot;
|
camera->rot = rot;
|
||||||
};
|
};
|
||||||
|
121
src/graphics.c
121
src/graphics.c
@ -1,26 +1,28 @@
|
|||||||
|
#include "../include/psx.h"
|
||||||
#include "../include/graphics.h"
|
#include "../include/graphics.h"
|
||||||
#include "../include/math.h"
|
#include "../include/math.h"
|
||||||
|
|
||||||
void enlightMesh(LEVEL * curLvl, MESH * mesh, SVECTOR * lgtang){
|
void enlightMesh(LEVEL * curLvl, MESH * mesh, SVECTOR * lgtang){
|
||||||
// Update light rotation on actor
|
// Update light rotation on actor
|
||||||
MATRIX rotlgt, rotmesh, light;
|
MATRIX rotlgt, rotmesh, light;
|
||||||
// Find rotmat from actor angle
|
// Find rotmat from actor angle
|
||||||
RotMatrix_gte(&mesh->rot, &rotmesh);
|
RotMatrix_gte(&mesh->rot, &rotmesh);
|
||||||
RotMatrix_gte(lgtang, &rotlgt);
|
RotMatrix_gte(lgtang, &rotlgt);
|
||||||
MulMatrix0(&rotmesh, &rotlgt, &rotlgt);
|
gte_MulMatrix0(&rotmesh, &rotlgt, &rotlgt);
|
||||||
MulMatrix0(curLvl->lgtmat, &rotlgt, &light);
|
gte_MulMatrix0(curLvl->lgtmat, &rotlgt, &light);
|
||||||
SetLightMatrix(&light);
|
gte_SetLightMatrix(&light);
|
||||||
};
|
};
|
||||||
void transformMesh(CAMERA * camera, MESH * mesh){
|
void transformMesh(CAMERA * camera, MESH * mesh){
|
||||||
MATRIX mat;
|
MATRIX mat;
|
||||||
// Apply rotation matrix
|
// Find rotation matrix
|
||||||
RotMatrix_gte(&mesh->rot, &mat);
|
RotMatrix_gte(&mesh->rot, &mat);
|
||||||
// Apply translation matrix
|
// Find translation matrix
|
||||||
TransMatrix(&mat, &mesh->pos);
|
TransMatrix(&mat, &mesh->pos);
|
||||||
// Compose matrix with cam
|
// Compose matrix with cam
|
||||||
CompMatrix(&camera->mat, &mat, &mat);
|
gte_CompMatrix(&camera->mat, &mat, &mat);
|
||||||
// Set default rotation and translation matrices
|
// Set default rotation and translation matrices
|
||||||
SetRotMatrix(&mat);
|
gte_SetRotMatrix(&mat);
|
||||||
SetTransMatrix(&mat);
|
gte_SetTransMatrix(&mat);
|
||||||
//~ }
|
//~ }
|
||||||
};
|
};
|
||||||
void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpri, u_long * ot, char * db, DRAWENV * draw) {
|
void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpri, u_long * ot, char * db, DRAWENV * draw) {
|
||||||
@ -41,6 +43,7 @@ void drawPoly(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
|
|||||||
void set3VertexLerPos(MESH * mesh, long t){
|
void set3VertexLerPos(MESH * mesh, long t){
|
||||||
// Find and set 3 interpolated vertex value
|
// Find and set 3 interpolated vertex value
|
||||||
// TODO : Fix artifacts at meshes seams.
|
// TODO : Fix artifacts at meshes seams.
|
||||||
|
// TODO : Pre-calculate lerp positions at runtime (for i in nframes, do calc)
|
||||||
// Fixed point math precision
|
// Fixed point math precision
|
||||||
short precision = 12;
|
short precision = 12;
|
||||||
// Vertex 1
|
// Vertex 1
|
||||||
@ -100,14 +103,15 @@ long interpolateTri(POLY_GT3 * poly, MESH * mesh, long t, long * Flag){
|
|||||||
// Find and set interpolated vertex value
|
// Find and set interpolated vertex value
|
||||||
set3VertexLerPos(mesh, t);
|
set3VertexLerPos(mesh, t);
|
||||||
// Coord transformation from world space to screen space
|
// Coord transformation from world space to screen space
|
||||||
nclip = RotAverageNclip3(
|
gte_RotAverageNclip3(
|
||||||
&mesh->tmesh->v[ mesh->index[t].order.vx ],
|
&mesh->tmesh->v[ mesh->index[t].order.vx ],
|
||||||
&mesh->tmesh->v[ mesh->index[t].order.vz ],
|
&mesh->tmesh->v[ mesh->index[t].order.vz ],
|
||||||
&mesh->tmesh->v[ mesh->index[t].order.vy ],
|
&mesh->tmesh->v[ mesh->index[t].order.vy ],
|
||||||
( long* ) &poly->x0, ( long* ) &poly->x1, ( long* ) &poly->x2,
|
( long* ) &poly->x0, ( long* ) &poly->x1, ( long* ) &poly->x2,
|
||||||
&mesh->p,
|
&mesh->p,
|
||||||
&mesh->OTz,
|
&mesh->OTz,
|
||||||
Flag
|
&Flag,
|
||||||
|
&nclip
|
||||||
);
|
);
|
||||||
return nclip;
|
return nclip;
|
||||||
};
|
};
|
||||||
@ -131,7 +135,7 @@ long interpolateQuad(POLY_GT4 * poly4, MESH * mesh, long t, long * Flag){
|
|||||||
// Find and set interpolated vertex value
|
// Find and set interpolated vertex value
|
||||||
set4VertexLerPos(mesh, t);
|
set4VertexLerPos(mesh, t);
|
||||||
// Coord transformations
|
// Coord transformations
|
||||||
nclip = RotAverageNclip4(
|
gte_RotAverageNclip4(
|
||||||
&mesh->tmesh->v[ mesh->index[t].order.pad ],
|
&mesh->tmesh->v[ mesh->index[t].order.pad ],
|
||||||
&mesh->tmesh->v[ mesh->index[t].order.vz],
|
&mesh->tmesh->v[ mesh->index[t].order.vz],
|
||||||
&mesh->tmesh->v[ mesh->index[t].order.vx ],
|
&mesh->tmesh->v[ mesh->index[t].order.vx ],
|
||||||
@ -139,7 +143,8 @@ long interpolateQuad(POLY_GT4 * poly4, MESH * mesh, long t, long * Flag){
|
|||||||
( long* )&poly4->x0, ( long* )&poly4->x1, ( long* )&poly4->x2, ( long* )&poly4->x3,
|
( long* )&poly4->x0, ( long* )&poly4->x1, ( long* )&poly4->x2, ( long* )&poly4->x3,
|
||||||
&mesh->p,
|
&mesh->p,
|
||||||
&mesh->OTz,
|
&mesh->OTz,
|
||||||
Flag
|
&Flag,
|
||||||
|
&nclip
|
||||||
);
|
);
|
||||||
return nclip;
|
return nclip;
|
||||||
};
|
};
|
||||||
@ -206,15 +211,13 @@ void set3Tex(POLY_GT3 * poly, MESH * mesh, DRAWENV * draw, long t, int i){
|
|||||||
setUV3(poly, mesh->tmesh->u[i].vx , mesh->tmesh->u[i].vy + mesh->tim->prect->y,
|
setUV3(poly, mesh->tmesh->u[i].vx , mesh->tmesh->u[i].vy + mesh->tim->prect->y,
|
||||||
mesh->tmesh->u[i+2].vx, mesh->tmesh->u[i+2].vy + mesh->tim->prect->y,
|
mesh->tmesh->u[i+2].vx, mesh->tmesh->u[i+2].vy + mesh->tim->prect->y,
|
||||||
mesh->tmesh->u[i+1].vx, mesh->tmesh->u[i+1].vy + mesh->tim->prect->y);
|
mesh->tmesh->u[i+1].vx, mesh->tmesh->u[i+1].vy + mesh->tim->prect->y);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
( (POLY_GT3 *) poly)->tpage = getTPage( 2,0,0,0 );
|
( (POLY_GT3 *) poly)->tpage = getTPage( 2,0,0,0 );
|
||||||
setUV3(poly, 0,0,0,0,0,0);
|
setUV3(poly, 0,0,0,0,0,0);
|
||||||
|
|
||||||
}
|
}
|
||||||
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vx ], &mesh->tmesh->c[ i+0 ], mesh->p, &outCol);
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vx ], &mesh->tmesh->c[ i+0 ], mesh->p, &outCol);
|
||||||
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vz ], &mesh->tmesh->c[ i+2 ], mesh->p, &outCol1);
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vz ], &mesh->tmesh->c[ i+2 ], mesh->p, &outCol1);
|
||||||
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vy ], &mesh->tmesh->c[ i+1 ], mesh->p, &outCol2);
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vy ], &mesh->tmesh->c[ i+1 ], mesh->p, &outCol2);
|
||||||
setRGB0(poly, outCol.r, outCol.g , outCol.b);
|
setRGB0(poly, outCol.r, outCol.g , outCol.b);
|
||||||
setRGB1(poly, outCol1.r, outCol1.g, outCol1.b);
|
setRGB1(poly, outCol1.r, outCol1.g, outCol1.b);
|
||||||
setRGB2(poly, outCol2.r, outCol2.g, outCol2.b);
|
setRGB2(poly, outCol2.r, outCol2.g, outCol2.b);
|
||||||
@ -244,63 +247,59 @@ void set4Tex(POLY_GT4 * poly4, MESH * mesh, DRAWENV * draw, long t, int i){
|
|||||||
( (POLY_GT4 *) poly4)->tpage = getTPage( 2,0,0,0 );
|
( (POLY_GT4 *) poly4)->tpage = getTPage( 2,0,0,0 );
|
||||||
setUV4(poly4, 0,0,0,0,0,0,0,0);
|
setUV4(poly4, 0,0,0,0,0,0,0,0);
|
||||||
}
|
}
|
||||||
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.pad ] , &mesh->tmesh->c[ i+3 ], mesh->p, &outCol);
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.pad ] , &mesh->tmesh->c[ i+3 ], mesh->p, &outCol);
|
||||||
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vz ] , &mesh->tmesh->c[ i+2 ], mesh->p, &outCol1);
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vz ] , &mesh->tmesh->c[ i+2 ], mesh->p, &outCol1);
|
||||||
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vx ] , &mesh->tmesh->c[ i+0 ], mesh->p, &outCol2);
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vx ] , &mesh->tmesh->c[ i+0 ], mesh->p, &outCol2);
|
||||||
NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vy ] , &mesh->tmesh->c[ i+1 ], mesh->p, &outCol3);
|
gte_NormalColorDpq(&mesh->tmesh->n[ mesh->index[t].order.vy ] , &mesh->tmesh->c[ i+1 ], mesh->p, &outCol3);
|
||||||
setRGB0(poly4, outCol.r, outCol.g , outCol.b);
|
setRGB0(poly4, outCol.r, outCol.g , outCol.b);
|
||||||
setRGB1(poly4, outCol1.r, outCol1.g, outCol1.b);
|
setRGB1(poly4, outCol1.r, outCol1.g, outCol1.b);
|
||||||
setRGB2(poly4, outCol2.r, outCol2.g, outCol2.b);
|
setRGB2(poly4, outCol2.r, outCol2.g, outCol2.b);
|
||||||
setRGB3(poly4, outCol3.r, outCol3.g, outCol3.b);
|
setRGB3(poly4, outCol3.r, outCol3.g, outCol3.b);
|
||||||
};
|
};
|
||||||
void set4Subdiv(void){
|
int set4Subdiv(MESH * mesh, POLY_GT4 * poly4, u_long * ot, long t, int i, char ** nextpri){
|
||||||
//(MESH * mesh, char ** nextpri, u_long * ot, long t, int i)
|
//~ // FIXME : Poly subdiv
|
||||||
// FIXME : Polygon subdiv - is it working ?
|
|
||||||
// In main.c, l.141
|
|
||||||
//~ DIVPOLYGON4 div4 = { 0 };
|
//~ DIVPOLYGON4 div4 = { 0 };
|
||||||
//~ div4.pih = SCREENXRES;
|
//~ div4.pih = SCREENXRES;
|
||||||
//~ div4.piv = SCREENYRES;
|
//~ div4.piv = SCREENYRES;
|
||||||
//~ div4.ndiv = 2;
|
//~ div4.ndiv = 1;
|
||||||
//~ long OTc = 0;
|
|
||||||
//~ DIVPOLYGON3 div3 = { 0 };
|
//~ long OTc = mesh->OTz >> 4;
|
||||||
//~ div3.pih = SCREENXRES;
|
|
||||||
//~ div3.piv = SCREENYRES;
|
|
||||||
//~ div3.ndiv = 1;
|
|
||||||
//
|
|
||||||
//~ long OTc = *mesh->OTz >> 4;
|
|
||||||
//~ FntPrint("OTC:%d", OTc);
|
//~ FntPrint("OTC:%d", OTc);
|
||||||
//~ if (OTc < 4) {
|
//~ if (OTc < 4) {
|
||||||
//~ if (OTc > 1) div4.ndiv = 1; else div4.ndiv = 2;
|
//~ // if (OTc > 1) div4.ndiv = 1; else div4.ndiv = 2;
|
||||||
//~ DivideGT4(
|
//~ DivideGT4(
|
||||||
//~ // Vertex coord
|
//~ // Vertex coord
|
||||||
//~ &mesh->tmesh->v[ mesh->index[t].order.pad ],
|
//~ mesh->tmesh->v[ mesh->index[t].order.pad ],
|
||||||
//~ &mesh->tmesh->v[ mesh->index[t].order.vz ],
|
//~ mesh->tmesh->v[ mesh->index[t].order.vz ],
|
||||||
//~ &mesh->tmesh->v[ mesh->index[t].order.vx ],
|
//~ mesh->tmesh->v[ mesh->index[t].order.vx ],
|
||||||
//~ &mesh->tmesh->v[ mesh->index[t].order.vy ],
|
//~ mesh->tmesh->v[ mesh->index[t].order.vy ],
|
||||||
//~ // UV coord
|
//~ // UV coord
|
||||||
//~ mesh->tmesh->u[i+3],
|
//~ mesh->tmesh->u[i+3],
|
||||||
//~ mesh->tmesh->u[i+2],
|
//~ mesh->tmesh->u[i+2],
|
||||||
//~ mesh->tmesh->u[i+0],
|
//~ mesh->tmesh->u[i+0],
|
||||||
//~ mesh->tmesh->u[i+1],
|
//~ mesh->tmesh->u[i+1],
|
||||||
//~ // Color
|
//~ // Color
|
||||||
//~ mesh->tmesh->c[i],
|
|
||||||
//~ mesh->tmesh->c[i+1],
|
|
||||||
//~ mesh->tmesh->c[i+2],
|
|
||||||
//~ mesh->tmesh->c[i+3],
|
//~ mesh->tmesh->c[i+3],
|
||||||
|
//~ mesh->tmesh->c[i+2],
|
||||||
|
//~ mesh->tmesh->c[i+0],
|
||||||
|
//~ mesh->tmesh->c[i+1],
|
||||||
//~ // Gpu packet
|
//~ // Gpu packet
|
||||||
//~ poly4,
|
//~ poly4,
|
||||||
//~ &ot[db][*mesh->OTz],
|
//~ &ot[ mesh->OTz-4],
|
||||||
//~ &div4);
|
//~ &div4);
|
||||||
//~ // Increment primitive list pointer
|
//~ // Increment primitive list pointer
|
||||||
//~ *nextpri += ( (sizeof(POLY_GT4) + 3) / 4 ) * (( 1 << ( div4.ndiv )) << ( div4.ndiv ));
|
//~ // *nextpri += ( (sizeof(POLY_GT4) + 3) / 4 ) * (( 1 << ( div4.ndiv )) << ( div4.ndiv ));
|
||||||
//~ triCount = ((1<<(div4.ndiv))<<(div4.ndiv));
|
//~ return ( (sizeof(POLY_GT4) * 4) );
|
||||||
//~ } else if (OTc < 48) {
|
//~ // triCount = ((1<<(div4.ndiv))<<(div4.ndiv));
|
||||||
//~ return 0;
|
|
||||||
//~ }
|
//~ }
|
||||||
|
//~ else if (OTc < 48) {
|
||||||
|
//~ return (sizeof( POLY_GT4 ));
|
||||||
|
//~ }
|
||||||
|
return 0;
|
||||||
};
|
};
|
||||||
long drawQuad(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpri, u_long * ot, char * db, DRAWENV * draw, int t, int i) {
|
long drawQuad(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpri, u_long * ot, char * db, DRAWENV * draw, int t, int i) {
|
||||||
long nclip = 0;
|
long nclip = 0;
|
||||||
|
int subSkip = 0;
|
||||||
// If mesh is quad
|
// If mesh is quad
|
||||||
POLY_GT4 * poly4;
|
POLY_GT4 * poly4;
|
||||||
//~ for (int i = 0; i < (mesh->tmesh->len * 4); i += 4) {
|
//~ for (int i = 0; i < (mesh->tmesh->len * 4); i += 4) {
|
||||||
@ -315,7 +314,7 @@ long drawQuad(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
|
|||||||
interpolateQuad(poly4, mesh, t, Flag);
|
interpolateQuad(poly4, mesh, t, Flag);
|
||||||
} else {
|
} else {
|
||||||
// No interpolation, use all vertices coordinates in anim data
|
// No interpolation, use all vertices coordinates in anim data
|
||||||
nclip = RotAverageNclip4(
|
gte_RotAverageNclip4(
|
||||||
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.pad ],
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.pad ],
|
||||||
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vz ],
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vz ],
|
||||||
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vx ],
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vx ],
|
||||||
@ -323,7 +322,8 @@ long drawQuad(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
|
|||||||
( long* )&poly4->x0, ( long* )&poly4->x1, ( long* )&poly4->x2, ( long* )&poly4->x3,
|
( long* )&poly4->x0, ( long* )&poly4->x1, ( long* )&poly4->x2, ( long* )&poly4->x3,
|
||||||
&mesh->p,
|
&mesh->p,
|
||||||
&mesh->OTz,
|
&mesh->OTz,
|
||||||
Flag
|
&Flag,
|
||||||
|
&nclip
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -331,12 +331,15 @@ long drawQuad(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
|
|||||||
if (mesh->isSprite){
|
if (mesh->isSprite){
|
||||||
// Find inverse rotation matrix so that sprite always faces camera
|
// Find inverse rotation matrix so that sprite always faces camera
|
||||||
MATRIX rot, invRot;
|
MATRIX rot, invRot;
|
||||||
ReadRotMatrix(&rot);
|
gte_ReadRotMatrix(&rot);
|
||||||
TransposeMatrix(&rot, &invRot);
|
TransposeMatrix(&rot, &invRot);
|
||||||
SetMulRotMatrix(&invRot);
|
//~ SetMulRotMatrix(&invRot);
|
||||||
|
gte_MulMatrix0(&rot, &invRot, &invRot);
|
||||||
|
gte_SetRotMatrix(&invRot);
|
||||||
}
|
}
|
||||||
// Use regular vertex coords
|
// Use regular vertex coords
|
||||||
nclip = RotAverageNclip4(
|
|
||||||
|
gte_RotAverageNclip4(
|
||||||
&mesh->tmesh->v[ mesh->index[t].order.pad ],
|
&mesh->tmesh->v[ mesh->index[t].order.pad ],
|
||||||
&mesh->tmesh->v[ mesh->index[t].order.vz],
|
&mesh->tmesh->v[ mesh->index[t].order.vz],
|
||||||
&mesh->tmesh->v[ mesh->index[t].order.vx ],
|
&mesh->tmesh->v[ mesh->index[t].order.vx ],
|
||||||
@ -344,7 +347,8 @@ long drawQuad(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpr
|
|||||||
(long*)&poly4->x0, (long*)&poly4->x1, (long*)&poly4->x2, (long*)&poly4->x3,
|
(long*)&poly4->x0, (long*)&poly4->x1, (long*)&poly4->x2, (long*)&poly4->x3,
|
||||||
&mesh->p,
|
&mesh->p,
|
||||||
&mesh->OTz,
|
&mesh->OTz,
|
||||||
Flag
|
&Flag,
|
||||||
|
&nclip
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (nclip > 0 && mesh->OTz > 0 && (mesh->p < 4096)) {
|
if (nclip > 0 && mesh->OTz > 0 && (mesh->p < 4096)) {
|
||||||
@ -395,14 +399,15 @@ long drawTri(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpri
|
|||||||
} else {
|
} else {
|
||||||
// No interpolation
|
// No interpolation
|
||||||
// Use the pre-calculated vertices coordinates from the animation data
|
// Use the pre-calculated vertices coordinates from the animation data
|
||||||
nclip = RotAverageNclip3(
|
gte_RotAverageNclip3(
|
||||||
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vx ],
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vx ],
|
||||||
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vz ],
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vz ],
|
||||||
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vy ],
|
&mesh->anim->data[ atime % mesh->anim->nframes * mesh->anim->nvert + mesh->index[t].order.vy ],
|
||||||
( long* ) &poly->x0, ( long* ) &poly->x1, ( long* ) &poly->x2,
|
( long* ) &poly->x0, ( long* ) &poly->x1, ( long* ) &poly->x2,
|
||||||
&mesh->p,
|
&mesh->p,
|
||||||
&mesh->OTz,
|
&mesh->OTz,
|
||||||
Flag
|
&Flag,
|
||||||
|
&nclip
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -410,9 +415,11 @@ long drawTri(MESH * mesh, long * Flag, int atime, int * camMode, char ** nextpri
|
|||||||
if (mesh->isSprite){
|
if (mesh->isSprite){
|
||||||
// Find inverse rotation matrix so that sprite always faces camera
|
// Find inverse rotation matrix so that sprite always faces camera
|
||||||
MATRIX rot, invRot;
|
MATRIX rot, invRot;
|
||||||
ReadRotMatrix(&rot);
|
gte_ReadRotMatrix(&rot);
|
||||||
TransposeMatrix(&rot, &invRot);
|
TransposeMatrix(&rot, &invRot);
|
||||||
SetMulRotMatrix(&invRot);
|
//~ SetMulRotMatrix(&invRot);
|
||||||
|
gte_MulMatrix0(&rot, &invRot, &invRot);
|
||||||
|
gte_SetRotMatrix(&invRot);
|
||||||
}
|
}
|
||||||
// Use model's regular vertex coordinates
|
// Use model's regular vertex coordinates
|
||||||
nclip = RotAverageNclip3(
|
nclip = RotAverageNclip3(
|
||||||
|
@ -37,7 +37,7 @@ u_long overlaySize = 0;
|
|||||||
#include "../levels/level1.h"
|
#include "../levels/level1.h"
|
||||||
|
|
||||||
// Levels
|
// Levels
|
||||||
volatile u_char level = 0;
|
volatile u_char level = 1;
|
||||||
u_short levelWas = 0;
|
u_short levelWas = 0;
|
||||||
u_short levelHasChanged = 0;
|
u_short levelHasChanged = 0;
|
||||||
// Overlay
|
// Overlay
|
||||||
|
Loading…
Reference in New Issue
Block a user