From: jal Date: Fri, 28 May 2010 19:49:38 +0000 (+0200) Subject: convert to float the input of RGBTOGRAY macro, or it can cause rounding errors in... X-Git-Tag: xonotic-v0.5.0~257^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=73c5be6f5f475210422ef3b040231bed7870548f;p=xonotic%2Fnetradiant.git convert to float the input of RGBTOGRAY macro, or it can cause rounding errors in byte vectors. --- diff --git a/libs/mathlib.h b/libs/mathlib.h index c2e2ed75..d206d330 100644 --- a/libs/mathlib.h +++ b/libs/mathlib.h @@ -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))