diff options
Diffstat (limited to 'client/src/scene_render.rs')
-rw-r--r-- | client/src/scene_render.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/client/src/scene_render.rs b/client/src/scene_render.rs index d19b083..f80f6c2 100644 --- a/client/src/scene_render.rs +++ b/client/src/scene_render.rs @@ -1,9 +1,9 @@ -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; use weareshared::{packets::Resource, tree::SceneTree}; use wgpu::{ - BindGroup, BindGroupDescriptor, BindGroupLayoutDescriptor, BlendState, Buffer, Color, - ColorTargetState, ColorWrites, CommandEncoder, Device, FragmentState, FrontFace, IndexFormat, - LoadOp, MultisampleState, Operations, PipelineCompilationOptions, PipelineLayoutDescriptor, + BindGroup, BindGroupDescriptor, BindGroupLayoutDescriptor, BlendState, Color, ColorTargetState, + ColorWrites, CommandEncoder, Device, FragmentState, FrontFace, IndexFormat, LoadOp, + MultisampleState, Operations, PipelineCompilationOptions, PipelineLayoutDescriptor, PolygonMode, PrimitiveState, PrimitiveTopology, RenderPassColorAttachment, RenderPassDescriptor, RenderPipeline, RenderPipelineDescriptor, StoreOp, TextureFormat, TextureView, VertexAttribute, VertexBufferLayout, VertexFormat, VertexState, VertexStepMode, @@ -16,6 +16,7 @@ pub struct ScenePipeline { pipeline: RenderPipeline, bind_group: BindGroup, prefabs: HashMap<Resource, RPrefab>, + prefabs_needed: HashSet<Resource>, } impl ScenePipeline { @@ -85,10 +86,11 @@ impl ScenePipeline { Self { bind_group, pipeline, + prefabs_needed: HashSet::new(), prefabs: HashMap::new(), } } - pub fn draw(&self, commands: &mut CommandEncoder, target: &TextureView, scene: &SceneTree) { + pub fn draw(&mut self, commands: &mut CommandEncoder, target: &TextureView, scene: &SceneTree) { let mut rpass = commands.begin_render_pass(&RenderPassDescriptor { label: None, color_attachments: &[Some(RenderPassColorAttachment { @@ -117,6 +119,8 @@ impl ScenePipeline { rpass.set_vertex_buffer(1, part.normals.slice(..)); rpass.draw_indexed(0..part.index_count, 0, 0..1); } + } else { + self.prefabs_needed.insert(ob.res); } } } |