]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
convert to float the input of RGBTOGRAY macro, or it can cause rounding errors in...
authorjal <germangar@gmail.com>
Fri, 28 May 2010 19:49:38 +0000 (21:49 +0200)
committerjal <germangar@gmail.com>
Fri, 28 May 2010 19:49:38 +0000 (21:49 +0200)
libs/mathlib.h

index c2e2ed7589835a08ac4b750a4aa1c552449a4229..d206d3306ea8fb65654714981f7008cdad244458 100644 (file)
@@ -77,7 +77,7 @@ extern const vec3_t g_vec3_axis_z;
 #define FLOAT_SNAP(f,snap) ( (float)( floor( (f) / (snap) + 0.5 ) * (snap) ) )
 #define FLOAT_TO_INTEGER(f) ( (float)( floor( (f) + 0.5 ) ) )
 
-#define RGBTOGRAY(x) ( (x)[0] * 0.2989f + (x)[1] * 0.5870f + (x)[2] * 0.1140f )
+#define RGBTOGRAY(x) ( (float)((x)[0]) * 0.2989f + (float)((x)[1]) * 0.5870f + (float)((x)[2]) * 0.1140f )
 
 #define Q_rint(in) ((vec_t)floor(in+0.5))