58 {
60
61 RenderBehaveBuilder builder{ this ,frameInfo.m_FrameIndex, frameInfo.m_ImageIndex };
62
63 builder.BeginRenderPass();
64
66
68
70
71 std::multimap<float, int> sortedEntity;
72 IterWorldCompWithBreak<SpriteComponent>(frameInfo, [&](int entityId, TransformComponent& tranComp, SpriteComponent& spriteComp) {
73
74 auto viewPos = glm::inverse(invViewMatrix) * glm::vec4(tranComp.GetPosition(), 0.0f);
75
76 sortedEntity.insert(std::pair(viewPos.z, entityId));
77
78 return false;
79 });
80
81 for (auto it = sortedEntity.rbegin(); it != sortedEntity.rend(); ++it)
82 {
83 auto [transComp, spriteComp] = frameInfo.m_World->GetRegistry().get<TransformComponent, SpriteComponent>(static_cast<entt::entity>(it->second));
84
86
87 builder.BindPipeline(meshPack->GetMaterial()->GetName());
88
89 builder.UpdatePushConstant<uint64_t>([&](auto& push) {
90 push = meshPack->GetMeshDesc().GetBufferAddress();
91 });
92 });
93 }
94
95 builder.EndRenderPass();
96 }
#define SPICES_PROFILE_ZONE
static DescriptorSetInfo & GetByName(const String2 &name)
Get a DescriptorSetInfo by owner's name.
std::shared_ptr< RendererPass > m_Pass
RendererPass.
std::tuple< glm::mat4, glm::mat4, unsigned int, float > GetActiveCameraMatrix(FrameInfo &frameInfo)
Get The activated camera entity's view matrix and projection matrix.
VulkanState & m_VulkanState
This variable is passed while renderer instanced.
std::array< VkCommandBuffer, MaxFrameInFlight > m_GraphicCommandBuffer