diff options
Diffstat (limited to 'client/src/render/scene/draw.rs')
-rw-r--r-- | client/src/render/scene/draw.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/client/src/render/scene/draw.rs b/client/src/render/scene/draw.rs index dabb9cd..672d7ef 100644 --- a/client/src/render/scene/draw.rs +++ b/client/src/render/scene/draw.rs @@ -15,7 +15,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ use super::{DemandMap, RPrefab}; -use glam::{EulerRot, Mat3, Mat4}; +use glam::{EulerRot, Mat3, Mat4, Vec3}; use std::sync::Arc; use weareshared::{packets::Resource, resources::Prefab, tree::SceneTree}; use wgpu::{ @@ -34,6 +34,7 @@ impl ScenePipeline { scene: &SceneTree, prefabs: &DemandMap<Resource<Prefab>, Arc<RPrefab>>, projection: Mat4, + camera_position: Vec3, ) { let mut rpass = commands.begin_render_pass(&RenderPassDescriptor { label: None, @@ -84,6 +85,8 @@ impl ScenePipeline { mb[6], mb[7], mb[8], 0., // ]; let model_basis = bytemuck::cast_slice(&model_basis); + let cp = &[camera_position.x, camera_position.y, camera_position.z, 0.]; + let camera_position = bytemuck::cast_slice(cp); rpass.set_pipeline(&part.pipeline); rpass.set_bind_group(0, &*part.tex_albedo, &[]); @@ -91,6 +94,7 @@ impl ScenePipeline { rpass.set_bind_group(2, &*part.material, &[]); rpass.set_push_constants(ShaderStages::VERTEX, 0, projection.as_flattened()); rpass.set_push_constants(ShaderStages::VERTEX, 64, model_basis); + rpass.set_push_constants(ShaderStages::VERTEX, 112, camera_position); rpass.set_index_buffer(part.index.slice(..), IndexFormat::Uint32); rpass.set_vertex_buffer(0, part.va_position.slice(..)); rpass.set_vertex_buffer(1, part.va_normal.slice(..)); |