Ensure render geometry is refreshed when the mesh component controller is moved (#6452)

* ensure render geometry is refreshed when the mesh component controller is moved

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* cache bus pointer and send update notification when mesh changes

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* add integration test to detect MeshComponentController notification to IntersectionNotificationBus

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* remove optimize off

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* update build visibility for AtomLyIntegration editor static lib

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>

* move runtime dependencies to gem module

Signed-off-by: Tom Hulton-Harrop <82228511+hultonha@users.noreply.github.com>
This commit is contained in:
Tom Hulton-Harrop
2022-01-24 10:41:32 +00:00
committed by GitHub
parent a623e52331
commit 5940982244
8 changed files with 253 additions and 29 deletions
@@ -5,25 +5,23 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/Component/EntityId.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/Math/Aabb.h>
#include <AzFramework/Entity/EntityContextBus.h>
#include <AzFramework/Render/GeometryIntersectionBus.h>
#include <AzFramework/Render/GeometryIntersectionStructures.h>
#include <AzFramework/Render/IntersectorInterface.h>
#include <AzFramework/Render/GeometryIntersectionBus.h>
namespace AzFramework
{
namespace RenderGeometry
{
//! Implementation of IntersectorBus interface, this class contains a cached AABB list
//! of the connected entities to the intersection bus and calculates performant ray intersections against them
//! Implementation of IntersectorBus interface, this class contains a cached AABB list of the connected
//! entities to the intersection bus and calculates efficient ray intersections against them.
class Intersector final
: public IntersectorBus::Handler
, protected IntersectionNotificationBus::Handler
@@ -34,32 +32,32 @@ namespace AzFramework
Intersector(AzFramework::EntityContextId contextId);
~Intersector();
// IntersectorBus
// IntersectorBus overrides ...
RayResult RayIntersect(const RayRequest& ray) override;
// IntersectionNotifications
// IntersectionNotificationBus overrides ...
void OnEntityConnected(AZ::EntityId entityId) override;
void OnEntityDisconnected(AZ::EntityId entityId) override;
void OnGeometryChanged(AZ::EntityId entityId) override;
private:
struct EntityData
{
EntityData(AZ::EntityId id, AZ::Aabb aabb)
: m_id(id)
, m_aabb(aabb)
, m_ref(1) {}
, m_ref(1)
{
}
AZ::EntityId m_id;
AZ::Aabb m_aabb;
int m_ref;
};
class EntityDataList
{
public:
int AddRef(AZ::EntityId entityId);
int RemoveRef(AZ::EntityId entityId);
void Update(const EntityData& newData);
@@ -88,5 +86,5 @@ namespace AzFramework
AZStd::vector<AZStd::pair<const EntityData*, float>> m_candidatesSortedByDist;
AzFramework::EntityContextId m_contextId;
};
}
}
} // namespace RenderGeometry
} // namespace AzFramework