From 961f8c6d405c9c6fcf9aaf4fb6f199b0e5c60d88 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Thu, 30 Apr 2026 10:06:32 -0400 Subject: add orbit rendering for bodies --- src/wgpuctx/pipeline.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/wgpuctx/pipeline.rs') diff --git a/src/wgpuctx/pipeline.rs b/src/wgpuctx/pipeline.rs index 0811800..d698ac4 100644 --- a/src/wgpuctx/pipeline.rs +++ b/src/wgpuctx/pipeline.rs @@ -14,7 +14,8 @@ pub struct RenderPipelineBuilder<'a> vertex_buffer_layouts: Vec>, - cull_mode: Option + cull_mode: Option, + primitive_topology: wgpu::PrimitiveTopology } impl<'a> RenderPipelineBuilder<'a> @@ -34,7 +35,8 @@ impl<'a> RenderPipelineBuilder<'a> vertex_buffer_layouts: Vec::new(), - cull_mode: Some(wgpu::Face::Back) + cull_mode: Some(wgpu::Face::Back), + primitive_topology: wgpu::PrimitiveTopology::TriangleList } } @@ -61,6 +63,13 @@ impl<'a> RenderPipelineBuilder<'a> self.cull_mode = mode; self } + pub fn primitive_topology( + mut self, + topology: wgpu::PrimitiveTopology + ) -> Self { + self.primitive_topology = topology; self + } + pub fn build( self, label: Option<&'static str>, @@ -109,8 +118,10 @@ impl<'a> RenderPipelineBuilder<'a> })], }), primitive: wgpu::PrimitiveState { - topology: wgpu::PrimitiveTopology::TriangleList, - strip_index_format: None, + topology: self.primitive_topology, + strip_index_format: if self.primitive_topology.is_strip() { + Some(wgpu::IndexFormat::Uint32) } else { + None }, front_face: wgpu::FrontFace::Ccw, cull_mode: self.cull_mode, polygon_mode: wgpu::PolygonMode::Fill, -- cgit v1.2.3