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 17 additions and 1 deletions
Showing only changes of commit ab869348f1 - Show all commits

View File

@ -27,6 +27,7 @@ of DigiPen Institute of Technology is prohibited.
#include "Math/Transform/SHTransformComponent.h" #include "Math/Transform/SHTransformComponent.h"
#include "Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.h" #include "Graphics/MiddleEnd/GlobalData/SHGraphicsGlobalData.h"
#include "Graphics/Descriptors/SHVkDescriptorPool.h" #include "Graphics/Descriptors/SHVkDescriptorPool.h"
#include "Scene/SHSceneManager.h"
namespace SHADE namespace SHADE
{ {
@ -222,10 +223,25 @@ namespace SHADE
// Transform // Transform
auto transform = SHComponentManager::GetComponent<SHTransformComponent>(rendId); auto transform = SHComponentManager::GetComponent<SHTransformComponent>(rendId);
if (transform) if (transform)
{
if (SHSceneManager::CheckNodeAndComponentsActive<SHRenderable>(rendId))
{ {
transformData.emplace_back(transform->GetTRS()); transformData.emplace_back(transform->GetTRS());
} }
else else
{
// 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!"); SHLOG_WARNING("[SHBatch] Entity contianing a SHRenderable with no SHTransformComponent found!");
transformData.emplace_back(); transformData.emplace_back();