Renderables now no longer render if disabled

This commit is contained in:
Kah Wei 2022-11-18 21:59:18 +08:00
parent 5ec8475842
commit 27413c380e
1 changed files with 20 additions and 5 deletions

View File

@ -441,14 +441,29 @@ namespace SHADE
{ {
// Transform // Transform
auto transform = SHComponentManager::GetComponent_s<SHTransformComponent>(rendId); auto transform = SHComponentManager::GetComponent_s<SHTransformComponent>(rendId);
if (!transform) if (transform)
{ {
SHLOG_WARNING("[SHBatch] Entity contianing a SHRenderable with no SHTransformComponent found!"); if (SHSceneManager::CheckNodeAndComponentsActive<SHRenderable>(rendId))
transformData.emplace_back(); {
transformData.emplace_back(transform->GetTRS());
} }
else 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); const SHRenderable* renderable = SHComponentManager::GetComponent<SHRenderable>(rendId);