diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-06 22:36:03 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-06 22:36:03 +0100 |
commit | 45282d3a54cc50306383c41e4c7e3d982cac69d1 (patch) | |
tree | d9b9046dae519f1e48716a7497c1dc8505d5e4d8 /client/src/scene_render.rs | |
parent | 44ef37bca0aa633f8c59d849946faf2319c5446b (diff) | |
download | weareserver-45282d3a54cc50306383c41e4c7e3d982cac69d1.tar weareserver-45282d3a54cc50306383c41e4c7e3d982cac69d1.tar.bz2 weareserver-45282d3a54cc50306383c41e4c7e3d982cac69d1.tar.zst |
mesh not visible
Diffstat (limited to 'client/src/scene_render.rs')
-rw-r--r-- | client/src/scene_render.rs | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/client/src/scene_render.rs b/client/src/scene_render.rs index 366b956..b2cd915 100644 --- a/client/src/scene_render.rs +++ b/client/src/scene_render.rs @@ -4,7 +4,7 @@ use wgpu::{ BindGroup, BindGroupDescriptor, BindGroupLayoutDescriptor, BlendState, Color, ColorTargetState, ColorWrites, CommandEncoder, Device, FragmentState, FrontFace, IndexFormat, LoadOp, MultisampleState, Operations, PipelineCompilationOptions, PipelineLayoutDescriptor, - PolygonMode, PrimitiveState, PrimitiveTopology, RenderPassColorAttachment, + PolygonMode, PrimitiveState, PrimitiveTopology, PushConstantRange, RenderPassColorAttachment, RenderPassDescriptor, RenderPipeline, RenderPipelineDescriptor, ShaderStages, StoreOp, TextureFormat, TextureView, VertexAttribute, VertexBufferLayout, VertexFormat, VertexState, VertexStepMode, include_wgsl, @@ -33,7 +33,10 @@ impl ScenePipeline { let pipeline_layout = device.create_pipeline_layout(&PipelineLayoutDescriptor { label: None, bind_group_layouts: &[&bind_group_layout], - push_constant_ranges: &[], + push_constant_ranges: &[PushConstantRange { + range: 0..(12 * 4), + stages: ShaderStages::VERTEX, + }], }); let pipeline = device.create_render_pipeline(&RenderPipelineDescriptor { label: None, @@ -53,19 +56,12 @@ impl ScenePipeline { entry_point: Some("vs_main"), buffers: &[VertexBufferLayout { step_mode: VertexStepMode::Vertex, - array_stride: 2 * 4 * 3, - attributes: &[ - VertexAttribute { - format: VertexFormat::Float32x3, - offset: 0, - shader_location: 0, - }, - VertexAttribute { - format: VertexFormat::Float32x3, - offset: 3 * 4, - shader_location: 1, - }, - ], + array_stride: 4, + attributes: &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(|i| VertexAttribute { + format: VertexFormat::Float32, + offset: 0, + shader_location: i, + }), }], compilation_options: PipelineCompilationOptions::default(), }, @@ -111,13 +107,13 @@ impl ScenePipeline { })], ..Default::default() }); - rpass.set_bind_group(0, &self.bind_group, &[]); - rpass.set_pipeline(&self.pipeline); for ob in scene.objects.values() { if let Some(prefab) = prefabs.get(&ob.res) { for (affine, part) in &prefab.0 { let affine = affine.to_cols_array().map(|v| v.to_le_bytes()); + rpass.set_bind_group(0, &self.bind_group, &[]); + rpass.set_pipeline(&self.pipeline); rpass.set_push_constants(ShaderStages::VERTEX, 0, affine.as_flattened()); rpass.set_index_buffer(part.index.slice(..), IndexFormat::Uint16); rpass.set_vertex_buffer(0, part.position[0].slice(..)); |