Open 3D Engine AzFramework API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzFramework::OcclusionRequests Class Referenceabstract

OcclusionRequests provides an interface for integrating with occlusion culling systems. Use the interface to create occlusion views that configure the camera state and context for making occlusion queries. Creating multiple occlusion views also allows queries to be made across multiple threads. More...

#include <OcclusionBus.h>

Inherits AZ::EBusTraits.

Public Types

using BusIdType = AzFramework::EntityContextId
 
using MutexType = AZStd::recursive_mutex
 

Public Member Functions

virtual void ClearOcclusionViewDebugInfo ()=0
 Clear previously collected debug rendering lines and statistics.
 
virtual bool IsOcclusionViewValid (const AZ::Name &viewName) const =0
 Check if an occlusion view exists with the specified name. More...
 
virtual bool CreateOcclusionView (const AZ::Name &viewName)=0
 Create an occlusion view using the specified name. After the view is created, the name can be used to look up the view and make updates or queries against it. More than one occlusion view can be created at a time and used across threads. More...
 
virtual bool DestroyOcclusionView (const AZ::Name &viewName)=0
 Destroy a previously created occlusion view. More...
 
virtual bool UpdateOcclusionView (const AZ::Name &viewName, const AZ::Vector3 &cameraWorldPos, const AZ::Matrix4x4 &cameraWorldToClip)=0
 Update the occlusion view from the given camera perspective. More...
 
virtual OcclusionState GetOcclusionViewEntityVisibility (const AZ::Name &viewName, const AZ::EntityId &entityId) const =0
 Determine if an entity is visible within the specified occlusion view. More...
 
virtual OcclusionState GetOcclusionViewAabbVisibility (const AZ::Name &viewName, const AZ::Aabb &bounds) const =0
 Determine if an AABB is visible within the specified occlusion view. More...
 
virtual AZStd::vector< OcclusionState > GetOcclusionViewAabbToAabbVisibility (const AZ::Name &viewName, const AZ::Aabb &sourceAabb, const AZStd::vector< AZ::Aabb > &targetAabbs) const =0
 Test if target bounding volumes are visible from the perspective of a source bounding volume, within a volume extruded between them. More...
 
virtual AZStd::vector< OcclusionState > GetOcclusionViewSphereToSphereVisibility (const AZ::Name &viewName, const AZ::Sphere &sourceSphere, const AZStd::vector< AZ::Sphere > &targetSpheres) const =0
 Test if target bounding volumes are visible from the perspective of a source bounding volume, within a volume extruded between them. More...
 
virtual AZStd::vector< OcclusionState > GetOcclusionViewEntityToEntityVisibility (const AZ::Name &viewName, const AZ::EntityId &sourceEntityId, const AZStd::vector< AZ::EntityId > &targetEntityIds) const =0
 Test if target entity AABBs are visible from the perspective of a source entity AABB, within a volume extruded between them. More...
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 

Static Public Attributes

static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple
 
static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById
 

Detailed Description

OcclusionRequests provides an interface for integrating with occlusion culling systems. Use the interface to create occlusion views that configure the camera state and context for making occlusion queries. Creating multiple occlusion views also allows queries to be made across multiple threads.

The bus must be connected to an entity context ID for an entity context containing objects that contribute to or interacting with the occlusion scene.

Member Function Documentation

◆ CreateOcclusionView()

virtual bool AzFramework::OcclusionRequests::CreateOcclusionView ( const AZ::Name &  viewName)
pure virtual

Create an occlusion view using the specified name. After the view is created, the name can be used to look up the view and make updates or queries against it. More than one occlusion view can be created at a time and used across threads.

Parameters
viewNameUnique name of the view to create
Returns
true if a view with the given name was created and registered with the system, otherwise false.

◆ DestroyOcclusionView()

virtual bool AzFramework::OcclusionRequests::DestroyOcclusionView ( const AZ::Name &  viewName)
pure virtual

Destroy a previously created occlusion view.

Parameters
viewNameUnique name of the view to destroy
Returns
true if a view with the given name was destroyed and removed from the system, otherwise false.

◆ GetOcclusionViewAabbToAabbVisibility()

virtual AZStd::vector<OcclusionState> AzFramework::OcclusionRequests::GetOcclusionViewAabbToAabbVisibility ( const AZ::Name &  viewName,
const AZ::Aabb &  sourceAabb,
const AZStd::vector< AZ::Aabb > &  targetAabbs 
) const
pure virtual

Test if target bounding volumes are visible from the perspective of a source bounding volume, within a volume extruded between them.

Parameters
viewNameUnique name of the view to query
sourceAabbSource bounding volume defining the frame of reference for visibility tests.
targetAabbsVector of target bounding volumes that will be tested for visibility.
Returns
A vector of OcclusionState values classifying the input target bounds as unknown, hidden, or visible. The size of the returned container should match the size of the input target container unless an error occurred, in which case an empty vector is returned.

◆ GetOcclusionViewAabbVisibility()

virtual OcclusionState AzFramework::OcclusionRequests::GetOcclusionViewAabbVisibility ( const AZ::Name &  viewName,
const AZ::Aabb &  bounds 
) const
pure virtual

Determine if an AABB is visible within the specified occlusion view.

Parameters
viewNameUnique name of the view to query for AABB visibility
boundsWorld AABB to test for visibility
Returns
OcclusionState value classifying the AABB as unknown, hidden, or visible.

◆ GetOcclusionViewEntityToEntityVisibility()

virtual AZStd::vector<OcclusionState> AzFramework::OcclusionRequests::GetOcclusionViewEntityToEntityVisibility ( const AZ::Name &  viewName,
const AZ::EntityId &  sourceEntityId,
const AZStd::vector< AZ::EntityId > &  targetEntityIds 
) const
pure virtual

Test if target entity AABBs are visible from the perspective of a source entity AABB, within a volume extruded between them.

Parameters
viewNameUnique name of the view to query
sourceEntityIdId for the source entity defining the frame of reference for visibility tests.
targetEntityIdsVector of target entity Ids that will be tested for visibility.
Returns
A vector of OcclusionState values classifying the input target entities as unknown, hidden, or visible. The size of the returned container should match the size of the input target container unless an error occurred, in which case an empty vector is returned.

◆ GetOcclusionViewEntityVisibility()

virtual OcclusionState AzFramework::OcclusionRequests::GetOcclusionViewEntityVisibility ( const AZ::Name &  viewName,
const AZ::EntityId &  entityId 
) const
pure virtual

Determine if an entity is visible within the specified occlusion view.

Parameters
viewNameUnique name of the view to query for entity visibility
entityIdID of the entity to test for visibility
Returns
OcclusionState value classifying the entity as unknown, hidden, or visible.

◆ GetOcclusionViewSphereToSphereVisibility()

virtual AZStd::vector<OcclusionState> AzFramework::OcclusionRequests::GetOcclusionViewSphereToSphereVisibility ( const AZ::Name &  viewName,
const AZ::Sphere &  sourceSphere,
const AZStd::vector< AZ::Sphere > &  targetSpheres 
) const
pure virtual

Test if target bounding volumes are visible from the perspective of a source bounding volume, within a volume extruded between them.

Parameters
viewNameUnique name of the view to query
sourceSphereSource bounding volume for the frame of reference for visibility tests.
targetSpheresVector of target bounding volumes that will be tested for visibility.
Returns
A vector of OcclusionState values classifying the input target bounds as unknown, hidden, or visible. The size of the returned container should match the size of the input target container unless an error occurred, in which case an empty vector is returned.

◆ IsOcclusionViewValid()

virtual bool AzFramework::OcclusionRequests::IsOcclusionViewValid ( const AZ::Name &  viewName) const
pure virtual

Check if an occlusion view exists with the specified name.

Parameters
viewNameUnique name of the view to check
Returns
true if a view with the given name exists, otherwise false.

◆ UpdateOcclusionView()

virtual bool AzFramework::OcclusionRequests::UpdateOcclusionView ( const AZ::Name &  viewName,
const AZ::Vector3 &  cameraWorldPos,
const AZ::Matrix4x4 &  cameraWorldToClip 
)
pure virtual

Update the occlusion view from the given camera perspective.

Parameters
viewNameUnique name of the view to update
cameraWorldPosWorld position of the camera view
cameraWorldToClipMatrix transforming vertices from world space to clip space for occlusion tests
Returns
true if a view with the given name was updated, otherwise false.

The documentation for this class was generated from the following file: