Merge pull request #367 from tkoeppe/nan

[tools/quake3/q3map2/light{,maps}_ydnar.c] Fix float-to-int conversion
This commit is contained in:
Timothee "TTimo" Besset 2016-08-20 15:56:26 -06:00 committed by GitHub
commit cee35a43d7
2 changed files with 3 additions and 3 deletions

View File

@ -2033,7 +2033,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){
}
/* set luxel filter radius */
luxelFilterRadius = superSample * filterRadius / lm->sampleSize;
luxelFilterRadius = lm->sampleSize != 0 ? superSample * filterRadius / lm->sampleSize : 0;
if ( luxelFilterRadius == 0 && ( filterRadius > 0.0f || filter ) ) {
luxelFilterRadius = 1;
}

View File

@ -518,7 +518,7 @@ qboolean AddPatchToRawLightmap( int num, rawLightmap_t *lm ){
length = 0;
for ( x = 0; x < ( mesh->width - 1 ); x++ )
length += widthTable[ x ];
lm->w = ceil( length / lm->sampleSize ) + 1;
lm->w = lm->sampleSize != 0 ? ceil( length / lm->sampleSize ) + 1 : 0;
if ( lm->w < ds->patchWidth ) {
lm->w = ds->patchWidth;
}
@ -531,7 +531,7 @@ qboolean AddPatchToRawLightmap( int num, rawLightmap_t *lm ){
length = 0;
for ( y = 0; y < ( mesh->height - 1 ); y++ )
length += heightTable[ y ];
lm->h = ceil( length / lm->sampleSize ) + 1;
lm->h = lm->sampleSize != 0 ? ceil( length / lm->sampleSize ) + 1 : 0;
if ( lm->h < ds->patchHeight ) {
lm->h = ds->patchHeight;
}