Should make biomes working but it doesn't (using hardcode)
This commit is contained in:
+41
-8
@@ -54,15 +54,12 @@ fn main() {
|
||||
in vec3 normal;
|
||||
in uint index;
|
||||
in float altitude;
|
||||
in uint biome;
|
||||
|
||||
out vec3 v_normal;
|
||||
out vec2 v_tex_coords;
|
||||
out uint v_biome;
|
||||
|
||||
void main() {
|
||||
v_normal = normal;
|
||||
v_biome = biome;
|
||||
uint index_mod = index % 6u;
|
||||
uint index_div = index / 6u;
|
||||
uint z = index_div / 250u;
|
||||
@@ -95,16 +92,34 @@ fn main() {
|
||||
in vec3 v_normal;
|
||||
in vec2 v_tex_coords;
|
||||
out vec4 f_color;
|
||||
in uint v_biome;
|
||||
flat in uint biome;
|
||||
|
||||
// TODO: not hardcode
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D tex0, tex1, tex2, tex3, tex4, tex5, tex6, tex7, tex8, tex9, tex10, tex11, tex12, tex13, tex14, tex15, tex16, tex17, tex18;
|
||||
|
||||
const vec3 LIGHT = vec3(0.0, -1.0, 0.0);
|
||||
|
||||
void main() {
|
||||
float lum = max(dot(normalize(v_normal), normalize(LIGHT)), 0.0);
|
||||
f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex, v_tex_coords);
|
||||
|
||||
if(biome == 0u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex0, v_tex_coords);
|
||||
else if(biome == 1u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex1, v_tex_coords);
|
||||
else if(biome == 2u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex2, v_tex_coords);
|
||||
else if(biome == 3u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex3, v_tex_coords);
|
||||
else if(biome == 4u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex4, v_tex_coords);
|
||||
else if(biome == 5u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex5, v_tex_coords);
|
||||
else if(biome == 6u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex6, v_tex_coords);
|
||||
else if(biome == 7u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex7, v_tex_coords);
|
||||
else if(biome == 8u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex8, v_tex_coords);
|
||||
else if(biome == 9u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex9, v_tex_coords);
|
||||
else if(biome == 10u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex10, v_tex_coords);
|
||||
else if(biome == 11u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex11, v_tex_coords);
|
||||
else if(biome == 12u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex12, v_tex_coords);
|
||||
else if(biome == 13u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex13, v_tex_coords);
|
||||
else if(biome == 14u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex14, v_tex_coords);
|
||||
else if(biome == 15u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex15, v_tex_coords);
|
||||
else if(biome == 16u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex16, v_tex_coords);
|
||||
else if(biome == 17u) f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex17, v_tex_coords);
|
||||
else /*if(biome == 18u)*/ f_color = (0.3 + 0.7 * lum, 1.0) * texture(tex18, v_tex_coords);
|
||||
}
|
||||
"
|
||||
},
|
||||
@@ -121,7 +136,25 @@ fn main() {
|
||||
let uniforms = uniform! {
|
||||
persp_matrix: camera.get_perspective(),
|
||||
view_matrix: camera.get_view(),
|
||||
tex: &textures[0] // could inline otherwise
|
||||
tex0: &textures[0],
|
||||
tex1: &textures[1],
|
||||
tex2: &textures[2],
|
||||
tex3: &textures[3],
|
||||
tex4: &textures[4],
|
||||
tex5: &textures[5],
|
||||
tex6: &textures[6],
|
||||
tex7: &textures[7],
|
||||
tex8: &textures[8],
|
||||
tex9: &textures[9],
|
||||
tex10: &textures[10],
|
||||
tex11: &textures[11],
|
||||
tex12: &textures[12],
|
||||
tex13: &textures[13],
|
||||
tex14: &textures[14],
|
||||
tex15: &textures[15],
|
||||
tex16: &textures[16],
|
||||
tex17: &textures[17],
|
||||
tex18: &textures[18],
|
||||
};
|
||||
|
||||
// draw parameters
|
||||
|
||||
Reference in New Issue
Block a user