Changed the DiffuseProbeGrid and ReflectionProbe components to only override the Box size if it's at the default (unit)

Signed-off-by: dmcdiar <dmcdiar@amazon.com>
This commit is contained in:
dmcdiar
2021-06-29 16:10:03 -07:00
parent f7c96e44b0
commit b65a2da548
7 changed files with 44 additions and 14 deletions
@@ -13,5 +13,6 @@ namespace AZ
{
static constexpr const char* const ReflectionProbeComponentTypeId = "{E5D29F09-F974-45FE-A1D0-2126079D1021}";
static constexpr const char* const EditorReflectionProbeComponentTypeId = "{6EBF2E41-2918-48B8-ACC3-FB115ED09E64}";
static constexpr float DefaultReflectionProbeExtents = 8.0f;
} // namespace Render
} // namespace AZ
@@ -127,9 +127,21 @@ namespace AZ
// set the visualization sphere option
m_featureProcessor->ShowProbeVisualization(m_handle, m_configuration.m_showVisualization);
// update the outer extents from the box shape
// if the user already resized the box shape on this entity it will inherit those extents
UpdateOuterExtents();
// if this is a new ReflectionProbe entity and the box shape has not been changed (i.e., it's still unit sized)
// then set the shape to the default extents
AZ::Vector3 boxDimensions = m_boxShapeInterface->GetBoxDimensions();
if (m_configuration.m_entityId == EntityId::InvalidEntityId && boxDimensions == AZ::Vector3(1.0f))
{
AZ::Vector3 extents(m_configuration.m_outerWidth, m_configuration.m_outerLength, m_configuration.m_outerHeight);
// resize the box shape, this will invoke OnShapeChanged
m_boxShapeInterface->SetBoxDimensions(extents);
}
else
{
// update the outer extents from the box shape
UpdateOuterExtents();
}
// set the inner extents
m_featureProcessor->SetProbeInnerExtents(m_handle, AZ::Vector3(m_configuration.m_innerWidth, m_configuration.m_innerLength, m_configuration.m_innerHeight));
@@ -14,6 +14,7 @@
#include <Atom/Feature/ReflectionProbe/ReflectionProbeFeatureProcessorInterface.h>
#include <Atom/RPI.Public/Model/Model.h>
#include <LmbrCentral/Shape/BoxShapeComponentBus.h>
#include <ReflectionProbe/ReflectionProbeComponentConstants.h>
namespace AZ
{
@@ -50,12 +51,12 @@ namespace AZ
AZ_CLASS_ALLOCATOR(ReflectionProbeComponentConfig, SystemAllocator, 0);
static void Reflect(AZ::ReflectContext* context);
float m_outerHeight = 20.0f;
float m_outerLength = 20.0f;
float m_outerWidth = 20.0f;
float m_innerHeight = 20.0f;
float m_innerLength = 20.0f;
float m_innerWidth = 20.0f;
float m_outerHeight = DefaultReflectionProbeExtents;
float m_outerLength = DefaultReflectionProbeExtents;
float m_outerWidth = DefaultReflectionProbeExtents;
float m_innerHeight = DefaultReflectionProbeExtents;
float m_innerLength = DefaultReflectionProbeExtents;
float m_innerWidth = DefaultReflectionProbeExtents;
bool m_useParallaxCorrection = true;
bool m_showVisualization = true;