Changeset 2219


Ignore:
Timestamp:
Jan 14, 2013, 12:44:54 PM (7 years ago)
Author:
sam
Message:

color: slightly better HSVToRGB routine.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lol/image/color.h

    r2218 r2219  
    7171    static vec3 HSVToRGB(vec3 src)
    7272    {
    73         vec3 tmp = abs(fract(vec3(src.x) + vec3(3.f, 2.f, 1.f) / 3.f) * 6.f - vec3(3.f));
    74         return mix(vec3(1.f), clamp(tmp - vec3(1.f), 0.f, 1.f), src.y) * src.z;
     73        vec3 tmp = vec3(-1.f + abs(6.f * src.x - 3.f),
     74                         2.f - abs(6.f * src.x - 2.f),
     75                         2.f - abs(6.f * src.x - 4.f));
     76        return src.z * mix(vec3(1.f), clamp(tmp, 0.f, 1.f), src.y);
    7577    }
    7678
Note: See TracChangeset for help on using the changeset viewer.