rephrase -trianglecheck and -extravisnudge code

This commit is contained in:
Garux 2019-09-07 20:55:55 +03:00
parent 05d7db4e3e
commit 8dab7339d9

View File

@ -446,7 +446,6 @@ static int MapSingleLuxel( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t
vec4_t sideplane, hostplane; vec4_t sideplane, hostplane;
vec3_t origintwo; vec3_t origintwo;
int j, next; int j, next;
float e;
float *nudge; float *nudge;
static float nudges[][ 2 ] = static float nudges[][ 2 ] =
{ {
@ -571,15 +570,11 @@ static int MapSingleLuxel( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t
PlaneFromPoints( sideplane,cverts[i],cverts[ next ], temp ); PlaneFromPoints( sideplane,cverts[i],cverts[ next ], temp );
//planetest sample point //planetest sample point
e = DotProduct( origin,sideplane ); const float e = DotProduct( origin, sideplane ) - sideplane[3];
e = e - sideplane[3]; if ( e > -LUXEL_EPSILON ) {
if ( e > 0 ) {
//we're bad. //we're bad.
//VectorClear(origin);
//Move the sample point back inside triangle bounds //Move the sample point back inside triangle bounds
origin[0] -= sideplane[0] * ( e + 1 ); VectorMA( origin, ( -e - 1 ), sideplane, origin );
origin[1] -= sideplane[1] * ( e + 1 );
origin[2] -= sideplane[2] * ( e + 1 );
#ifdef DEBUG_27_1 #ifdef DEBUG_27_1
VectorClear( origin ); VectorClear( origin );
#endif #endif
@ -628,9 +623,7 @@ static int MapSingleLuxel( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t
VectorCopy( origin,origintwo ); VectorCopy( origin,origintwo );
if ( lightmapExtraVisClusterNudge ) { if ( lightmapExtraVisClusterNudge ) {
origintwo[0] += vecs[2][0]; VectorAdd( origintwo, vecs[2], origintwo );
origintwo[1] += vecs[2][1];
origintwo[2] += vecs[2][2];
} }
/* get cluster */ /* get cluster */