|
|
@ -146,10 +146,9 @@ static INLINE void draw_triangle_textured(STVECTOR *verts, u_short tpage, u_long |
|
|
++polyCount; |
|
|
++polyCount; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static INLINE void draw_quadstrip_textured(STVECTOR *verts, u_char numVerts, u_short tpage, u_long *ot) |
|
|
|
|
|
|
|
|
static INLINE void draw_quadstrip_textured(const ps1bsp_vertex_t *vertices, const ps1bsp_polyvertex_t *polyVerts, u_char numVerts, u_short tpage, u_long *ot) |
|
|
{ |
|
|
{ |
|
|
// Draw the face as a quad strip |
|
|
|
|
|
STVECTOR *v0, *v1, *v2, *v3; |
|
|
|
|
|
|
|
|
const ps1bsp_polyvertex_t *v0, *v1, *v2, *v3; |
|
|
u_char i0, i1, i2, i3; |
|
|
u_char i0, i1, i2, i3; |
|
|
u_char head = 0; |
|
|
u_char head = 0; |
|
|
u_char tail = numVerts; |
|
|
u_char tail = numVerts; |
|
|
@ -168,23 +167,22 @@ static INLINE void draw_quadstrip_textured(STVECTOR *verts, u_char numVerts, u_s |
|
|
i2 = --tail; |
|
|
i2 = --tail; |
|
|
i3 = head++; |
|
|
i3 = head++; |
|
|
|
|
|
|
|
|
v0 = &verts[i0]; |
|
|
|
|
|
v1 = &verts[i1]; |
|
|
|
|
|
v2 = &verts[i2]; |
|
|
|
|
|
|
|
|
v0 = &polyVerts[i0]; |
|
|
|
|
|
v1 = &polyVerts[i1]; |
|
|
|
|
|
v2 = &polyVerts[i2]; |
|
|
|
|
|
v3 = &polyVerts[i3]; |
|
|
|
|
|
|
|
|
// Naively draw the quad with GTE, nothing special or optimized about this |
|
|
|
|
|
gte_ldv3(v0, v1, v2); |
|
|
|
|
|
|
|
|
// Transform the first three vertices |
|
|
|
|
|
gte_ldv3(&vertices[v0->index], &vertices[v1->index], &vertices[v2->index]); |
|
|
gte_rtpt(); // Rotation, translation, perspective projection |
|
|
gte_rtpt(); // Rotation, translation, perspective projection |
|
|
|
|
|
|
|
|
// Draw a flat-shaded untextured colored quad |
|
|
|
|
|
|
|
|
// Draw a gouraud shaded textured quad |
|
|
POLY_GT4 *poly = (POLY_GT4*)mem_prim(sizeof(POLY_GT4)); |
|
|
POLY_GT4 *poly = (POLY_GT4*)mem_prim(sizeof(POLY_GT4)); |
|
|
setPolyGT4(poly); |
|
|
setPolyGT4(poly); |
|
|
gte_stsxy3_gt3(poly); |
|
|
gte_stsxy3_gt3(poly); |
|
|
|
|
|
|
|
|
v3 = &verts[i3]; |
|
|
|
|
|
|
|
|
|
|
|
// Transform the fourth vertex to complete the quad |
|
|
// Transform the fourth vertex to complete the quad |
|
|
gte_ldv0(v3); |
|
|
|
|
|
|
|
|
gte_ldv0(&vertices[v3->index]); |
|
|
gte_rtps(); |
|
|
gte_rtps(); |
|
|
gte_stsxy(&poly->x3); |
|
|
gte_stsxy(&poly->x3); |
|
|
|
|
|
|
|
|
@ -194,20 +192,20 @@ static INLINE void draw_quadstrip_textured(STVECTOR *verts, u_char numVerts, u_s |
|
|
poly->tpage = tpage; |
|
|
poly->tpage = tpage; |
|
|
|
|
|
|
|
|
// Vertex color lighting |
|
|
// Vertex color lighting |
|
|
poly->r0 = poly->g0 = poly->b0 = (uint8_t)v0->pad; |
|
|
|
|
|
poly->r1 = poly->g1 = poly->b1 = (uint8_t)v1->pad; |
|
|
|
|
|
poly->r2 = poly->g2 = poly->b2 = (uint8_t)v2->pad; |
|
|
|
|
|
poly->r3 = poly->g3 = poly->b3 = (uint8_t)v3->pad; |
|
|
|
|
|
|
|
|
poly->r0 = poly->g0 = poly->b0 = (uint8_t)v0->light; |
|
|
|
|
|
poly->r1 = poly->g1 = poly->b1 = (uint8_t)v1->light; |
|
|
|
|
|
poly->r2 = poly->g2 = poly->b2 = (uint8_t)v2->light; |
|
|
|
|
|
poly->r3 = poly->g3 = poly->b3 = (uint8_t)v3->light; |
|
|
|
|
|
|
|
|
addPrim(ot, poly); |
|
|
addPrim(ot, poly); |
|
|
++polyCount; |
|
|
++polyCount; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static INLINE void draw_quadstrip_water(STVECTOR *verts, u_char numVerts, u_short tpage, u_long *ot) |
|
|
|
|
|
|
|
|
static INLINE void draw_quadstrip_water(const ps1bsp_vertex_t *vertices, const ps1bsp_polyvertex_t *polyVerts, u_char numVerts, u_short tpage, u_long *ot) |
|
|
{ |
|
|
{ |
|
|
// Draw the face as a quad strip |
|
|
// Draw the face as a quad strip |
|
|
const STVECTOR *v0, *v1, *v2, *v3; |
|
|
|
|
|
|
|
|
const ps1bsp_polyvertex_t *v0, *v1, *v2, *v3; |
|
|
u_char i0, i1, i2, i3; |
|
|
u_char i0, i1, i2, i3; |
|
|
u_char head = 0; |
|
|
u_char head = 0; |
|
|
u_char tail = numVerts; |
|
|
u_char tail = numVerts; |
|
|
@ -225,25 +223,22 @@ static INLINE void draw_quadstrip_water(STVECTOR *verts, u_char numVerts, u_shor |
|
|
i2 = --tail; |
|
|
i2 = --tail; |
|
|
i3 = head++; |
|
|
i3 = head++; |
|
|
|
|
|
|
|
|
v0 = &verts[i0]; |
|
|
|
|
|
v1 = &verts[i1]; |
|
|
|
|
|
v2 = &verts[i2]; |
|
|
|
|
|
|
|
|
v0 = &polyVerts[i0]; |
|
|
|
|
|
v1 = &polyVerts[i1]; |
|
|
|
|
|
v2 = &polyVerts[i2]; |
|
|
|
|
|
v3 = &polyVerts[i3]; |
|
|
|
|
|
|
|
|
// Naively draw the quad with GTE, nothing special or optimized about this |
|
|
|
|
|
gte_ldv3(v0, v1, v2); |
|
|
|
|
|
|
|
|
// Transform the first three vertices |
|
|
|
|
|
gte_ldv3(&vertices[v0->index], &vertices[v1->index], &vertices[v2->index]); |
|
|
gte_rtpt(); // Rotation, translation, perspective projection |
|
|
gte_rtpt(); // Rotation, translation, perspective projection |
|
|
|
|
|
|
|
|
// Draw a flat-shaded untextured colored quad |
|
|
|
|
|
|
|
|
// Draw a flat-shaded textured quad |
|
|
POLY_FT4 *poly = (POLY_FT4*)mem_prim(sizeof(POLY_FT4)); |
|
|
POLY_FT4 *poly = (POLY_FT4*)mem_prim(sizeof(POLY_FT4)); |
|
|
setPolyFT4(poly); |
|
|
setPolyFT4(poly); |
|
|
gte_stsxy0(&poly->x0); |
|
|
|
|
|
gte_stsxy1(&poly->x1); |
|
|
|
|
|
gte_stsxy2(&poly->x2); |
|
|
|
|
|
|
|
|
|
|
|
v3 = &verts[i3]; |
|
|
|
|
|
|
|
|
gte_stsxy3_ft3(poly); |
|
|
|
|
|
|
|
|
// Transform the fourth vertex to complete the quad |
|
|
// Transform the fourth vertex to complete the quad |
|
|
gte_ldv0(v3); |
|
|
|
|
|
|
|
|
gte_ldv0(&vertices[v3->index]); |
|
|
gte_rtps(); |
|
|
gte_rtps(); |
|
|
gte_stsxy(&poly->x3); |
|
|
gte_stsxy(&poly->x3); |
|
|
|
|
|
|
|
|
|