-
Notifications
You must be signed in to change notification settings - Fork 0
/
palete.cpp
65 lines (52 loc) · 970 Bytes
/
palete.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "renderables.h"
#include "math.h"
#define _RGB(r,g,b) r.0f/255.0f, g.0f/255.0f, b.0f/255.0f
float palete[3][5][3] =
{
{
{_RGB(11, 0, 0)},
{_RGB(33, 0, 0)},
{_RGB(90, 0, 0)},
{_RGB(136, 0, 0)},
{_RGB(180, 0, 0)}
},
{
{_RGB(11, 44, 51)},
{_RGB(33, 83, 84)},
{_RGB(90, 156, 154)},
{_RGB(136, 224, 225)},
{_RGB(180, 237, 230)}
},
{
{_RGB(190, 150, 29)},
{_RGB(201, 167, 83)},
{_RGB(203, 190, 137)},
{_RGB(203, 200, 193)},
{_RGB(227, 229, 210)}
},
};
vec3f color[5];
int curr = 0;
float* pal_color(int i)
{
return color[i];
}
void set_pal_color(int i, float alpha)
{
float* c = pal_color(i);
glColor4f(c[0], c[1], c[2], alpha);
}
void pal_update()
{
for(int i = 0; i < 5; ++i)
{
float* to = palete[curr][i];
color[i][0] += (to[0] - color[i][0])*0.05f;
color[i][1] += (to[1] - color[i][1])*0.05f;
color[i][2] += (to[2] - color[i][2])*0.05f;
}
}
void pal_change_to(int i)
{
curr = i;
}