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

Inherits Data::InstanceData.

Public Member Functions

 AZ_INSTANCE_DATA (Model, "{C30F5522-B381-4B38-BBAF-6E0B1885C8B9}")
 
 AZ_CLASS_ALLOCATOR (Model, AZ::SystemAllocator)
 
void WaitForUpload ()
 
size_t GetLodCount () const
 Returns the number of Lods in the model.
 
AZStd::span< const Data::Instance< ModelLod > > GetLods () const
 Returns the full list of Lods, where index 0 is the most detailed, and N-1 is the least.
 
bool IsUploadPending () const
 Returns whether a buffer upload is pending.
 
const Data::Asset< ModelAsset > & GetModelAsset () const
 
bool LocalRayIntersection (const AZ::Vector3 &rayStart, const AZ::Vector3 &rayDir, float &distanceNormalized, AZ::Vector3 &normal) const
 
bool RayIntersection (const AZ::Transform &modelTransform, const AZ::Vector3 &nonUniformScale, const AZ::Vector3 &rayStart, const AZ::Vector3 &rayDir, float &distanceNormalized, AZ::Vector3 &normal) const
 
const AZStd::unordered_set< AZ::Name > & GetUvNames () const
 Get available UV names from the model and its lods.
 

Static Public Member Functions

static Data::Instance< ModelFindOrCreate (const Data::Asset< ModelAsset > &modelAsset)
 
static void TEMPOrphanFromDatabase (const Data::Asset< ModelAsset > &modelAsset)
 

Friends

class ModelSystem
 

Member Function Documentation

◆ LocalRayIntersection()

bool AZ::RPI::Model::LocalRayIntersection ( const AZ::Vector3 &  rayStart,
const AZ::Vector3 &  rayDir,
float &  distanceNormalized,
AZ::Vector3 &  normal 
) const

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 during AP processing]

Parameters
rayStartThe starting point of the ray.
rayDirThe direction and length of the ray (magnitude is encoded in the direction).
[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.

◆ RayIntersection()

bool AZ::RPI::Model::RayIntersection ( const AZ::Transform &  modelTransform,
const AZ::Vector3 &  nonUniformScale,
const AZ::Vector3 &  rayStart,
const AZ::Vector3 &  rayDir,
float &  distanceNormalized,
AZ::Vector3 &  normal 
) const

Checks a ray for intersection against this model, where the ray is in a different coordinate space. 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 during AP processing]

Parameters
modelTransforma transform that puts the model into the ray's coordinate space
nonUniformScaleNon-uniform scale applied in the model's local frame.
rayStartThe starting point of the ray.
rayDirThe direction and length of the ray (magnitude is encoded in the direction).
[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.

◆ TEMPOrphanFromDatabase()

static void AZ::RPI::Model::TEMPOrphanFromDatabase ( const Data::Asset< ModelAsset > &  modelAsset)
static

Orphan the model, its lods, and all their buffers so that they can be replaced in the instance database This is a temporary function, that will be removed once the Model/ModelAsset classes no longer need it

◆ WaitForUpload()

void AZ::RPI::Model::WaitForUpload ( )

Blocks the CPU until the streaming upload is complete. Returns immediately if no streaming upload is currently pending.


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