subdiv investigation
This commit is contained in:
parent
ffe0fffd26
commit
18a3007c16
@ -20,6 +20,7 @@
|
|||||||
#include <libetc.h>
|
#include <libetc.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
// Precalculated sin/cos values
|
// Precalculated sin/cos values
|
||||||
//~ #include "psin.c"
|
//~ #include "psin.c"
|
||||||
@ -27,7 +28,7 @@
|
|||||||
#include "atan.c"
|
#include "atan.c"
|
||||||
|
|
||||||
// Sample vector model
|
// Sample vector model
|
||||||
#include "coridor1.c"
|
#include "coridor2.c"
|
||||||
//~ #include "tst-quads.c"
|
//~ #include "tst-quads.c"
|
||||||
//~ #include "gnd.c"
|
//~ #include "gnd.c"
|
||||||
//~ #include "startcube.c"
|
//~ #include "startcube.c"
|
||||||
@ -46,6 +47,7 @@
|
|||||||
#define FNT_POS_X 960
|
#define FNT_POS_X 960
|
||||||
#define FNT_POS_Y 0
|
#define FNT_POS_Y 0
|
||||||
|
|
||||||
|
#define OT2LEN 8
|
||||||
#define OTLEN 256 // Maximum number of OT entries
|
#define OTLEN 256 // Maximum number of OT entries
|
||||||
#define PRIMBUFFLEN 1024 * sizeof(POLY_GT4) // Maximum number of POLY_GT3 primitives
|
#define PRIMBUFFLEN 1024 * sizeof(POLY_GT4) // Maximum number of POLY_GT3 primitives
|
||||||
|
|
||||||
@ -76,7 +78,12 @@
|
|||||||
DISPENV disp[2];
|
DISPENV disp[2];
|
||||||
DRAWENV draw[2];
|
DRAWENV draw[2];
|
||||||
|
|
||||||
|
// OT for BG/FG discrimination
|
||||||
|
u_long otdisc[2][OT2LEN] = {0};
|
||||||
|
|
||||||
|
// Main OT
|
||||||
u_long ot[2][OTLEN] = {0}; // Ordering table (contains addresses to primitives)
|
u_long ot[2][OTLEN] = {0}; // Ordering table (contains addresses to primitives)
|
||||||
|
|
||||||
char primbuff[2][PRIMBUFFLEN] = {0}; // Primitive list // That's our prim buffer
|
char primbuff[2][PRIMBUFFLEN] = {0}; // Primitive list // That's our prim buffer
|
||||||
|
|
||||||
//~ int primcnt=0; // Primitive counter
|
//~ int primcnt=0; // Primitive counter
|
||||||
@ -240,10 +247,10 @@ int main() {
|
|||||||
DR_TPAGE * tpage;
|
DR_TPAGE * tpage;
|
||||||
|
|
||||||
// Poly subdiv
|
// Poly subdiv
|
||||||
//~ DIVPOLYGON3 div = { 0 };
|
DIVPOLYGON4 div = { 0 };
|
||||||
//~ div.pih = SCREENXRES;
|
div.pih = SCREENXRES;
|
||||||
//~ div.piv = SCREENYRES;
|
div.piv = SCREENYRES;
|
||||||
//~ div.ndiv = 1;
|
div.ndiv = 1;
|
||||||
|
|
||||||
MATRIX Cmatrix = {0};
|
MATRIX Cmatrix = {0};
|
||||||
|
|
||||||
@ -264,6 +271,12 @@ int main() {
|
|||||||
LoadTexture(meshes[k]->tim_data, meshes[k]->tim);
|
LoadTexture(meshes[k]->tim_data, meshes[k]->tim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//~ camPtr = &camAngle_camPath_001;
|
||||||
|
|
||||||
|
if (camPtr->tim_data){
|
||||||
|
LoadTexture(camPtr->tim_data, camPtr->BGtim);
|
||||||
|
}
|
||||||
|
|
||||||
// physics
|
// physics
|
||||||
short physics = 1;
|
short physics = 1;
|
||||||
long dt;
|
long dt;
|
||||||
@ -286,13 +299,19 @@ int main() {
|
|||||||
triCount += meshes[k]->tmesh->len;
|
triCount += meshes[k]->tmesh->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
setCameraPos(camStartPos.pos, camStartPos.rot);
|
// Pre-calc bg test
|
||||||
|
setCameraPos(camPtr->campos->pos, camPtr->campos->rot);
|
||||||
|
|
||||||
|
|
||||||
//~ camera.rot.vz = 100;
|
//~ camera.rot.vz = 100;
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
||||||
// Clear the current OT
|
// Clear the main OT
|
||||||
|
ClearOTagR(otdisc[db], OT2LEN);
|
||||||
|
|
||||||
|
// Clear Secondary OT
|
||||||
ClearOTagR(ot[db], OTLEN);
|
ClearOTagR(ot[db], OTLEN);
|
||||||
|
|
||||||
// timeB = time;
|
// timeB = time;
|
||||||
@ -368,30 +387,61 @@ int main() {
|
|||||||
// Fixed Camera angle
|
// Fixed Camera angle
|
||||||
if (camMode == 2){
|
if (camMode == 2){
|
||||||
|
|
||||||
|
// Load BG image in two SPRT since max width == 256
|
||||||
|
if (camPtr->tim_data){
|
||||||
|
|
||||||
|
// left part
|
||||||
sprt = (SPRT *) nextpri;
|
sprt = (SPRT *) nextpri;
|
||||||
|
|
||||||
setSprt(sprt);
|
setSprt(sprt);
|
||||||
setRGB0(sprt, 255,255,0);
|
setRGB0(sprt, 128,128,128);
|
||||||
setXY0(sprt, 0, 0);
|
setXY0(sprt, 0, 0);
|
||||||
setWH(sprt, 320, 240);
|
setWH(sprt, 256, 240);
|
||||||
setUV0(sprt, 0, 0);
|
setUV0(sprt, 0, 0);
|
||||||
|
setClut(sprt, camPtr->BGtim->crect->x, camPtr->BGtim->crect->y);
|
||||||
|
|
||||||
AddPrim(&ot[db][OTz], sprt);
|
addPrim(&otdisc[db][OT2LEN-1], sprt);
|
||||||
|
|
||||||
nextpri += sizeof(SPRT);
|
nextpri += sizeof(SPRT);
|
||||||
|
|
||||||
DR_TPAGE * tpage;
|
tpage = (DR_TPAGE *) nextpri;
|
||||||
|
|
||||||
setDrawTPage(tpage, 0, 1,
|
setDrawTPage(tpage, 0, 1,
|
||||||
getTPage(tim_home.mode&0x3, 0,
|
getTPage(camPtr->BGtim->mode & 0x3, 0,
|
||||||
tim_home.prect->x, tim_home.prect->y));
|
camPtr->BGtim->prect->x, camPtr->BGtim->prect->y));
|
||||||
|
|
||||||
addPrim(&ot[db], tpage);
|
addPrim(&otdisc[db][OT2LEN-1], tpage);
|
||||||
|
|
||||||
nextpri += sizeof(DR_TPAGE);
|
nextpri += sizeof(DR_TPAGE);
|
||||||
|
|
||||||
|
|
||||||
setCameraPos(camStartPos.pos, camStartPos.rot);
|
// right part
|
||||||
|
sprt = (SPRT *) nextpri;
|
||||||
|
|
||||||
|
setSprt(sprt);
|
||||||
|
setRGB0(sprt, 128,128,128);
|
||||||
|
setXY0(sprt, 320-(320-256), 0);
|
||||||
|
setWH(sprt, 320-256, 240);
|
||||||
|
setUV0(sprt, 0, 0);
|
||||||
|
|
||||||
|
setClut(sprt, camPtr->BGtim->crect->x, camPtr->BGtim->crect->y);
|
||||||
|
|
||||||
|
addPrim(&otdisc[db][OT2LEN-1], sprt);
|
||||||
|
|
||||||
|
nextpri += sizeof(SPRT);
|
||||||
|
|
||||||
|
tpage = (DR_TPAGE *) nextpri;
|
||||||
|
|
||||||
|
setDrawTPage(tpage, 0, 1,
|
||||||
|
getTPage(camPtr->BGtim->mode & 0x3, 0,
|
||||||
|
camPtr->BGtim->prect->x + 128, camPtr->BGtim->prect->y));
|
||||||
|
|
||||||
|
addPrim(&otdisc[db][OT2LEN-1], tpage);
|
||||||
|
|
||||||
|
nextpri += sizeof(DR_TPAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
setCameraPos(camPtr->campos->pos, camPtr->campos->rot);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,9 +478,9 @@ int main() {
|
|||||||
camera.pos.vz = lerpD(camPath.points[camPath.cursor].vz << precision, camPath.points[camPath.cursor+1].vz << precision, camPath.pos << precision) >> precision;
|
camera.pos.vz = lerpD(camPath.points[camPath.cursor].vz << precision, camPath.points[camPath.cursor+1].vz << precision, camPath.pos << precision) >> precision;
|
||||||
|
|
||||||
//~ FntPrint("Cam %d, %d\n", (int32_t)camPath.points[camPath.cursor].vx, camPath.points[camPath.cursor+1].vx);
|
//~ FntPrint("Cam %d, %d\n", (int32_t)camPath.points[camPath.cursor].vx, camPath.points[camPath.cursor+1].vx);
|
||||||
FntPrint("Cam %d, %d, %d\n", camera.pos.vx, camera.pos.vy, camera.pos.vz);
|
//~ FntPrint("Cam %d, %d, %d\n", camera.pos.vx, camera.pos.vy, camera.pos.vz);
|
||||||
FntPrint("Theta y: %d x: %d\n", theta.vy, theta.vx);
|
//~ FntPrint("Theta y: %d x: %d\n", theta.vy, theta.vx);
|
||||||
FntPrint("Pos: %d Cur: %d\nTheta y: %d x: %d\n", camPath.pos, camPath.cursor, theta.vy, theta.vx);
|
//~ FntPrint("Pos: %d Cur: %d\nTheta y: %d x: %d\n", camPath.pos, camPath.cursor, theta.vy, theta.vx);
|
||||||
|
|
||||||
// Linearly increment the lerp factor
|
// Linearly increment the lerp factor
|
||||||
camPath.pos += 20;
|
camPath.pos += 20;
|
||||||
@ -490,10 +540,10 @@ int main() {
|
|||||||
//~ FntPrint("Pos: %d Cur: %d\nTheta y: %d x: %d\n", camPath.pos, camPath.cursor, theta.vy, theta.vx);
|
//~ FntPrint("Pos: %d Cur: %d\nTheta y: %d x: %d\n", camPath.pos, camPath.cursor, theta.vy, theta.vx);
|
||||||
|
|
||||||
if ( theta.vy < -50 ) {
|
if ( theta.vy < -50 ) {
|
||||||
camPath.pos += 20;
|
camPath.pos += 40;
|
||||||
}
|
}
|
||||||
if ( theta.vy > 50 ) {
|
if ( theta.vy > 50 ) {
|
||||||
camPath.pos -= 20;
|
camPath.pos -= 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If camera has reached next key pos, reset pos index, move cursor to next key pos
|
// If camera has reached next key pos, reset pos index, move cursor to next key pos
|
||||||
@ -666,6 +716,9 @@ int main() {
|
|||||||
// modelCube is a TMESH, len member == # vertices, but here it's # of triangle... So, for each tri * 3 vertices ...
|
// modelCube is a TMESH, len member == # vertices, but here it's # of triangle... So, for each tri * 3 vertices ...
|
||||||
for (i = 0; i < (meshes[k]->tmesh->len * 3); i += 3) {
|
for (i = 0; i < (meshes[k]->tmesh->len * 3); i += 3) {
|
||||||
|
|
||||||
|
// if mesh is not part of BG, draw them, else, discard
|
||||||
|
//~ if (!*meshes[k]->isBG) {
|
||||||
|
|
||||||
poly = (POLY_GT3 *)nextpri;
|
poly = (POLY_GT3 *)nextpri;
|
||||||
|
|
||||||
// Vertex Anim
|
// Vertex Anim
|
||||||
@ -778,6 +831,7 @@ int main() {
|
|||||||
draw[db].clip.y
|
draw[db].clip.y
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//~ setShadeTex(poly, 1);
|
||||||
// Use projected coordinates (results from RotAverage...) as UV coords and clamp them to 0-255,0-224
|
// Use projected coordinates (results from RotAverage...) as UV coords and clamp them to 0-255,0-224
|
||||||
setUV3(poly, (poly->x0 < 0? 0 : poly->x0 > 255? 255 : poly->x0),
|
setUV3(poly, (poly->x0 < 0? 0 : poly->x0 > 255? 255 : poly->x0),
|
||||||
(poly->y0 < 0? 0 : poly->y0 > 224? 224 : poly->y0),
|
(poly->y0 < 0? 0 : poly->y0 > 224? 224 : poly->y0),
|
||||||
@ -796,12 +850,30 @@ int main() {
|
|||||||
meshes[k]->tim->prect->y
|
meshes[k]->tim->prect->y
|
||||||
);
|
);
|
||||||
|
|
||||||
// Use model UV coordinates
|
//~ if (!meshes[k]->isBG) {
|
||||||
|
//~ setShadeTex(poly, 1);
|
||||||
|
//~ setSemiTrans(poly, 1);
|
||||||
|
//~ }
|
||||||
setUV3(poly, meshes[k]->tmesh->u[i].vx , meshes[k]->tmesh->u[i].vy + meshes[k]->tim->prect->y,
|
setUV3(poly, meshes[k]->tmesh->u[i].vx , meshes[k]->tmesh->u[i].vy + meshes[k]->tim->prect->y,
|
||||||
meshes[k]->tmesh->u[i+2].vx, meshes[k]->tmesh->u[i+2].vy + meshes[k]->tim->prect->y,
|
meshes[k]->tmesh->u[i+2].vx, meshes[k]->tmesh->u[i+2].vy + meshes[k]->tim->prect->y,
|
||||||
meshes[k]->tmesh->u[i+1].vx, meshes[k]->tmesh->u[i+1].vy + meshes[k]->tim->prect->y);
|
meshes[k]->tmesh->u[i+1].vx, meshes[k]->tmesh->u[i+1].vy + meshes[k]->tim->prect->y);
|
||||||
|
//~ }
|
||||||
|
//~ else {
|
||||||
|
|
||||||
|
//~ // Use model UV coordinates
|
||||||
|
//~ setUV3(poly, 255 , 255,
|
||||||
|
//~ 255 , 255,
|
||||||
|
//~ 255 , 255);
|
||||||
|
|
||||||
|
//~ }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// If tim mode == 0 | 1, set CLUT coordinates
|
||||||
|
if ((meshes[k]->tim->mode & 0x3) < 2){
|
||||||
|
setClut(poly,
|
||||||
|
meshes[k]->tim->crect->x,
|
||||||
|
meshes[k]->tim->crect->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If vertex anim has updated normals
|
// If vertex anim has updated normals
|
||||||
@ -813,15 +885,24 @@ int main() {
|
|||||||
//~ } else {
|
//~ } else {
|
||||||
|
|
||||||
|
|
||||||
// default to neutral grey
|
|
||||||
|
// using precalc BG, default to black
|
||||||
CVECTOR outCol ={128,128,128,0};
|
CVECTOR outCol ={128,128,128,0};
|
||||||
CVECTOR outCol1 ={128,128,128,0};
|
CVECTOR outCol1 ={128,128,128,0};
|
||||||
CVECTOR outCol2 ={128,128,128,0};
|
CVECTOR outCol2 ={128,128,128,0};
|
||||||
|
|
||||||
|
//~ if ( !camPtr->tim_data ) {
|
||||||
|
|
||||||
|
// default to neutral grey
|
||||||
|
//~ outCol.r , outCol.g , outCol.b = 128;
|
||||||
|
//~ outCol1.r, outCol1.g, outCol1.b = 128;
|
||||||
|
//~ outCol2.r, outCol2.g, outCol2.b = 128;
|
||||||
|
|
||||||
NormalColorDpq(&meshes[k]->tmesh->n[ meshes[k]->index[t].order.vx ], &meshes[k]->tmesh->c[ meshes[k]->index[t].order.vx ], *meshes[k]->p, &outCol);
|
NormalColorDpq(&meshes[k]->tmesh->n[ meshes[k]->index[t].order.vx ], &meshes[k]->tmesh->c[ meshes[k]->index[t].order.vx ], *meshes[k]->p, &outCol);
|
||||||
NormalColorDpq(&meshes[k]->tmesh->n[ meshes[k]->index[t].order.vz ], &meshes[k]->tmesh->c[ meshes[k]->index[t].order.vz ], *meshes[k]->p, &outCol1);
|
NormalColorDpq(&meshes[k]->tmesh->n[ meshes[k]->index[t].order.vz ], &meshes[k]->tmesh->c[ meshes[k]->index[t].order.vz ], *meshes[k]->p, &outCol1);
|
||||||
NormalColorDpq(&meshes[k]->tmesh->n[ meshes[k]->index[t].order.vy ], &meshes[k]->tmesh->c[ meshes[k]->index[t].order.vy ], *meshes[k]->p, &outCol2);
|
NormalColorDpq(&meshes[k]->tmesh->n[ meshes[k]->index[t].order.vy ], &meshes[k]->tmesh->c[ meshes[k]->index[t].order.vy ], *meshes[k]->p, &outCol2);
|
||||||
|
|
||||||
|
//~ }
|
||||||
|
|
||||||
if (*meshes[k]->isPrism){
|
if (*meshes[k]->isPrism){
|
||||||
|
|
||||||
@ -849,8 +930,8 @@ int main() {
|
|||||||
//~ if (*meshes[k]->isRigidBody){
|
//~ if (*meshes[k]->isRigidBody){
|
||||||
//~ PopMatrix(); // Pull previous matrix from stack (slow)
|
//~ PopMatrix(); // Pull previous matrix from stack (slow)
|
||||||
//~ }
|
//~ }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//~ }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -860,6 +941,9 @@ int main() {
|
|||||||
|
|
||||||
for (i = 0; i < (meshes[k]->tmesh->len * 4); i += 4) {
|
for (i = 0; i < (meshes[k]->tmesh->len * 4); i += 4) {
|
||||||
|
|
||||||
|
// if mesh is not part of BG, draw them, else, discard
|
||||||
|
if (!*meshes[k]->isBG) {
|
||||||
|
|
||||||
poly4 = (POLY_GT4 *)nextpri;
|
poly4 = (POLY_GT4 *)nextpri;
|
||||||
|
|
||||||
|
|
||||||
@ -920,7 +1004,7 @@ int main() {
|
|||||||
&meshes[k]->tmesh->v[ meshes[k]->index[t].order.vy ],
|
&meshes[k]->tmesh->v[ meshes[k]->index[t].order.vy ],
|
||||||
(long*)&poly4->x0, (long*)&poly4->x1, (long*)&poly4->x2, (long*)&poly4->x3,
|
(long*)&poly4->x0, (long*)&poly4->x1, (long*)&poly4->x2, (long*)&poly4->x3,
|
||||||
meshes[k]->p,
|
meshes[k]->p,
|
||||||
&OTz,
|
meshes[k]->OTz,
|
||||||
&Flag
|
&Flag
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -935,7 +1019,7 @@ int main() {
|
|||||||
&meshes[k]->anim->data[ atime % meshes[k]->anim->nframes * meshes[k]->anim->nvert + meshes[k]->index[t].order.vy ],
|
&meshes[k]->anim->data[ atime % meshes[k]->anim->nframes * meshes[k]->anim->nvert + meshes[k]->index[t].order.vy ],
|
||||||
(long*)&poly4->x0, (long*)&poly4->x1, (long*)&poly4->x2, (long*)&poly4->x3,
|
(long*)&poly4->x0, (long*)&poly4->x1, (long*)&poly4->x2, (long*)&poly4->x3,
|
||||||
meshes[k]->p,
|
meshes[k]->p,
|
||||||
&OTz,
|
meshes[k]->OTz,
|
||||||
&Flag
|
&Flag
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -952,61 +1036,64 @@ int main() {
|
|||||||
&meshes[k]->tmesh->v[ meshes[k]->index[t].order.vy ],
|
&meshes[k]->tmesh->v[ meshes[k]->index[t].order.vy ],
|
||||||
(long*)&poly4->x0, (long*)&poly4->x1, (long*)&poly4->x2, (long*)&poly4->x3,
|
(long*)&poly4->x0, (long*)&poly4->x1, (long*)&poly4->x2, (long*)&poly4->x3,
|
||||||
meshes[k]->p,
|
meshes[k]->p,
|
||||||
&OTz,
|
meshes[k]->OTz,
|
||||||
&Flag
|
&Flag
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nclip > 0 && OTz > 0 && (*meshes[k]->p < 4096)) {
|
if (nclip > 0 && *meshes[k]->OTz > 0 && (*meshes[k]->p < 4096)) {
|
||||||
|
|
||||||
SetPolyGT4(poly4);
|
SetPolyGT4(poly4);
|
||||||
|
|
||||||
// FIXME : Polygon subdiv
|
// FIXME : Polygon subdiv - is it working ?
|
||||||
|
|
||||||
//~ OTc = OTz>>4;
|
OTc = OTz>>4;
|
||||||
|
FntPrint("OTC:%d", OTc);
|
||||||
|
if (OTc < 15) {
|
||||||
|
|
||||||
//~ if (OTc < 1) {
|
if (OTc > 5) div.ndiv = 1; else div.ndiv = 2;
|
||||||
|
|
||||||
//~ if (OTc > 5) div.ndiv = 1; else div.ndiv = 1;
|
DivideGT4(
|
||||||
|
// Vertex coord
|
||||||
|
&meshes[k]->tmesh->v[ meshes[k]->index[t].order.vx ],
|
||||||
|
&meshes[k]->tmesh->v[ meshes[k]->index[t].order.vy ],
|
||||||
|
&meshes[k]->tmesh->v[ meshes[k]->index[t].order.pad ],
|
||||||
|
&meshes[k]->tmesh->v[ meshes[k]->index[t].order.vz ],
|
||||||
|
// UV coord
|
||||||
|
meshes[k]->tmesh->u[i+3],
|
||||||
|
meshes[k]->tmesh->u[i+2],
|
||||||
|
meshes[k]->tmesh->u[i+0],
|
||||||
|
meshes[k]->tmesh->u[i+1],
|
||||||
|
|
||||||
//~ DivideGT4(
|
// Color
|
||||||
//~ // Vertex coord
|
meshes[k]->tmesh->c[i],
|
||||||
//~ &meshes[k]->tmesh->v[ meshes[k]->index[t].order.vx ],
|
meshes[k]->tmesh->c[i+1],
|
||||||
//~ &meshes[k]->tmesh->v[ meshes[k]->index[t].order.vy ],
|
meshes[k]->tmesh->c[i+2],
|
||||||
//~ &meshes[k]->tmesh->v[ meshes[k]->index[t].order.pad ],
|
meshes[k]->tmesh->c[i+3],
|
||||||
//~ &meshes[k]->tmesh->v[ meshes[k]->index[t].order.vz ],
|
|
||||||
//~ // UV coord
|
|
||||||
//~ meshes[k]->tmesh->u[i+3],
|
|
||||||
//~ meshes[k]->tmesh->u[i+2],
|
|
||||||
//~ meshes[k]->tmesh->u[i+0],
|
|
||||||
//~ meshes[k]->tmesh->u[i+1],
|
|
||||||
|
|
||||||
//~ // Color
|
// Gpu packet
|
||||||
//~ meshes[k]->tmesh->c[i],
|
poly4,
|
||||||
//~ meshes[k]->tmesh->c[i+1],
|
&ot[db][OTz],
|
||||||
//~ meshes[k]->tmesh->c[i+2],
|
&div);
|
||||||
//~ meshes[k]->tmesh->c[i+3],
|
|
||||||
|
|
||||||
//~ // Gpu packet
|
//~ // Increment primitive list pointer
|
||||||
//~ poly4,
|
nextpri += ( (sizeof(POLY_GT4) + 3) / 4 ) * (( 1 << ( div.ndiv )) << ( div.ndiv ));
|
||||||
//~ &ot[db][OTz],
|
triCount = ((1<<(div.ndiv))<<(div.ndiv));
|
||||||
//~ &div);
|
|
||||||
|
|
||||||
// Increment primitive list pointer
|
}
|
||||||
//~ nextpri += ( (sizeof(POLY_GT4) + 3) / 4 ) * (( 1 << ( div.ndiv )) << ( div.ndiv ));
|
|
||||||
//~ triCount = ((1<<(div.ndiv))<<(div.ndiv));
|
|
||||||
|
|
||||||
//~ }
|
|
||||||
|
|
||||||
// Transparency effect
|
// Transparency effect
|
||||||
if (*meshes[k]->isPrism){
|
if (*meshes[k]->isPrism){
|
||||||
|
|
||||||
|
|
||||||
// Use current DRAWENV clip as TPAGE
|
// Use current DRAWENV clip as TPAGE
|
||||||
((POLY_GT4 *)poly4)->tpage = getTPage(meshes[k]->tim->mode&0x3, 0,
|
((POLY_GT4 *)poly4)->tpage = getTPage(meshes[k]->tim->mode&0x3, 0,
|
||||||
draw[db].clip.x,
|
draw[db].clip.x,
|
||||||
draw[db].clip.y
|
draw[db].clip.y
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//SetShadeTex(poly4, 1);
|
||||||
|
|
||||||
// Use projected coordinates (results from RotAverage...) as UV coords and clamp them to 0-255,0-224
|
// Use projected coordinates (results from RotAverage...) as UV coords and clamp them to 0-255,0-224
|
||||||
setUV4(poly4, (poly4->x0 < 0? 0 : poly4->x0 > 255? 255 : poly4->x0),
|
setUV4(poly4, (poly4->x0 < 0? 0 : poly4->x0 > 255? 255 : poly4->x0),
|
||||||
(poly4->y0 < 0? 0 : poly4->y0 > 224? 224 : poly4->y0),
|
(poly4->y0 < 0? 0 : poly4->y0 > 224? 224 : poly4->y0),
|
||||||
@ -1036,6 +1123,13 @@ int main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// If tim mode == 0 | 1, set CLUT coordinates
|
||||||
|
if ((meshes[k]->tim->mode & 0x3) < 2){
|
||||||
|
setClut(poly,
|
||||||
|
meshes[k]->tim->crect->x,
|
||||||
|
meshes[k]->tim->crect->y);
|
||||||
|
}
|
||||||
CVECTOR outCol = {128,128,128,0};
|
CVECTOR outCol = {128,128,128,0};
|
||||||
CVECTOR outCol1 = {128,128,128,0};
|
CVECTOR outCol1 = {128,128,128,0};
|
||||||
CVECTOR outCol2 = {128,128,128,0};
|
CVECTOR outCol2 = {128,128,128,0};
|
||||||
@ -1062,8 +1156,8 @@ int main() {
|
|||||||
setRGB3(poly4, outCol3.r, outCol3.g, outCol3.b);
|
setRGB3(poly4, outCol3.r, outCol3.g, outCol3.b);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((OTz > 0) && (OTz < OTLEN) && (*meshes[k]->p < 4096)){
|
if ((*meshes[k]->OTz > 0) && (*meshes[k]->OTz < OTLEN) && (*meshes[k]->p < 4096)){
|
||||||
AddPrim(&ot[db][OTz-3], poly4); // OTz - 2
|
AddPrim(&ot[db][*meshes[k]->OTz-3], poly4); // OTz - 2
|
||||||
}
|
}
|
||||||
|
|
||||||
nextpri += sizeof(POLY_GT4);
|
nextpri += sizeof(POLY_GT4);
|
||||||
@ -1073,6 +1167,7 @@ int main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find and apply light rotation matrix
|
// Find and apply light rotation matrix
|
||||||
RotMatrix(&lgtang, &rotlgt);
|
RotMatrix(&lgtang, &rotlgt);
|
||||||
@ -1083,19 +1178,17 @@ int main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Add secondary OT to main OT
|
||||||
|
AddPrims(otdisc[db], ot[db] + OTLEN - 1, ot[db]);
|
||||||
|
|
||||||
//~ FntPrint("Time : %d %d dt :%d\n",time, atime, dt);
|
//~ FntPrint("Time : %d %d dt :%d\n",time, atime, dt);
|
||||||
//~ FntPrint("CamMode: %d Slowmo : %d\nTricount: %d OTz: %d\nOTc: %d, p: %d\n", camMode, actorPtr->anim->interpolate, triCount, OTz, OTc, *meshes[0]->p);
|
//~ FntPrint("CamMode: %d Slowmo : %d\nTricount: %d OTz: %d\nOTc: %d, p: %d\n", camMode, actorPtr->anim->interpolate, triCount, *meshes[9]->OTz, OTc, *meshes[9]->p);
|
||||||
//~ FntPrint("Fy: %d Vy:%d\n", actorPtr->body->gForce.vy, actorPtr->body->velocity.vy );
|
//~ FntPrint("Fy: %d Vy:%d\n", actorPtr->body->gForce.vy, actorPtr->body->velocity.vy );
|
||||||
//~ FntPrint("Vy: %4d\n", actorPtr->body->gForce.vy );
|
//~ FntPrint("Vy: %4d\n", actorPtr->body->gForce.vy );
|
||||||
FntPrint("%d", *meshes[0]->OTz);
|
//~ FntPrint("%d %d %d", meshes[0]->tim->mode & 0x3, meshes[0]->tim->crect->x, meshes[0]->tim->crect->y);
|
||||||
//~ static int lerpValues[16];
|
|
||||||
|
|
||||||
//~ for ( short i = 0; i < (4096 >> 8) ; i++ ){
|
|
||||||
//~ lerpValues[15-i] = lerp(-24, -224, ( i << 8 ) );
|
|
||||||
//~ FntPrint("%d, ", lerpValues[i] );
|
|
||||||
//~ }
|
|
||||||
|
|
||||||
|
|
||||||
|
//~ FntPrint("%d", OTc);
|
||||||
|
|
||||||
FntFlush(-1);
|
FntFlush(-1);
|
||||||
|
|
||||||
@ -1156,7 +1249,11 @@ void display(void){
|
|||||||
|
|
||||||
SetDispMask(1);
|
SetDispMask(1);
|
||||||
|
|
||||||
DrawOTag(ot[db] + OTLEN - 1);
|
// Main OT
|
||||||
|
DrawOTag(otdisc[db] + OT2LEN - 1);
|
||||||
|
|
||||||
|
// Secondary OT
|
||||||
|
//~ DrawOTag(ot[db] + OTLEN - 1);
|
||||||
|
|
||||||
db = !db;
|
db = !db;
|
||||||
|
|
||||||
@ -1544,6 +1641,8 @@ void callback(){
|
|||||||
|
|
||||||
static short cursor = 0;
|
static short cursor = 0;
|
||||||
|
|
||||||
|
static short curCamAngle = 0;
|
||||||
|
|
||||||
if(!lerpValues[0]){
|
if(!lerpValues[0]){
|
||||||
for ( long long i = 0; i < div ; i++ ){
|
for ( long long i = 0; i < div ; i++ ){
|
||||||
// lerp
|
// lerp
|
||||||
@ -1570,18 +1669,33 @@ void callback(){
|
|||||||
if(cursor>0){cursor--;}
|
if(cursor>0){cursor--;}
|
||||||
|
|
||||||
if (pad & PADR1 && !timer){
|
if (pad & PADR1 && !timer){
|
||||||
if(camMode < 5){
|
|
||||||
|
if (!camPtr->tim_data){
|
||||||
|
if(camMode < 6){
|
||||||
|
|
||||||
camMode ++;
|
camMode ++;
|
||||||
lerping = 0;
|
lerping = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setCameraPos(camStartPos.pos, camStartPos.rot);
|
setCameraPos(camPtr->campos->pos, camPtr->campos->rot);
|
||||||
camPath.cursor = 0;
|
camPath.cursor = 0;
|
||||||
camMode = 0;
|
camMode = 0;
|
||||||
lerping = 0;
|
lerping = 0;
|
||||||
}
|
}
|
||||||
|
//~ lastPad = pad;
|
||||||
|
//~ timer = 10;
|
||||||
|
//~ pressed = 1;
|
||||||
|
} else {
|
||||||
|
if (curCamAngle < 5) {
|
||||||
|
curCamAngle++;
|
||||||
|
camPtr = camAngles[curCamAngle];
|
||||||
|
LoadTexture(camPtr->tim_data, camPtr->BGtim);
|
||||||
|
} else {
|
||||||
|
curCamAngle = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
lastPad = pad;
|
lastPad = pad;
|
||||||
timer = 10;
|
timer = 10;
|
||||||
//~ pressed = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pad & PADR1) && lastPad & PADR1){
|
if (!(pad & PADR1) && lastPad & PADR1){
|
||||||
@ -1652,16 +1766,16 @@ void callback(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pad & PADLleft){
|
if (pad & PADLleft){
|
||||||
actorPtr->rot->vx = 0;
|
//~ actorPtr->rot->vx = 0;
|
||||||
actorPtr->rot->vz = 0;
|
//~ actorPtr->rot->vz = 0;
|
||||||
actorPtr->rot->vy -= 10;
|
actorPtr->rot->vy -= 10;
|
||||||
lastPad = pad;
|
lastPad = pad;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pad & PADLright){
|
if (pad & PADLright){
|
||||||
actorPtr->rot->vx = 0;
|
//~ actorPtr->rot->vx = 0;
|
||||||
actorPtr->rot->vz = 0;
|
//~ actorPtr->rot->vz = 0;
|
||||||
actorPtr->rot->vy += 10;
|
actorPtr->rot->vy += 10;
|
||||||
lastPad = pad;
|
lastPad = pad;
|
||||||
}
|
}
|
||||||
@ -1674,6 +1788,8 @@ void callback(){
|
|||||||
if (cursor){
|
if (cursor){
|
||||||
actorPtr->body->position.vy = lerpValues[cursor];}
|
actorPtr->body->position.vy = lerpValues[cursor];}
|
||||||
|
|
||||||
|
FntPrint("Mode : %d Angle: %d\n", camMode, curCamAngle);
|
||||||
|
|
||||||
//~ FntPrint("Curs: %d Vy: %d\n", cursor, actorPtr->body->position.vy );
|
//~ FntPrint("Curs: %d Vy: %d\n", cursor, actorPtr->body->position.vy );
|
||||||
//~ FntPrint("Force: %d\n", forceApplied);
|
//~ FntPrint("Force: %d\n", forceApplied);
|
||||||
//~ FntPrint("%d\n", !(pad & PADRdown) && lastPad & PADRdown);
|
//~ FntPrint("%d\n", !(pad & PADRdown) && lastPad & PADRdown);
|
||||||
|
Loading…
Reference in New Issue
Block a user