Disable AO

This commit is contained in:
Imbris 2019-09-24 02:03:40 -04:00 committed by Joshua Barretto
parent d745acc948
commit 34221a0f1d
3 changed files with 22 additions and 29 deletions

View File

@ -31,7 +31,7 @@ void main() {
vec3 diffuse_light, ambient_light;
get_sun_diffuse(f_norm, time_of_day.x, diffuse_light, ambient_light);
diffuse_light += light_at(f_pos, f_norm);
vec3 surf_color = illuminate(srgb_to_linear(model_col.rgb * f_col) * 2.0, diffuse_light, ambient_light);
vec3 surf_color = illuminate(srgb_to_linear(model_col.rgb * f_col), diffuse_light * 4.0, ambient_light);
float fog_level = fog(f_pos.xyz, focus_pos.xyz, medium.x);
vec3 fog_color = get_sky_color(normalize(f_pos - cam_pos.xyz), time_of_day.x, true);

View File

@ -5,7 +5,7 @@ use crate::{
use common::{
figure::Segment,
util::{linear_to_srgb, srgb_to_linear},
vol::{IntoFullVolIterator, Vox},
vol::{IntoFullVolIterator, ReadVol, Vox},
};
use vek::*;
@ -42,7 +42,25 @@ impl Meshable<FigurePipeline, FigurePipeline> for Segment {
)
},
true,
&[[[1.0; 3]; 3]; 3],
&{
let mut ls = [[[0.0; 3]; 3]; 3];
for x in 0..3 {
for y in 0..3 {
for z in 0..3 {
ls[x][y][z] = if self
.get(pos + Vec3::new(x as i32, y as i32, z as i32) - 1)
.map(|v| v.is_empty())
.unwrap_or(true)
{
1.0
} else {
0.0
};
}
}
}
ls
},
|vox| vox.is_empty(),
|vox| !vox.is_empty(),
);

View File

@ -20,15 +20,6 @@ fn get_ao_quad<V: ReadVol>(
) -> Vec4<(f32, f32)> {
dirs.windows(2)
.map(|offs| {
let (s1, s2) = (
vol.get(pos + shift + offs[0])
.map(&is_opaque)
.unwrap_or(false),
vol.get(pos + shift + offs[1])
.map(&is_opaque)
.unwrap_or(false),
);
let mut darkness = 0.0;
for x in 0..2 {
for y in 0..2 {
@ -39,23 +30,7 @@ fn get_ao_quad<V: ReadVol>(
}
}
(
darkness,
if s1 && s2 {
0.0
} else {
let corner = vol
.get(pos + shift + offs[0] + offs[1])
.map(&is_opaque)
.unwrap_or(false);
// Map both 1 and 2 neighbors to 0.5 occlusion.
if s1 || s2 || corner {
0.5
} else {
1.0
}
},
)
(darkness, 1.0)
})
.collect::<Vec4<(f32, f32)>>()
}