From 74da949da6ae221cbef673d5fbf7d893936d2951 Mon Sep 17 00:00:00 2001 From: robtfm <50659922+robtfm@users.noreply.github.com> Date: Mon, 21 Oct 2024 19:36:14 +0100 Subject: [PATCH] bound scene heights --- assets/shaders/bound_material.wgsl | 5 ++++- assets/ui/chat.dui | 2 +- crates/avatar/src/lib.rs | 1 + crates/scene_material/src/lib.rs | 5 ++++- crates/scene_runner/src/initialize_scene.rs | 4 +++- crates/scene_runner/src/renderer_context.rs | 3 +++ crates/scene_runner/src/update_world/gltf_container.rs | 6 +++++- crates/scene_runner/src/update_world/material.rs | 6 +++--- crates/scene_runner/src/update_world/mesh_renderer/mod.rs | 6 +++--- crates/scene_runner/src/update_world/text_shape.rs | 1 + crates/world_ui/src/lib.rs | 3 ++- 11 files changed, 30 insertions(+), 12 deletions(-) diff --git a/assets/shaders/bound_material.wgsl b/assets/shaders/bound_material.wgsl index 8fd0a1cc..c2467af2 100644 --- a/assets/shaders/bound_material.wgsl +++ b/assets/shaders/bound_material.wgsl @@ -12,6 +12,7 @@ struct SceneBounds { bounds: vec4, + height: f32, distance: f32, flags: u32, } @@ -88,7 +89,9 @@ fn fragment( // check bounds let world_position = pbr_input.world_position.xyz; - let outside_amt = max(max(max(0.0, bounds.bounds.x - world_position.x), max(world_position.x - bounds.bounds.z, bounds.bounds.y - world_position.z)), world_position.z - bounds.bounds.w); + let outside_xy = max(max(max(0.0, bounds.bounds.x - world_position.x), max(world_position.x - bounds.bounds.z, bounds.bounds.y - world_position.z)), world_position.z - bounds.bounds.w); + let outside_height = max(world_position.y - bounds.height, 0.0); + let outside_amt = max(outside_height, outside_xy); var noise = 0.05; var should_discard = false; diff --git a/assets/ui/chat.dui b/assets/ui/chat.dui index 97efe37f..4a3220e1 100644 --- a/assets/ui/chat.dui +++ b/assets/ui/chat.dui @@ -22,7 +22,7 @@