[GHI 2178] Vegetation Debugger info was sometimes getting culled (#2209)
* [GHI 2178] Fixed missing vegetation info The entity debug drawing culling system was removing it due to the level entity not having an AABB. Since this component can draw infinitely far, it just needed a max AABB. With the culling fixed, it made another culling problem evident - a bug in the font code where it wasn't culling 3D text rendered behind the camera. Now it is. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * Fix problem with debug rendering not immediately showing up. When using FloatMax for the AABB, it causes math overflows with the initial camera frustrum. Changing to max/2.0f is sufficient to avoid the overflows. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * Fixed normals on mesh raycasts. The normals needed to be normalized after transformation, and didn't need the non-uniform scale applied to them, since they're normals. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com> * Fixed the bug that prevented max-size AABBs from working with ShapeIntersection::Overlap. Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
This commit is contained in:
@@ -112,6 +112,7 @@ void DebugComponent::Activate()
|
||||
DebugNotificationBus::Handler::BusConnect();
|
||||
DebugNotificationBus::AllowFunctionQueuing(true);
|
||||
AzFramework::EntityDebugDisplayEventBus::Handler::BusConnect(GetEntityId());
|
||||
AzFramework::BoundsRequestBus::Handler::BusConnect(GetEntityId());
|
||||
SystemConfigurationRequestBus::Handler::BusConnect();
|
||||
|
||||
VEG_PROFILE_METHOD(DebugSystemDataBus::BroadcastResult(m_debugData, &DebugSystemDataBus::Events::GetDebugData));
|
||||
@@ -120,6 +121,7 @@ void DebugComponent::Activate()
|
||||
void DebugComponent::Deactivate()
|
||||
{
|
||||
SystemConfigurationRequestBus::Handler::BusDisconnect();
|
||||
AzFramework::BoundsRequestBus::Handler::BusDisconnect();
|
||||
AzFramework::EntityDebugDisplayEventBus::Handler::BusDisconnect();
|
||||
DebugRequestBus::Handler::BusDisconnect();
|
||||
DebugNotificationBus::Handler::BusDisconnect();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
|
||||
#include <AzFramework/Visibility/BoundsBus.h>
|
||||
#include <AzCore/PlatformDef.h>
|
||||
#include <Vegetation/Ebuses/InstanceSystemRequestBus.h>
|
||||
#include <Vegetation/Ebuses/SystemConfigurationBus.h>
|
||||
@@ -56,6 +57,7 @@ namespace Vegetation
|
||||
class DebugComponent
|
||||
: public AZ::Component
|
||||
, private AzFramework::EntityDebugDisplayEventBus::Handler
|
||||
, private AzFramework::BoundsRequestBus::Handler
|
||||
, private DebugRequestBus::Handler
|
||||
, private DebugNotificationBus::Handler
|
||||
, private SystemConfigurationRequestBus::Handler
|
||||
@@ -80,6 +82,9 @@ namespace Vegetation
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// EntityDebugDisplayEventBus
|
||||
|
||||
// Ideally this would use ViewportDebugDisplayEventBus::DisplayViewport, but that doesn't currently work in game mode,
|
||||
// so instead we use this plus the BoundsRequestBus with a large AABB to get ourselves rendered.
|
||||
void DisplayEntityViewport(
|
||||
const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override;
|
||||
|
||||
@@ -110,6 +115,20 @@ namespace Vegetation
|
||||
void UpdateSystemConfig(const AZ::ComponentConfig* config) override;
|
||||
void GetSystemConfig([[maybe_unused]] AZ::ComponentConfig* config) const override {}; // ignore this call
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// BoundsRequestBus
|
||||
AZ::Aabb GetWorldBounds() override
|
||||
{
|
||||
// DisplayEntityViewport relies on the BoundsRequestBus to get the entity bounds to determine when to call debug drawing
|
||||
// for that entity. Since this is a level component that can draw infinitely far in every direction, we return an
|
||||
// effectively infinite AABB so that it always draws.
|
||||
return AZ::Aabb::CreateFromMinMax(AZ::Vector3(-AZ::Constants::FloatMax), AZ::Vector3(AZ::Constants::FloatMax));
|
||||
}
|
||||
AZ::Aabb GetLocalBounds() override
|
||||
{
|
||||
// The local and world bounds will be the same for this component.
|
||||
return GetWorldBounds();
|
||||
}
|
||||
|
||||
protected:
|
||||
void PrepareNextReport();
|
||||
|
||||
Reference in New Issue
Block a user