Open 3D Engine Atom Gem API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Public Member Functions | Static Public Member Functions | List of all members
AZ::Render::MeshFeatureProcessor Class Referencefinal

This feature processor handles static and dynamic non-skinned meshes. More...

#include <MeshFeatureProcessor.h>

Inherits AZ::Render::MeshFeatureProcessorInterface.

Public Member Functions

 AZ_RTTI (AZ::Render::MeshFeatureProcessor, "{6E3DFA1D-22C7-4738-A3AE-1E10AB88B29B}", MeshFeatureProcessorInterface)
 
void Activate () override
 Creates pools, buffers, and buffer views.
 
void Deactivate () override
 Releases GPU resources.
 
void Simulate (const FeatureProcessor::SimulatePacket &packet) override
 Updates GPU buffers with latest data from render proxies.
 
void OnBeginPrepareRender () override
 
void OnEndPrepareRender () override
 
TransformServiceFeatureProcessorInterface::ObjectId GetObjectId (const MeshHandle &meshHandle) const override
 Returns the object id for a mesh handle.
 
MeshHandle AcquireMesh (const MeshHandleDescriptor &descriptor, const MaterialAssignmentMap &materials={}) override
 
MeshHandle AcquireMesh (const MeshHandleDescriptor &descriptor, const Data::Instance< RPI::Material > &material) override
 Acquires a model with a single material applied to all its meshes.
 
bool ReleaseMesh (MeshHandle &meshHandle) override
 Releases the mesh handle.
 
MeshHandle CloneMesh (const MeshHandle &meshHandle) override
 Creates a new instance and handle of a mesh using an existing MeshId. Currently, this will reset the new mesh to default materials.
 
Data::Instance< RPI::ModelGetModel (const MeshHandle &meshHandle) const override
 Gets the underlying RPI::Model instance for a meshHandle. May be null if the model has not loaded.
 
Data::Asset< RPI::ModelAssetGetModelAsset (const MeshHandle &meshHandle) const override
 Gets the underlying RPI::ModelAsset for a meshHandle.
 
const AZStd::vector< Data::Instance< RPI::ShaderResourceGroup > > & GetObjectSrgs (const MeshHandle &meshHandle) const override
 
void QueueObjectSrgForCompile (const MeshHandle &meshHandle) const override
 Queues the object srg for compile.
 
void SetMaterialAssignmentMap (const MeshHandle &meshHandle, const Data::Instance< RPI::Material > &material) override
 
void SetMaterialAssignmentMap (const MeshHandle &meshHandle, const MaterialAssignmentMap &materials) override
 Sets the MaterialAssignmentMap for a meshHandle.
 
const MaterialAssignmentMap & GetMaterialAssignmentMap (const MeshHandle &meshHandle) const override
 Gets the MaterialAssignmentMap for a meshHandle.
 
void ConnectModelChangeEventHandler (const MeshHandle &meshHandle, ModelChangedEvent::Handler &handler) override
 Connects a handler to any changes to an RPI::Model. Changes include loading and reloading.
 
void SetTransform (const MeshHandle &meshHandle, const AZ::Transform &transform, const AZ::Vector3 &nonUniformScale=AZ::Vector3::CreateOne()) override
 
Transform GetTransform (const MeshHandle &meshHandle) override
 Gets the transform for a given mesh handle.
 
Vector3 GetNonUniformScale (const MeshHandle &meshHandle) override
 Gets the non-uniform scale for a given mesh handle.
 
void SetLocalAabb (const MeshHandle &meshHandle, const AZ::Aabb &localAabb) override
 Sets the local space bbox for a given mesh handle. You don't need to call this for static models, only skinned/animated models.
 
AZ::Aabb GetLocalAabb (const MeshHandle &meshHandle) const override
 Gets the local space bbox for a given mesh handle. Unless SetLocalAabb has been called before, this will be the bbox of the model asset.
 
void SetSortKey (const MeshHandle &meshHandle, RHI::DrawItemSortKey sortKey) override
 Sets the sort key for a given mesh handle.
 
RHI::DrawItemSortKey GetSortKey (const MeshHandle &meshHandle) const override
 Gets the sort key for a given mesh handle.
 
void SetMeshLodConfiguration (const MeshHandle &meshHandle, const RPI::Cullable::LodConfiguration &meshLodConfig) override
 Sets LOD mesh configurations to be used in the Mesh Feature Processor.
 
RPI::Cullable::LodConfiguration GetMeshLodConfiguration (const MeshHandle &meshHandle) const override
 Gets the LOD mesh configurations being used in the Mesh Feature Processor.
 
void SetExcludeFromReflectionCubeMaps (const MeshHandle &meshHandle, bool excludeFromReflectionCubeMaps) override
 Sets the option to exclude this mesh from baked reflection probe cubemaps.
 
void SetRayTracingEnabled (const MeshHandle &meshHandle, bool rayTracingEnabled) override
 Sets the option to exclude this mesh from raytracing.
 
bool GetRayTracingEnabled (const MeshHandle &meshHandle) const override
 Gets whether this mesh is excluded from raytracing.
 
void SetVisible (const MeshHandle &meshHandle, bool visible) override
 Sets the mesh as visible or hidden. When the mesh is hidden it will not be rendered by the feature processor.
 
void SetUseForwardPassIblSpecular (const MeshHandle &meshHandle, bool useForwardPassIblSpecular) override
 Sets the mesh to render IBL specular in the forward pass.
 
void UpdateMeshReflectionProbes ()
 
- Public Member Functions inherited from AZ::Render::MeshFeatureProcessorInterface
 AZ_RTTI (AZ::Render::MeshFeatureProcessorInterface, "{975D7F0C-2E7E-4819-94D0-D3C4E2024721}", FeatureProcessor)
 
virtual void SetTransform (const MeshHandle &meshHandle, const Transform &transform, const Vector3 &nonUniformScale=Vector3::CreateOne())=0
 Sets the transform for a given mesh handle.
 
- Public Member Functions inherited from AZ::RPI::FeatureProcessor
 AZ_RTTI (FeatureProcessor, "{B8027170-C65C-4237-964D-B557FC9D7575}")
 
 AZ_CLASS_ALLOCATOR (FeatureProcessor, AZ::SystemAllocator, 0)
 
SceneGetParentScene () const
 
virtual void ApplyRenderPipelineChange (RenderPipeline *)
 Apply changes and add additional render passes to the render pipeline from the feature processors.
 
virtual void PrepareViews (const PrepareViewsPacket &, AZStd::vector< AZStd::pair< PipelineViewTag, ViewPtr >> &)
 
virtual void Simulate (const SimulatePacket &)
 
virtual void Render (const RenderPacket &)
 
virtual void OnRenderEnd ()
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 

Additional Inherited Members

- Public Types inherited from AZ::Render::MeshFeatureProcessorInterface
using MeshHandle = StableDynamicArrayHandle< ModelDataInstance >
 
using ModelChangedEvent = Event< const Data::Instance< RPI::Model > >
 
- Protected Member Functions inherited from AZ::RPI::FeatureProcessor
void EnableSceneNotification ()
 
void DisableSceneNotification ()
 

Detailed Description

This feature processor handles static and dynamic non-skinned meshes.

Member Function Documentation

◆ AcquireMesh()

MeshHandle AZ::Render::MeshFeatureProcessor::AcquireMesh ( const MeshHandleDescriptor descriptor,
const MaterialAssignmentMap &  materials = {} 
)
overridevirtual

Acquires a model with an optional collection of material assignments.

Parameters
requiresCloneCallbackThe callback indicates whether cloning is required for a given model asset.

Implements AZ::Render::MeshFeatureProcessorInterface.

◆ GetObjectSrgs()

const AZStd::vector<Data::Instance<RPI::ShaderResourceGroup> >& AZ::Render::MeshFeatureProcessor::GetObjectSrgs ( const MeshHandle meshHandle) const
overridevirtual

Gets the ObjectSrgs for a meshHandle. Updating the ObjectSrgs should be followed by a call to QueueObjectSrgForCompile, instead of compiling the srgs directly. This way, if the srgs have already been queued for compile, they will not be queued twice in the same frame. The ObjectSrgs should not be updated during Simulate, or it will create a race between updating the data and the call to Compile Cases where there may be multiple ObjectSrgs: if a model has multiple submeshes and those submeshes use different materials with different object SRGs.

Implements AZ::Render::MeshFeatureProcessorInterface.

◆ SetMaterialAssignmentMap()

void AZ::Render::MeshFeatureProcessor::SetMaterialAssignmentMap ( const MeshHandle meshHandle,
const Data::Instance< RPI::Material > &  material 
)
overridevirtual

Sets the MaterialAssignmentMap for a meshHandle, using just a single material for the DefaultMaterialAssignmentId. Note if there is already a material assignment map, this will replace the entire map with just a single material.

Implements AZ::Render::MeshFeatureProcessorInterface.


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