diff --git a/Gems/CMakeLists.txt b/Gems/CMakeLists.txt
index b6bda8c16e..3b630cfd2f 100644
--- a/Gems/CMakeLists.txt
+++ b/Gems/CMakeLists.txt
@@ -37,7 +37,6 @@ add_subdirectory(MessagePopup)
add_subdirectory(PhysX)
add_subdirectory(PhysXDebug)
add_subdirectory(ScriptEvents)
-add_subdirectory(Visibility)
add_subdirectory(AssetValidation)
add_subdirectory(VirtualGamepad)
add_subdirectory(SaveData)
diff --git a/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.cpp b/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.cpp
index 516b958adb..05ac4b1363 100644
--- a/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.cpp
+++ b/Gems/PhysX/Code/Editor/Source/Components/EditorSystemComponent.cpp
@@ -48,11 +48,6 @@ namespace PhysX
AzToolsFramework::EditorRequests::Bus::BroadcastResult(editor, &AzToolsFramework::EditorRequests::GetEditor);
ISurfaceTypeEnumerator* surfaceTypeEnumerator = nullptr;
- if (editor)
- {
- surfaceTypeEnumerator = editor->Get3DEngine()->GetMaterialManager()->GetSurfaceTypeManager()->GetEnumerator();
- }
-
if (surfaceTypeEnumerator)
{
// Enumerate through CryEngine surface types and create a Physics API material for each of them
diff --git a/Gems/Visibility/Assets/Editor/Icons/Components/Disabled/OccluderArea_white.png b/Gems/Visibility/Assets/Editor/Icons/Components/Disabled/OccluderArea_white.png
deleted file mode 100644
index 5554bfc38e..0000000000
--- a/Gems/Visibility/Assets/Editor/Icons/Components/Disabled/OccluderArea_white.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:46757cf327aa9ed60ded1f3025140bc065569634f69e5aaba0b83086fa7642e0
-size 786
diff --git a/Gems/Visibility/Assets/Editor/Icons/Components/Disabled/Portal_white.png b/Gems/Visibility/Assets/Editor/Icons/Components/Disabled/Portal_white.png
deleted file mode 100644
index fc72adc85e..0000000000
--- a/Gems/Visibility/Assets/Editor/Icons/Components/Disabled/Portal_white.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:44150d202f318598e939bf29a543b6edaa0d2cf7455989a2d0da916ba7c83384
-size 833
diff --git a/Gems/Visibility/Assets/Editor/Icons/Components/Disabled/VisArea_white.png b/Gems/Visibility/Assets/Editor/Icons/Components/Disabled/VisArea_white.png
deleted file mode 100644
index 48a7af896a..0000000000
--- a/Gems/Visibility/Assets/Editor/Icons/Components/Disabled/VisArea_white.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:44570118c315725d13affcc87b0eb4fb01f01cf67f9da0a4e066a347e096a36f
-size 757
diff --git a/Gems/Visibility/Assets/Editor/Icons/Components/OccluderArea.svg b/Gems/Visibility/Assets/Editor/Icons/Components/OccluderArea.svg
deleted file mode 100644
index aa8840a798..0000000000
--- a/Gems/Visibility/Assets/Editor/Icons/Components/OccluderArea.svg
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
diff --git a/Gems/Visibility/Assets/Editor/Icons/Components/Portal.svg b/Gems/Visibility/Assets/Editor/Icons/Components/Portal.svg
deleted file mode 100644
index 967a891222..0000000000
--- a/Gems/Visibility/Assets/Editor/Icons/Components/Portal.svg
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
diff --git a/Gems/Visibility/Assets/Editor/Icons/Components/Viewport/OccluderArea.png b/Gems/Visibility/Assets/Editor/Icons/Components/Viewport/OccluderArea.png
deleted file mode 100644
index 3e98e852dd..0000000000
--- a/Gems/Visibility/Assets/Editor/Icons/Components/Viewport/OccluderArea.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7288c80d906ec59271ccd4db168d318f4c5b4fd65fca6077acbf4aaeb76b9e24
-size 4081
diff --git a/Gems/Visibility/Assets/Editor/Icons/Components/Viewport/Portal.png b/Gems/Visibility/Assets/Editor/Icons/Components/Viewport/Portal.png
deleted file mode 100644
index b7198e5803..0000000000
--- a/Gems/Visibility/Assets/Editor/Icons/Components/Viewport/Portal.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:486816ea8e6cb090f8d78e26d9ed6a73aca8e5d6c5fb6bcb3cb2fff8277053db
-size 4687
diff --git a/Gems/Visibility/Assets/Editor/Icons/Components/Viewport/VisArea.png b/Gems/Visibility/Assets/Editor/Icons/Components/Viewport/VisArea.png
deleted file mode 100644
index e2d0c7f803..0000000000
--- a/Gems/Visibility/Assets/Editor/Icons/Components/Viewport/VisArea.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:aca391fc79c7b5400465bcdaa3a1c21a0fbb3dd042420b6511ecf568048ee6ec
-size 4558
diff --git a/Gems/Visibility/Assets/Editor/Icons/Components/VisArea.svg b/Gems/Visibility/Assets/Editor/Icons/Components/VisArea.svg
deleted file mode 100644
index 389f4cf35d..0000000000
--- a/Gems/Visibility/Assets/Editor/Icons/Components/VisArea.svg
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
diff --git a/Gems/Visibility/CMakeLists.txt b/Gems/Visibility/CMakeLists.txt
deleted file mode 100644
index 20a680bce9..0000000000
--- a/Gems/Visibility/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-#
-# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-# its licensors.
-#
-# For complete copyright and license terms please see the LICENSE at the root of this
-# distribution (the "License"). All use of this software is governed by the License,
-# or, if provided, by the license below or the license accompanying this file. Do not
-# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#
-
-add_subdirectory(Code)
diff --git a/Gems/Visibility/Code/CMakeLists.txt b/Gems/Visibility/Code/CMakeLists.txt
deleted file mode 100644
index c8650eea79..0000000000
--- a/Gems/Visibility/Code/CMakeLists.txt
+++ /dev/null
@@ -1,105 +0,0 @@
-#
-# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-# its licensors.
-#
-# For complete copyright and license terms please see the LICENSE at the root of this
-# distribution (the "License"). All use of this software is governed by the License,
-# or, if provided, by the license below or the license accompanying this file. Do not
-# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#
-
-ly_add_target(
- NAME Visibility.Static STATIC
- NAMESPACE Gem
- FILES_CMAKE
- visibility_files.cmake
- INCLUDE_DIRECTORIES
- PRIVATE
- Source
- PUBLIC
- Include
- BUILD_DEPENDENCIES
- PUBLIC
- Legacy::CryCommon
-)
-
-ly_add_target(
- NAME Visibility ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
- NAMESPACE Gem
- FILES_CMAKE
- visibility_shared_files.cmake
- INCLUDE_DIRECTORIES
- PRIVATE
- Source
- PUBLIC
- Include
- BUILD_DEPENDENCIES
- PRIVATE
- Gem::Visibility.Static
-)
-
-if(PAL_TRAIT_BUILD_HOST_TOOLS)
-
- ly_add_target(
- NAME Visibility.Editor.Static STATIC
- NAMESPACE Gem
- FILES_CMAKE
- visibility_editor_files.cmake
- COMPILE_DEFINITIONS
- PUBLIC
- VISIBILITY_EDITOR
- INCLUDE_DIRECTORIES
- PRIVATE
- Source
- PUBLIC
- Include
- BUILD_DEPENDENCIES
- PUBLIC
- Legacy::Editor.Headers
- Legacy::EditorCore
- AZ::AzToolsFramework
- Gem::Visibility.Static
- )
-
- ly_add_target(
- NAME Visibility.Editor GEM_MODULE
-
- NAMESPACE Gem
- FILES_CMAKE
- visibility_editor_shared_files.cmake
- INCLUDE_DIRECTORIES
- PRIVATE
- Source
- PUBLIC
- Include
- BUILD_DEPENDENCIES
- PRIVATE
- Gem::Visibility.Editor.Static
- )
-endif()
-
-################################################################################
-# Tests
-################################################################################
-if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
- if(PAL_TRAIT_BUILD_HOST_TOOLS)
- ly_add_target(
- NAME Visibility.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
- NAMESPACE Gem
- FILES_CMAKE
- visibility_editor_tests_files.cmake
- INCLUDE_DIRECTORIES
- PRIVATE
- Tests
- Source
- BUILD_DEPENDENCIES
- PRIVATE
- AZ::AzTest
- Gem::Visibility.Editor.Static
- )
- ly_add_googletest(
- NAME Gem::Visibility.Editor.Tests
- )
- endif()
-endif()
diff --git a/Gems/Visibility/Code/Include/EditorOccluderAreaComponentBus.h b/Gems/Visibility/Code/Include/EditorOccluderAreaComponentBus.h
deleted file mode 100644
index f2714691cb..0000000000
--- a/Gems/Visibility/Code/Include/EditorOccluderAreaComponentBus.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-
-#include "OccluderAreaComponentBus.h"
-
-namespace Visibility
-{
- /// Request bus for the EditorOccluderComponent.
- class EditorOccluderAreaRequests
- : public OccluderAreaRequests
- , public AZ::FixedVertices
- {
- public:
- virtual void SetDisplayFilled(bool displayFilled) = 0;
- virtual void SetCullDistRatio(float cullDistRatio) = 0;
- virtual void SetUseInIndoors(bool inDoors) = 0;
- virtual void SetDoubleSide(bool doubleSided) = 0;
- virtual void UpdateOccluderAreaObject() = 0;
-
- protected:
- ~EditorOccluderAreaRequests() = default;
- };
-
- /// Type to inherit to implement EditorOccluderAreaComponentRequests
- using EditorOccluderAreaRequestBus = AZ::EBus;
-
- /// Editor notification bus for EditorOccluderAreaComponent.
- class EditorOccluderAreaNotifications
- : public AZ::ComponentBus
- {
- public:
- virtual void OnVerticesChangedInspector() {}
-
- protected:
- ~EditorOccluderAreaNotifications() = default;
- };
-
- /// Type to inherit to implement EditorOccluderAreaNotifications.
- using EditorOccluderAreaNotificationBus = AZ::EBus;
-
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Include/EditorPortalComponentBus.h b/Gems/Visibility/Code/Include/EditorPortalComponentBus.h
deleted file mode 100644
index c4ab43d8a0..0000000000
--- a/Gems/Visibility/Code/Include/EditorPortalComponentBus.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-
-#include "PortalComponentBus.h"
-
-namespace Visibility
-{
- /// Request bus for the EditorPortalComponent.
- class EditorPortalRequests
- : public PortalRequests
- , public AZ::FixedVertices
- {
- public:
- virtual void SetHeight(float height) = 0;
- virtual void SetDisplayFilled(bool filled) = 0;
- virtual void SetAffectedBySun(bool affectedBySun) = 0;
- virtual void SetViewDistRatio(float viewDistRatio) = 0;
- virtual void SetSkyOnly(bool skyOnly) = 0;
- virtual void SetOceanIsVisible(bool oceanVisible) = 0;
- virtual void SetUseDeepness(bool useDeepness) = 0;
- virtual void SetDoubleSide(bool doubleSided) = 0;
- virtual void SetLightBlending(bool lightBending) = 0;
- virtual void SetLightBlendValue(float lightBendAmount) = 0;
- virtual void UpdatePortalObject() = 0;
-
- protected:
- ~EditorPortalRequests() = default;
- };
-
- /// Type to inherit to implement EditorPortalComponentRequests
- using EditorPortalRequestBus = AZ::EBus;
-
- /// Editor notification bus for EditorPortalComponent.
- class EditorPortalNotifications
- : public AZ::ComponentBus
- {
- public:
- virtual void OnVerticesChangedInspector() {}
-
- protected:
- ~EditorPortalNotifications() = default;
- };
-
- /// Type to inherit to implement EditorPortalNotifications.
- using EditorPortalNotificationBus = AZ::EBus;
-
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Include/EditorVisAreaComponentBus.h b/Gems/Visibility/Code/Include/EditorVisAreaComponentBus.h
deleted file mode 100644
index 6803ea77a6..0000000000
--- a/Gems/Visibility/Code/Include/EditorVisAreaComponentBus.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-
-#include "VisAreaComponentBus.h"
-
-namespace Visibility
-{
- /// Request bus for the EditorVisAreaComponent.
- class EditorVisAreaComponentRequests
- : public VisAreaComponentRequests
- , public AZ::VariableVertices
- {
- public:
- virtual void SetHeight(float height) = 0;
- virtual void SetDisplayFilled(bool filled) = 0;
- virtual void SetAffectedBySun(bool affectedBySun) = 0;
- virtual void SetViewDistRatio(float viewDistRatio) = 0;
- virtual void SetOceanIsVisible(bool oceanVisible) = 0;
- virtual void UpdateVisAreaObject() = 0;
- };
-
- /// Type to inherit to implement EditorVisAreaComponentRequests.
- using EditorVisAreaComponentRequestBus = AZ::EBus;
-
- /// Notification bus for the EditorVisAreaComponent.
- class EditorVisAreaComponentNotifications
- : public AZ::ComponentBus
- , public AZ::VertexContainerNotificationInterface
- {
- public:
- /// Called when a new vertex is added to the vis area.
- void OnVertexAdded(size_t /*index*/) override {}
-
- /// Called when a vertex is removed from the vis area.
- void OnVertexRemoved(size_t /*index*/) override {}
-
- /// Called when a vertex is updated.
- void OnVertexUpdated(size_t /*index*/) override {}
-
- /// Called when all vertices on the vis area are set.
- void OnVerticesSet(const AZStd::vector& /*vertices*/) override {}
-
- /// Called when all vertices are removed from the vis area.
- void OnVerticesCleared() override {}
-
- protected:
- ~EditorVisAreaComponentNotifications() = default;
- };
-
- /// Type to inherit to implement EditorVisAreaComponentNotifications.
- using EditorVisAreaComponentNotificationBus = AZ::EBus;
-
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Include/OccluderAreaComponentBus.h b/Gems/Visibility/Code/Include/OccluderAreaComponentBus.h
deleted file mode 100644
index 21b66c14c1..0000000000
--- a/Gems/Visibility/Code/Include/OccluderAreaComponentBus.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-#include
-#include
-
-namespace Visibility
-{
- /// Request bus for the OccluderAreaComponent.
- class OccluderAreaRequests
- {
- public:
- virtual bool GetDisplayFilled() = 0;
- virtual float GetCullDistRatio() = 0;
- virtual bool GetUseInIndoors() = 0;
- virtual bool GetDoubleSide() = 0;
-
- protected:
- ~OccluderAreaRequests() = default;
- };
-
- /// Type to inherit to implement OccluderAreaRequests.
- using OccluderAreaRequestBus = AZ::EBus;
-
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Include/PortalComponentBus.h b/Gems/Visibility/Code/Include/PortalComponentBus.h
deleted file mode 100644
index 7de4cb4e80..0000000000
--- a/Gems/Visibility/Code/Include/PortalComponentBus.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-#include
-#include
-
-namespace Visibility
-{
- // Request bus for the PortalComponent.
- class PortalRequests
- {
- public:
- virtual float GetHeight() = 0;
- virtual bool GetDisplayFilled() = 0;
- virtual bool GetAffectedBySun() = 0;
- virtual float GetViewDistRatio() = 0;
- virtual bool GetSkyOnly() = 0;
- virtual bool GetOceanIsVisible() = 0;
- virtual bool GetUseDeepness() = 0;
- virtual bool GetDoubleSide() = 0;
- virtual bool GetLightBlending() = 0;
- virtual float GetLightBlendValue() = 0;
-
- protected:
- ~PortalRequests() = default;
- };
-
- /// Type to inherit to implement PortalRequests.
- using PortalRequestBus = AZ::EBus;
-
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Include/VisAreaComponentBus.h b/Gems/Visibility/Code/Include/VisAreaComponentBus.h
deleted file mode 100644
index 632e68ffc5..0000000000
--- a/Gems/Visibility/Code/Include/VisAreaComponentBus.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-#include
-#include
-
-namespace Visibility
-{
- /// Request bus for the VisAreaComponent.
- class VisAreaComponentRequests
- {
- public:
- virtual float GetHeight() = 0;
- virtual bool GetDisplayFilled() = 0;
- virtual bool GetAffectedBySun() = 0;
- virtual float GetViewDistRatio() = 0;
- virtual bool GetOceanIsVisible() = 0;
-
- protected:
- ~VisAreaComponentRequests() = default;
- };
-
- /// Type to inherit to implement VisAreaComponentRequests.
- using VisAreaComponentRequestBus = AZ::EBus;
-
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorOccluderAreaComponent.cpp b/Gems/Visibility/Code/Source/EditorOccluderAreaComponent.cpp
deleted file mode 100644
index 9a88799a31..0000000000
--- a/Gems/Visibility/Code/Source/EditorOccluderAreaComponent.cpp
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#include "Visibility_precompiled.h"
-#include "EditorOccluderAreaComponent.h"
-#include "EditorOccluderAreaComponentMode.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-// Include files needed for writing DisplayEntity functions that access the DisplayContext directly.
-#include
-
-#include "MathConversion.h"
-
-namespace Visibility
-{
- void EditorOccluderAreaComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provides)
- {
- provides.push_back(AZ_CRC("EditorOccluderAreaService", 0xf943e16a));
- provides.push_back(AZ_CRC("OccluderAreaService", 0x2fefad66));
- provides.push_back(AZ_CRC("FixedVertexContainerService", 0x83f1bbf2));
- }
-
- void EditorOccluderAreaComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& requires)
- {
- requires.push_back(AZ_CRC("TransformService", 0x8ee22c50));
- }
-
- void EditorOccluderAreaComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
- {
- dependent.push_back(AZ_CRC("QuadShapeService", 0xe449b0fc));
- }
-
- void EditorOccluderAreaComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
- {
- incompatible.push_back(AZ_CRC("EditorOccluderAreaService", 0xf943e16a));
- incompatible.push_back(AZ_CRC("OccluderAreaService", 0x2fefad66));
- incompatible.push_back(AZ_CRC("FixedVertexContainerService", 0x83f1bbf2));
- }
-
- void EditorOccluderAreaConfiguration::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(1);
-
- if (AZ::EditContext* editContext = serializeContext->GetEditContext())
- {
- editContext->Class("OccluderArea Configuration", "")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true);
-
- editContext->Class("OccluderArea Configuration", "")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
- ->DataElement(AZ::Edit::UIHandlers::Default, &OccluderAreaConfiguration::m_displayFilled, "DisplayFilled", "Display the Occlude Area as a filled quad.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &OccluderAreaConfiguration::OnChange)
- ->DataElement(AZ::Edit::UIHandlers::Default, &OccluderAreaConfiguration::m_cullDistRatio, "CullDistRatio", "The range of the culling effect.")
- ->Attribute(AZ::Edit::Attributes::Max, 100.0f)
- ->Attribute(AZ::Edit::Attributes::Min, 0.0f)
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &OccluderAreaConfiguration::OnChange)
- ->DataElement(AZ::Edit::UIHandlers::Default, &OccluderAreaConfiguration::m_useInIndoors, "UseInIndoors", "Should this occluder work inside VisAreas.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &OccluderAreaConfiguration::OnChange)
- ->DataElement(AZ::Edit::UIHandlers::Default, &OccluderAreaConfiguration::m_doubleSide, "DoubleSide", "Should this occlude from both sides.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &OccluderAreaConfiguration::OnChange)
- ->DataElement(AZ::Edit::UIHandlers::Default, &OccluderAreaConfiguration::m_vertices, "Vertices", "Points that make up the OccluderArea.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &OccluderAreaConfiguration::OnVerticesChange)
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
- ;
- }
- }
- }
-
- void EditorOccluderAreaComponent::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(2)
- ->Field("m_config", &EditorOccluderAreaComponent::m_config)
- ->Field("ComponentMode", &EditorOccluderAreaComponent::m_componentModeDelegate)
- ;
-
- if (AZ::EditContext* editContext = serializeContext->GetEditContext())
- {
- editContext->Class("OccluderArea", "An area that blocks objects behind it from rendering.")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::Category, "Rendering")
- ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/OccluderArea.png")
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
- ->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/OccluderArea.svg")
- ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
- ->Attribute(AZ::Edit::Attributes::HelpPageURL, "http://docs.aws.amazon.com/console/lumberyard/userguide/occluder-area-component")
- ->DataElement(AZ::Edit::UIHandlers::Default, &EditorOccluderAreaComponent::m_config, "m_config", "No Description")
- ->DataElement(AZ::Edit::UIHandlers::Default, &EditorOccluderAreaComponent::m_componentModeDelegate, "Component Mode", "OccluderArea Component Mode")
- ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
- ;
- }
- }
-
- if (auto behaviorContext = azrtti_cast(context))
- {
- behaviorContext->EBus("EditorOccluderAreaRequestBus")
- ->Event("SetDisplayFilled", &EditorOccluderAreaRequestBus::Events::SetDisplayFilled)
- ->Event("GetDisplayFilled", &EditorOccluderAreaRequestBus::Events::GetDisplayFilled)
- ->VirtualProperty("DisplayFilled", "GetDisplayFilled", "SetDisplayFilled")
-
- ->Event("SetCullDistRatio", &EditorOccluderAreaRequestBus::Events::SetCullDistRatio)
- ->Event("GetCullDistRatio", &EditorOccluderAreaRequestBus::Events::GetCullDistRatio)
- ->VirtualProperty("CullDistRatio", "GetCullDistRatio", "SetCullDistRatio")
-
- ->Event("SetUseInIndoors", &EditorOccluderAreaRequestBus::Events::SetUseInIndoors)
- ->Event("GetUseInIndoors", &EditorOccluderAreaRequestBus::Events::GetUseInIndoors)
- ->VirtualProperty("UseInIndoors", "GetUseInIndoors", "SetUseInIndoors")
-
- ->Event("SetDoubleSide", &EditorOccluderAreaRequestBus::Events::SetDoubleSide)
- ->Event("GetDoubleSide", &EditorOccluderAreaRequestBus::Events::GetDoubleSide)
- ->VirtualProperty("DoubleSide", "GetDoubleSide", "SetDoubleSide")
- ;
-
- behaviorContext->Class()->RequestBus("EditorOccluderAreaRequestBus");
- }
-
- EditorOccluderAreaConfiguration::Reflect(context);
- }
-
- void EditorOccluderAreaConfiguration::OnChange()
- {
- EditorOccluderAreaRequestBus::Event(m_entityId, &EditorOccluderAreaRequests::UpdateOccluderAreaObject);
- }
-
- void EditorOccluderAreaConfiguration::OnVerticesChange()
- {
- EditorOccluderAreaRequestBus::Event(
- m_entityId, &EditorOccluderAreaRequests::UpdateOccluderAreaObject);
- EditorOccluderAreaNotificationBus::Event(
- m_entityId, &EditorOccluderAreaNotifications::OnVerticesChangedInspector);
- }
-
- void EditorOccluderAreaConfiguration::SetEntityId(const AZ::EntityId entityId)
- {
- m_entityId = entityId;
- }
-
- EditorOccluderAreaComponent::~EditorOccluderAreaComponent()
- {
- if (m_area)
- {
- GetIEditor()->Get3DEngine()->DeleteVisArea(m_area);
- m_area = nullptr;
- }
- }
-
- void EditorOccluderAreaComponent::Activate()
- {
- Base::Activate();
-
- const AZ::EntityId entityId = GetEntityId();
- m_config.SetEntityId(entityId);
-
- // NOTE: We create the vis-area here at activate, but destroy it in the destructor.
- // We have to do this, otherwise the vis-area is not saved into the level.
- // Unfortunately, at this time we cannot create the vis-areas at game runtime.
- // This means that dynamic slices cannot effectively contain vis areas until we fix
- // the core rendering system to allow that.
- const auto visGUID = static_cast(entityId);
- if(!m_area && GetIEditor())
- {
- m_area = GetIEditor()->Get3DEngine()->CreateVisArea(visGUID);
- }
-
- m_componentModeDelegate.ConnectWithSingleComponentMode<
- EditorOccluderAreaComponent, EditorOccluderAreaComponentMode>(
- AZ::EntityComponentIdPair(entityId, GetId()), this);
-
- EditorOccluderAreaRequestBus::Handler::BusConnect(entityId);
- AZ::FixedVerticesRequestBus::Handler::BusConnect(entityId);
- AZ::TransformNotificationBus::Handler::BusConnect(entityId);
- AzFramework::EntityDebugDisplayEventBus::Handler::BusConnect(entityId);
- AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusConnect(entityId);
- AzFramework::BoundsRequestBus::Handler::BusConnect(entityId);
-
- UpdateOccluderAreaObject();
- }
-
- void EditorOccluderAreaComponent::Deactivate()
- {
- m_componentModeDelegate.Disconnect();
-
- AzFramework::BoundsRequestBus::Handler::BusDisconnect();
- AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusDisconnect();
- AzFramework::EntityDebugDisplayEventBus::Handler::BusDisconnect();
- AZ::TransformNotificationBus::Handler::BusDisconnect();
- AZ::FixedVerticesRequestBus::Handler::BusDisconnect();
- EditorOccluderAreaRequestBus::Handler::BusDisconnect();
-
- Base::Deactivate();
- }
-
- /// Update the object runtime after changes to the Configuration.
- /// Called by the default RequestBus SetXXX implementations,
- /// and used to initially set up the object the first time the
- /// Configuration are set.
- void EditorOccluderAreaComponent::UpdateOccluderAreaObject()
- {
- if (m_area)
- {
- AZStd::array verts;
-
- const Matrix34& wtm = AZTransformToLYTransform(GetWorldTM());
- for (size_t i = 0; i < m_config.m_vertices.size(); ++i)
- {
- verts[i] = wtm.TransformPoint(AZVec3ToLYVec3(m_config.m_vertices[i]));
- }
-
- SVisAreaInfo info;
- info.fHeight = 0;
- info.vAmbientColor = Vec3(0, 0, 0);
- info.bAffectedByOutLights = false;
- info.bSkyOnly = false;
- info.fViewDistRatio = m_config.m_cullDistRatio;
- info.bDoubleSide = m_config.m_doubleSide;
- info.bUseDeepness = false;
- info.bUseInIndoors = m_config.m_useInIndoors;
- info.bOceanIsVisible = false;
- info.fPortalBlending = -1.0f;
-
- const AZStd::string name = AZStd::string("OcclArea_") + GetEntity()->GetName();
- GetIEditor()->Get3DEngine()->UpdateVisArea(m_area, &verts[0], verts.size(), name.c_str(), info, false);
-
- AzFramework::EntityBoundsUnionRequestBus::Broadcast(
- &AzFramework::EntityBoundsUnionRequestBus::Events::RefreshEntityLocalBoundsUnion, GetEntityId());
- }
- }
-
- void EditorOccluderAreaComponent::SetDisplayFilled(const bool value)
- {
- m_config.m_displayFilled = value;
- UpdateOccluderAreaObject();
- }
-
- bool EditorOccluderAreaComponent::GetDisplayFilled()
- {
- return m_config.m_displayFilled;
- }
-
- void EditorOccluderAreaComponent::SetCullDistRatio(const float value)
- {
- m_config.m_cullDistRatio = value;
- UpdateOccluderAreaObject();
- }
-
- float EditorOccluderAreaComponent::GetCullDistRatio()
- {
- return m_config.m_cullDistRatio;
- }
-
- void EditorOccluderAreaComponent::SetUseInIndoors(const bool value)
- {
- m_config.m_useInIndoors = value;
- UpdateOccluderAreaObject();
- }
-
- bool EditorOccluderAreaComponent::GetUseInIndoors()
- {
- return m_config.m_useInIndoors;
- }
-
- void EditorOccluderAreaComponent::SetDoubleSide(const bool value)
- {
- m_config.m_doubleSide = value;
- UpdateOccluderAreaObject();
- }
-
- bool EditorOccluderAreaComponent::GetDoubleSide()
- {
- return m_config.m_doubleSide;
- }
-
- bool EditorOccluderAreaComponent::GetVertex(const size_t index, AZ::Vector3& vertex) const
- {
- if (index < m_config.m_vertices.size())
- {
- vertex = m_config.m_vertices[index];
- return true;
- }
-
- return false;
- }
-
- bool EditorOccluderAreaComponent::UpdateVertex(const size_t index, const AZ::Vector3& vertex)
- {
- if (index < m_config.m_vertices.size())
- {
- m_config.m_vertices[index] = vertex;
- return true;
- }
-
- return false;
- }
-
- void EditorOccluderAreaComponent::OnTransformChanged(const AZ::Transform& /*local*/, [[maybe_unused]] const AZ::Transform& world)
- {
- UpdateOccluderAreaObject();
- }
-
- void EditorOccluderAreaComponent::DisplayEntityViewport(
- [[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo,
- AzFramework::DebugDisplayRequests& debugDisplay)
- {
- const AZ::Transform worldFromLocal = GetWorldTM();
- const AZ::Vector4 color(0.5f, 0.25f, 0.0f, 1.0f);
- const AZ::Vector4 selectedColor(1.0f, 0.5f, 0.0f, 1.0f);
- const float previousLineWidth = debugDisplay.GetLineWidth();
-
- debugDisplay.DepthWriteOff();
- debugDisplay.PushMatrix(worldFromLocal);
- debugDisplay.SetColor(IsSelected() ? selectedColor : color);
- debugDisplay.SetLineWidth(5.0f);
- debugDisplay.SetAlpha(0.8f);
-
- for (size_t i = 2; i < 4; i++)
- {
- // draw the plane
- if (m_config.m_displayFilled)
- {
- debugDisplay.SetAlpha(0.3f);
- debugDisplay.CullOff();
- debugDisplay.DrawTri(m_config.m_vertices[0], m_config.m_vertices[i - 1], m_config.m_vertices[i]);
- debugDisplay.CullOn();
- debugDisplay.SetAlpha(0.8f);
- }
-
- debugDisplay.DrawLine(m_config.m_vertices[i - 2], m_config.m_vertices[i - 1]);
- debugDisplay.DrawLine(m_config.m_vertices[i - 1], m_config.m_vertices[i]);
- }
-
- // draw the closing line
- debugDisplay.DrawLine(m_config.m_vertices[3], m_config.m_vertices[0]);
-
- if (m_componentModeDelegate.AddedToComponentMode())
- {
- AzToolsFramework::VertexContainerDisplay::DisplayVertexContainerIndices(
- debugDisplay, AzToolsFramework::FixedVerticesArray(m_config.m_vertices),
- GetWorldTM(), AZ::Vector3::CreateOne(), IsSelected());
- }
-
- debugDisplay.DepthWriteOn();
- debugDisplay.SetLineWidth(previousLineWidth);
- debugDisplay.PopMatrix();
- }
-
- void EditorOccluderAreaComponent::BuildGameEntity(AZ::Entity* gameEntity)
- {
- gameEntity->CreateComponent(m_config);
- }
-
- AZ::Aabb EditorOccluderAreaComponent::GetEditorSelectionBoundsViewport(
- const AzFramework::ViewportInfo& /*viewportInfo*/)
- {
- return GetWorldBounds();
- }
-
- bool EditorOccluderAreaComponent::EditorSelectionIntersectRayViewport(
- const AzFramework::ViewportInfo& /*viewportInfo*/, const AZ::Vector3& src,
- const AZ::Vector3& dir, float& distance)
- {
- const float rayLength = 1000.0f;
- AZ::Vector3 scaledDir = dir * rayLength;
- AZ::Vector3 end = src + scaledDir;
- float t;
- float intermediateT = std::numeric_limits::max();
- bool didHit = false;
-
- // Transform verts to world space for tris test
- AZStd::array verts;
- const AZ::Transform& wtm = GetWorldTM();
- for (size_t i = 0; i < m_config.m_vertices.size(); ++i)
- {
- verts[i] = wtm.TransformPoint(m_config.m_vertices[i]);
- }
-
- AZ::Vector3 normal;
- for (AZ::u8 i = 2; i < 4; ++i)
- {
- if (AZ::Intersect::IntersectSegmentTriangleCCW(src, end, verts[0], verts[i - 1], verts[i], normal, t) > 0)
- {
- intermediateT = AZStd::GetMin(t, intermediateT);
- didHit = true;
- }
- //Else if here as we shouldn't successfully ccw and cw intersect at the same time
- else if (AZ::Intersect::IntersectSegmentTriangle(src, end, verts[0], verts[i - 1], verts[i], normal, t) > 0)
- {
- intermediateT = AZStd::GetMin(t, intermediateT);
- didHit = true;
- }
- }
-
- if (didHit)
- {
- distance = intermediateT * rayLength;
- }
- return didHit;
- }
-
- AZ::Aabb EditorOccluderAreaComponent::GetWorldBounds()
- {
- return GetLocalBounds().GetTransformedAabb(GetWorldTM());
- }
-
- AZ::Aabb EditorOccluderAreaComponent::GetLocalBounds()
- {
- AZ::Aabb bbox = AZ::Aabb::CreateNull();
- for (const auto& vertex : m_config.m_vertices)
- {
- bbox.AddPoint(vertex);
- }
- return bbox;
- }
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorOccluderAreaComponent.h b/Gems/Visibility/Code/Source/EditorOccluderAreaComponent.h
deleted file mode 100644
index 0ac6528bc7..0000000000
--- a/Gems/Visibility/Code/Source/EditorOccluderAreaComponent.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
- * its licensors.
- *
- * For complete copyright and license terms please see the LICENSE at the root of this
- * distribution (the "License"). All use of this software is governed by the License,
- * or, if provided, by the license below or the license accompanying this file. Do not
- * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *
- */
-
-#pragma once
-
-#include "OccluderAreaComponent.h"
-#include "EditorOccluderAreaComponentBus.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace Visibility
-{
- class EditorOccluderAreaComponent;
-
- class EditorOccluderAreaConfiguration
- : public OccluderAreaConfiguration
- {
- public:
- AZ_TYPE_INFO_LEGACY(EditorOccluderAreaConfiguration, "{032F466F-25CB-5460-AC2F-B04236C87878}", OccluderAreaConfiguration);
- AZ_CLASS_ALLOCATOR(EditorOccluderAreaConfiguration, AZ::SystemAllocator, 0);
-
- static void Reflect(AZ::ReflectContext* context);
-
- void OnChange() override;
- void OnVerticesChange() override;
-
- void SetEntityId(AZ::EntityId entityId);
-
- private:
- AZ::EntityId m_entityId;
- };
-
- class EditorOccluderAreaComponent
- : public AzToolsFramework::Components::EditorComponentBase
- , private EditorOccluderAreaRequestBus::Handler
- , private AZ::FixedVerticesRequestBus::Handler
- , private AzFramework::EntityDebugDisplayEventBus::Handler
- , private AzToolsFramework::EditorComponentSelectionRequestsBus::Handler
- , private AZ::TransformNotificationBus::Handler
- , public AzFramework::BoundsRequestBus::Handler
- {
- friend class EditorOccluderAreaConfiguration;
-
- using Base = AzToolsFramework::Components::EditorComponentBase;
-
- public:
- AZ_COMPONENT(EditorOccluderAreaComponent, "{1A209C7C-6C06-5AE6-AD60-22CD8D0DAEE3}", AzToolsFramework::Components::EditorComponentBase);
-
- static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provides);
- static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& requires);
- static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
- static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
-
- static void Reflect(AZ::ReflectContext* context);
-
- EditorOccluderAreaComponent() = default;
- EditorOccluderAreaComponent(const EditorOccluderAreaComponent&) = delete;
- EditorOccluderAreaComponent& operator=(const EditorOccluderAreaComponent&) = delete;
- ~EditorOccluderAreaComponent();
-
- // AZ::Component overrides ...
- void Activate() override;
- void Deactivate() override;
- void BuildGameEntity(AZ::Entity* gameEntity) override;
-
- // TransformNotificationBus overrides ...
- void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
-
- // EditorComponentSelectionRequestsBus overrides ...
- AZ::Aabb GetEditorSelectionBoundsViewport(
- const AzFramework::ViewportInfo& viewportInfo) override;
- bool EditorSelectionIntersectRayViewport(
- const AzFramework::ViewportInfo& viewportInfo, const AZ::Vector3& src,
- const AZ::Vector3& dir, float& distance) override;
- bool SupportsEditorRayIntersect() override { return true; }
-
- // BoundsRequestBus overrides ...
- AZ::Aabb GetWorldBounds() override;
- AZ::Aabb GetLocalBounds() override;
-
- /// EditorOccluderAreaRequestBus overrides ...
- void SetDisplayFilled(bool value) override;
- bool GetDisplayFilled() override;
- void SetCullDistRatio(float value) override;
- float GetCullDistRatio() override;
- void SetUseInIndoors(bool value) override;
- bool GetUseInIndoors() override;
- void SetDoubleSide(bool value) override;
- bool GetDoubleSide() override;
- bool GetVertex(size_t index, AZ::Vector3& vertex) const override;
- bool UpdateVertex(size_t index, const AZ::Vector3& vertex) override;
- size_t Size() const override { return m_config.m_vertices.size(); }
- void UpdateOccluderAreaObject() override;
-
- private:
- friend EditorOccluderAreaConfiguration;
-
- // AzFramework::EntityDebugDisplayEventBus overrides ...
- void DisplayEntityViewport(
- const AzFramework::ViewportInfo& viewportInfo,
- AzFramework::DebugDisplayRequests& debugDisplay) override;
-
- // Reflected members
- EditorOccluderAreaConfiguration m_config;
-
- using ComponentModeDelegate = AzToolsFramework::ComponentModeFramework::ComponentModeDelegate;
- ComponentModeDelegate m_componentModeDelegate; ///< Responsible for detecting ComponentMode activation
- ///< and creating a concrete ComponentMode.
-
- // Unreflected members
- IVisArea* m_area = nullptr;
- };
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorOccluderAreaComponentMode.cpp b/Gems/Visibility/Code/Source/EditorOccluderAreaComponentMode.cpp
deleted file mode 100644
index 0ab51d362a..0000000000
--- a/Gems/Visibility/Code/Source/EditorOccluderAreaComponentMode.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
- * its licensors.
- *
- * For complete copyright and license terms please see the LICENSE at the root of this
- * distribution (the "License"). All use of this software is governed by the License,
- * or, if provided, by the license below or the license accompanying this file. Do not
- * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *
- */
-
-#include "Visibility_precompiled.h"
-#include "EditorOccluderAreaComponentMode.h"
-
-#include
-
-namespace Visibility
-{
- AZ_CLASS_ALLOCATOR_IMPL(EditorOccluderAreaComponentMode, AZ::SystemAllocator, 0)
-
- EditorOccluderAreaComponentMode::EditorOccluderAreaComponentMode(
- const AZ::EntityComponentIdPair& entityComponentIdPair, AZ::Uuid componentType)
- : EditorBaseComponentMode(entityComponentIdPair, componentType)
- {
- CreateManipulators();
-
- AZ::TransformNotificationBus::Handler::BusConnect(entityComponentIdPair.GetEntityId());
- EditorOccluderAreaNotificationBus::Handler::BusConnect(entityComponentIdPair.GetEntityId());
- }
-
- EditorOccluderAreaComponentMode::~EditorOccluderAreaComponentMode()
- {
- EditorOccluderAreaNotificationBus::Handler::BusDisconnect();
- AZ::TransformNotificationBus::Handler::BusDisconnect();
-
- m_vertexSelection.Destroy();
- }
-
- void EditorOccluderAreaComponentMode::CreateManipulators()
- {
- using namespace AzToolsFramework;
-
- m_vertexSelection.Create(
- AZ::EntityComponentIdPair(GetEntityId(), GetComponentId()), g_mainManipulatorManagerId,
- AZStd::make_unique(),
- TranslationManipulators::Dimensions::Three,
- ConfigureTranslationManipulatorAppearance3d);
-
- m_vertexSelection.SetVertexPositionsUpdatedCallback([this]()
- {
- EditorOccluderAreaRequestBus::Event(
- GetEntityId(), &EditorOccluderAreaRequests::UpdateOccluderAreaObject);
- });
- }
-
- void EditorOccluderAreaComponentMode::OnTransformChanged(
- const AZ::Transform& /*local*/, const AZ::Transform& world)
- {
- m_vertexSelection.RefreshSpace(world);
- }
-
- void EditorOccluderAreaComponentMode::OnVerticesChangedInspector()
- {
- m_vertexSelection.RefreshLocal();
- }
-
- void EditorOccluderAreaComponentMode::Refresh()
- {
- // destroy and recreate manipulators when container is modified (vertices are added or removed)
- m_vertexSelection.Destroy();
- CreateManipulators();
- }
-
- AZStd::vector EditorOccluderAreaComponentMode::PopulateActionsImpl()
- {
- return m_vertexSelection.ActionOverrides();
- }
-
- bool EditorOccluderAreaComponentMode::HandleMouseInteraction(
- const AzToolsFramework::ViewportInteraction::MouseInteractionEvent& mouseInteraction)
- {
- return m_vertexSelection.HandleMouse(mouseInteraction);
- }
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorOccluderAreaComponentMode.h b/Gems/Visibility/Code/Source/EditorOccluderAreaComponentMode.h
deleted file mode 100644
index babef3bccc..0000000000
--- a/Gems/Visibility/Code/Source/EditorOccluderAreaComponentMode.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-#include
-#include
-
-#include "EditorOccluderAreaComponentBus.h"
-
-namespace Visibility
-{
- class EditorOccluderAreaComponentMode
- : public AzToolsFramework::ComponentModeFramework::EditorBaseComponentMode
- , private AZ::TransformNotificationBus::Handler
- , private EditorOccluderAreaNotificationBus::Handler
- {
- public:
- AZ_CLASS_ALLOCATOR_DECL
-
- EditorOccluderAreaComponentMode(
- const AZ::EntityComponentIdPair& entityComponentIdPair, AZ::Uuid componentType);
- ~EditorOccluderAreaComponentMode();
-
- private:
- // EditorBaseComponentMode
- void Refresh() override;
- AZStd::vector PopulateActionsImpl() override;
- bool HandleMouseInteraction(
- const AzToolsFramework::ViewportInteraction::MouseInteractionEvent& mouseInteraction) override;
-
- // Manipulator handling
- void CreateManipulators();
-
- // TransformNotificationBus
- void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
-
- // OccluderAreaNotificationBus
- void OnVerticesChangedInspector() override;
-
- AzToolsFramework::EditorVertexSelectionFixed m_vertexSelection; ///< Handles all manipulator interactions with vertices.
- };
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorPortalComponent.cpp b/Gems/Visibility/Code/Source/EditorPortalComponent.cpp
deleted file mode 100644
index 4e1b07991a..0000000000
--- a/Gems/Visibility/Code/Source/EditorPortalComponent.cpp
+++ /dev/null
@@ -1,785 +0,0 @@
-/*
- * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
- * its licensors.
- *
- * For complete copyright and license terms please see the LICENSE at the root of this
- * distribution (the "License"). All use of this software is governed by the License,
- * or, if provided, by the license below or the license accompanying this file. Do not
- * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *
- */
-
-#include "Visibility_precompiled.h"
-#include "EditorPortalComponent.h"
-#include "EditorPortalComponentMode.h"
-
-#include
-
-// Include files needed for writing DisplayEntity functions that access the DisplayContext directly.
-#include
-
-#include
-#include
-#include
-#include
-#include
-
-namespace Visibility
-{
- void EditorPortalComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
- {
- provided.push_back(AZ_CRC("EditorPortalService", 0x6ead38f6));
- provided.push_back(AZ_CRC("PortalService", 0x06076210));
- provided.push_back(AZ_CRC("FixedVertexContainerService", 0x83f1bbf2));
- }
-
- void EditorPortalComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
- {
- required.push_back(AZ_CRC("TransformService", 0x8ee22c50));
- }
-
- void EditorPortalComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
- {
- dependent.push_back(AZ_CRC("QuadShapeService", 0xe449b0fc));
- }
-
- void EditorPortalComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
- {
- incompatible.push_back(AZ_CRC("SphereShapeService", 0x90c8dc80));
- incompatible.push_back(AZ_CRC("SplineShapeService", 0x4d4b94a2));
- incompatible.push_back(AZ_CRC("PolygonPrismShapeService", 0x1cbc4ed4));
- incompatible.push_back(AZ_CRC("FixedVertexContainerService", 0x83f1bbf2));
- }
-
- void EditorPortalConfiguration::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(1);
-
- if (AZ::EditContext* editContext = serializeContext->GetEditContext())
- {
- editContext->Class("Portal Configuration", "")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true);
-
- editContext->Class("Portal Configuration", "")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
-
- ->DataElement(
- AZ::Edit::UIHandlers::Default, &PortalConfiguration::m_height, "Height", "How tall the Portal is.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &PortalConfiguration::OnChange)
- ->DataElement(
- AZ::Edit::UIHandlers::Default, &PortalConfiguration::m_displayFilled, "DisplayFilled", "Display the Portal as a filled volume.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &PortalConfiguration::OnChange)
- ->DataElement(
- AZ::Edit::UIHandlers::Default, &PortalConfiguration::m_affectedBySun, "AffectedBySun", "Allows sunlight to affect objects inside the Portal.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &PortalConfiguration::OnChange)
- ->DataElement(
- AZ::Edit::UIHandlers::Default, &PortalConfiguration::m_viewDistRatio, "ViewDistRatio", "Specifies how far the Portal is rendered.")
- ->Attribute(AZ::Edit::Attributes::Max, 100.000000)
- ->Attribute(AZ::Edit::Attributes::Min, 0.000000)
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &PortalConfiguration::OnChange)
- ->DataElement(
- AZ::Edit::UIHandlers::Default, &PortalConfiguration::m_skyOnly, "SkyOnly", "Only the Sky Box will render when looking outside the Portal.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &PortalConfiguration::OnChange)
- ->DataElement(
- AZ::Edit::UIHandlers::Default, &PortalConfiguration::m_oceanIsVisible, "OceanIsVisible", "Ocean will be visible when looking outside the Portal.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &PortalConfiguration::OnChange)
- ->DataElement(
- AZ::Edit::UIHandlers::Default, &PortalConfiguration::m_useDeepness, "UseDeepness", "Portal will be treated as an object with volume rather than a plane.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &PortalConfiguration::OnChange)
- ->DataElement(
- AZ::Edit::UIHandlers::Default, &PortalConfiguration::m_doubleSide, "DoubleSide", "Cameras will be able to look through the portal from both sides.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &PortalConfiguration::OnChange)
- ->DataElement(
- AZ::Edit::UIHandlers::Default, &PortalConfiguration::m_lightBlending, "LightBlending", "Light from neighboring VisAreas will blend into the Portal.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &PortalConfiguration::OnChange)
- ->DataElement(
- AZ::Edit::UIHandlers::Default, &PortalConfiguration::m_lightBlendValue, "LightBlendValue", "How much to blend lights from neighboring VisAreas.")
- ->Attribute(AZ::Edit::Attributes::Max, 1.000000)
- ->Attribute(AZ::Edit::Attributes::Min, 0.000000)
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &PortalConfiguration::OnChange)
- ->DataElement(
- AZ::Edit::UIHandlers::Default, &PortalConfiguration::m_vertices, "Vertices", "Points that make up the floor of the Portal.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &PortalConfiguration::OnVerticesChange)
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
- ;
- }
- }
- }
-
- void EditorPortalComponent::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(2)
- ->Field("m_config", &EditorPortalComponent::m_config)
- ->Field("ComponentMode", &EditorPortalComponent::m_componentModeDelegate)
- ;
-
- if (AZ::EditContext* editContext = serializeContext->GetEditContext())
- {
- editContext->Class("Portal", "An area that describes a visibility portal between VisAreas.")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::Category, "Rendering")
- ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/Portal.png")
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
- ->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/Portal.svg")
- ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
- ->Attribute(AZ::Edit::Attributes::HelpPageURL, "http://docs.aws.amazon.com/console/lumberyard/userguide/portal-component")
- ->DataElement(AZ::Edit::UIHandlers::Default, &EditorPortalComponent::m_config, "m_config", "No Description")
- ->DataElement(AZ::Edit::UIHandlers::Default, &EditorPortalComponent::m_componentModeDelegate, "Component Mode", "Portal Component Mode")
- ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
- ;
- }
- }
-
- if (auto behaviorContext = azrtti_cast(context))
- {
- behaviorContext->EBus("EditorPortalRequestBus")
- ->Event("SetHeight", &EditorPortalRequestBus::Events::SetHeight)
- ->Event("GetHeight", &EditorPortalRequestBus::Events::GetHeight)
- ->VirtualProperty("Height", "GetHeight", "SetHeight")
-
- ->Event("SetDisplayFilled", &EditorPortalRequestBus::Events::SetDisplayFilled)
- ->Event("GetDisplayFilled", &EditorPortalRequestBus::Events::GetDisplayFilled)
- ->VirtualProperty("DisplayFilled", "GetDisplayFilled", "SetDisplayFilled")
-
- ->Event("SetAffectedBySun", &EditorPortalRequestBus::Events::SetAffectedBySun)
- ->Event("GetAffectedBySun", &EditorPortalRequestBus::Events::GetAffectedBySun)
- ->VirtualProperty("AffectedBySun", "GetAffectedBySun", "SetAffectedBySun")
-
- ->Event("SetViewDistRatio", &EditorPortalRequestBus::Events::SetViewDistRatio)
- ->Event("GetViewDistRatio", &EditorPortalRequestBus::Events::GetViewDistRatio)
- ->VirtualProperty("ViewDistRatio", "GetViewDistRatio", "SetViewDistRatio")
-
- ->Event("SetSkyOnly", &EditorPortalRequestBus::Events::SetSkyOnly)
- ->Event("GetSkyOnly", &EditorPortalRequestBus::Events::GetSkyOnly)
- ->VirtualProperty("SkyOnly", "GetSkyOnly", "SetSkyOnly")
-
- ->Event("SetOceanIsVisible", &EditorPortalRequestBus::Events::SetOceanIsVisible)
- ->Event("GetOceanIsVisible", &EditorPortalRequestBus::Events::GetOceanIsVisible)
- ->VirtualProperty("OceanIsVisible", "GetOceanIsVisible", "SetOceanIsVisible")
-
- ->Event("SetUseDeepness", &EditorPortalRequestBus::Events::SetUseDeepness)
- ->Event("GetUseDeepness", &EditorPortalRequestBus::Events::GetUseDeepness)
- ->VirtualProperty("UseDeepness", "GetUseDeepness", "SetUseDeepness")
-
- ->Event("SetDoubleSide", &EditorPortalRequestBus::Events::SetDoubleSide)
- ->Event("GetDoubleSide", &EditorPortalRequestBus::Events::GetDoubleSide)
- ->VirtualProperty("DoubleSide", "GetDoubleSide", "SetDoubleSide")
-
- ->Event("SetLightBlending", &EditorPortalRequestBus::Events::SetLightBlending)
- ->Event("GetLightBlending", &EditorPortalRequestBus::Events::GetLightBlending)
- ->VirtualProperty("LightBlending", "GetLightBlending", "SetLightBlending")
-
- ->Event("SetLightBlendValue", &EditorPortalRequestBus::Events::SetLightBlendValue)
- ->Event("GetLightBlendValue", &EditorPortalRequestBus::Events::GetLightBlendValue)
- ->VirtualProperty("LightBlendValue", "GetLightBlendValue", "SetLightBlendValue")
- ;
-
- behaviorContext->Class()->RequestBus("EditorPortalRequestBus");
- }
-
- EditorPortalConfiguration::Reflect(context);
- }
-
- void EditorPortalConfiguration::OnChange()
- {
- EditorPortalRequestBus::Event(m_entityId, &EditorPortalRequests::UpdatePortalObject);
- }
-
- void EditorPortalConfiguration::OnVerticesChange()
- {
- EditorPortalRequestBus::Event(m_entityId, &EditorPortalRequests::UpdatePortalObject);
- EditorPortalNotificationBus::Event(m_entityId, &EditorPortalNotifications::OnVerticesChangedInspector);
- }
-
- void EditorPortalConfiguration::SetEntityId(const AZ::EntityId entityId)
- {
- m_entityId = entityId;
- }
-
- EditorPortalComponent::~EditorPortalComponent()
- {
- if (m_area)
- {
- // reset the listener vis area in the unlucky case that we are deleting the
- // vis area where the listener is currently in
- // Audio: do we still need this?
- GetIEditor()->Get3DEngine()->DeleteVisArea(m_area);
- m_area = nullptr;
- }
- }
-
- void EditorPortalComponent::Activate()
- {
- Base::Activate();
-
- const AZ::EntityId entityId = GetEntityId();
- m_config.SetEntityId(entityId);
-
- // NOTE: We create the vis-area here at activated, but destroy it in the destructor.
- // We have to do this, otherwise the vis-area is not saved into the level.
- // Unfortunately, at this time we cannot create the vis-areas at game runtime.
- // This means that dynamic slices cannot effectively contain vis-areas until we fix the core rendering system to allow that.
-
- const auto visGUID = static_cast(entityId);
- if(!m_area && GetIEditor())
- {
- m_area = GetIEditor()->Get3DEngine()->CreateVisArea(visGUID);
- }
-
- m_AZCachedWorldTransform = AZ::Transform::CreateIdentity();
- m_cryCachedWorldTransform = Matrix34::CreateIdentity();
-
- m_componentModeDelegate.ConnectWithSingleComponentMode<
- EditorPortalComponent, EditorPortalComponentMode>(
- AZ::EntityComponentIdPair(entityId, GetId()), this);
-
- EditorPortalRequestBus::Handler::BusConnect(entityId);
- AZ::FixedVerticesRequestBus::Handler::BusConnect(entityId);
- AZ::TransformNotificationBus::Handler::BusConnect(entityId);
- AzFramework::EntityDebugDisplayEventBus::Handler::BusConnect(entityId);
- AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusConnect(entityId);
- AzFramework::BoundsRequestBus::Handler::BusConnect(entityId);
-
- //Call OnTransformChanged manually to cache current transform since it won't be called
- //automatically for us when the level starts up.
- AZ::Transform worldTM;
- AZ::TransformBus::EventResult(worldTM, entityId, &AZ::TransformBus::Events::GetWorldTM);
-
- //Use an identity transform for localTM because the
- //OnTransformChanged impl for this class doesn't need it
- OnTransformChanged(AZ::Transform::CreateIdentity(), worldTM);
- }
-
- void EditorPortalComponent::Deactivate()
- {
- m_componentModeDelegate.Disconnect();
-
- AzFramework::BoundsRequestBus::Handler::BusDisconnect();
- AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusDisconnect(GetEntityId());
- AzFramework::EntityDebugDisplayEventBus::Handler::BusDisconnect(GetEntityId());
- AZ::TransformNotificationBus::Handler::BusDisconnect(GetEntityId());
- AZ::FixedVerticesRequestBus::Handler::BusDisconnect();
- EditorPortalRequestBus::Handler::BusDisconnect();
-
- Base::Deactivate();
- }
-
- void EditorPortalComponent::SetHeight(const float height)
- {
- m_config.m_height = height;
- UpdatePortalObject();
- }
-
- float EditorPortalComponent::GetHeight()
- {
- return m_config.m_height;
- }
-
- void EditorPortalComponent::SetDisplayFilled(const bool filled)
- {
- m_config.m_displayFilled = filled;
- UpdatePortalObject();
- }
-
- bool EditorPortalComponent::GetDisplayFilled()
- {
- return m_config.m_displayFilled;
- }
-
- void EditorPortalComponent::SetAffectedBySun(const bool affectedBySun)
- {
- m_config.m_affectedBySun = affectedBySun;
- UpdatePortalObject();
- }
-
- bool EditorPortalComponent::GetAffectedBySun()
- {
- return m_config.m_affectedBySun;
- }
-
- void EditorPortalComponent::SetViewDistRatio(const float viewDistRatio)
- {
- m_config.m_viewDistRatio = viewDistRatio;
- UpdatePortalObject();
- }
-
- float EditorPortalComponent::GetViewDistRatio()
- {
- return m_config.m_viewDistRatio;
- }
-
- void EditorPortalComponent::SetSkyOnly(const bool skyOnly)
- {
- m_config.m_skyOnly = skyOnly;
- UpdatePortalObject();
- }
-
- bool EditorPortalComponent::GetSkyOnly()
- {
- return m_config.m_skyOnly;
- }
-
- void EditorPortalComponent::SetOceanIsVisible(const bool oceanVisible)
- {
- m_config.m_oceanIsVisible = oceanVisible;
- UpdatePortalObject();
- }
-
- bool EditorPortalComponent::GetOceanIsVisible()
- {
- return m_config.m_oceanIsVisible;
- }
-
- void EditorPortalComponent::SetUseDeepness(const bool useDeepness)
- {
- m_config.m_useDeepness = useDeepness;
- UpdatePortalObject();
- }
-
- bool EditorPortalComponent::GetUseDeepness()
- {
- return m_config.m_useDeepness;
- }
-
- void EditorPortalComponent::SetDoubleSide(const bool doubleSided)
- {
- m_config.m_doubleSide = doubleSided;
- UpdatePortalObject();
- }
-
- bool EditorPortalComponent::GetDoubleSide()
- {
- return m_config.m_doubleSide;
- }
-
- void EditorPortalComponent::SetLightBlending(const bool lightBending)
- {
- m_config.m_lightBlending = lightBending;
- UpdatePortalObject();
- }
-
- bool EditorPortalComponent::GetLightBlending()
- {
- return m_config.m_lightBlending;
- }
-
- void EditorPortalComponent::SetLightBlendValue(const float lightBendAmount)
- {
- m_config.m_lightBlendValue = lightBendAmount;
- UpdatePortalObject();
- }
-
- float EditorPortalComponent::GetLightBlendValue()
- {
- return m_config.m_lightBlendValue;
- }
-
- bool EditorPortalComponent::GetVertex(const size_t index, AZ::Vector3& vertex) const
- {
- if (index < m_config.m_vertices.size())
- {
- vertex = m_config.m_vertices[index];
- return true;
- }
-
- return false;
- }
-
- bool EditorPortalComponent::UpdateVertex(const size_t index, const AZ::Vector3& vertex)
- {
- if (index < m_config.m_vertices.size())
- {
- m_config.m_vertices[index] = vertex;
- return true;
- }
-
- return false;
- }
-
- /// Update the object runtime after changes to the Configuration.
- /// Called by the default RequestBus SetXXX implementations,
- /// and used to initially set up the object the first time the
- /// Configuration are set.
- void EditorPortalComponent::UpdatePortalObject()
- {
- if (m_area)
- {
- SVisAreaInfo info;
- info.vAmbientColor = Vec3(ZERO);
- info.bAffectedByOutLights = m_config.m_affectedBySun;
- info.bSkyOnly = m_config.m_skyOnly;
- info.fViewDistRatio = m_config.m_viewDistRatio;
- info.bDoubleSide = m_config.m_doubleSide;
- info.bUseDeepness = m_config.m_useDeepness;
- info.bUseInIndoors = true; //Does not apply to Portals (Portals are only in VisAreas)
- info.bOceanIsVisible = m_config.m_oceanIsVisible;
- info.fPortalBlending = -1.0f;
-
- if (m_config.m_lightBlending)
- {
- info.fPortalBlending = m_config.m_lightBlendValue;
- }
-
- AZStd::string name = AZStd::string("Portal_") + GetEntity()->GetName();
-
- // Calculate scaled height
- // Height exists separate from plane points but we still want to scale it with the transform
- info.fHeight = m_config.m_height;
-
- /*
- We have to derive at least 3 points and pass them to the vis area system
- For now that means getting the 4 points of the bottom face of the box.
-
- If we want to send *all* points of a shape the vis system we need to make sure
- that Height is 0; otherwise it'll extend the AABB of the area upwards.
- */
-
- //Convert to Cry vectors and apply the transform to the given points
- AZStd::fixed_vector verts(4);
- for (AZ::u32 i = 0; i < verts.size(); ++i)
- {
- verts[i] = AZVec3ToLYVec3(m_config.m_vertices[i]);
- verts[i] = m_cryCachedWorldTransform.TransformPoint(verts[i]);
- }
-
- GetIEditor()->Get3DEngine()->UpdateVisArea(m_area, &verts[0], verts.size(), name.c_str(), info, true);
-
- AzFramework::EntityBoundsUnionRequestBus::Broadcast(
- &AzFramework::EntityBoundsUnionRequestBus::Events::RefreshEntityLocalBoundsUnion, GetEntityId());
- }
- }
-
- void EditorPortalComponent::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world)
- {
- //Cache the transform so that we don't have to retrieve it every time UpdatePortalObject is called
- m_AZCachedWorldTransform = world;
- m_cryCachedWorldTransform = AZTransformToLYTransform(m_AZCachedWorldTransform);
-
- UpdatePortalObject();
- }
-
- struct PortalQuadVertices
- {
- AZ::Vector3 floorLeftFront;
- AZ::Vector3 floorRightFront;
- AZ::Vector3 floorLeftBack;
- AZ::Vector3 floorRightBack;
-
- AZ::Vector3 quadUpperLeftFront;
- AZ::Vector3 quadUpperRightFront;
- AZ::Vector3 quadUpperLeftBack;
- AZ::Vector3 quadUpperRightBack;
-
- AZ::Vector3 portalUpperLeftFront;
- AZ::Vector3 portalUpperRightFront;
- AZ::Vector3 portalUpperLeftBack;
- AZ::Vector3 portalUpperRightBack;
- };
-
- PortalQuadVertices EditorPortalComponent::CalculatePortalQuadVertices(VertTranslation vertTranslation)
- {
- PortalQuadVertices pqv;
-
- //Untransformed quad corners
- const AZ::Vector3 lowerLeftFront = m_config.m_vertices[0];
- const AZ::Vector3 lowerRightFront = m_config.m_vertices[1];
- const AZ::Vector3 lowerLeftBack = m_config.m_vertices[3];
- const AZ::Vector3 lowerRightBack = m_config.m_vertices[2];
-
- //Need to calculate the height of the quad after transformation
- const AZ::u32 quadPointCount = 4;
- AZ::Vector3 transformedQuadPoints[quadPointCount];
-
- transformedQuadPoints[0] = m_AZCachedWorldTransform.TransformPoint(lowerLeftFront);
- transformedQuadPoints[1] = m_AZCachedWorldTransform.TransformPoint(lowerRightFront);
- transformedQuadPoints[2] = m_AZCachedWorldTransform.TransformPoint(lowerLeftBack);
- transformedQuadPoints[3] = m_AZCachedWorldTransform.TransformPoint(lowerRightBack);
-
- const AZ::Vector3 translation = m_AZCachedWorldTransform.GetTranslation();
-
- float minHeight = FLT_MAX;
- float maxHeight = FLT_MIN;
-
- for (auto& transformedQuadPoint : transformedQuadPoints)
- {
- // remove translation from quad points so we can use them with the DisplayContext's usage of the transform
- if (vertTranslation == VertTranslation::Remove)
- {
- transformedQuadPoint -= translation;
- }
-
- const float height = transformedQuadPoint.GetZ();
- if (height < minHeight)
- {
- minHeight = height;
- }
- if (height > maxHeight)
- {
- maxHeight = height;
- }
- }
-
- pqv.floorLeftFront = AZ::Vector3(transformedQuadPoints[0].GetX(), transformedQuadPoints[0].GetY(), minHeight);
- pqv.floorRightFront = AZ::Vector3(transformedQuadPoints[1].GetX(), transformedQuadPoints[1].GetY(), minHeight);
- pqv.floorLeftBack = AZ::Vector3(transformedQuadPoints[2].GetX(), transformedQuadPoints[2].GetY(), minHeight);
- pqv.floorRightBack = AZ::Vector3(transformedQuadPoints[3].GetX(), transformedQuadPoints[3].GetY(), minHeight);
-
- pqv.quadUpperLeftFront = AZ::Vector3(transformedQuadPoints[0].GetX(), transformedQuadPoints[0].GetY(), maxHeight);
- pqv.quadUpperRightFront = AZ::Vector3(transformedQuadPoints[1].GetX(), transformedQuadPoints[1].GetY(), maxHeight);
- pqv.quadUpperLeftBack = AZ::Vector3(transformedQuadPoints[2].GetX(), transformedQuadPoints[2].GetY(), maxHeight);
- pqv.quadUpperRightBack = AZ::Vector3(transformedQuadPoints[3].GetX(), transformedQuadPoints[3].GetY(), maxHeight);
-
- pqv.portalUpperLeftFront = AZ::Vector3(transformedQuadPoints[0].GetX(), transformedQuadPoints[0].GetY(), maxHeight + m_config.m_height);
- pqv.portalUpperRightFront = AZ::Vector3(transformedQuadPoints[1].GetX(), transformedQuadPoints[1].GetY(), maxHeight + m_config.m_height);
- pqv.portalUpperLeftBack = AZ::Vector3(transformedQuadPoints[2].GetX(), transformedQuadPoints[2].GetY(), maxHeight + m_config.m_height);
- pqv.portalUpperRightBack = AZ::Vector3(transformedQuadPoints[3].GetX(), transformedQuadPoints[3].GetY(), maxHeight + m_config.m_height);
-
- return pqv;
- }
-
- void EditorPortalComponent::DisplayEntityViewport(
- [[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo,
- AzFramework::DebugDisplayRequests& debugDisplay)
- {
- /*
- IMPORTANT NOTE: This method may seem very complicated but it is an accurate visualization of
- how portals actually work. The legacy visualization used with the legacy portal entity is
- very misleading!
-
- Portals always exist as a quad but if the quad becomes non-planar, from rotation or in the legacy
- system from a point being pulled up or down, the volume changes in a non-obvious way. Instead of portal
- existing as the shape defined by 4 points and extruded upwards, the portal actually remains planar.
- Any height difference that you add by making the shape non-planar is just applied to the height of the volume.
-
- If this is confusing, please actually look at the visualization created by this method. Make sure
- that you rotate the portal in many weird contorted ways and examine how the visualization reacts.
- The portal volume is always going to be a box rotated on only X and Y axes that stretches up along the Z axis.
-
- Important note on the complexity of this method:
- We cannot directly visualize the OBB of the portal with an AABB that we then transform. The OBB that's mentioned
- here is best imagined as the top plane being all points of the quad pulled up to the height of the highest quad's vert
- and the bottom plane being all points of the quad pulled down to the height of the lowest quad's vert. Trying to
- create an AABB from these points won't produce the correct visualization under complex rotations as the Min and Max
- of the AABB will either only encompass part of the bounding volume or be too large.
- */
-
- const PortalQuadVertices pqv = CalculatePortalQuadVertices(VertTranslation::Remove);
-
- //Draw the outline of the OBB of the Portal's quad
- AZ::Color color(0.000f, 1.0f, 0.000f, 1.0f);
- debugDisplay.SetColor(AZ::Vector4(color.GetR(), color.GetG(), color.GetB(), 1.f));
-
- //Remove all rotation from the transform
- const AZ::Quaternion rotation = AZ::Quaternion::CreateIdentity();
-
- AZ::Transform worldTMOnlyZRot = m_AZCachedWorldTransform;
- worldTMOnlyZRot.SetRotation(rotation);
-
- debugDisplay.PushMatrix(worldTMOnlyZRot);
-
- //Draw the outline of the OBB of the portal quad
-
- //Bottom
- debugDisplay.DrawLine(pqv.floorLeftFront, pqv.floorRightFront);
- debugDisplay.DrawLine(pqv.floorRightFront, pqv.floorRightBack);
- debugDisplay.DrawLine(pqv.floorRightBack, pqv.floorLeftBack);
- debugDisplay.DrawLine(pqv.floorLeftBack, pqv.floorLeftFront);
- //Top
- debugDisplay.DrawLine(pqv.quadUpperLeftFront, pqv.quadUpperRightFront);
- debugDisplay.DrawLine(pqv.quadUpperRightFront, pqv.quadUpperRightBack);
- debugDisplay.DrawLine(pqv.quadUpperRightBack, pqv.quadUpperLeftBack);
- debugDisplay.DrawLine(pqv.quadUpperLeftBack, pqv.quadUpperLeftFront);
- //Left
- debugDisplay.DrawLine(pqv.floorLeftFront, pqv.quadUpperLeftFront);
- debugDisplay.DrawLine(pqv.quadUpperLeftFront, pqv.quadUpperLeftBack);
- debugDisplay.DrawLine(pqv.quadUpperLeftBack, pqv.floorLeftBack);
- debugDisplay.DrawLine(pqv.floorLeftBack, pqv.floorLeftFront);
- //Right
- debugDisplay.DrawLine(pqv.floorRightFront, pqv.quadUpperRightFront);
- debugDisplay.DrawLine(pqv.quadUpperRightFront, pqv.quadUpperRightBack);
- debugDisplay.DrawLine(pqv.quadUpperRightBack, pqv.floorRightBack);
- debugDisplay.DrawLine(pqv.floorRightBack, pqv.floorRightFront);
- //Front
- debugDisplay.DrawLine(pqv.floorLeftFront, pqv.floorRightFront);
- debugDisplay.DrawLine(pqv.floorRightFront, pqv.quadUpperRightFront);
- debugDisplay.DrawLine(pqv.quadUpperRightFront, pqv.quadUpperLeftFront);
- debugDisplay.DrawLine(pqv.quadUpperLeftFront, pqv.floorLeftFront);
- //Back
- debugDisplay.DrawLine(pqv.floorLeftBack, pqv.floorRightBack);
- debugDisplay.DrawLine(pqv.floorRightBack, pqv.quadUpperRightBack);
- debugDisplay.DrawLine(pqv.quadUpperRightBack, pqv.quadUpperLeftBack);
- debugDisplay.DrawLine(pqv.quadUpperLeftBack, pqv.floorLeftBack);
-
- //Now draw the entire portal volume (Previous OBB + extra height)
- if (m_config.m_displayFilled)
- {
- //Draw whole portal with less alpha
- debugDisplay.SetColor(AZ::Vector4(color.GetR(), color.GetG(), color.GetB(), 0.1f));
-
- //Draw both winding orders for quads so they appear solid from all angles
- //Not drawing boxes because the corners of the quad may not be hit if the bounds are rotated oddly
-
- //Bottom
- debugDisplay.DrawQuad(pqv.floorLeftFront, pqv.floorRightFront, pqv.floorRightBack, pqv.floorLeftBack);
- debugDisplay.DrawQuad(pqv.floorLeftFront, pqv.floorLeftBack, pqv.floorRightBack, pqv.floorRightFront);
- //Top
- debugDisplay.DrawQuad(pqv.portalUpperLeftFront, pqv.portalUpperRightFront, pqv.portalUpperRightBack, pqv.portalUpperLeftBack);
- debugDisplay.DrawQuad(pqv.portalUpperLeftFront, pqv.portalUpperLeftBack, pqv.portalUpperRightBack, pqv.portalUpperRightFront);
- //Left
- debugDisplay.DrawQuad(pqv.floorLeftFront, pqv.portalUpperLeftFront, pqv.portalUpperLeftBack, pqv.floorLeftBack);
- debugDisplay.DrawQuad(pqv.floorLeftFront, pqv.floorLeftBack, pqv.portalUpperLeftBack, pqv.portalUpperLeftFront);
- //Right
- debugDisplay.DrawQuad(pqv.floorRightFront, pqv.portalUpperRightFront, pqv.portalUpperRightBack, pqv.floorRightBack);
- debugDisplay.DrawQuad(pqv.floorRightFront, pqv.floorRightBack, pqv.portalUpperRightBack, pqv.portalUpperRightFront);
- //Front
- debugDisplay.DrawQuad(pqv.floorLeftFront, pqv.floorRightFront, pqv.portalUpperRightFront, pqv.portalUpperLeftFront);
- debugDisplay.DrawQuad(pqv.floorLeftFront, pqv.portalUpperLeftFront, pqv.portalUpperRightFront, pqv.floorRightFront);
- //Back
- debugDisplay.DrawQuad(pqv.floorLeftBack, pqv.floorRightBack, pqv.portalUpperRightBack, pqv.portalUpperLeftBack);
- debugDisplay.DrawQuad(pqv.floorLeftBack, pqv.portalUpperLeftBack, pqv.portalUpperRightBack, pqv.floorRightBack);
- }
- else
- {
- //Bottom
- debugDisplay.DrawLine(pqv.floorLeftFront, pqv.floorRightFront);
- debugDisplay.DrawLine(pqv.floorRightFront, pqv.floorRightBack);
- debugDisplay.DrawLine(pqv.floorRightBack, pqv.floorLeftBack);
- debugDisplay.DrawLine(pqv.floorLeftBack, pqv.floorLeftFront);
- //Top
- debugDisplay.DrawLine(pqv.portalUpperLeftFront, pqv.portalUpperRightFront);
- debugDisplay.DrawLine(pqv.portalUpperRightFront, pqv.portalUpperRightBack);
- debugDisplay.DrawLine(pqv.portalUpperRightBack, pqv.portalUpperLeftBack);
- debugDisplay.DrawLine(pqv.portalUpperLeftBack, pqv.portalUpperLeftFront);
- //Left
- debugDisplay.DrawLine(pqv.floorLeftFront, pqv.portalUpperLeftFront);
- debugDisplay.DrawLine(pqv.portalUpperLeftFront, pqv.portalUpperLeftBack);
- debugDisplay.DrawLine(pqv.portalUpperLeftBack, pqv.floorLeftBack);
- debugDisplay.DrawLine(pqv.floorLeftBack, pqv.floorLeftFront);
- //Right
- debugDisplay.DrawLine(pqv.floorRightFront, pqv.portalUpperRightFront);
- debugDisplay.DrawLine(pqv.portalUpperRightFront, pqv.portalUpperRightBack);
- debugDisplay.DrawLine(pqv.portalUpperRightBack, pqv.floorRightBack);
- debugDisplay.DrawLine(pqv.floorRightBack, pqv.floorRightFront);
- //Front
- debugDisplay.DrawLine(pqv.floorLeftFront, pqv.floorRightFront);
- debugDisplay.DrawLine(pqv.floorRightFront, pqv.portalUpperRightFront);
- debugDisplay.DrawLine(pqv.portalUpperRightFront, pqv.portalUpperLeftFront);
- debugDisplay.DrawLine(pqv.portalUpperLeftFront, pqv.floorLeftFront);
- //Back
- debugDisplay.DrawLine(pqv.floorLeftBack, pqv.floorRightBack);
- debugDisplay.DrawLine(pqv.floorRightBack, pqv.portalUpperRightBack);
- debugDisplay.DrawLine(pqv.portalUpperRightBack, pqv.portalUpperLeftBack);
- debugDisplay.DrawLine(pqv.portalUpperLeftBack, pqv.floorLeftBack);
- }
-
- if (m_componentModeDelegate.AddedToComponentMode())
- {
- AzToolsFramework::VertexContainerDisplay::DisplayVertexContainerIndices(
- debugDisplay, AzToolsFramework::FixedVerticesArray(m_config.m_vertices),
- GetWorldTM(), AZ::Vector3::CreateOne(), IsSelected());
- }
-
- debugDisplay.PopMatrix();
- }
-
- void EditorPortalComponent::BuildGameEntity(AZ::Entity* gameEntity)
- {
- gameEntity->CreateComponent(m_config);
- }
-
- AZ::Aabb EditorPortalComponent::GetEditorSelectionBoundsViewport(const AzFramework::ViewportInfo& /*viewportInfo*/)
- {
- const PortalQuadVertices pqv = CalculatePortalQuadVertices(VertTranslation::Keep);
-
- AZ::Aabb bbox = AZ::Aabb::CreateNull();
- bbox.AddPoint(pqv.floorLeftFront);
- bbox.AddPoint(pqv.floorRightFront);
- bbox.AddPoint(pqv.floorLeftBack);
- bbox.AddPoint(pqv.floorRightBack);
- bbox.AddPoint(pqv.portalUpperLeftFront);
- return bbox;
- }
-
- bool EditorPortalComponent::EditorSelectionIntersectRayViewport(
- const AzFramework::ViewportInfo& /*viewportInfo*/, const AZ::Vector3& src,
- const AZ::Vector3& dir, float& distance)
- {
- float t;
- float intermediateT = FLT_MAX;
-
- const PortalQuadVertices pqv = CalculatePortalQuadVertices(VertTranslation::Keep);
-
- //Count each quad for intersection hits, two hits implies we are intersecting the prism from outside of it (or from too far)
- AZ::u8 hits = 0;
-
- //Bottom
- if (AZ::Intersect::IntersectRayQuad(src, dir, pqv.floorLeftFront, pqv.floorRightFront, pqv.floorRightBack, pqv.floorLeftBack, t))
- {
- ++hits;
- intermediateT = AZStd::GetMin(t, intermediateT);
- }
- //Top
- if (AZ::Intersect::IntersectRayQuad(src, dir, pqv.portalUpperLeftFront, pqv.portalUpperRightFront, pqv.portalUpperRightBack, pqv.portalUpperLeftBack, t))
- {
- ++hits;
- intermediateT = AZStd::GetMin(t, intermediateT);
- }
-
- //Left
- if (AZ::Intersect::IntersectRayQuad(src, dir, pqv.floorLeftFront, pqv.portalUpperLeftFront, pqv.portalUpperLeftBack, pqv.floorLeftBack, t))
- {
- ++hits;
- intermediateT = AZStd::GetMin(t, intermediateT);
- }
- //Right
- if (AZ::Intersect::IntersectRayQuad(src, dir, pqv.floorRightFront, pqv.portalUpperRightFront, pqv.portalUpperRightBack, pqv.floorRightBack, t))
- {
- ++hits;
- intermediateT = AZStd::GetMin(t, intermediateT);
- }
- //Front
- if (AZ::Intersect::IntersectRayQuad(src, dir, pqv.floorLeftFront, pqv.floorRightFront, pqv.portalUpperRightFront, pqv.portalUpperLeftFront, t))
- {
- ++hits;
- intermediateT = AZStd::GetMin(t, intermediateT);
- }
- //Back
- if (AZ::Intersect::IntersectRayQuad(src, dir, pqv.floorLeftBack, pqv.floorRightBack, pqv.portalUpperRightBack, pqv.portalUpperLeftBack, t))
- {
- ++hits;
- intermediateT = AZStd::GetMin(t, intermediateT);
- }
-
- if (hits > 0)
- {
- distance = intermediateT;
- }
- return hits >= 2;
- }
-
- AZ::Aabb EditorPortalComponent::GetWorldBounds()
- {
- return GetLocalBounds().GetTransformedAabb(m_AZCachedWorldTransform);
- }
-
- AZ::Aabb EditorPortalComponent::GetLocalBounds()
- {
- AZ::Aabb bbox = AZ::Aabb::CreateNull();
- for (const auto& vertex : m_config.m_vertices)
- {
- bbox.AddPoint(vertex);
- }
- return bbox;
- }
-} //namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorPortalComponent.h b/Gems/Visibility/Code/Source/EditorPortalComponent.h
deleted file mode 100644
index a8e00b9698..0000000000
--- a/Gems/Visibility/Code/Source/EditorPortalComponent.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "PortalComponent.h"
-#include "EditorPortalComponentBus.h"
-
-namespace Visibility
-{
- class EditorPortalComponent;
- struct PortalQuadVertices;
-
- class EditorPortalConfiguration
- : public PortalConfiguration
- {
- public:
- AZ_TYPE_INFO_LEGACY(EditorPortalConfiguration, "{C9F99449-7A77-50C4-9ED3-D69B923BFDBD}", PortalConfiguration);
- AZ_CLASS_ALLOCATOR(EditorPortalConfiguration, AZ::SystemAllocator,0);
-
- static void Reflect(AZ::ReflectContext* context);
-
- void OnChange() override;
- void OnVerticesChange() override;
-
- void SetEntityId(AZ::EntityId entityId);
-
- private:
- AZ::EntityId m_entityId;
- };
-
- class EditorPortalComponent
- : public AzToolsFramework::Components::EditorComponentBase
- , private EditorPortalRequestBus::Handler
- , private AZ::FixedVerticesRequestBus::Handler
- , private AzFramework::EntityDebugDisplayEventBus::Handler
- , private AzToolsFramework::EditorComponentSelectionRequestsBus::Handler
- , public AZ::TransformNotificationBus::Handler
- , public AzFramework::BoundsRequestBus::Handler
- {
- friend class EditorPortalConfiguration;
-
- using Base = AzToolsFramework::Components::EditorComponentBase;
-
- public:
- AZ_COMPONENT(EditorPortalComponent, "{64525CDD-7DD4-5CEF-B545-559127DC834E}", AzToolsFramework::Components::EditorComponentBase);
-
- static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
- static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
- static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
- static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
-
- static void Reflect(AZ::ReflectContext* context);
-
- EditorPortalComponent() = default;
- EditorPortalComponent(const EditorPortalComponent&) = delete;
- EditorPortalComponent& operator=(const EditorPortalComponent&) = delete;
- ~EditorPortalComponent() override;
-
- // EditorComponentBase overrides ...
- void Activate() override;
- void Deactivate() override;
- void BuildGameEntity(AZ::Entity* gameEntity) override;
-
- // TransformNotificationBus overrides ...
- void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
-
- // EditorComponentSelectionRequestsBus overrides ...
- AZ::Aabb GetEditorSelectionBoundsViewport(
- const AzFramework::ViewportInfo& viewportInfo) override;
- bool EditorSelectionIntersectRayViewport(
- const AzFramework::ViewportInfo& viewportInfo, const AZ::Vector3& src,
- const AZ::Vector3& dir, float& distance) override;
- bool SupportsEditorRayIntersect() override { return true; }
-
- // PortalRequestBus overrides ...
- void SetHeight(float height) override;
- float GetHeight() override;
- void SetDisplayFilled(bool filled) override;
- bool GetDisplayFilled() override;
- void SetAffectedBySun(bool affectedBySun) override;
- bool GetAffectedBySun() override;
- void SetViewDistRatio(float viewDistRatio) override;
- float GetViewDistRatio() override;
- void SetSkyOnly(bool skyOnly) override;
- bool GetSkyOnly() override;
- void SetOceanIsVisible(bool oceanVisible) override;
- bool GetOceanIsVisible() override;
- void SetUseDeepness(bool useDeepness) override;
- bool GetUseDeepness() override;
- void SetDoubleSide(bool doubleSided) override;
- bool GetDoubleSide() override;
- void SetLightBlending(bool lightBending) override;
- bool GetLightBlending() override;
- void SetLightBlendValue(float lightBendAmount) override;
- float GetLightBlendValue() override;
- bool GetVertex(size_t index, AZ::Vector3& vertex) const override;
- bool UpdateVertex(size_t index, const AZ::Vector3& vertex) override;
- size_t Size() const override { return m_config.m_vertices.size(); }
- void UpdatePortalObject() override;
-
- // EntityDebugDisplayBus overrides ...
- void DisplayEntityViewport(
- const AzFramework::ViewportInfo& viewportInfo,
- AzFramework::DebugDisplayRequests& debugDisplay) override;
-
- // BoundsRequestBus overrides ...
- AZ::Aabb GetWorldBounds() override;
- AZ::Aabb GetLocalBounds() override;
-
- private:
- enum class VertTranslation
- {
- Keep,
- Remove
- };
-
- PortalQuadVertices CalculatePortalQuadVertices(VertTranslation vertTranslation);
-
- // Reflected members
- EditorPortalConfiguration m_config;
-
- using ComponentModeDelegate = AzToolsFramework::ComponentModeFramework::ComponentModeDelegate;
- ComponentModeDelegate m_componentModeDelegate; ///< Responsible for detecting ComponentMode activation
- ///< and creating a concrete ComponentMode.
-
- AZ::Transform m_AZCachedWorldTransform;
- Matrix44 m_cryCachedWorldTransform;
- IVisArea* m_area = nullptr;
- };
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorPortalComponentMode.cpp b/Gems/Visibility/Code/Source/EditorPortalComponentMode.cpp
deleted file mode 100644
index 5d9b089c65..0000000000
--- a/Gems/Visibility/Code/Source/EditorPortalComponentMode.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
- * its licensors.
- *
- * For complete copyright and license terms please see the LICENSE at the root of this
- * distribution (the "License"). All use of this software is governed by the License,
- * or, if provided, by the license below or the license accompanying this file. Do not
- * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *
- */
-
-#include "Visibility_precompiled.h"
-#include "EditorPortalComponentMode.h"
-
-#include
-
-namespace Visibility
-{
- AZ_CLASS_ALLOCATOR_IMPL(EditorPortalComponentMode, AZ::SystemAllocator, 0)
-
- EditorPortalComponentMode::EditorPortalComponentMode(
- const AZ::EntityComponentIdPair& entityComponentIdPair, AZ::Uuid componentType)
- : EditorBaseComponentMode(entityComponentIdPair, componentType)
- {
- CreateManipulators();
-
- AZ::TransformNotificationBus::Handler::BusConnect(entityComponentIdPair.GetEntityId());
- EditorPortalNotificationBus::Handler::BusConnect(entityComponentIdPair.GetEntityId());
- }
-
- EditorPortalComponentMode::~EditorPortalComponentMode()
- {
- EditorPortalNotificationBus::Handler::BusDisconnect();
- AZ::TransformNotificationBus::Handler::BusDisconnect();
-
- m_vertexSelection.Destroy();
- }
-
- void EditorPortalComponentMode::CreateManipulators()
- {
- using namespace AzToolsFramework;
-
- m_vertexSelection.Create(
- AZ::EntityComponentIdPair(GetEntityId(), GetComponentId()), g_mainManipulatorManagerId,
- AZStd::make_unique(),
- TranslationManipulators::Dimensions::Three,
- ConfigureTranslationManipulatorAppearance3d);
-
- m_vertexSelection.SetVertexPositionsUpdatedCallback([this]()
- {
- EditorPortalRequestBus::Event(
- GetEntityId(), &EditorPortalRequests::UpdatePortalObject);
- });
- }
-
- void EditorPortalComponentMode::OnTransformChanged(
- const AZ::Transform& /*local*/, const AZ::Transform& world)
- {
- m_vertexSelection.RefreshSpace(world);
- }
-
- void EditorPortalComponentMode::OnVerticesChangedInspector()
- {
- m_vertexSelection.RefreshLocal();
- }
-
- void EditorPortalComponentMode::Refresh()
- {
- // destroy and recreate manipulators when container is modified (vertices are added or removed)
- m_vertexSelection.Destroy();
- CreateManipulators();
- }
-
- AZStd::vector EditorPortalComponentMode::PopulateActionsImpl()
- {
- return m_vertexSelection.ActionOverrides();
- }
-
- bool EditorPortalComponentMode::HandleMouseInteraction(
- const AzToolsFramework::ViewportInteraction::MouseInteractionEvent& mouseInteraction)
- {
- return m_vertexSelection.HandleMouse(mouseInteraction);
- }
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorPortalComponentMode.h b/Gems/Visibility/Code/Source/EditorPortalComponentMode.h
deleted file mode 100644
index 633c3a1ba8..0000000000
--- a/Gems/Visibility/Code/Source/EditorPortalComponentMode.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-#include
-#include
-
-#include "EditorPortalComponentBus.h"
-
-namespace Visibility
-{
- class EditorPortalComponentMode
- : public AzToolsFramework::ComponentModeFramework::EditorBaseComponentMode
- , private AZ::TransformNotificationBus::Handler
- , private EditorPortalNotificationBus::Handler
- {
- public:
- AZ_CLASS_ALLOCATOR_DECL
-
- EditorPortalComponentMode(
- const AZ::EntityComponentIdPair& entityComponentIdPair, AZ::Uuid componentType);
- ~EditorPortalComponentMode();
-
- private:
- // EditorBaseComponentMode
- void Refresh() override;
- AZStd::vector PopulateActionsImpl() override;
- bool HandleMouseInteraction(
- const AzToolsFramework::ViewportInteraction::MouseInteractionEvent& mouseInteraction) override;
-
- // Manipulator handling
- void CreateManipulators();
-
- // TransformNotificationBus
- void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
-
- // EditorPortalNotificationBus
- void OnVerticesChangedInspector() override;
-
- AzToolsFramework::EditorVertexSelectionFixed m_vertexSelection; ///< Handles all manipulator interactions with vertices.
- };
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorVisAreaComponent.cpp b/Gems/Visibility/Code/Source/EditorVisAreaComponent.cpp
deleted file mode 100644
index 48045d9023..0000000000
--- a/Gems/Visibility/Code/Source/EditorVisAreaComponent.cpp
+++ /dev/null
@@ -1,629 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#include "Visibility_precompiled.h"
-#include "EditorVisAreaComponent.h"
-#include "EditorVisAreaComponentMode.h"
-
-#include
-#include
-#include
-#include
-#include
-
-// Include files needed for writing DisplayEntity functions that access the DisplayContext directly.
-#include
-
-#include "MathConversion.h"
-
-namespace Visibility
-{
- /*static*/ AZ::Color EditorVisAreaComponent::s_visAreaColor = AZ::Color(1.0f, 0.5f, 0.0f, 1.0f);
-
- void EditorVisAreaComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
- {
- provided.push_back(AZ_CRC("EditorVisAreaService", 0x4507d2ae));
- provided.push_back(AZ_CRC("VisAreaService", 0x0c063fb9));
- provided.push_back(AZ_CRC("VariableVertexContainerService", 0x70c58740));
- provided.push_back(AZ_CRC("FixedVertexContainerService", 0x83f1bbf2));
- }
-
- void EditorVisAreaComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& requires)
- {
- requires.push_back(AZ_CRC("TransformService", 0x8ee22c50));
- }
-
- void EditorVisAreaComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
- {
- incompatible.push_back(AZ_CRC("VariableVertexContainerService", 0x70c58740));
- incompatible.push_back(AZ_CRC("FixedVertexContainerService", 0x83f1bbf2));
- }
-
- void EditorVisAreaConfiguration::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(1);
-
- if (AZ::EditContext* editContext = serializeContext->GetEditContext())
- {
- editContext->Class("VisArea Configuration", "")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true);
-
- editContext->Class("VisArea Configuration", "")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
- ->DataElement(AZ::Edit::UIHandlers::Default, &VisAreaConfiguration::m_height, "Height", "How tall the VisArea is.")
- ->Attribute(AZ::Edit::Attributes::Max, 100.0f)
- ->Attribute(AZ::Edit::Attributes::Min, 0.0f)
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &VisAreaConfiguration::ChangeHeight)
- ->DataElement(AZ::Edit::UIHandlers::Default, &VisAreaConfiguration::m_displayFilled, "DisplayFilled", "Display the VisArea as a filled volume.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &VisAreaConfiguration::ChangeDisplayFilled)
- ->DataElement(AZ::Edit::UIHandlers::Default, &VisAreaConfiguration::m_affectedBySun, "AffectedBySun", "Allows sunlight to affect objects inside the VisArea.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &VisAreaConfiguration::ChangeAffectedBySun)
- ->DataElement(AZ::Edit::UIHandlers::Default, &VisAreaConfiguration::m_viewDistRatio, "ViewDistRatio", "Specifies how far the VisArea is rendered.")
- ->Attribute(AZ::Edit::Attributes::Max, 100.0f)
- ->Attribute(AZ::Edit::Attributes::Min, 0.0f)
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &VisAreaConfiguration::ChangeViewDistRatio)
- ->DataElement(AZ::Edit::UIHandlers::Default, &VisAreaConfiguration::m_oceanIsVisible, "OceanIsVisible", "Ocean will be visible when looking outside the VisArea.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &VisAreaConfiguration::ChangeOceanIsVisible)
- // note: This will not work as expected. See Activate where we set the callbacks on the vertex container directly
- ->DataElement(AZ::Edit::UIHandlers::Default, &VisAreaConfiguration::m_vertexContainer, "Vertices", "Points that make up the floor of the VisArea.")
- ->Attribute(AZ::Edit::Attributes::ChangeNotify, &VisAreaConfiguration::ChangeVertexContainer)
- ;
- }
- }
- }
-
- void EditorVisAreaComponent::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(2)
- ->Field("m_config", &EditorVisAreaComponent::m_config)
- ->Field("ComponentMode", &EditorVisAreaComponent::m_componentModeDelegate)
- ;
-
- if (AZ::EditContext* editContext = serializeContext->GetEditContext())
- {
- editContext->Class("VisArea", "An area where only objects inside the area will be visible.")
- ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
- ->Attribute(AZ::Edit::Attributes::Category, "Rendering")
- ->Attribute(AZ::Edit::Attributes::ViewportIcon, "Editor/Icons/Components/Viewport/VisArea.png")
- ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
- ->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/Components/VisArea.svg")
- ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
- ->Attribute(AZ::Edit::Attributes::HelpPageURL, "http://docs.aws.amazon.com/console/lumberyard/userguide/vis-area-component")
- ->DataElement(AZ::Edit::UIHandlers::Default, &EditorVisAreaComponent::m_config, "m_config", "No Description")
- ->DataElement(AZ::Edit::UIHandlers::Default, &EditorVisAreaComponent::m_componentModeDelegate, "Component Mode", "VisArea Component Mode")
- ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
- ;
- }
- }
-
- if (auto behaviorContext = azrtti_cast(context))
- {
- behaviorContext->EBus("EditorVisAreaComponentRequestBus")
- ->Event("SetHeight", &EditorVisAreaComponentRequestBus::Events::SetHeight)
- ->Event("GetHeight", &EditorVisAreaComponentRequestBus::Events::GetHeight)
- ->VirtualProperty("Height", "GetHeight", "SetHeight")
-
- ->Event("SetDisplayFilled", &EditorVisAreaComponentRequestBus::Events::SetDisplayFilled)
- ->Event("GetDisplayFilled", &EditorVisAreaComponentRequestBus::Events::GetDisplayFilled)
- ->VirtualProperty("DisplayFilled", "GetDisplayFilled", "SetDisplayFilled")
-
- ->Event("SetAffectedBySun", &EditorVisAreaComponentRequestBus::Events::SetAffectedBySun)
- ->Event("GetAffectedBySun", &EditorVisAreaComponentRequestBus::Events::GetAffectedBySun)
- ->VirtualProperty("AffectedBySun", "GetAffectedBySun", "SetAffectedBySun")
-
- ->Event("SetViewDistRatio", &EditorVisAreaComponentRequestBus::Events::SetViewDistRatio)
- ->Event("GetViewDistRatio", &EditorVisAreaComponentRequestBus::Events::GetViewDistRatio)
- ->VirtualProperty("ViewDistRatio", "GetViewDistRatio", "SetViewDistRatio")
-
- ->Event("SetOceanIsVisible", &EditorVisAreaComponentRequestBus::Events::SetOceanIsVisible)
- ->Event("GetOceanIsVisible", &EditorVisAreaComponentRequestBus::Events::GetOceanIsVisible)
- ->VirtualProperty("OceanIsVisible", "GetOceanIsVisible", "SetOceanIsVisible")
- ;
-
- behaviorContext->Class()->RequestBus("EditorVisAreaComponentRequestBus");
- }
-
- EditorVisAreaConfiguration::Reflect(context);
- }
-
- void EditorVisAreaConfiguration::ChangeHeight()
- {
- EditorVisAreaComponentRequestBus::Event(
- m_entityId, &EditorVisAreaComponentRequests::UpdateVisAreaObject);
- }
-
- void EditorVisAreaConfiguration::ChangeDisplayFilled()
- {
- EditorVisAreaComponentRequestBus::Event(
- m_entityId, &EditorVisAreaComponentRequests::UpdateVisAreaObject);
- }
-
- void EditorVisAreaConfiguration::ChangeAffectedBySun()
- {
- EditorVisAreaComponentRequestBus::Event(
- m_entityId, &EditorVisAreaComponentRequests::UpdateVisAreaObject);
- }
-
- void EditorVisAreaConfiguration::ChangeViewDistRatio()
- {
- EditorVisAreaComponentRequestBus::Event(
- m_entityId, &EditorVisAreaComponentRequests::UpdateVisAreaObject);
- }
-
- void EditorVisAreaConfiguration::ChangeOceanIsVisible()
- {
- EditorVisAreaComponentRequestBus::Event(
- m_entityId, &EditorVisAreaComponentRequests::UpdateVisAreaObject);
- }
-
- void EditorVisAreaConfiguration::ChangeVertexContainer()
- {
- EditorVisAreaComponentRequestBus::Event(
- m_entityId, &EditorVisAreaComponentRequests::UpdateVisAreaObject);
- }
-
- void EditorVisAreaConfiguration::SetEntityId(const AZ::EntityId entityId)
- {
- m_entityId = entityId;
- }
-
- EditorVisAreaComponent::~EditorVisAreaComponent()
- {
- if (m_area)
- {
- // Reset the listener vis area in the unlucky case that we are deleting the
- // vis area where the listener is currently in
- GetIEditor()->Get3DEngine()->DeleteVisArea(m_area);
- m_area = nullptr;
- }
- }
-
- void EditorVisAreaComponent::Activate()
- {
- Base::Activate();
-
- const AZ::EntityId entityId = GetEntityId();
-
- // NOTE: We create the vis-area here at activated, but destroy it in the destructor.
- // We have to do this, otherwise the vis-area is not saved into the level.
- // Unfortunately, at this time we cannot create the vis-areas at game runtime.
- // This means that dynamic slices cannot effectively contain vis areas until we fix the core rendering system to allow that.
-
- const auto visGUID = AZ::u64(entityId);
- if(!m_area && GetIEditor())
- {
- m_area = GetIEditor()->Get3DEngine()->CreateVisArea(visGUID);
- }
-
- m_componentModeDelegate.ConnectWithSingleComponentMode<
- EditorVisAreaComponent, EditorVisAreaComponentMode>(
- AZ::EntityComponentIdPair(entityId, GetId()), this);
-
- // give default values to the vertices if needed
- if (m_config.m_vertexContainer.Size() == 0)
- {
- m_config.m_vertexContainer.AddVertex(AZ::Vector3(-1.0f, -1.0f, 0.0f));
- m_config.m_vertexContainer.AddVertex(AZ::Vector3(+1.0f, -1.0f, 0.0f));
- m_config.m_vertexContainer.AddVertex(AZ::Vector3(+1.0f, +1.0f, 0.0f));
- m_config.m_vertexContainer.AddVertex(AZ::Vector3(-1.0f, +1.0f, 0.0f));
- }
-
- const auto vertexAdded = [this](size_t vertIndex)
- {
- EditorVisAreaComponentNotificationBus::Event(
- GetEntityId(), &EditorVisAreaComponentNotifications::OnVertexAdded, vertIndex);
-
- UpdateVisAreaObject();
- };
-
- const auto vertexRemoved = [this](size_t vertIndex)
- {
- EditorVisAreaComponentNotificationBus::Event(
- GetEntityId(), &EditorVisAreaComponentNotifications::OnVertexRemoved, vertIndex);
-
- UpdateVisAreaObject();
- };
-
- const auto vertexChanged = [this](size_t vertIndex)
- {
- EditorVisAreaComponentNotificationBus::Event(
- GetEntityId(), &EditorVisAreaComponentNotifications::OnVertexUpdated, vertIndex);
-
- UpdateVisAreaObject();
- };
-
- const auto verticesSet = [this]()
- {
- EditorVisAreaComponentNotificationBus::Event(
- GetEntityId(), &EditorVisAreaComponentNotifications::OnVerticesSet,
- m_config.m_vertexContainer.GetVertices());
-
- UpdateVisAreaObject();
- };
-
- const auto verticesCleared = [this]()
- {
- EditorVisAreaComponentNotificationBus::Event(
- GetEntityId(), &EditorVisAreaComponentNotifications::OnVerticesCleared);
-
- UpdateVisAreaObject();
- };
-
- m_config.m_vertexContainer.SetCallbacks(
- vertexAdded, vertexRemoved, vertexChanged,
- verticesSet, verticesCleared);
-
- m_config.SetEntityId(entityId);
-
- AZ::TransformBus::EventResult(
- m_currentWorldTransform, GetEntityId(), &AZ::TransformBus::Events::GetWorldTM);
-
- // make the initial vis area with the data we just parsed
- UpdateVisAreaObject();
-
- EditorVisAreaComponentRequestBus::Handler::BusConnect(entityId);
- AZ::VariableVerticesRequestBus::Handler::BusConnect(entityId);
- AZ::FixedVerticesRequestBus::Handler::BusConnect(entityId);
- AZ::TransformNotificationBus::Handler::BusConnect(entityId);
- AzFramework::EntityDebugDisplayEventBus::Handler::BusConnect(entityId);
- AzToolsFramework::EditorEntityInfoNotificationBus::Handler::BusConnect();
- AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusConnect(entityId);
- AzFramework::BoundsRequestBus::Handler::BusConnect(entityId);
- }
-
- void EditorVisAreaComponent::Deactivate()
- {
- m_componentModeDelegate.Disconnect();
-
- AzFramework::BoundsRequestBus::Handler::BusDisconnect();
- AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusDisconnect();
- AzFramework::EntityDebugDisplayEventBus::Handler::BusDisconnect();
- AzToolsFramework::EditorEntityInfoNotificationBus::Handler::BusDisconnect();
- AZ::TransformNotificationBus::Handler::BusDisconnect();
- AZ::FixedVerticesRequestBus::Handler::BusDisconnect();
- AZ::VariableVerticesRequestBus::Handler::BusDisconnect();
- EditorVisAreaComponentRequestBus::Handler::BusDisconnect();
-
- Base::Deactivate();
- }
-
- void EditorVisAreaComponent::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world)
- {
- m_currentWorldTransform = world;
- UpdateVisAreaObject();
- }
-
- /// Apply the component's settings to the underlying vis area
- void EditorVisAreaComponent::UpdateVisAreaObject()
- {
- if (m_area)
- {
- std::vector points;
-
- const AZStd::vector& vertices = m_config.m_vertexContainer.GetVertices();
- const size_t vertexCount = vertices.size();
-
- if (vertexCount > 3)
- {
- const Matrix34& wtm = AZTransformToLYTransform(GetWorldTM());
- points.resize(vertexCount);
- for (size_t i = 0; i < vertexCount; i++)
- {
- points[i] = wtm.TransformPoint(AZVec3ToLYVec3(vertices[i]));
- }
-
- SVisAreaInfo info;
- info.fHeight = GetHeight();
- info.bAffectedByOutLights = m_config.m_affectedBySun;
- info.fViewDistRatio = m_config.m_viewDistRatio;
- info.bOceanIsVisible = m_config.m_oceanIsVisible;
-
- //Unconfigurable; these values are used by other area types
- //We set them just so that debugging later it's clear that these
- //aren't being used because this is a VisArea.
- info.fPortalBlending = -1;
- info.bDoubleSide = true;
- info.bUseDeepness = false;
- info.bUseInIndoors = false;
-
- const AZStd::string name = AZStd::string("vis-area_") + GetEntity()->GetName();
-
- GetIEditor()->Get3DEngine()->UpdateVisArea(m_area, &points[0], points.size(), name.c_str(), info, true);
-
- AzFramework::EntityBoundsUnionRequestBus::Broadcast(
- &AzFramework::EntityBoundsUnionRequestBus::Events::RefreshEntityLocalBoundsUnion, GetEntityId());
- }
- }
- }
-
- void EditorVisAreaComponent::SetHeight(const float value)
- {
- m_config.m_height = value;
- UpdateVisAreaObject();
- }
-
- float EditorVisAreaComponent::GetHeight()
- {
- return m_config.m_height;
- }
-
- void EditorVisAreaComponent::SetDisplayFilled(const bool value)
- {
- m_config.m_displayFilled = value;
- UpdateVisAreaObject();
- }
-
- bool EditorVisAreaComponent::GetDisplayFilled()
- {
- return m_config.m_displayFilled;
- }
-
- void EditorVisAreaComponent::SetAffectedBySun(const bool value)
- {
- m_config.m_affectedBySun = value;
- UpdateVisAreaObject();
- }
-
- bool EditorVisAreaComponent::GetAffectedBySun()
- {
- return m_config.m_affectedBySun;
- }
-
- void EditorVisAreaComponent::SetViewDistRatio(const float value)
- {
- m_config.m_viewDistRatio = value;
- UpdateVisAreaObject();
- }
-
- float EditorVisAreaComponent::GetViewDistRatio()
- {
- return m_config.m_viewDistRatio;
- }
-
- void EditorVisAreaComponent::SetOceanIsVisible(const bool value)
- {
- m_config.m_oceanIsVisible = value;
- UpdateVisAreaObject();
- }
-
- bool EditorVisAreaComponent::GetOceanIsVisible()
- {
- return m_config.m_oceanIsVisible;
- }
-
- bool EditorVisAreaComponent::GetVertex(size_t index, AZ::Vector3& vertex) const
- {
- return m_config.m_vertexContainer.GetVertex(index, vertex);
- }
-
- void EditorVisAreaComponent::AddVertex(const AZ::Vector3& vertex)
- {
- m_config.m_vertexContainer.AddVertex(vertex);
- UpdateVisAreaObject();
- }
-
- bool EditorVisAreaComponent::UpdateVertex(size_t index, const AZ::Vector3& vertex)
- {
- if (m_config.m_vertexContainer.UpdateVertex(index, vertex))
- {
- UpdateVisAreaObject();
- return true;
- }
-
- return false;
- }
-
- bool EditorVisAreaComponent::InsertVertex(size_t index, const AZ::Vector3& vertex)
- {
- if (m_config.m_vertexContainer.InsertVertex(index, vertex))
- {
- UpdateVisAreaObject();
- return true;
- }
-
- return false;
- }
-
- bool EditorVisAreaComponent::RemoveVertex(size_t index)
- {
- if (m_config.m_vertexContainer.RemoveVertex(index))
- {
- UpdateVisAreaObject();
- return true;
- }
-
- return false;
- }
-
- void EditorVisAreaComponent::SetVertices(const AZStd::vector& vertices)
- {
- m_config.m_vertexContainer.SetVertices(vertices);
- UpdateVisAreaObject();
- }
-
- void EditorVisAreaComponent::ClearVertices()
- {
- m_config.m_vertexContainer.Clear();
- UpdateVisAreaObject();
- }
-
- size_t EditorVisAreaComponent::Size() const
- {
- return m_config.m_vertexContainer.Size();
- }
-
- bool EditorVisAreaComponent::Empty() const
- {
- return m_config.m_vertexContainer.Empty();
- }
-
- void EditorVisAreaComponent::DisplayEntityViewport(
- [[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo,
- AzFramework::DebugDisplayRequests& debugDisplay)
- {
- /*
- The VisArea and Portal share a common strangeness with how they are displayed.
- The Legacy visualization is actually incorrect! It's important to know that
- the vis volumes essentially act as a points on an XY plane with a known Z
- position and a height. The volumes that actually affect rendition are planar
- quads with a height. The height is calculated by the largest height value on
- a local point + the given height value on the component.
-
- Also note that this visualization does not display the floors or ceilings of the vis area
- volumes. There is currently no way with the display context to easily draw a filled polygon.
- We could try to draw some triangles but it would take up a great deal of rendering
- time and could potentially slow down the editor more than we want if there are a lot
- of volumes.
- */
-
- const AZStd::vector& vertices = m_config.m_vertexContainer.GetVertices();
- const size_t vertexCount = vertices.size();
-
- //We do not want to push a transform with scale or rotation as the
- //vis area is always snapped to the XY plane with a height.
- //Scale will be applied during flattening
- AZ::Transform translation = AZ::Transform::CreateIdentity();
- translation.SetTranslation(m_currentWorldTransform.GetTranslation());
-
- debugDisplay.PushMatrix(translation);
- debugDisplay.SetColor(s_visAreaColor.GetAsVector4());
-
- AZStd::vector transformedPoints;
- transformedPoints.resize(vertexCount);
-
- //Min and max Z value (in local space)
- float minZ = FLT_MAX;
- float maxZ = FLT_MIN;
-
- //Apply rotation and scale before removing translation.
- //We want translation to apply with the matrix to make things easier
- //but we need to calculate a difference in Z after rotation and scaling.
- //During the next loop we'll flatten all these points down to a common XY plane
- for (size_t i = 0; i < vertexCount; ++i)
- {
- AZ::Vector3 transformedPoint = m_currentWorldTransform.TransformPoint(vertices[i]);
-
- //Back into local space
- transformedPoints[i] = transformedPoint - m_currentWorldTransform.GetTranslation();
-
- const float transformedZ = transformedPoints[i].GetZ();
-
- minZ = AZ::GetMin(transformedZ, minZ);
- maxZ = AZ::GetMax(transformedZ, maxZ);
- }
-
- //The height of the vis area + the max local height
- const float actualHeight = m_config.m_height + maxZ;
-
- //Draw walls for every line segment
- size_t transformedPointCount = transformedPoints.size();
- for (size_t i = 0; i < transformedPointCount; ++i)
- {
- AZ::Vector3 lowerLeft = AZ::Vector3();
- AZ::Vector3 lowerRight = AZ::Vector3();
- AZ::Vector3 upperRight = AZ::Vector3();
- AZ::Vector3 upperLeft = AZ::Vector3();
-
- lowerLeft = transformedPoints[i];
- lowerRight = transformedPoints[(i + 1) % transformedPointCount];
- //The mod with transformedPointCount ensures that for the last vert it will connect back with vert 0
- //If vert count is 10, the last vert will be i = 9 and we want that to create a surface with vert 0
-
- //Make all lower points planar
- lowerLeft.SetZ(minZ);
- lowerRight.SetZ(minZ);
-
- upperRight = AZ::Vector3(lowerRight.GetX(), lowerRight.GetY(), actualHeight);
- upperLeft = AZ::Vector3(lowerLeft.GetX(), lowerLeft.GetY(), actualHeight);
-
- if (m_config.m_displayFilled)
- {
- debugDisplay.SetAlpha(0.3f);
- //Draw filled quad with two winding orders to make it double sided
- debugDisplay.DrawQuad(lowerLeft, lowerRight, upperRight, upperLeft);
- debugDisplay.DrawQuad(lowerLeft, upperLeft, upperRight, lowerRight);
- }
-
- debugDisplay.SetAlpha(1.0f);
- debugDisplay.DrawLine(lowerLeft, lowerRight);
- debugDisplay.DrawLine(lowerRight, upperRight);
- debugDisplay.DrawLine(upperRight, upperLeft);
- debugDisplay.DrawLine(upperLeft, lowerLeft);
- }
-
- if (m_componentModeDelegate.AddedToComponentMode())
- {
- AzToolsFramework::VertexContainerDisplay::DisplayVertexContainerIndices(
- debugDisplay, AzToolsFramework::VariableVerticesVertexContainer(m_config.m_vertexContainer),
- GetWorldTM(), AZ::Vector3::CreateOne(), IsSelected());
- }
-
- debugDisplay.PopMatrix();
- }
-
- void EditorVisAreaComponent::BuildGameEntity(AZ::Entity* gameEntity)
- {
- gameEntity->CreateComponent(m_config);
- }
-
- AZ::Aabb EditorVisAreaComponent::GetEditorSelectionBoundsViewport(
- const AzFramework::ViewportInfo& /*viewportInfo*/)
- {
- return GetWorldBounds();
- }
-
- bool EditorVisAreaComponent::EditorSelectionIntersectRayViewport(
- const AzFramework::ViewportInfo& viewportInfo, const AZ::Vector3& src,
- const AZ::Vector3& dir, float& distance)
- {
- AZ::Aabb bbox = GetEditorSelectionBoundsViewport(viewportInfo);
- float end;
- float t;
-
- const bool intersection = AZ::Intersect::IntersectRayAABB2(
- src, dir.GetReciprocal(),
- bbox, t, end) > 0;
-
- if (intersection)
- {
- distance = t;
- }
-
- return intersection;
- }
-
- AZ::Aabb EditorVisAreaComponent::GetWorldBounds()
- {
- return GetLocalBounds().GetTransformedAabb(GetWorldTM());
- }
-
- AZ::Aabb EditorVisAreaComponent::GetLocalBounds()
- {
- AZ::Aabb bbox = AZ::Aabb::CreateNull();
- for (const auto& vertex : m_config.m_vertexContainer.GetVertices())
- {
- bbox.AddPoint(vertex);
- }
- bbox.AddPoint(bbox.GetMax() + AZ::Vector3::CreateAxisZ(m_config.m_height));
- return bbox;
- }
-} //namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorVisAreaComponent.h b/Gems/Visibility/Code/Source/EditorVisAreaComponent.h
deleted file mode 100644
index 45c87e13cc..0000000000
--- a/Gems/Visibility/Code/Source/EditorVisAreaComponent.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "EditorVisAreaComponentBus.h"
-#include "VisAreaComponent.h"
-
-namespace Visibility
-{
- class EditorVisAreaComponent;
-
- class EditorVisAreaConfiguration
- : public VisAreaConfiguration
- {
- public:
- AZ_TYPE_INFO_LEGACY(EditorVisAreaConfiguration, "{C329E65C-1F34-5C80-9A7A-4B568105256B}", VisAreaConfiguration);
- AZ_CLASS_ALLOCATOR(EditorVisAreaConfiguration, AZ::SystemAllocator,0);
-
- static void Reflect(AZ::ReflectContext* context);
-
- void ChangeHeight() override;
- void ChangeDisplayFilled() override;
- void ChangeAffectedBySun() override;
- void ChangeViewDistRatio() override;
- void ChangeOceanIsVisible() override;
- void ChangeVertexContainer() override;
-
- void SetEntityId(AZ::EntityId entityId);
-
- private:
- AZ::EntityId m_entityId;
- };
-
- class EditorVisAreaComponent
- : public AzToolsFramework::Components::EditorComponentBase
- , private EditorVisAreaComponentRequestBus::Handler
- , private AZ::FixedVerticesRequestBus::Handler
- , private AZ::VariableVerticesRequestBus::Handler
- , private AzFramework::EntityDebugDisplayEventBus::Handler
- , private AzToolsFramework::EditorEntityInfoNotificationBus::Handler
- , private AzToolsFramework::EditorComponentSelectionRequestsBus::Handler
- , private AZ::TransformNotificationBus::Handler
- , public AzFramework::BoundsRequestBus::Handler
- {
- friend class EditorVisAreaConfiguration; //So that the config can set m_vertices when the vertex container changes
-
- using Base = AzToolsFramework::Components::EditorComponentBase;
-
- public:
- AZ_COMPONENT(EditorVisAreaComponent, "{F4EC32D8-D4DD-54F7-97A8-D195497D5F2C}", AzToolsFramework::Components::EditorComponentBase);
-
- static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provides);
- static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& requires);
- static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
-
- static void Reflect(AZ::ReflectContext* context);
-
- EditorVisAreaComponent() = default;
- EditorVisAreaComponent(const EditorVisAreaComponent&) = delete;
- EditorVisAreaComponent& operator=(const EditorVisAreaComponent&) = delete;
- virtual ~EditorVisAreaComponent();
-
- // AZ::Component overrides ...
- void Activate() override;
- void Deactivate() override;
- void BuildGameEntity(AZ::Entity* gameEntity) override;
-
- // TransformNotificationBus overrides ...
- void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
-
- // EditorComponentSelectionRequestsBus overrides ...
- AZ::Aabb GetEditorSelectionBoundsViewport(
- const AzFramework::ViewportInfo& viewportInfo) override;
- bool EditorSelectionIntersectRayViewport(
- const AzFramework::ViewportInfo& viewportInfo, const AZ::Vector3& src,
- const AZ::Vector3& dir, float& distance) override;
- bool SupportsEditorRayIntersect() override { return true; }
-
- // VisAreaComponentRequestBus overrides ...
- void SetHeight(float height) override;
- float GetHeight() override;
- void SetDisplayFilled(bool filled) override;
- bool GetDisplayFilled() override;
- void SetAffectedBySun(bool affectedBySun) override;
- bool GetAffectedBySun() override;
- void SetViewDistRatio(float viewDistRatio) override;
- float GetViewDistRatio() override;
- void SetOceanIsVisible(bool oceanVisible) override;
- bool GetOceanIsVisible() override;
- bool GetVertex(size_t index, AZ::Vector3& vertex) const override;
- void AddVertex(const AZ::Vector3& vertex) override;
- bool UpdateVertex(size_t index, const AZ::Vector3& vertex) override;
- bool InsertVertex(size_t index, const AZ::Vector3& vertex) override;
- bool RemoveVertex(size_t index) override;
- void SetVertices(const AZStd::vector& vertices) override;
- void ClearVertices() override;
- size_t Size() const override;
- bool Empty() const override;
- void UpdateVisAreaObject() override;
-
- // AzFramework::EntityDebugDisplayEventBus overrides ...
- void DisplayEntityViewport(
- const AzFramework::ViewportInfo& viewportInfo,
- AzFramework::DebugDisplayRequests& debugDisplay) override;
-
- // BoundsRequestBus overrides ...
- AZ::Aabb GetWorldBounds() override;
- AZ::Aabb GetLocalBounds() override;
-
- private:
- // Reflected members
- EditorVisAreaConfiguration m_config;
-
- using ComponentModeDelegate = AzToolsFramework::ComponentModeFramework::ComponentModeDelegate;
- ComponentModeDelegate m_componentModeDelegate; ///< Responsible for detecting ComponentMode activation
- ///< and creating a concrete ComponentMode.
-
- // Unreflected members
- AZ::Transform m_currentWorldTransform;
- IVisArea* m_area = nullptr;
-
- static AZ::Color s_visAreaColor; ///< The orange color that all vis-areas draw with.
- };
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorVisAreaComponentMode.cpp b/Gems/Visibility/Code/Source/EditorVisAreaComponentMode.cpp
deleted file mode 100644
index d479e51345..0000000000
--- a/Gems/Visibility/Code/Source/EditorVisAreaComponentMode.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
- * its licensors.
- *
- * For complete copyright and license terms please see the LICENSE at the root of this
- * distribution (the "License"). All use of this software is governed by the License,
- * or, if provided, by the license below or the license accompanying this file. Do not
- * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *
- */
-
-#include "Visibility_precompiled.h"
-#include "EditorVisAreaComponentMode.h"
-
-#include
-#include
-
-namespace Visibility
-{
- AZ_CLASS_ALLOCATOR_IMPL(EditorVisAreaComponentMode, AZ::SystemAllocator, 0)
-
- EditorVisAreaComponentMode::EditorVisAreaComponentMode(
- const AZ::EntityComponentIdPair& entityComponentIdPair, AZ::Uuid componentType)
- : EditorBaseComponentMode(entityComponentIdPair, componentType)
- {
- CreateManipulators();
-
- AZ::TransformNotificationBus::Handler::BusConnect(entityComponentIdPair.GetEntityId());
- EditorVisAreaComponentNotificationBus::Handler::BusConnect(entityComponentIdPair.GetEntityId());
- }
-
- EditorVisAreaComponentMode::~EditorVisAreaComponentMode()
- {
- EditorVisAreaComponentNotificationBus::Handler::BusDisconnect();
- AZ::TransformNotificationBus::Handler::BusDisconnect();
-
- m_vertexSelection.Destroy();
- }
-
- void EditorVisAreaComponentMode::CreateManipulators()
- {
- using namespace AzToolsFramework;
-
- m_vertexSelection.Create(
- GetEntityComponentIdPair(), g_mainManipulatorManagerId,
- AZStd::make_unique>(GetEntityComponentIdPair(), g_mainManipulatorManagerId),
- TranslationManipulators::Dimensions::Three,
- ConfigureTranslationManipulatorAppearance3d);
-
- m_vertexSelection.SetVertexPositionsUpdatedCallback([this]()
- {
- EditorVisAreaComponentRequestBus::Event(
- GetEntityId(), &EditorVisAreaComponentRequests::UpdateVisAreaObject);
- });
- }
-
- void EditorVisAreaComponentMode::OnTransformChanged(
- const AZ::Transform& /*local*/, const AZ::Transform& world)
- {
- m_vertexSelection.RefreshSpace(world);
- }
-
- void EditorVisAreaComponentMode::OnVertexAdded(size_t index)
- {
- Refresh();
-
- AZ::Vector3 vertex;
- bool found = false;
- AZ::FixedVerticesRequestBus::EventResult(
- found, GetEntityId(), &AZ::FixedVerticesRequestBus::Handler::GetVertex,
- index, vertex);
-
- if (found)
- {
- m_vertexSelection.CreateTranslationManipulator(
- GetEntityComponentIdPair(), AzToolsFramework::g_mainManipulatorManagerId,
- vertex, index);
- }
- }
-
- void EditorVisAreaComponentMode::OnVertexRemoved(size_t /*index*/)
- {
- Refresh();
- }
-
- void EditorVisAreaComponentMode::OnVerticesSet(const AZStd::vector& /*vertices*/)
- {
- Refresh();
- }
-
- void EditorVisAreaComponentMode::OnVerticesCleared()
- {
- Refresh();
- }
-
- void EditorVisAreaComponentMode::Refresh()
- {
- // destroy and recreate manipulators when container is modified (vertices are added or removed)
- m_vertexSelection.Destroy();
- CreateManipulators();
- }
-
- AZStd::vector EditorVisAreaComponentMode::PopulateActionsImpl()
- {
- return m_vertexSelection.ActionOverrides();
- }
-
- bool EditorVisAreaComponentMode::HandleMouseInteraction(
- const AzToolsFramework::ViewportInteraction::MouseInteractionEvent& mouseInteraction)
- {
- return m_vertexSelection.HandleMouse(mouseInteraction);
- }
-
- AZStd::string EditorVisAreaComponentMode::GetComponentModeName() const
- {
- return "Vis Area Edit Mode";
- }
-
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/EditorVisAreaComponentMode.h b/Gems/Visibility/Code/Source/EditorVisAreaComponentMode.h
deleted file mode 100644
index e33aed32f0..0000000000
--- a/Gems/Visibility/Code/Source/EditorVisAreaComponentMode.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-#include
-#include
-
-#include "EditorVisAreaComponentBus.h"
-
-namespace Visibility
-{
- /// The ComponentMode for editing the Vis Area Component.
- class EditorVisAreaComponentMode
- : public AzToolsFramework::ComponentModeFramework::EditorBaseComponentMode
- , private AZ::TransformNotificationBus::Handler
- , private EditorVisAreaComponentNotificationBus::Handler
- {
- public:
- AZ_CLASS_ALLOCATOR_DECL
-
- EditorVisAreaComponentMode(
- const AZ::EntityComponentIdPair& entityComponentIdPair, AZ::Uuid componentType);
- ~EditorVisAreaComponentMode();
-
- private:
- // EditorBaseComponentMode
- void Refresh() override;
- AZStd::vector PopulateActionsImpl() override;
- bool HandleMouseInteraction(
- const AzToolsFramework::ViewportInteraction::MouseInteractionEvent& mouseInteraction) override;
- AZStd::string GetComponentModeName() const override;
-
- // Manipulator handling
- void CreateManipulators();
-
- // TransformNotificationBus
- void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
-
- // EditorVisAreaComponentNotificationBus
- void OnVertexAdded(size_t index) override;
- void OnVertexRemoved(size_t index) override;
- void OnVerticesSet(const AZStd::vector& vertices) override;
- void OnVerticesCleared() override;
-
- AzToolsFramework::EditorVertexSelectionVariable m_vertexSelection; ///< Handles all manipulator interactions with vertices (inserting and translating).
- };
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/OccluderAreaComponent.cpp b/Gems/Visibility/Code/Source/OccluderAreaComponent.cpp
deleted file mode 100644
index 947bc3a38b..0000000000
--- a/Gems/Visibility/Code/Source/OccluderAreaComponent.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
- * its licensors.
- *
- * For complete copyright and license terms please see the LICENSE at the root of this
- * distribution (the "License"). All use of this software is governed by the License,
- * or, if provided, by the license below or the license accompanying this file. Do not
- * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *
- */
-
-#include "Visibility_precompiled.h"
-#include "OccluderAreaComponent.h"
-
-#include
-#include
-#include
-
-namespace Visibility
-{
- void OccluderAreaComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provides)
- {
- provides.push_back(AZ_CRC("OccluderAreaService"));
- }
- void OccluderAreaComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& requires)
- {
- requires.push_back(AZ_CRC("TransformService"));
- }
-
- void OccluderAreaConfiguration::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(1)
- ->Field("DisplayFilled", &OccluderAreaConfiguration::m_displayFilled)
- ->Field("CullDistRatio", &OccluderAreaConfiguration::m_cullDistRatio)
- ->Field("UseInIndoors", &OccluderAreaConfiguration::m_useInIndoors)
- ->Field("DoubleSide", &OccluderAreaConfiguration::m_doubleSide)
- ->Field("vertices", &OccluderAreaConfiguration::m_vertices)
- ;
- }
-
- if (auto behaviorContext = azrtti_cast(context))
- {
- behaviorContext->EBus("OccluderAreaRequestBus")
- ->Event("GetDisplayFilled", &OccluderAreaRequestBus::Events::GetDisplayFilled)
- ->VirtualProperty("DisplayFilled", "GetDisplayFilled", nullptr)
-
- ->Event("GetCullDistRatio", &OccluderAreaRequestBus::Events::GetCullDistRatio)
- ->VirtualProperty("CullDistRatio", "GetCullDistRatio", nullptr)
-
- ->Event("GetUseInIndoors", &OccluderAreaRequestBus::Events::GetUseInIndoors)
- ->VirtualProperty("UseInIndoors", "GetUseInIndoors", nullptr)
-
- ->Event("GetDoubleSide", &OccluderAreaRequestBus::Events::GetDoubleSide)
- ->VirtualProperty("DoubleSide", "GetDoubleSide", nullptr)
- ;
-
- behaviorContext->Class()->RequestBus("OccluderAreaRequestBus");
- }
- }
-
- void OccluderAreaComponent::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(1)
- ->Field("m_config", &OccluderAreaComponent::m_config)
- ;
- }
-
- OccluderAreaConfiguration::Reflect(context);
- }
-
- OccluderAreaComponent::OccluderAreaComponent(const OccluderAreaConfiguration& params)
- : m_config(params)
- {
- }
-
- void OccluderAreaComponent::Activate()
- {
- OccluderAreaRequestBus::Handler::BusConnect(GetEntityId());
- AZ::TransformNotificationBus::Handler::BusConnect(GetEntityId());
- }
-
- void OccluderAreaComponent::Deactivate()
- {
- AZ::TransformNotificationBus::Handler::BusDisconnect(GetEntityId());
- OccluderAreaRequestBus::Handler::BusDisconnect(GetEntityId());
- }
-
- bool OccluderAreaComponent::GetDisplayFilled()
- {
- return m_config.m_displayFilled;
- }
-
- float OccluderAreaComponent::GetCullDistRatio()
- {
- return m_config.m_cullDistRatio;
- }
-
- bool OccluderAreaComponent::GetUseInIndoors()
- {
- return m_config.m_useInIndoors;
- }
-
- bool OccluderAreaComponent::GetDoubleSide()
- {
- return m_config.m_doubleSide;
- }
-
-} //namespace Visibility
diff --git a/Gems/Visibility/Code/Source/OccluderAreaComponent.h b/Gems/Visibility/Code/Source/OccluderAreaComponent.h
deleted file mode 100644
index 80d98af4df..0000000000
--- a/Gems/Visibility/Code/Source/OccluderAreaComponent.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
- * its licensors.
- *
- * For complete copyright and license terms please see the LICENSE at the root of this
- * distribution (the "License"). All use of this software is governed by the License,
- * or, if provided, by the license below or the license accompanying this file. Do not
- * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *
- */
-
-#pragma once
-
-#include
-#include
-#include
-
-#include "OccluderAreaComponentBus.h"
-
-namespace Visibility
-{
- class OccluderAreaConfiguration
- {
- public:
- AZ_TYPE_INFO(OccluderAreaConfiguration, "{F024EC7E-717F-576C-8C22-09CAFEFEAF29}");
- AZ_CLASS_ALLOCATOR(OccluderAreaConfiguration, AZ::SystemAllocator, 0);
-
- virtual ~OccluderAreaConfiguration() = default;
-
- static void Reflect(AZ::ReflectContext* context);
-
- bool m_displayFilled = true;
- float m_cullDistRatio = 100.0f;
- bool m_useInIndoors = false;
- bool m_doubleSide = true;
-
- AZStd::array m_vertices =
- AZStd::array { {
- AZ::Vector3(-1.0f, -1.0f, 0.0f),
- AZ::Vector3( 1.0f, -1.0f, 0.0f),
- AZ::Vector3( 1.0f, 1.0f, 0.0f),
- AZ::Vector3(-1.0f, 1.0f, 0.0f)
- } };
-
- virtual void OnChange() {}
- virtual void OnVerticesChange() {}
- };
-
- class OccluderAreaComponent
- : public AZ::Component
- , private OccluderAreaRequestBus::Handler
- , public AZ::TransformNotificationBus::Handler
- {
- public:
- AZ_COMPONENT(OccluderAreaComponent, "{B3C90C5F-0F9B-5D4F-ABAE-6D16CB45CB5A}", AZ::Component);
-
- static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provides);
- static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& requires);
- static void Reflect(AZ::ReflectContext* context);
-
- OccluderAreaComponent() = default;
- explicit OccluderAreaComponent(const OccluderAreaConfiguration& params);
-
- // AZ::Component
- void Activate() override;
- void Deactivate() override;
-
- // OccluderAreaRequestBus
- bool GetDisplayFilled() override;
- float GetCullDistRatio() override;
- bool GetUseInIndoors() override;
- bool GetDoubleSide() override;
-
- protected:
- // Reflected Data
- OccluderAreaConfiguration m_config;
- };
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/PortalComponent.cpp b/Gems/Visibility/Code/Source/PortalComponent.cpp
deleted file mode 100644
index 9f1f618607..0000000000
--- a/Gems/Visibility/Code/Source/PortalComponent.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#include "Visibility_precompiled.h"
-#include "PortalComponent.h"
-
-#include
-#include
-
-namespace Visibility
-{
- void PortalComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provides)
- {
- provides.push_back(AZ::Crc32("PortalService"));
- }
-
- void PortalComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& requires)
- {
- requires.push_back(AZ::Crc32("TransformService"));
- }
-
- void PortalConfiguration::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(1)
- ->Field("Height", &PortalConfiguration::m_height)
- ->Field("DisplayFilled", &PortalConfiguration::m_displayFilled)
- ->Field("AffectedBySun", &PortalConfiguration::m_affectedBySun)
- ->Field("ViewDistRatio", &PortalConfiguration::m_viewDistRatio)
- ->Field("SkyOnly", &PortalConfiguration::m_skyOnly)
- ->Field("OceanIsVisible", &PortalConfiguration::m_oceanIsVisible)
- ->Field("UseDeepness", &PortalConfiguration::m_useDeepness)
- ->Field("DoubleSide", &PortalConfiguration::m_doubleSide)
- ->Field("LightBlending", &PortalConfiguration::m_lightBlending)
- ->Field("LightBlendValue", &PortalConfiguration::m_lightBlendValue)
- ->Field("vertices", &PortalConfiguration::m_vertices)
- ;
- }
-
- if (auto* behaviorContext = azrtti_cast(context))
- {
- behaviorContext->EBus("PortalRequestBus")
- ->Event("GetHeight", &PortalRequestBus::Events::GetHeight)
- ->VirtualProperty("Height", "GetHeight", nullptr)
-
- ->Event("GetDisplayFilled", &PortalRequestBus::Events::GetDisplayFilled)
- ->VirtualProperty("DisplayFilled", "GetDisplayFilled", nullptr)
-
- ->Event("GetAffectedBySun", &PortalRequestBus::Events::GetAffectedBySun)
- ->VirtualProperty("AffectedBySun", "GetAffectedBySun", nullptr)
-
- ->Event("GetViewDistRatio", &PortalRequestBus::Events::GetViewDistRatio)
- ->VirtualProperty("ViewDistRatio", "GetViewDistRatio", nullptr)
-
- ->Event("GetSkyOnly", &PortalRequestBus::Events::GetSkyOnly)
- ->VirtualProperty("SkyOnly", "GetSkyOnly", nullptr)
-
- ->Event("GetOceanIsVisible", &PortalRequestBus::Events::GetOceanIsVisible)
- ->VirtualProperty("OceanIsVisible", "GetOceanIsVisible", nullptr)
-
- ->Event("GetUseDeepness", &PortalRequestBus::Events::GetUseDeepness)
- ->VirtualProperty("UseDeepness", "GetUseDeepness", nullptr)
-
- ->Event("GetDoubleSide", &PortalRequestBus::Events::GetDoubleSide)
- ->VirtualProperty("DoubleSide", "GetDoubleSide", nullptr)
-
- ->Event("GetLightBlending", &PortalRequestBus::Events::GetLightBlending)
- ->VirtualProperty("LightBlending", "GetLightBlending", nullptr)
-
- ->Event("GetLightBlendValue", &PortalRequestBus::Events::GetLightBlendValue)
- ->VirtualProperty("LightBlendValue", "GetLightBlendValue", nullptr)
- ;
-
- behaviorContext->Class()->RequestBus("PortalRequestBus");
- }
- }
-
- bool PortalConfiguration::VersionConverter(
- [[maybe_unused]] AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement)
- {
- // conversion from version 1:
- // - Remove IgnoreSkyColor
- // - Remove IgnoreGI
- if (classElement.GetVersion() <= 1)
- {
- classElement.RemoveElementByName(AZ_CRC("IgnoreSkyColor"));
- classElement.RemoveElementByName(AZ_CRC("IgnoreGI"));
- }
-
- return true;
- }
-
- void PortalComponent::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(1)
- ->Field("m_config", &PortalComponent::m_config)
- ;
- }
-
- PortalConfiguration::Reflect(context);
- }
-
- PortalComponent::PortalComponent(const PortalConfiguration& params)
- : m_config(params)
- {
- }
-
- void PortalComponent::Activate()
- {
- PortalRequestBus::Handler::BusConnect(GetEntityId());
- }
-
- void PortalComponent::Deactivate()
- {
- PortalRequestBus::Handler::BusDisconnect(GetEntityId());
- }
-
- float PortalComponent::GetHeight()
- {
- return m_config.m_height;
- }
-
- bool PortalComponent::GetDisplayFilled()
- {
- return m_config.m_displayFilled;
- }
-
- bool PortalComponent::GetAffectedBySun()
- {
- return m_config.m_affectedBySun;
- }
-
- float PortalComponent::GetViewDistRatio()
- {
- return m_config.m_viewDistRatio;
- }
-
- bool PortalComponent::GetSkyOnly()
- {
- return m_config.m_skyOnly;
- }
-
- bool PortalComponent::GetOceanIsVisible()
- {
- return m_config.m_oceanIsVisible;
- }
-
- bool PortalComponent::GetUseDeepness()
- {
- return m_config.m_useDeepness;
- }
-
- bool PortalComponent::GetDoubleSide()
- {
- return m_config.m_doubleSide;
- }
-
- bool PortalComponent::GetLightBlending()
- {
- return m_config.m_lightBlending;
- }
-
- float PortalComponent::GetLightBlendValue()
- {
- return m_config.m_lightBlendValue;
- }
-
-} //namespace Visibility
diff --git a/Gems/Visibility/Code/Source/PortalComponent.h b/Gems/Visibility/Code/Source/PortalComponent.h
deleted file mode 100644
index fd6ce4ab77..0000000000
--- a/Gems/Visibility/Code/Source/PortalComponent.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-#include
-#include
-
-#include "PortalComponentBus.h"
-
-namespace Visibility
-{
- class PortalConfiguration
- {
- public:
- AZ_TYPE_INFO(PortalConfiguration, "{B9BDF017-DF8B-5DBE-8A92-5F62B7AECC1C}");
- AZ_CLASS_ALLOCATOR(PortalConfiguration, AZ::SystemAllocator,0);
-
- virtual ~PortalConfiguration() = default;
-
- static void Reflect(AZ::ReflectContext* context);
- static bool VersionConverter(
- AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement);
-
- float m_height = 1.0f;
- bool m_displayFilled = false;
- bool m_affectedBySun = false;
- float m_viewDistRatio = 100.0f;
- bool m_skyOnly = false;
- bool m_oceanIsVisible = false;
- bool m_useDeepness = true;
- bool m_doubleSide = true;
- bool m_lightBlending = true;
- float m_lightBlendValue = 0.5f;
-
- AZStd::array m_vertices =
- AZStd::array { {
- AZ::Vector3(-1.0f, -1.0f, 0.0f),
- AZ::Vector3( 1.0f, -1.0f, 0.0f),
- AZ::Vector3( 1.0f, 1.0f, 0.0f),
- AZ::Vector3(-1.0f, 1.0f, 0.0f)
- } };
-
- virtual void OnChange() {}
- virtual void OnVerticesChange() {}
- };
-
- class PortalComponent
- : public AZ::Component
- , private PortalRequestBus::Handler
- {
- public:
- AZ_COMPONENT(PortalComponent, "{89F1DD88-4445-5A9D-9223-6D4D8D44E6AC}", AZ::Component);
-
- static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provides);
- static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& requires);
- static void Reflect(AZ::ReflectContext* context);
-
- PortalComponent() = default;
- explicit PortalComponent(const PortalConfiguration& params);
-
- // AZ::Component
- void Activate() override;
- void Deactivate() override;
-
- // PortalRequestBus
- float GetHeight() override;
- bool GetDisplayFilled() override;
- bool GetAffectedBySun() override;
- float GetViewDistRatio() override;
- bool GetSkyOnly() override;
- bool GetOceanIsVisible() override;
- bool GetUseDeepness() override;
- bool GetDoubleSide() override;
- bool GetLightBlending() override;
- float GetLightBlendValue() override;
-
- protected:
- // Reflected Data
- PortalConfiguration m_config;
- };
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/VisAreaComponent.cpp b/Gems/Visibility/Code/Source/VisAreaComponent.cpp
deleted file mode 100644
index 7db60f1688..0000000000
--- a/Gems/Visibility/Code/Source/VisAreaComponent.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#include "Visibility_precompiled.h"
-#include "VisAreaComponent.h"
-
-#include
-#include
-
-namespace Visibility
-{
- void VisAreaComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provides)
- {
- provides.push_back(AZ::Crc32("VisAreaService"));
- }
-
- void VisAreaComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& requires)
- {
- requires.push_back(AZ::Crc32("TransformService"));
- }
-
- void VisAreaConfiguration::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(2, &VersionConverter)
- ->Field("m_Height", &VisAreaConfiguration::m_height)
- ->Field("m_DisplayFilled", &VisAreaConfiguration::m_displayFilled)
- ->Field("m_AffectedBySun", &VisAreaConfiguration::m_affectedBySun)
- ->Field("m_ViewDistRatio", &VisAreaConfiguration::m_viewDistRatio)
- ->Field("m_OceanIsVisible", &VisAreaConfiguration::m_oceanIsVisible)
- ->Field("m_vertexContainer", &VisAreaConfiguration::m_vertexContainer)
- ;
- }
-
- if (auto behaviorContext = azrtti_cast(context))
- {
- behaviorContext->EBus("VisAreaComponentRequestBus")
- ->Event("GetHeight", &VisAreaComponentRequestBus::Events::GetHeight)
- ->VirtualProperty("Height", "GetHeight", nullptr)
-
- ->Event("GetDisplayFilled", &VisAreaComponentRequestBus::Events::GetDisplayFilled)
- ->VirtualProperty("DisplayFilled", "GetDisplayFilled", nullptr)
-
- ->Event("GetAffectedBySun", &VisAreaComponentRequestBus::Events::GetAffectedBySun)
- ->VirtualProperty("AffectedBySun", "GetAffectedBySun", nullptr)
-
- ->Event("GetViewDistRatio", &VisAreaComponentRequestBus::Events::GetViewDistRatio)
- ->VirtualProperty("ViewDistRatio", "GetViewDistRatio", nullptr)
-
- ->Event("GetOceanIsVisible", &VisAreaComponentRequestBus::Events::GetOceanIsVisible)
- ->VirtualProperty("OceanIsVisible", "GetOceanIsVisible", nullptr)
- ;
-
- behaviorContext->Class()->RequestBus("VisAreaComponentRequestBus");
- }
- }
-
- bool VisAreaConfiguration::VersionConverter([[maybe_unused]] AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement)
- {
- // conversion from version 1:
- // - Remove IgnoreSkyColor
- // - Remove IgnoreGI
- // - Remove SkyOnly
- if (classElement.GetVersion() <= 1)
- {
- classElement.RemoveElementByName(AZ_CRC("IgnoreSkyColor"));
- classElement.RemoveElementByName(AZ_CRC("IgnoreGI"));
- classElement.RemoveElementByName(AZ_CRC("SkyOnly"));
- }
-
- return true;
- }
-
- void VisAreaComponent::Reflect(AZ::ReflectContext* context)
- {
- if (auto serializeContext = azrtti_cast(context))
- {
- serializeContext->Class()
- ->Version(1)
- ->Field("m_config", &VisAreaComponent::m_config)
- ;
- }
-
- VisAreaConfiguration::Reflect(context);
- }
-
- VisAreaComponent::VisAreaComponent(const VisAreaConfiguration& params)
- : m_config(params)
- {
- }
-
- void VisAreaComponent::Activate()
- {
- VisAreaComponentRequestBus::Handler::BusConnect(GetEntityId());
- }
-
- void VisAreaComponent::Deactivate()
- {
- VisAreaComponentRequestBus::Handler::BusDisconnect(GetEntityId());
- }
-
- float VisAreaComponent::GetHeight()
- {
- return m_config.m_height;
- }
-
- bool VisAreaComponent::GetDisplayFilled()
- {
- return m_config.m_displayFilled;
- }
-
- bool VisAreaComponent::GetAffectedBySun()
- {
- return m_config.m_affectedBySun;
- }
-
- float VisAreaComponent::GetViewDistRatio()
- {
- return m_config.m_viewDistRatio;
- }
-
- bool VisAreaComponent::GetOceanIsVisible()
- {
- return m_config.m_oceanIsVisible;
- }
-} //namespace Visibility
diff --git a/Gems/Visibility/Code/Source/VisAreaComponent.h b/Gems/Visibility/Code/Source/VisAreaComponent.h
deleted file mode 100644
index f2efe7167d..0000000000
--- a/Gems/Visibility/Code/Source/VisAreaComponent.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-#include
-#include
-#include
-
-#include "VisAreaComponentBus.h"
-
-namespace Visibility
-{
- class VisAreaConfiguration
- {
- public:
- AZ_TYPE_INFO(VisAreaConfiguration, "{160D9FC2-936F-59BB-827C-DEF89671E4DC}");
- AZ_CLASS_ALLOCATOR(VisAreaConfiguration, AZ::SystemAllocator,0);
-
- virtual ~VisAreaConfiguration() = default;
-
- static void Reflect(AZ::ReflectContext* context);
- static bool VersionConverter(
- AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement);
-
- float m_height = 5.0f;
- bool m_displayFilled = false;
- bool m_affectedBySun = false;
- float m_viewDistRatio = 100.0f;
- bool m_oceanIsVisible = false;
- AZ::VertexContainer m_vertexContainer;
-
- virtual void ChangeHeight() {}
- virtual void ChangeDisplayFilled() {}
- virtual void ChangeAffectedBySun() {}
- virtual void ChangeViewDistRatio() {}
- virtual void ChangeOceanIsVisible() {}
- virtual void ChangeVertexContainer() {}
- };
-
- class VisAreaComponent
- : public AZ::Component
- , private VisAreaComponentRequestBus::Handler
- {
- public:
- AZ_COMPONENT(VisAreaComponent, "{ACAB60F8-100E-5EAF-BE2B-D60F79312404}", AZ::Component);
-
- static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provides);
- static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& requires);
- static void Reflect(AZ::ReflectContext* context);
-
- VisAreaComponent() = default;
- explicit VisAreaComponent(const VisAreaConfiguration& params);
-
- // AZ::Component
- void Activate() override;
- void Deactivate() override;
-
- // VisAreaComponentRequestBus
- float GetHeight() override;
- bool GetDisplayFilled() override;
- bool GetAffectedBySun() override;
- float GetViewDistRatio() override;
- bool GetOceanIsVisible() override;
-
- private:
- VisAreaConfiguration m_config; ///< Reflected configuration.
- };
-} // namespace Visibility
diff --git a/Gems/Visibility/Code/Source/VisibilityGem.cpp b/Gems/Visibility/Code/Source/VisibilityGem.cpp
deleted file mode 100644
index 37d31a56f6..0000000000
--- a/Gems/Visibility/Code/Source/VisibilityGem.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-#include "Visibility_precompiled.h"
-
-#include "VisibilityGem.h"
-
-#include "OccluderAreaComponent.h"
-#include "PortalComponent.h"
-#include "VisAreaComponent.h"
-
-#ifdef VISIBILITY_EDITOR
-#include "EditorOccluderAreaComponent.h"
-#include "EditorPortalComponent.h"
-#include "EditorVisAreaComponent.h"
-#endif //VISIBILITY_EDITOR
-
-VisibilityGem::VisibilityGem()
-{
- m_descriptors.push_back(Visibility::OccluderAreaComponent::CreateDescriptor());
- m_descriptors.push_back(Visibility::PortalComponent::CreateDescriptor());
- m_descriptors.push_back(Visibility::VisAreaComponent::CreateDescriptor());
-
-#ifdef VISIBILITY_EDITOR
- m_descriptors.push_back(Visibility::EditorOccluderAreaComponent::CreateDescriptor());
- m_descriptors.push_back(Visibility::EditorPortalComponent::CreateDescriptor());
- m_descriptors.push_back(Visibility::EditorVisAreaComponent::CreateDescriptor());
-#endif //VISIBILITY_EDITOR
-}
-
-AZ_DECLARE_MODULE_CLASS(Gem_Visibility, VisibilityGem)
diff --git a/Gems/Visibility/Code/Source/VisibilityGem.h b/Gems/Visibility/Code/Source/VisibilityGem.h
deleted file mode 100644
index 1abc1b8901..0000000000
--- a/Gems/Visibility/Code/Source/VisibilityGem.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-
-#include
-
-
-class VisibilityGem
- : public AZ::Module
-{
-public:
- AZ_RTTI(VisibilityGem, "{5138F2B6-EDFB-490E-AB3E-B82E43263A20}");
-
- VisibilityGem();
-};
diff --git a/Gems/Visibility/Code/Source/Visibility_precompiled.cpp b/Gems/Visibility/Code/Source/Visibility_precompiled.cpp
deleted file mode 100644
index 6d32d0ea69..0000000000
--- a/Gems/Visibility/Code/Source/Visibility_precompiled.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-#include "Visibility_precompiled.h"
diff --git a/Gems/Visibility/Code/Source/Visibility_precompiled.h b/Gems/Visibility/Code/Source/Visibility_precompiled.h
deleted file mode 100644
index 2a1bc2e083..0000000000
--- a/Gems/Visibility/Code/Source/Visibility_precompiled.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
diff --git a/Gems/Visibility/Code/Tests/VisibilityTest.cpp b/Gems/Visibility/Code/Tests/VisibilityTest.cpp
deleted file mode 100644
index 406cef86a4..0000000000
--- a/Gems/Visibility/Code/Tests/VisibilityTest.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
-* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-* its licensors.
-*
-* For complete copyright and license terms please see the LICENSE at the root of this
-* distribution (the "License"). All use of this software is governed by the License,
-* or, if provided, by the license below or the license accompanying this file. Do not
-* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-*
-*/
-#include "Visibility_precompiled.h"
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-#include
-#include
-#include
-#include
-
-class VisibilityTest
- : public ::testing::Test
-{
-protected:
-
- void SetUp() override
- {
- AZ::ComponentApplication::Descriptor appDesc;
- appDesc.m_memoryBlocksByteSize = 10 * 1024 * 1024;
- appDesc.m_recordingMode = AZ::Debug::AllocationRecords::RECORD_FULL;
-
- AZ::ComponentApplication::StartupParameters appStartup;
- appStartup.m_createStaticModulesCallback =
- [](AZStd::vector& modules)
- {
- modules.emplace_back(new VisibilityGem);
- };
-
- m_systemEntity = m_application.Create(appDesc, appStartup);
- m_systemEntity->Init();
- m_systemEntity->Activate();
-
- m_application.RegisterComponentDescriptor(AzFramework::TransformComponent::CreateDescriptor());
- m_application.RegisterComponentDescriptor(Visibility::OccluderAreaComponent::CreateDescriptor());
- m_application.RegisterComponentDescriptor(Visibility::PortalComponent::CreateDescriptor());
- m_application.RegisterComponentDescriptor(Visibility::VisAreaComponent::CreateDescriptor());
- }
-
- void TearDown() override
- {
- m_application.Destroy();
- }
-
- AZ::ComponentApplication m_application;
- AZ::Entity* m_systemEntity;
-};
-
-#include
-#include
-#include
-
-TEST_F(VisibilityTest, Occluder_TestIntersect)
-{
- AZ::Entity* testEntity = aznew AZ::Entity();
- ASSERT_TRUE(testEntity != nullptr);
-
- testEntity->CreateComponent();
- testEntity->CreateComponent();
-
- Visibility::EditorOccluderAreaComponent* oaComp = testEntity->FindComponent();
- ASSERT_TRUE(oaComp != nullptr);
- testEntity->Init();
- testEntity->Activate();
-
- // Test CCW tri intersection test
- const AZ::Vector3 src(0, 0, 10);
- const AZ::Vector3 dir(0, 0, -1);
- float distance;
-
- // Visibility Components do not make use of the ViewportInfo to determine
- // camera position etc.
- AzFramework::ViewportInfo viewportInfo{};
-
- bool didHit = oaComp->EditorSelectionIntersectRayViewport(viewportInfo, src, dir, distance);
- ASSERT_TRUE(didHit);
- ASSERT_NEAR(distance, 10, 0.1f); // Occluder is a flat plane
-
- // Test CW tri intersection test
- const AZ::Vector3 srcNeg(0, 0, -10);
- const AZ::Vector3 dirNeg(0, 0, 1);
-
- didHit = oaComp->EditorSelectionIntersectRayViewport(viewportInfo, srcNeg, dirNeg, distance);
- ASSERT_TRUE(didHit);
- ASSERT_NEAR(distance, 10, 0.1f); // Occluder is a flat plane
-
- // Test intersect failure
- const AZ::Vector3 badDir(100, 100, -1);
- didHit = oaComp->EditorSelectionIntersectRayViewport(viewportInfo, src, badDir, distance);
- ASSERT_FALSE(didHit);
-}
-
-TEST_F(VisibilityTest, Portal_TestIntersect)
-{
- AZ::Entity* testEntity = aznew AZ::Entity();
- ASSERT_TRUE(testEntity != nullptr);
-
- testEntity->CreateComponent();
- testEntity->CreateComponent();
-
- Visibility::EditorPortalComponent* pComp = testEntity->FindComponent();
- ASSERT_TRUE(pComp != nullptr);
- testEntity->Init();
- testEntity->Activate();
-
- const AZ::Vector3 src(0, 0, 10);
- const AZ::Vector3 dir(0, 0, -1);
- float distance;
-
- // Visibility Components do not make use of the ViewportInfo to determine
- // camera position etc.
- AzFramework::ViewportInfo viewportInfo{};
-
- // Test intersect
- bool didHit = pComp->EditorSelectionIntersectRayViewport(viewportInfo, src, dir, distance);
- ASSERT_TRUE(didHit);
- ASSERT_NEAR(distance, 9, 0.1f); // Portal has a default height of 1
-
- // Test casting a ray from inside the geom
- const AZ::Vector3 internalSrc(0, 0, 0.5f);
- didHit = pComp->EditorSelectionIntersectRayViewport(viewportInfo, internalSrc, dir, distance);
- ASSERT_FALSE(didHit);
-
- // Test intersect failure
- const AZ::Vector3 badDir(100, 100, -1);
- didHit = pComp->EditorSelectionIntersectRayViewport(viewportInfo, src, badDir, distance);
- ASSERT_FALSE(didHit);
-}
-
-TEST_F(VisibilityTest, VisArea_TestIntersect)
-{
- AZ::Entity* testEntity = aznew AZ::Entity();
- ASSERT_TRUE(testEntity != nullptr);
-
- testEntity->CreateComponent();
- testEntity->CreateComponent();
- testEntity->Init();
- testEntity->Activate();
-
- Visibility::EditorVisAreaComponent* vaComp = testEntity->FindComponent();
- ASSERT_TRUE(vaComp != nullptr);
-
- const AZ::Vector3 src(0, 0, 10);
- const AZ::Vector3 dir(0, 0, -1);
- float distance;
-
- // Visibility Components do not make use of the ViewportInfo to determine
- // camera position etc.
- AzFramework::ViewportInfo viewportInfo{};
-
- bool didHit = vaComp->EditorSelectionIntersectRayViewport(viewportInfo, src, dir, distance);
- ASSERT_TRUE(didHit);
- ASSERT_NEAR(distance, 5, 0.1f); // VisArea has a default height of 5
-
- const AZ::Vector3 badDir(100, 100, -1);
- didHit = vaComp->EditorSelectionIntersectRayViewport(viewportInfo, src, badDir, distance);
- ASSERT_FALSE(didHit);
-}
-
-AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);
diff --git a/Gems/Visibility/Code/visibility_editor_files.cmake b/Gems/Visibility/Code/visibility_editor_files.cmake
deleted file mode 100644
index 9d17b92e27..0000000000
--- a/Gems/Visibility/Code/visibility_editor_files.cmake
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-# its licensors.
-#
-# For complete copyright and license terms please see the LICENSE at the root of this
-# distribution (the "License"). All use of this software is governed by the License,
-# or, if provided, by the license below or the license accompanying this file. Do not
-# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#
-
-set(FILES
- Include/EditorOccluderAreaComponentBus.h
- Include/EditorPortalComponentBus.h
- Include/EditorVisAreaComponentBus.h
- Source/EditorOccluderAreaComponentMode.h
- Source/EditorOccluderAreaComponentMode.cpp
- Source/EditorPortalComponentMode.h
- Source/EditorPortalComponentMode.cpp
- Source/EditorVisAreaComponentMode.h
- Source/EditorVisAreaComponentMode.cpp
-)
diff --git a/Gems/Visibility/Code/visibility_editor_shared_files.cmake b/Gems/Visibility/Code/visibility_editor_shared_files.cmake
deleted file mode 100644
index 1714fc1402..0000000000
--- a/Gems/Visibility/Code/visibility_editor_shared_files.cmake
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-# its licensors.
-#
-# For complete copyright and license terms please see the LICENSE at the root of this
-# distribution (the "License"). All use of this software is governed by the License,
-# or, if provided, by the license below or the license accompanying this file. Do not
-# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#
-
-set(FILES
- Source/VisibilityGem.h
- Source/VisibilityGem.cpp
- Source/EditorOccluderAreaComponent.h
- Source/EditorOccluderAreaComponent.cpp
- Source/EditorPortalComponent.h
- Source/EditorPortalComponent.cpp
- Source/EditorVisAreaComponent.h
- Source/EditorVisAreaComponent.cpp
-)
diff --git a/Gems/Visibility/Code/visibility_editor_tests_files.cmake b/Gems/Visibility/Code/visibility_editor_tests_files.cmake
deleted file mode 100644
index 52867e64af..0000000000
--- a/Gems/Visibility/Code/visibility_editor_tests_files.cmake
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-# its licensors.
-#
-# For complete copyright and license terms please see the LICENSE at the root of this
-# distribution (the "License"). All use of this software is governed by the License,
-# or, if provided, by the license below or the license accompanying this file. Do not
-# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#
-
-set(FILES
- Tests/VisibilityTest.cpp
- Source/VisibilityGem.h
- Source/VisibilityGem.cpp
- Source/EditorOccluderAreaComponent.h
- Source/EditorOccluderAreaComponent.cpp
- Source/EditorPortalComponent.h
- Source/EditorPortalComponent.cpp
- Source/EditorVisAreaComponent.h
- Source/EditorVisAreaComponent.cpp
-)
diff --git a/Gems/Visibility/Code/visibility_files.cmake b/Gems/Visibility/Code/visibility_files.cmake
deleted file mode 100644
index e58ac4fbba..0000000000
--- a/Gems/Visibility/Code/visibility_files.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-# its licensors.
-#
-# For complete copyright and license terms please see the LICENSE at the root of this
-# distribution (the "License"). All use of this software is governed by the License,
-# or, if provided, by the license below or the license accompanying this file. Do not
-# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#
-
-set(FILES
- Source/Visibility_precompiled.cpp
- Source/Visibility_precompiled.h
- Include/OccluderAreaComponentBus.h
- Include/PortalComponentBus.h
- Include/VisAreaComponentBus.h
- Source/OccluderAreaComponent.h
- Source/OccluderAreaComponent.cpp
- Source/PortalComponent.h
- Source/PortalComponent.cpp
- Source/VisAreaComponent.h
- Source/VisAreaComponent.cpp
-)
diff --git a/Gems/Visibility/Code/visibility_shared_files.cmake b/Gems/Visibility/Code/visibility_shared_files.cmake
deleted file mode 100644
index a37350ade6..0000000000
--- a/Gems/Visibility/Code/visibility_shared_files.cmake
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-# its licensors.
-#
-# For complete copyright and license terms please see the LICENSE at the root of this
-# distribution (the "License"). All use of this software is governed by the License,
-# or, if provided, by the license below or the license accompanying this file. Do not
-# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#
-
-set(FILES
- Source/VisibilityGem.h
- Source/VisibilityGem.cpp
-)
diff --git a/Gems/Visibility/gem.json b/Gems/Visibility/gem.json
deleted file mode 100644
index 3e8eca471b..0000000000
--- a/Gems/Visibility/gem.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "gem_name": "Visibility",
- "GemFormatVersion": 3,
- "Uuid": "3b4ab3f54c2749328934c5b864355a61",
- "Name": "Visibility",
- "DisplayName": "Visibility",
- "Version": "0.1.0",
- "LinkType": "Dynamic",
- "Summary": "Provides components for defining visible regions of a scene",
- "Tags": ["Untagged"],
- "IconPath": "preview.png",
- "EditorModule": true
-}
diff --git a/Gems/Visibility/preview.png b/Gems/Visibility/preview.png
deleted file mode 100644
index f60ab5eebd..0000000000
--- a/Gems/Visibility/preview.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8f1a3e838ba075704ee974a1289487d4007e7b7385eb855b8b2a09534b6cecd1
-size 1949