]> git.rm.cloudns.org Git - xonotic/xonotic.git/commitdiff
do not write zero alpha values
authorRudolf Polzer <divverent@alientrap.org>
Sat, 28 Aug 2010 09:29:36 +0000 (11:29 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 28 Aug 2010 09:29:36 +0000 (11:29 +0200)
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);
        }