Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | exuin |
I have 32 variables in my shader code and I think that’s too many. How do I make less variables?
I’m just looking for something that doesn’t require me to have so many different variables. I need to replace 4 colors with 4 other colors, but each color has 4 shades, so I have 32 colors in all.
uniform vec4 REPLACE_0_0 : hint_color = vec4(.902, .271, .224, 1);
uniform vec4 REPLACE_0_1 : hint_color = vec4(.678, .184, .271, 1);
uniform vec4 REPLACE_0_2 : hint_color = vec4(.471, .114, .31, 1);
uniform vec4 REPLACE_0_3 : hint_color = vec4(0.31, 0.114, 0.2981, 1);
const vec4 COLOR_0_0 = vec4(230.0/255.0, 69.0/255.0, 57.0/255.0, 1);
const vec4 COLOR_0_1 = vec4(173.0/255.0, 47.0/255.0, 69.0/255.0, 1);
const vec4 COLOR_0_2 = vec4(120.0/255.0, 29.0/255.0, 79.0/255.0, 1);
const vec4 COLOR_0_3 = vec4(79.0/255.0, 29.0/255.0, 76.0/255.0, 1);
uniform vec4 REPLACE_1_0 : hint_color = vec4(0.941, 0.71, 0.255, 1);
uniform vec4 REPLACE_1_1 : hint_color = vec4(0.812, 0.459, 0.169, 1);
uniform vec4 REPLACE_1_2 : hint_color = vec4(0.671, 0.318, 0.188, 1);
uniform vec4 REPLACE_1_3 : hint_color = vec4(0.49, 0.22, 0.2, 1);
const vec4 COLOR_1_0 = vec4(240.0/255.0, 181.0/255.0, 65.0/255.0, 1);
const vec4 COLOR_1_1 = vec4(207.0/255.0, 117.0/255.0, 43.0/255.0, 1);
const vec4 COLOR_1_2 = vec4(171.0/255.0, 81.0/255.0, 48.0/255.0, 1);
const vec4 COLOR_1_3 = vec4(125.0/255.0, 56.0/255.0, 51.0/255.0, 1);
uniform vec4 REPLACE_2_0 : hint_color = vec4(0.784, 0.831, 0.365, 1);
uniform vec4 REPLACE_2_1 : hint_color = vec4(0.388, 0.671, 0.247, 1);
uniform vec4 REPLACE_2_2 : hint_color = vec4(0.231, 0.49, 0.31, 1);
uniform vec4 REPLACE_2_3 : hint_color = vec4(0.184, 0.341, 0.325, 1);
const vec4 COLOR_2_0 = vec4(200.0/255.0, 212.0/255.0, 93.0/255.0, 1);
const vec4 COLOR_2_1 = vec4(99.0/255.0, 171.0/255.0, 63.0/255.0, 1);
const vec4 COLOR_2_2 = vec4(59.0/255.0, 125.0/255.0, 79.0/255.0, 1);
const vec4 COLOR_2_3 = vec4(47.0/255.0, 87.0/255.0, 83.0/255.0, 1);
uniform vec4 REPLACE_3_0 : hint_color = vec4(0.573, 0.91, 0.753, 1);
uniform vec4 REPLACE_3_1 : hint_color = vec4(0.31, 0.643, 0.722, 1);
uniform vec4 REPLACE_3_2 : hint_color = vec4(0.298, 0.408, 0.522, 1);
uniform vec4 REPLACE_3_3 : hint_color = vec4(0.227, 0.247, 0.369, 1);
const vec4 COLOR_3_0 = vec4(146.0/255.0, 232.0/255.0, 192.0/255.0, 1);
const vec4 COLOR_3_1 = vec4(79.0/255.0, 164.0/255.0, 184.0/255.0, 1);
const vec4 COLOR_3_2 = vec4(76.0/255.0, 104.0/255.0, 133.0/255.0, 1);
const vec4 COLOR_3_3 = vec4(58.0/255.0, 63.0/255.0, 94.0/255.0, 1);
I tried making an array but it just gave me the error Array initialization is only supported on high-end platform!
. Is this related to the fact that I’m using GLES2?