it works again!!

This commit is contained in:
2021-10-24 19:27:37 +02:00
parent 2834623ba7
commit c8d4da62b6
9 changed files with 14 additions and 22 deletions

View File

@@ -9,7 +9,7 @@ use crate::vulkan::Vertex;
use crate::vulkan::GameData;
use crate::VulkanRenderer;
use super::TextureHandle;
use super::{TextureHandle, gameobject::PushConstantType};
type RP = Arc<RenderPass>;
type GP = Arc<GraphicsPipeline>;
@@ -142,15 +142,16 @@ impl Drawcall for DefaultShader {
for i in 0..game_objects.len() {
let game_object = &game_objects[i];
let mesh = &game_data.meshes[game_object.mesh_index];
let push_constants = game_object.get_push_constants();
builder
if let PushConstantType::MeshPC(mesh_push) = game_object.get_push_constants() {
builder
.bind_pipeline_graphics(self.pipeline.clone())
.bind_descriptor_sets(PipelineBindPoint::Graphics, self.pipeline.layout().clone(), 0, game_object.descriptor_sets[fb_index].clone())
.bind_vertex_buffers(0, mesh.vertex_buffer.clone())
.bind_index_buffer(mesh.index_buffer.clone())
.push_constants(self.pipeline.layout().clone(), 0, push_constants)
.push_constants(self.pipeline.layout().clone(), 0, mesh_push)
.draw_indexed(mesh.index_buffer.len() as u32, 1, 0, 0, 0).unwrap();
}
}
}
@@ -341,7 +342,6 @@ impl Drawcall for TextShader {
.bind_descriptor_sets(PipelineBindPoint::Graphics, self.pipeline.layout().clone(), 0, game_object.descriptor_sets[fb_index].clone())
.bind_vertex_buffers(0, mesh.vertex_buffer.clone())
.bind_index_buffer(mesh.index_buffer.clone())
.push_constants(self.pipeline.layout().clone(), 0, game_object.get_push_constants())
.draw_indexed(mesh.index_buffer.len() as u32, 1, 0, 0, 0).unwrap();
}
}