Remove normals to try to firstly optimize chunks rendered

This commit is contained in:
2022-10-22 23:52:08 +02:00
parent fc8c713067
commit 732c65914f
2 changed files with 21 additions and 36 deletions
+19 -27
View File
@@ -121,8 +121,6 @@ fn main() {
fragment: "
#version 140
// warning: that way maybe have a null normal
flat in vec3 normal;
in vec2 v_tex_coords;
flat in uint v_biome;
@@ -130,71 +128,65 @@ fn main() {
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(normal), normalize(LIGHT)), 0.0);
vec4 tex;
switch (v_biome) {
case 0u:
tex = texture(tex0, v_tex_coords);
f_color = texture(tex0, v_tex_coords);
break;
case 1u:
tex = texture(tex1, v_tex_coords);
f_color = texture(tex1, v_tex_coords);
break;
case 2u:
tex = texture(tex2, v_tex_coords);
f_color = texture(tex2, v_tex_coords);
break;
case 3u:
tex = texture(tex3, v_tex_coords);
f_color = texture(tex3, v_tex_coords);
break;
case 4u:
tex = texture(tex4, v_tex_coords);
f_color = texture(tex4, v_tex_coords);
break;
case 5u:
tex = texture(tex5, v_tex_coords);
f_color = texture(tex5, v_tex_coords);
break;
case 6u:
tex = texture(tex6, v_tex_coords);
f_color = texture(tex6, v_tex_coords);
break;
case 7u:
tex = texture(tex7, v_tex_coords);
f_color = texture(tex7, v_tex_coords);
break;
case 8u:
tex = texture(tex8, v_tex_coords);
f_color = texture(tex8, v_tex_coords);
break;
case 9u:
tex = texture(tex9, v_tex_coords);
f_color = texture(tex9, v_tex_coords);
break;
case 10u:
tex = texture(tex10, v_tex_coords);
f_color = texture(tex10, v_tex_coords);
break;
case 11u:
tex = texture(tex11, v_tex_coords);
f_color = texture(tex11, v_tex_coords);
break;
case 12u:
tex = texture(tex12, v_tex_coords);
f_color = texture(tex12, v_tex_coords);
break;
case 13u:
tex = texture(tex13, v_tex_coords);
f_color = texture(tex13, v_tex_coords);
break;
case 14u:
tex = texture(tex14, v_tex_coords);
f_color = texture(tex14, v_tex_coords);
break;
case 15u:
tex = texture(tex15, v_tex_coords);
f_color = texture(tex15, v_tex_coords);
break;
case 16u:
tex = texture(tex16, v_tex_coords);
f_color = texture(tex16, v_tex_coords);
break;
case 17u:
tex = texture(tex17, v_tex_coords);
f_color = texture(tex17, v_tex_coords);
break;
default: // case 18u:
tex = texture(tex18, v_tex_coords);
f_color = texture(tex18, v_tex_coords);
}
f_color = (0.3 + 0.7 * lum, 1.0) * tex;
}
"
},