Remove normals to try to firstly optimize chunks rendered
This commit is contained in:
+19
-27
@@ -121,8 +121,6 @@ fn main() {
|
|||||||
fragment: "
|
fragment: "
|
||||||
#version 140
|
#version 140
|
||||||
|
|
||||||
// warning: that way maybe have a null normal
|
|
||||||
flat in vec3 normal;
|
|
||||||
in vec2 v_tex_coords;
|
in vec2 v_tex_coords;
|
||||||
flat in uint v_biome;
|
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;
|
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() {
|
void main() {
|
||||||
float lum = max(dot(normalize(normal), normalize(LIGHT)), 0.0);
|
|
||||||
vec4 tex;
|
|
||||||
|
|
||||||
switch (v_biome) {
|
switch (v_biome) {
|
||||||
case 0u:
|
case 0u:
|
||||||
tex = texture(tex0, v_tex_coords);
|
f_color = texture(tex0, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 1u:
|
case 1u:
|
||||||
tex = texture(tex1, v_tex_coords);
|
f_color = texture(tex1, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 2u:
|
case 2u:
|
||||||
tex = texture(tex2, v_tex_coords);
|
f_color = texture(tex2, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 3u:
|
case 3u:
|
||||||
tex = texture(tex3, v_tex_coords);
|
f_color = texture(tex3, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 4u:
|
case 4u:
|
||||||
tex = texture(tex4, v_tex_coords);
|
f_color = texture(tex4, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 5u:
|
case 5u:
|
||||||
tex = texture(tex5, v_tex_coords);
|
f_color = texture(tex5, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 6u:
|
case 6u:
|
||||||
tex = texture(tex6, v_tex_coords);
|
f_color = texture(tex6, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 7u:
|
case 7u:
|
||||||
tex = texture(tex7, v_tex_coords);
|
f_color = texture(tex7, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 8u:
|
case 8u:
|
||||||
tex = texture(tex8, v_tex_coords);
|
f_color = texture(tex8, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 9u:
|
case 9u:
|
||||||
tex = texture(tex9, v_tex_coords);
|
f_color = texture(tex9, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 10u:
|
case 10u:
|
||||||
tex = texture(tex10, v_tex_coords);
|
f_color = texture(tex10, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 11u:
|
case 11u:
|
||||||
tex = texture(tex11, v_tex_coords);
|
f_color = texture(tex11, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 12u:
|
case 12u:
|
||||||
tex = texture(tex12, v_tex_coords);
|
f_color = texture(tex12, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 13u:
|
case 13u:
|
||||||
tex = texture(tex13, v_tex_coords);
|
f_color = texture(tex13, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 14u:
|
case 14u:
|
||||||
tex = texture(tex14, v_tex_coords);
|
f_color = texture(tex14, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 15u:
|
case 15u:
|
||||||
tex = texture(tex15, v_tex_coords);
|
f_color = texture(tex15, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 16u:
|
case 16u:
|
||||||
tex = texture(tex16, v_tex_coords);
|
f_color = texture(tex16, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
case 17u:
|
case 17u:
|
||||||
tex = texture(tex17, v_tex_coords);
|
f_color = texture(tex17, v_tex_coords);
|
||||||
break;
|
break;
|
||||||
default: // case 18u:
|
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)]
|
#[derive(Copy, Clone)]
|
||||||
struct Vertex {
|
struct Vertex {
|
||||||
altitude: f32,
|
altitude: f32,
|
||||||
normal: [f32; 3],
|
|
||||||
index: u32,
|
index: u32,
|
||||||
biome: u32,
|
biome: u32,
|
||||||
chunk: [u32; 2],
|
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();
|
let mut vertex_data: Vec<Vertex> = Vec::new();
|
||||||
|
|
||||||
@@ -152,7 +151,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
|||||||
|
|
||||||
vertex_data.push(Vertex {
|
vertex_data.push(Vertex {
|
||||||
altitude: column,
|
altitude: column,
|
||||||
normal: [0.0, 0.0, 1.0],
|
|
||||||
index,
|
index,
|
||||||
biome,
|
biome,
|
||||||
chunk,
|
chunk,
|
||||||
@@ -161,7 +159,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
|||||||
|
|
||||||
vertex_data.push(Vertex {
|
vertex_data.push(Vertex {
|
||||||
altitude: column_right,
|
altitude: column_right,
|
||||||
normal: [0.0, 0.0, 1.0],
|
|
||||||
index,
|
index,
|
||||||
biome,
|
biome,
|
||||||
chunk,
|
chunk,
|
||||||
@@ -170,7 +167,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
|||||||
|
|
||||||
vertex_data.push(Vertex {
|
vertex_data.push(Vertex {
|
||||||
altitude: column_below,
|
altitude: column_below,
|
||||||
normal: [0.0, 0.0, 1.0],
|
|
||||||
index,
|
index,
|
||||||
biome,
|
biome,
|
||||||
chunk,
|
chunk,
|
||||||
@@ -181,7 +177,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
|||||||
|
|
||||||
vertex_data.push(Vertex {
|
vertex_data.push(Vertex {
|
||||||
altitude: column_below,
|
altitude: column_below,
|
||||||
normal: [0.0, 0.0, 1.0],
|
|
||||||
index,
|
index,
|
||||||
biome,
|
biome,
|
||||||
chunk,
|
chunk,
|
||||||
@@ -190,7 +185,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
|||||||
|
|
||||||
vertex_data.push(Vertex {
|
vertex_data.push(Vertex {
|
||||||
altitude: column_right,
|
altitude: column_right,
|
||||||
normal: [0.0, 0.0, 1.0],
|
|
||||||
index,
|
index,
|
||||||
biome,
|
biome,
|
||||||
chunk,
|
chunk,
|
||||||
@@ -199,7 +193,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
|||||||
|
|
||||||
vertex_data.push(Vertex {
|
vertex_data.push(Vertex {
|
||||||
altitude: column_below_right,
|
altitude: column_below_right,
|
||||||
normal: [0.0, 0.0, 1.0],
|
|
||||||
index,
|
index,
|
||||||
biome,
|
biome,
|
||||||
chunk,
|
chunk,
|
||||||
@@ -209,7 +202,7 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
|||||||
}
|
}
|
||||||
i += 1;
|
i += 1;
|
||||||
// i == 250 thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BufferCreationError(OutOfMemory)', src/support/mod.rs:203:10
|
// 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user