fixed floating point precision inconsistency causing collisions in hsv color computation

This commit is contained in:
korialis 2020-04-01 09:27:43 +02:00
parent 9b47103f6f
commit 34eccf9958
1 changed files with 4 additions and 3 deletions

View File

@ -184,8 +184,8 @@ public:
h = modff(h,&dummy);
if(h==1.0) h = 0.0;
int i = int( floor(h*6.0) );
float f = float(h*6.0f - floor(h*6.0f));
int i = int( floor(h*6.0f) );
float f = float(h*6.0f- floor(h*6.0f));
float p = v*(1.0f-s);
float q = v*(1.0f-s*f);
@ -242,7 +242,8 @@ inline static Color4 Scatter(int range, int value,float Sat=.3f,float Val=.9f)
value -= (m+1)>>1;
m >>= 1;
}
else m = (m+1)>>1;
else m = (m+1)>>1;
if (r>range-b) r = range-b;
//TRACE("Scatter range 0..%i, in %i out %i\n",n,a,b);