Merge remote-tracking branch 'origin/main' into SP3-2-Physics

This commit is contained in:
Diren D Bharwani 2022-11-19 17:38:18 +08:00
commit b1179d02c2
2 changed files with 43 additions and 9 deletions

View File

@ -50,6 +50,9 @@ project "SHADE_CSharp"
function platformsElementCS(cfg) function platformsElementCS(cfg)
_p(2,'<Platforms>x64</Platforms>') _p(2,'<Platforms>x64</Platforms>')
end end
function configElementCS(cfg)
_p(2,'<Configurations>Debug;Release;Publish</Configurations>')
end
function docsElementCS(cfg) function docsElementCS(cfg)
_p(2,'<GenerateDocumentationFile>true</GenerateDocumentationFile>') _p(2,'<GenerateDocumentationFile>true</GenerateDocumentationFile>')
end end
@ -59,6 +62,6 @@ project "SHADE_CSharp"
premake.override(premake.vstudio.cs2005.elements, "projectProperties", function (oldfn, cfg) premake.override(premake.vstudio.cs2005.elements, "projectProperties", function (oldfn, cfg)
return table.join(oldfn(cfg), { return table.join(oldfn(cfg), {
platformsElementCS, docsElementCS, docsLocationElementCS, platformsElementCS, configElementCS, docsElementCS, docsLocationElementCS,
}) })
end) end)

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
{ {
@ -49,7 +50,7 @@ namespace SHADE
, referencedMatInstances { std::move(rhs.referencedMatInstances) } , referencedMatInstances { std::move(rhs.referencedMatInstances) }
, matBufferDirty { std::move(rhs.matBufferDirty) } , matBufferDirty { std::move(rhs.matBufferDirty) }
, subBatches { std::move(rhs.subBatches) } , subBatches { std::move(rhs.subBatches) }
, drawData { std::move(drawData) } , drawData { std::move(rhs.drawData) }
, transformData { std::move(rhs.transformData) } , transformData { std::move(rhs.transformData) }
, instancedIntegerData { std::move(rhs.instancedIntegerData) } , instancedIntegerData { std::move(rhs.instancedIntegerData) }
, matPropsData { std::move(rhs.matPropsData) } , matPropsData { std::move(rhs.matPropsData) }
@ -80,7 +81,7 @@ namespace SHADE
referencedMatInstances = std::move(rhs.referencedMatInstances); referencedMatInstances = std::move(rhs.referencedMatInstances);
matBufferDirty = std::move(rhs.matBufferDirty) ; matBufferDirty = std::move(rhs.matBufferDirty) ;
subBatches = std::move(rhs.subBatches) ; subBatches = std::move(rhs.subBatches) ;
drawData = std::move(drawData) ; drawData = std::move(rhs.drawData) ;
transformData = std::move(rhs.transformData) ; transformData = std::move(rhs.transformData) ;
instancedIntegerData = std::move(rhs.instancedIntegerData) ; instancedIntegerData = std::move(rhs.instancedIntegerData) ;
matPropsData = std::move(rhs.matPropsData) ; matPropsData = std::move(rhs.matPropsData) ;
@ -301,10 +302,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();
@ -425,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);