mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-13 07:33:35 +00:00
working on scene management
This commit is contained in:
@@ -43,19 +43,19 @@ namespace Scop
|
||||
|
||||
VkCommandBuffer cmd = renderer.GetActiveCommandBuffer();
|
||||
pipeline.BindPipeline(cmd, 0, {});
|
||||
for(auto actor : scene.GetActors())
|
||||
for(const auto& actor : scene.GetActors())
|
||||
{
|
||||
if(!actor->IsVisible())
|
||||
if(!actor.IsVisible())
|
||||
continue;
|
||||
ModelData model_data;
|
||||
model_data.model_mat = Mat4f::Identity();
|
||||
model_data.model_mat.SetTranslation(actor->GetPosition() - actor->GetModel().GetCenter());
|
||||
model_data.model_mat.SetScale(actor->GetScale());
|
||||
model_data.model_mat = Mat4f::Translate(-actor->GetModel().GetCenter()) * Mat4f::Rotate(actor->GetOrientation()) * model_data.model_mat;
|
||||
model_data.model_mat.SetTranslation(actor.GetPosition() - actor.GetModel().GetCenter());
|
||||
model_data.model_mat.SetScale(actor.GetScale());
|
||||
model_data.model_mat = Mat4f::Translate(-actor.GetModel().GetCenter()) * Mat4f::Rotate(actor.GetOrientation()) * model_data.model_mat;
|
||||
model_data.normal_mat = model_data.model_mat;
|
||||
model_data.normal_mat.Inverse().Transpose();
|
||||
RenderCore::Get().vkCmdPushConstants(cmd, pipeline.GetPipelineLayout(), VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(ModelData), &model_data);
|
||||
actor->GetModel().Draw(cmd, *data.matrices_set, pipeline, *data.albedo_set, renderer.GetDrawCallsCounterRef(), renderer.GetPolygonDrawnCounterRef(), renderer.GetCurrentFrameIndex());
|
||||
actor.GetModel().Draw(cmd, *data.matrices_set, pipeline, *data.albedo_set, renderer.GetDrawCallsCounterRef(), renderer.GetPolygonDrawnCounterRef(), renderer.GetCurrentFrameIndex());
|
||||
}
|
||||
pipeline.EndPipeline(cmd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user