]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
Comment ColorToBytesNonZero and fix zero detection in light.c.
authorRudolf Polzer <divVerent@gmail.com>
Sun, 19 Apr 2020 00:41:25 +0000 (02:41 +0200)
committerRudolf Polzer <divVerent@gmail.com>
Sun, 19 Apr 2020 00:41:25 +0000 (02:41 +0200)
tools/quake3/q3map2/light.c
tools/quake3/q3map2/light_ydnar.c

index b8ad379f158b9ab853d966d97f0fc3b44b18cfe4..709b2ab996bc87ad8eb516d7da8baed799d0e841 100644 (file)
@@ -1771,7 +1771,7 @@ void TraceGrid( int num ){
                        }
 
                /* vortex: apply gridscale and gridambientscale here */
-               if (gp->directed[0] || gp->directed[1] || gp->directed[2]) {
+               if (gp->directed[i][0] || gp->directed[i][1] || gp->directed[i][2]) {
                        /*
                         * HACK: if there's a non-zero directed component, this
                         * lightgrid cell is useful. However, ioq3 skips grid
index 5653987557017e5db02c49537149233c13b1e880..b86ff4b2f228f66b4a8f7a38b292f0776a6990ef 100644 (file)
@@ -132,6 +132,12 @@ void ColorToBytes( const float *color, byte *colorBytes, float scale ){
        colorBytes[ 2 ] = sample[ 2 ];
 }
 
+/*
+ * Same as ColorToBytes, but if the output color will never contain zero
+ * components. Used to avoid returning 0 0 0 due to an ioq3 issue. Reason
+ * to also map 0 0 1 to 1 1 1 is to ensure monotonicity in the color mapping
+ * to prevent banding-like artifacts on lightmaps.
+ */
 void ColorToBytesNonZero( const float *color, byte *colorBytes, float scale) {
        int i;
        ColorToBytes(color, colorBytes, scale);