[Quake2world-dev] r42 - in quake2world/trunk/src: . tools/q2wmap

jdolan at jdolan.dyndns.org jdolan at jdolan.dyndns.org
Sun Dec 21 22:54:14 UTC 2008


Author: jdolan
Date: 2008-12-21 22:54:13 +0000 (Sun, 21 Dec 2008)
New Revision: 42

Modified:
   quake2world/trunk/src/shared.c
   quake2world/trunk/src/tools/q2wmap/lightmap.c
Log:
Fix regression in ColorNormalize.

Modified: quake2world/trunk/src/shared.c
===================================================================
--- quake2world/trunk/src/shared.c	2008-12-21 19:07:51 UTC (rev 41)
+++ quake2world/trunk/src/shared.c	2008-12-21 22:54:13 UTC (rev 42)
@@ -506,7 +506,6 @@
 vec_t ColorNormalize(const vec3_t in, vec3_t out){
 	vec_t max;
 
-	VectorClear(out);
 
 	// find the brightest component
 	max = in[0];
@@ -517,8 +516,10 @@
 	if(in[2] > max)
 		max = in[2];
 
-	if(max == 0.0)  // avoid FPE
+	if(max == 0.0){  // avoid FPE
+		VectorClear(out);
 		return 0.0;
+	}
 
 	VectorScale(in, 1.0 / max, out);
 

Modified: quake2world/trunk/src/tools/q2wmap/lightmap.c
===================================================================
--- quake2world/trunk/src/tools/q2wmap/lightmap.c	2008-12-21 19:07:51 UTC (rev 41)
+++ quake2world/trunk/src/tools/q2wmap/lightmap.c	2008-12-21 22:54:13 UTC (rev 42)
@@ -354,7 +354,8 @@
 		const entity_t *e = &entities[i];
 
 		const char *name = ValueForKey(e, "classname");
-		if(strncmp(name, "light", 5))
+
+		if(strncmp(name, "light", 5))  // not a light or 
 			continue;
 
 		numlights++;
@@ -372,14 +373,15 @@
 		if(!intensity)
 			intensity = FloatForKey(e, "_light");
 		if(!intensity)
-			intensity = 300;
+			intensity = 300.0;
 
 		color = ValueForKey(e, "_color");
 		if(color && color[0]){
 			sscanf(color, "%f %f %f", &l->color[0], &l->color[1], &l->color[2]);
 			ColorNormalize(l->color, l->color);
-		} else
-			l->color[0] = l->color[1] = l->color[2] = 1.0;
+		} else {
+			VectorSet(l->color, 1.0, 1.0, 1.0);
+		}
 
 		l->intensity = intensity * entity_scale;
 		l->type = emit_point;



More information about the Quake2World-dev mailing list