Open 3D Engine Atom Gem API Reference 26.05.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::RPI::ModelAsset Class Reference

#include <ModelAsset.h>

Inherits AZ::Data::AssetData.

Public Member Functions

 AZ_RTTI (ModelAsset, "{2C7477B6-69C5-45BE-8163-BCD6A275B6D8}", AZ::Data::AssetData)
 
 AZ_CLASS_ALLOCATOR (ModelAsset, AZ::SystemAllocator)
 
const Name & GetName () const
 Returns the human readable name of the model.
 
const AZ::Aabb & GetAabb () const
 Returns the model-space axis aligned bounding box.
 
const ModelMaterialSlotMap & GetMaterialSlots () const
 Returns the list of all ModelMaterialSlot's for the model, across all LODs.
 
const ModelMaterialSlotFindMaterialSlot (uint32_t stableId) const
 Find a material slot with the given stableId, or returns an invalid slot if it isn't found.
 
size_t GetLodCount () const
 Returns the number of Lods in the model.
 
AZStd::span< const Data::Asset< ModelLodAsset > > GetLodAssets () const
 
void AddRefBufferAssets ()
 
void ReleaseRefBufferAssets ()
 
bool SupportLocalRayIntersection () const
 Returns true if the ModelAsset contains data which is required by LocalRayIntersectionAgainstModel() function.
 
virtual bool LocalRayIntersectionAgainstModel (const AZ::Vector3 &rayStart, const AZ::Vector3 &rayDir, bool allowBruteForce, float &distanceNormalized, AZ::Vector3 &normal) const
 
const AZStd::vector< AZ::Name > & GetTags () const
 Returns the model tags.
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 

Static Public Attributes

static constexpr const char * DisplayName { "ModelAsset" }
 
static constexpr const char * Group { "Model" }
 
static constexpr const char * Extension { "azmodel" }
 

Friends

class ModelAssetCreator
 
class ModelAssetHelpers
 

Detailed Description

Contains a set of RPI::ModelLodAsset objects. Serialized to a .azmodel file. Actual model data is stored in the BufferAssets referenced by ModelLodAssets.

Member Function Documentation

◆ AddRefBufferAssets()

void AZ::RPI::ModelAsset::AddRefBufferAssets ( )

Increase reference for an overall reference count for all BufferAssets referenced by this ModelAsset When the ref count was 0, increase ref count would trigger block loading for all the BufferAssets

◆ LocalRayIntersectionAgainstModel()

virtual bool AZ::RPI::ModelAsset::LocalRayIntersectionAgainstModel ( const AZ::Vector3 &  rayStart,
const AZ::Vector3 &  rayDir,
bool  allowBruteForce,
float &  distanceNormalized,
AZ::Vector3 &  normal 
) const
virtual

Checks a ray for intersection against this model. The ray must be in the same coordinate space as the model. Important: only to be used in the Editor, it may kick off a job to calculate spatial information. [GFX TODO][ATOM-4343 Bake mesh spatial information during AP processing]

Parameters
rayStartThe starting point of the ray.
rayDirThe direction and length of the ray (magnitude is encoded in the direction).
allowBruteForceAllow for brute force queries while the mesh is baking (remove when ATOM-4343 is complete)
[out]distanceNormalizedIf an intersection is found, will be set to the normalized distance of the intersection (in the range 0.0-1.0) - to calculate the actual distance, multiply distanceNormalized by the magnitude of rayDir.
[out]normalIf an intersection is found, will be set to the normal at the point of collision.
Returns
True if the ray intersects the mesh.

◆ ReleaseRefBufferAssets()

void AZ::RPI::ModelAsset::ReleaseRefBufferAssets ( )

Reduce reference for an overall reference count for all BufferAssets referenced by this ModelAsset When the ref count reaches 0 after the reduce, it would release all the BufferAssets from the ModelAsset


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