Fix some minor display issues.

This commit is contained in:
Joshua Yanovski 2020-07-04 19:17:59 +02:00
parent 0ed752e087
commit bfda6da42f
4 changed files with 12 additions and 8 deletions

View File

@ -127,9 +127,10 @@ void main() {
} }
vec3 c_norm = cross(f_norm, b_norm); vec3 c_norm = cross(f_norm, b_norm);
float wave00 = wave_height(f_pos); vec3 wave_pos = f_pos + focus_off.xyz;
float wave10 = wave_height(f_pos + vec3(0.1, 0, 0)); float wave00 = wave_height(wave_pos);
float wave01 = wave_height(f_pos + vec3(0, 0.1, 0)); float wave10 = wave_height(wave_pos + vec3(0.1, 0, 0));
float wave01 = wave_height(wave_pos + vec3(0, 0.1, 0));
float slope = abs(wave00 - wave10) * abs(wave00 - wave01); float slope = abs(wave00 - wave10) * abs(wave00 - wave01);
vec3 nmap = vec3( vec3 nmap = vec3(

View File

@ -428,7 +428,8 @@ void main() {
f_pos.xyz += abs(voxel_norm) * delta_sides; f_pos.xyz += abs(voxel_norm) * delta_sides;
voxel_norm = voxel_norm == vec3(0.0) ? f_norm : voxel_norm; voxel_norm = voxel_norm == vec3(0.0) ? f_norm : voxel_norm;
f_col = /*srgb_to_linear*/(f_col + hash(vec4(floor(f_pos * 3.0 - voxel_norm * 0.5), 0)) * 0.01/* - 0.01*/); // Small-scale noise vec3 hash_pos = f_pos + focus_off.xyz;
f_col = /*srgb_to_linear*/(f_col + hash(vec4(floor(hash_pos * 3.0 - voxel_norm * 0.5), 0)) * 0.01/* - 0.01*/); // Small-scale noise
// f_ao = 1.0; // f_ao = 1.0;
// f_ao = dot(f_ao_vec, sqrt(1.0 - delta_sides * delta_sides)); // f_ao = dot(f_ao_vec, sqrt(1.0 - delta_sides * delta_sides));

View File

@ -2246,9 +2246,10 @@ impl Hud {
let camera::Dependents { let camera::Dependents {
view_mat, proj_mat, .. view_mat, proj_mat, ..
} = camera.dependents(); } = camera.dependents();
let focus_off = camera.get_focus_pos().map(f32::trunc);
self.ui.maintain( self.ui.maintain(
&mut global_state.window.renderer_mut(), &mut global_state.window.renderer_mut(),
Some(proj_mat * view_mat), Some(proj_mat * view_mat * Mat4::translation_3d(-focus_off)),
); );
// Check if item images need to be reloaded // Check if item images need to be reloaded

View File

@ -478,9 +478,10 @@ impl FigureMgr {
// Don't display figures outside the frustum spectrum (this is important to do // Don't display figures outside the frustum spectrum (this is important to do
// for any figure that potentially casts a shadow, since we use this // for any figure that potentially casts a shadow, since we use this
// to estimate bounds for shadow maps). Currently, we don't do this before the update // to estimate bounds for shadow maps). Currently, we don't do this before the
// cull, so it's possible that faraway figures will not shadow correctly until their // update cull, so it's possible that faraway figures will not
// next update. For now, we treat this as an acceptable tradeoff. // shadow correctly until their next update. For now, we treat this
// as an acceptable tradeoff.
let radius = scale.unwrap_or(&Scale(1.0)).0 * 2.0; let radius = scale.unwrap_or(&Scale(1.0)).0 * 2.0;
let (in_frustum, lpindex) = if let Some(mut meta) = self.states.get_mut(body, &entity) { let (in_frustum, lpindex) = if let Some(mut meta) = self.states.get_mut(body, &entity) {
let (in_frustum, lpindex) = BoundingSphere::new(pos.0.into_array(), radius) let (in_frustum, lpindex) = BoundingSphere::new(pos.0.into_array(), radius)