This commit is contained in:
2021-10-22 07:37:38 +02:00
parent c63f7fc556
commit 0ccc56bbad
7 changed files with 18 additions and 13 deletions

View File

@@ -20,6 +20,7 @@ pub struct GameObject {
pub descriptor_sets: Vec<Arc<RendererDescriptorSets>>,
pub is_selected: bool,
pub pipeline_index: usize,
pub visible: bool,
}
#[derive(Clone)]
@@ -37,7 +38,7 @@ impl GameObject {
GameObject { mesh_index: mesh.index, textures, position: Vector3::new(0.0, 0.0, 0.0),
rotation: Quaternion::new(1.0, 0.0, 0.0, 0.0), scale: Vector3::new(1.0, 1.0, 1.0), children: vec![],
descriptor_sets: vec![], is_selected: false, pipeline_index: mesh.pipeline_index }
descriptor_sets: vec![], is_selected: false, pipeline_index: mesh.pipeline_index, visible: true }
}
pub fn init_descriptor_sets(&mut self, renderer: &mut VulkanRenderer) {

View File

@@ -335,7 +335,8 @@ impl VulkanRenderer {
// Draw meshes etc.
let mut index = 0;
for pipeline in &self.pipelines {
pipeline.draw(&mut builder, fb_index, game_objects.iter().filter(|go| go.pipeline_index == index).collect(), &self.game_data, &self.dynamic_state);
let objects = game_objects.iter().filter(|go| go.visible && go.pipeline_index == index).collect();
pipeline.draw(&mut builder, fb_index, objects, &self.game_data, &self.dynamic_state);
index += 1;
}