- Timestamp:
- Feb 1, 2013, 2:28:08 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lol/image/color.h
r2308 r2309 123 123 float chroma = src.r - min(src.g, src.b); 124 124 float luma = src.r + min(src.g, src.b); 125 /* XXX: we use min() here because numerical stability is not 126 * guaranteed with -ffast-math, I’ve seen it fail on i386. */ 125 127 float h = min(abs(K + (src.g - src.b) / (6.f * chroma)), 1.f); 126 float s = min(abs(chroma / (min(luma, 2.f - luma))), 1.f);128 float s = clamp(chroma / (min(luma, 2.f - luma)), 0.f, 1.f); 127 129 return vec3(h, s, 0.5f * luma); 128 130 }
Note: See TracChangeset
for help on using the changeset viewer.