Remove normals to try to firstly optimize chunks rendered
This commit is contained in:
+19
-27
@@ -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;
|
||||
}
|
||||
"
|
||||
},
|
||||
|
||||
+2
-9
@@ -78,13 +78,12 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
||||
#[derive(Copy, Clone)]
|
||||
struct Vertex {
|
||||
altitude: f32,
|
||||
normal: [f32; 3],
|
||||
index: u32,
|
||||
biome: u32,
|
||||
chunk: [u32; 2],
|
||||
}
|
||||
|
||||
implement_vertex!(Vertex, altitude, normal, index, biome, chunk);
|
||||
implement_vertex!(Vertex, altitude, index, biome, chunk);
|
||||
|
||||
let mut vertex_data: Vec<Vertex> = Vec::new();
|
||||
|
||||
@@ -152,7 +151,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
||||
|
||||
vertex_data.push(Vertex {
|
||||
altitude: column,
|
||||
normal: [0.0, 0.0, 1.0],
|
||||
index,
|
||||
biome,
|
||||
chunk,
|
||||
@@ -161,7 +159,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
||||
|
||||
vertex_data.push(Vertex {
|
||||
altitude: column_right,
|
||||
normal: [0.0, 0.0, 1.0],
|
||||
index,
|
||||
biome,
|
||||
chunk,
|
||||
@@ -170,7 +167,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
||||
|
||||
vertex_data.push(Vertex {
|
||||
altitude: column_below,
|
||||
normal: [0.0, 0.0, 1.0],
|
||||
index,
|
||||
biome,
|
||||
chunk,
|
||||
@@ -181,7 +177,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
||||
|
||||
vertex_data.push(Vertex {
|
||||
altitude: column_below,
|
||||
normal: [0.0, 0.0, 1.0],
|
||||
index,
|
||||
biome,
|
||||
chunk,
|
||||
@@ -190,7 +185,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
||||
|
||||
vertex_data.push(Vertex {
|
||||
altitude: column_right,
|
||||
normal: [0.0, 0.0, 1.0],
|
||||
index,
|
||||
biome,
|
||||
chunk,
|
||||
@@ -199,7 +193,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
||||
|
||||
vertex_data.push(Vertex {
|
||||
altitude: column_below_right,
|
||||
normal: [0.0, 0.0, 1.0],
|
||||
index,
|
||||
biome,
|
||||
chunk,
|
||||
@@ -209,7 +202,7 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
||||
}
|
||||
i += 1;
|
||||
// i == 250 thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BufferCreationError(OutOfMemory)', src/support/mod.rs:203:10
|
||||
if i == 175 {
|
||||
if i == 286 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user