Renderables now no longer render if disabled #225

Merged
Pycorax merged 3 commits from SP3-1-RenderOnlyActive into main 2022-11-19 16:24:22 +08:00
1 changed files with 20 additions and 5 deletions
Showing only changes of commit 27413c380e - Show all commits

View File

@ -441,14 +441,29 @@ namespace SHADE
{
// Transform
auto transform = SHComponentManager::GetComponent_s<SHTransformComponent>(rendId);
if (!transform)
if (transform)
{
SHLOG_WARNING("[SHBatch] Entity contianing a SHRenderable with no SHTransformComponent found!");
transformData.emplace_back();
if (SHSceneManager::CheckNodeAndComponentsActive<SHRenderable>(rendId))
{
transformData.emplace_back(transform->GetTRS());
}
else
{
transformData.emplace_back(transform->GetTRS());
// Should be deactivated
static const SHMatrix ZERO_MTX =
{
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f
};
transformData.emplace_back(ZERO_MTX);
}
}
else
{
SHLOG_WARNING("[SHBatch] Entity contianing a SHRenderable with no SHTransformComponent found!");
transformData.emplace_back();
}
const SHRenderable* renderable = SHComponentManager::GetComponent<SHRenderable>(rendId);