]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/lightmaps_ydnar.c
Turn some UT stuff into options, as it is broken for Nexuiz. Also add -nodeluxenormal...
[xonotic/netradiant.git] / tools / quake3 / q3map2 / lightmaps_ydnar.c
index b4b6349fb4bb2713b7e2d7a6daa3e9ec06228cc6..d3054b1f8fe439c2d4595f92232ae2b49398b620 100644 (file)
@@ -2172,8 +2172,21 @@ static void FindOutLightmaps( rawLightmap_t *lm )
                                /* store direction */
                                if( deluxemap )
                                {
+                                       if(normalizeDeluxemap)
+                                       {
+                                               if(!VectorNormalize(deluxel, direction))
+                                                       VectorClear(direction);
+                                       }
+                                       else
+                                       {
+                                               if(deluxel[3])
+                                                       VectorScale(deluxel, 1 / deluxel[3], direction);
+                                               else
+                                                       VectorClear(direction);
+                                       }
+
                                        /* normalize average light direction */
-                                       if( VectorNormalize( deluxel, direction ) )
+                                       if(direction[0] != 0 || direction[1] != 0 || direction[2] != 0)
                                        {
                                                /* encode [-1,1] in [0,255] */
                                                pixel = olm->bspDirBytes + (((oy * olm->customWidth) + ox) * 3);