}
/* vortex: apply gridscale and gridambientscale here */
- ColorToBytes( color, bgp->ambient[ i ], gridScale * gridAmbientScale );
+ if (gp->directed[0] || gp->directed[1] || gp->directed[2]) {
+ /*
+ * HACK: if there's a non-zero directed component, this
+ * lightgrid cell is useful. However, ioq3 skips grid
+ * cells with zero ambient. So let's force ambient to be
+ * nonzero unless directed is zero too.
+ */
+ ColorToBytesNonZero(color, bgp->ambient[i], gridScale * gridAmbientScale);
+ } else {
+ ColorToBytes(color, bgp->ambient[i], gridScale * gridAmbientScale);
+ }
ColorToBytes( gp->directed[ i ], bgp->directed[ i ], gridScale );
}
colorBytes[ 2 ] = sample[ 2 ];
}
+void ColorToBytesNonZero( const float *color, byte *colorBytes, float scale) {
+ int i;
+ ColorToBytes(color, colorBytes, scale);
+ for (i = 0; i < 3; ++i)
+ if (colorBytes[i] == 0)
+ colorBytes[i] = 1;
+}
/* -------------------------------------------------------------------------------
/* light_ydnar.c */
void ColorToBytes( const float *color, byte *colorBytes, float scale );
+void ColorToBytesNonZero( const float *color, byte *colorBytes, float scale );
void SmoothNormals( void );
void MapRawLightmap( int num );