]> git.xonotic.org Git - xonotic/xonotic.git/blobdiff - misc/tools/fft-normalmap-to-heightmap.c
do not write zero alpha values
[xonotic/xonotic.git] / misc / tools / fft-normalmap-to-heightmap.c
index 17f9fd896ac66a4d33d4801fe0c60f090f99f2c4..8d95d5c6f5f4325d13e8746c0a1cadc61c3318d0 100644 (file)
@@ -270,6 +270,8 @@ void hmap_to_nmap(unsigned char *map, int w, int h, int src_chan, double scale)
                imgspace1[(w*y+x)][0] = (v - 128.0) / 127.0;
                imgspace1[(w*y+x)][1] = 0;
 #endif
+               if(v < 1)
+                       v = 1; /* do not write alpha zero */
                map[(w*y+x)*4+3] = floor(v + 0.5);
        }
 
@@ -380,6 +382,8 @@ void hmap_to_nmap_local(unsigned char *map, int w, int h, int src_chan, double s
                                break;
                }
                img_reduced[(w*y+x)] = (v - 128.0) / 127.0;
+               if(v < 1)
+                       v = 1; /* do not write alpha zero */
                map[(w*y+x)*4+3] = floor(v + 0.5);
        }