mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-04-04 08:51:46 +00:00
Fixing Mirrored models
This commit is contained in:
parent
01f4125e1b
commit
df90233606
3 changed files with 23 additions and 2 deletions
|
@ -76,6 +76,8 @@ typedef struct {
|
|||
|
||||
qboolean needDlights; // true for bmodels that touch a dlight
|
||||
qboolean lightingCalculated;
|
||||
// JBravo: Mirrored models
|
||||
qboolean mirrored; // mirrored matrix, needs reversed culling
|
||||
vec3_t lightDir; // normalized direction towards light
|
||||
vec3_t ambientLight; // color normalized to 0-255
|
||||
int ambientLightInt; // 32 bit rgba packed
|
||||
|
|
|
@ -205,6 +205,9 @@ RE_AddRefEntityToScene
|
|||
=====================
|
||||
*/
|
||||
void RE_AddRefEntityToScene( const refEntity_t *ent ) {
|
||||
// JBravo: Mirrored models
|
||||
vec3_t cross;
|
||||
|
||||
if ( !tr.registered ) {
|
||||
return;
|
||||
}
|
||||
|
@ -226,6 +229,10 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) {
|
|||
backEndData[tr.smpFrame]->entities[r_numentities].e = *ent;
|
||||
backEndData[tr.smpFrame]->entities[r_numentities].lightingCalculated = qfalse;
|
||||
|
||||
// JBravo: Mirrored models
|
||||
CrossProduct(ent->axis[0], ent->axis[1], cross);
|
||||
backEndData[tr.smpFrame]->entities[r_numentities].mirrored = (DotProduct(ent->axis[2], cross) < 0.f);
|
||||
|
||||
r_numentities++;
|
||||
}
|
||||
|
||||
|
|
|
@ -879,8 +879,20 @@ static void RB_SurfaceMesh(md3Surface_t *surface) {
|
|||
indexes = surface->numTriangles * 3;
|
||||
Bob = tess.numIndexes;
|
||||
Doug = tess.numVertexes;
|
||||
for (j = 0 ; j < indexes ; j++) {
|
||||
tess.indexes[Bob + j] = Doug + triangles[j];
|
||||
// JBravo: Mirrored models
|
||||
if (backEnd.currentEntity->mirrored) {
|
||||
// Makro - this should be done differently, but since we're copying
|
||||
// indices in a loop anyway (see below), reversing them in the same loop
|
||||
// is practically free...
|
||||
for (j = 0 ; j < indexes ; j += 3) {
|
||||
tess.indexes[Bob + j + 0] = Doug + triangles[j + 0];
|
||||
tess.indexes[Bob + j + 1] = Doug + triangles[j + 2];
|
||||
tess.indexes[Bob + j + 2] = Doug + triangles[j + 1];
|
||||
}
|
||||
} else {
|
||||
for (j = 0 ; j < indexes ; j++) {
|
||||
tess.indexes[Bob + j] = Doug + triangles[j];
|
||||
}
|
||||
}
|
||||
tess.numIndexes += indexes;
|
||||
|
||||
|
|
Loading…
Reference in a new issue