Changes to get visibility system working again in-game
This commit is contained in:
+2
-2
@@ -190,7 +190,7 @@ namespace AzToolsFramework
|
||||
|
||||
EditorLegacyGameModeNotificationBus::Handler::BusConnect();
|
||||
|
||||
m_entityVisibilityBoundsUnionSystem.Connect();
|
||||
//m_entityVisibilityBoundsUnionSystem.Connect();
|
||||
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace AzToolsFramework
|
||||
//=========================================================================
|
||||
void EditorEntityContextComponent::Deactivate()
|
||||
{
|
||||
m_entityVisibilityBoundsUnionSystem.Disconnect();
|
||||
//m_entityVisibilityBoundsUnionSystem.Disconnect();
|
||||
|
||||
EditorLegacyGameModeNotificationBus::Handler::BusDisconnect();
|
||||
|
||||
|
||||
+1
-1
@@ -189,7 +189,7 @@ namespace AzToolsFramework
|
||||
AZ::ComponentTypeList m_requiredEditorComponentTypes;
|
||||
|
||||
//! Edit time visibility management integrating entities with the IVisibilitySystem.
|
||||
AzFramework::EntityVisibilityBoundsUnionSystem m_entityVisibilityBoundsUnionSystem;
|
||||
//AzFramework::EntityVisibilityBoundsUnionSystem m_entityVisibilityBoundsUnionSystem;
|
||||
bool m_isLegacySliceService;
|
||||
|
||||
UndoSystem::UndoCacheInterface* m_undoCacheInterface = nullptr;
|
||||
|
||||
+2
-1
@@ -9,7 +9,7 @@
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma optimize ("", off)
|
||||
#include "AzToolsFramework_precompiled.h"
|
||||
#include "TransformComponent.h"
|
||||
|
||||
@@ -261,6 +261,7 @@ namespace AzToolsFramework
|
||||
|
||||
AZ::TransformNotificationBus::Event(
|
||||
GetEntityId(), &TransformNotification::OnTransformChanged, localTM, worldTM);
|
||||
m_transformChangedEvent.Signal(localTM, worldTM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -68,6 +68,7 @@ namespace AzToolsFramework
|
||||
{
|
||||
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework);
|
||||
|
||||
const AZ::Entity* entity = AZ::Interface<AZ::ComponentApplicationRequests>::Get()->FindEntity(entityId);
|
||||
AzFramework::EntityDebugDisplayEventBus::Event(
|
||||
entityId, &AzFramework::EntityDebugDisplayEvents::DisplayEntityViewport,
|
||||
viewportInfo, debugDisplay);
|
||||
@@ -84,10 +85,9 @@ namespace AzToolsFramework
|
||||
|
||||
if (ed_visibility_showAggregateEntityTransformedLocalBounds)
|
||||
{
|
||||
AZ::Transform worldFromLocal = AZ::Transform::CreateIdentity();
|
||||
AZ::TransformBus::EventResult(worldFromLocal, entityId, &AZ::TransformBus::Events::GetWorldTM);
|
||||
AZ::Transform worldFromLocal = entity->GetTransform()->GetWorldTM();
|
||||
|
||||
if (const AZ::Aabb localAabb = AzFramework::CalculateEntityLocalBoundsUnion(entityId); localAabb.IsValid())
|
||||
if (const AZ::Aabb localAabb = AzFramework::CalculateEntityLocalBoundsUnion(entity); localAabb.IsValid())
|
||||
{
|
||||
const AZ::Aabb worldAabb = localAabb.GetTransformedAabb(worldFromLocal);
|
||||
debugDisplay.SetColor(AZ::Colors::Turquoise);
|
||||
@@ -97,7 +97,7 @@ namespace AzToolsFramework
|
||||
|
||||
if (ed_visibility_showAggregateEntityWorldBounds)
|
||||
{
|
||||
if (const AZ::Aabb worldAabb = AzFramework::CalculateEntityWorldBoundsUnion(entityId); worldAabb.IsValid())
|
||||
if (const AZ::Aabb worldAabb = AzFramework::CalculateEntityWorldBoundsUnion(entity); worldAabb.IsValid())
|
||||
{
|
||||
debugDisplay.SetColor(AZ::Colors::Magenta);
|
||||
debugDisplay.DrawWireBox(worldAabb.GetMin(), worldAabb.GetMax());
|
||||
|
||||
+4
-1
@@ -13,7 +13,9 @@
|
||||
#include "EditorSelectionUtil.h"
|
||||
|
||||
#include <AzCore/Math/Aabb.h>
|
||||
#include <AzCore/Interface/Interface.h>
|
||||
#include <AzCore/Math/IntersectSegment.h>
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzFramework/Visibility/BoundsBus.h>
|
||||
#include <AzToolsFramework/API/ComponentEntitySelectionBus.h>
|
||||
#include <AzToolsFramework/Viewport/ViewportMessages.h>
|
||||
@@ -28,7 +30,8 @@ namespace AzToolsFramework
|
||||
{
|
||||
if (Centered(pivot))
|
||||
{
|
||||
if (const AZ::Aabb localBound = AzFramework::CalculateEntityLocalBoundsUnion(entityId);
|
||||
const AZ::Entity* entity = AZ::Interface<AZ::ComponentApplicationRequests>::Get()->FindEntity(entityId);
|
||||
if (const AZ::Aabb localBound = AzFramework::CalculateEntityLocalBoundsUnion(entity);
|
||||
localBound.IsValid())
|
||||
{
|
||||
return localBound.GetCenter();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma optimize("", off)
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
#include <AzFramework/Viewport/CameraState.h>
|
||||
#include <AzFramework/Visibility/BoundsBus.h>
|
||||
@@ -62,8 +62,8 @@ namespace UnitTest
|
||||
SetupRowOfEntities(AZ::Vector3::CreateAxisX(-20.0f), AZ::Vector3::CreateAxisX(2.0f));
|
||||
|
||||
// request the entity union bounds system to update
|
||||
AzFramework::EntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::EntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
AzFramework::IEntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::IEntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
|
||||
// create default camera looking down the negative y-axis moved just back from the origin
|
||||
AzFramework::CameraState cameraState = AzFramework::CreateDefaultCamera(
|
||||
@@ -101,8 +101,8 @@ namespace UnitTest
|
||||
SetupRowOfEntities(AZ::Vector3::CreateAxisX(-20.0f), AZ::Vector3::CreateAxisX(2.0f));
|
||||
|
||||
// request the entity union bounds system to update
|
||||
AzFramework::EntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::EntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
AzFramework::IEntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::IEntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
|
||||
// create default camera looking down the negative x-axis moved along the x-axis and tilted slightly down
|
||||
AzFramework::CameraState cameraState = AzFramework::CreateDefaultCamera(
|
||||
@@ -143,15 +143,15 @@ namespace UnitTest
|
||||
SetupRowOfEntities(AZ::Vector3::CreateAxisX(-20.0f), AZ::Vector3::CreateAxisX(2.0f));
|
||||
|
||||
// request the entity union bounds system to update
|
||||
AzFramework::EntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::EntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
AzFramework::IEntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::IEntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
|
||||
const AZ::EntityId entityIdToMove = m_editorEntityIds[10];
|
||||
AZ::TransformBus::Event(
|
||||
entityIdToMove, &AZ::TransformBus::Events::SetWorldTranslation, AZ::Vector3::CreateAxisZ(100.0f));
|
||||
|
||||
AzFramework::EntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::EntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
AzFramework::IEntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::IEntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
|
||||
// create default camera looking down the negative y-axis moved just back from the origin
|
||||
AzFramework::CameraState cameraState = AzFramework::CreateDefaultCamera(
|
||||
@@ -241,8 +241,8 @@ namespace UnitTest
|
||||
{
|
||||
m_localAabb = localAabb;
|
||||
|
||||
AzFramework::EntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::EntityBoundsUnionRequestBus::Events::RefreshEntityLocalBoundsUnion, GetEntityId());
|
||||
AzFramework::IEntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::IEntityBoundsUnionRequestBus::Events::RefreshEntityLocalBoundsUnion, GetEntityId());
|
||||
}
|
||||
|
||||
TEST_F(EditorVisibilityFixture, UpdatedBoundsIntersectingFrustumAddsVisibleEntity)
|
||||
@@ -264,8 +264,8 @@ namespace UnitTest
|
||||
entityId, &AZ::TransformBus::Events::SetWorldTranslation, AZ::Vector3(40.0f, -3.0f, 20.0f));
|
||||
|
||||
// request the entity union bounds system to update
|
||||
AzFramework::EntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::EntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
AzFramework::IEntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::IEntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
|
||||
// create default camera looking down the positive x-axis moved to position offset from world origin
|
||||
AzFramework::CameraState cameraState = AzFramework::CreateDefaultCamera(
|
||||
@@ -288,8 +288,8 @@ namespace UnitTest
|
||||
testBoundComponent->ChangeBounds(AZ::Aabb::CreateFromMinMax(AZ::Vector3(-2.5f), AZ::Vector3(2.5f)));
|
||||
|
||||
// perform an 'update' of the visibility system
|
||||
AzFramework::EntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::EntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
AzFramework::IEntityBoundsUnionRequestBus::Broadcast(
|
||||
&AzFramework::IEntityBoundsUnionRequestBus::Events::ProcessEntityBoundsUnionRequests);
|
||||
|
||||
entityVisibilityQuery.UpdateVisibility(cameraState);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user