Reversed water draw order

This commit is contained in:
Joshua Barretto 2020-02-11 12:18:08 +00:00
parent 9dc46c490e
commit 5f2d0021a3
2 changed files with 5 additions and 2 deletions

View File

@ -89,9 +89,9 @@ void main() {
0.1 / slope
);
nmap = mix(vec3(0, 0, 1), normalize(nmap), min(1.0 / pow(frag_dist, 0.75), 1));
nmap = mix(f_norm, normalize(nmap), min(1.0 / pow(frag_dist, 0.75), 1));
vec3 norm = f_norm * nmap.z + b_norm * nmap.x + c_norm * nmap.y;
vec3 norm = vec3(0, 0, 1) * nmap.z + b_norm * nmap.x + c_norm * nmap.y;
vec3 light, diffuse_light, ambient_light;
get_sun_diffuse(norm, time_of_day.x, light, diffuse_light, ambient_light, 0.0);

View File

@ -1483,6 +1483,9 @@ impl<V: RectRasterableVol> Terrain<V> {
.as_ref()
.map(|model| (model, &chunk.locals))
})
.collect::<Vec<_>>()
.into_iter()
.rev() // Render back-to-front
.for_each(|(model, locals)| {
renderer.render_fluid_chunk(model, globals, locals, lights, shadows, &self.waves)
});