mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 07:11:54 +00:00
[tools/quake3/q3map2/light{,maps}_ydnar.c] Fix float-to-int conversion by preventing NaN values
This commit is contained in:
parent
6409de3029
commit
f463907e46
2 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue