]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
[tools/quake3/q3map2/light{,maps}_ydnar.c] Fix float-to-int conversion by preventing...
authorThomas Köppe <tkoeppe@google.com>
Sun, 14 Aug 2016 11:13:18 +0000 (12:13 +0100)
committerThomas Debesse <dev@illwieckz.net>
Fri, 14 Oct 2016 00:38:11 +0000 (02:38 +0200)
tools/quake3/q3map2/light_ydnar.c
tools/quake3/q3map2/lightmaps_ydnar.c

index 91f5e047b9562a90b7edab6dbf33709e38e861ea..5bb8438da0a5227b8dfb83ba4863da45862e51e0 100644 (file)
@@ -2216,7 +2216,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;
                        }
index 462331f1ad79ebdef34173719157122209db6f18..c5633ae372d3f754eafc70c61ab4f0e0e6e8578c 100644 (file)
@@ -525,7 +525,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;
        }
@@ -538,7 +538,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;
        }