X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=inline;f=test.cpp;fp=test.cpp;h=6de5452a7270601cf12d1c5d8f3390da6cdf2057;hb=02d19b8323a1b626acd9d3b4f08bb63f51149cf3;hp=634a0ea249d2c4155c27e5380533509ad12700d3;hpb=8df9b9f19175effb728f3b587a65dd753457670e;p=movit diff --git a/test.cpp b/test.cpp index 634a0ea..6de5452 100644 --- a/test.cpp +++ b/test.cpp @@ -20,6 +20,8 @@ #include #include +#include "util.h" + #ifdef NDEBUG #define check_error() #else @@ -92,48 +94,6 @@ enum textures { HSV_WHEEL = 4, }; -// assumes h in [0, 2pi> or [-pi, pi> -void hsv2rgb(float h, float s, float v, float *r, float *g, float *b) -{ - if (h < 0.0f) { - h += 2.0f * M_PI; - } - float c = v * s; - float hp = (h * 180.0 / M_PI) / 60.0; - float x = c * (1 - fabs(fmod(hp, 2.0f) - 1.0f)); - - if (hp >= 0 && hp < 1) { - *r = c; - *g = x; - *b = 0.0f; - } else if (hp >= 1 && hp < 2) { - *r = x; - *g = c; - *b = 0.0f; - } else if (hp >= 2 && hp < 3) { - *r = 0.0f; - *g = c; - *b = x; - } else if (hp >= 3 && hp < 4) { - *r = 0.0f; - *g = x; - *b = c; - } else if (hp >= 4 && hp < 5) { - *r = x; - *g = 0.0f; - *b = c; - } else { - *r = c; - *g = 0.0f; - *b = x; - } - - float m = v - c; - *r += m; - *g += m; - *b += m; -} - GLhandleARB read_shader(const char* filename, GLenum type) { static char buf[131072];