MAGE  v0.171.0
Matthias Advanced Game Engine
mage::rendering::ModelDescriptor Class Reference

#include <model_descriptor.hpp>

Inheritance diagram for mage::rendering::ModelDescriptor:
mage::Resource< ModelDescriptor >

Public Member Functions

template<typename VertexT , typename IndexT >
 ModelDescriptor (ID3D11Device &device, ResourceManager &resource_manager, std::wstring fname, const MeshDescriptor< VertexT, IndexT > &desc=MeshDescriptor< VertexT, IndexT >(), bool export_as_MDL=false)
 
 ModelDescriptor (const ModelDescriptor &desc)=delete
 
 ModelDescriptor (ModelDescriptor &&desc) noexcept
 
virtual ~ModelDescriptor ()
 
ModelDescriptoroperator= (const ModelDescriptor &desc)=delete
 
ModelDescriptoroperator= (ModelDescriptor &&desc) noexcept
 
SharedPtr< const MeshGetMesh () const noexcept
 
const MaterialGetMaterial (std::string_view name) const noexcept
 
template<typename ActionT >
void ForEachMaterial (ActionT &&action) const
 
const ModelPartGetModelPart (std::string_view name) const noexcept
 
template<typename ActionT >
void ForEachModelPart (ActionT &&action) const
 
- Public Member Functions inherited from mage::Resource< ModelDescriptor >
 Resource (std::wstring guid) noexcept
 
 Resource (const Resource &resource)=delete
 
 Resource (Resource &&resource) noexcept
 
virtual ~Resource ()
 
Resourceoperator= (const Resource &resource)=delete
 
Resourceoperator= (Resource &&resource) noexcept
 
const std::wstring_view GetGuid () const noexcept
 
bool IsFileResource () const
 
const std::filesystem::path GetPath () const
 

Private Attributes

SharedPtr< const Meshm_mesh
 
std::vector< Materialm_materials
 
AlignedVector< ModelPartm_model_parts
 

Detailed Description

A class of model descriptors describing a complete model.

Constructor & Destructor Documentation

◆ ModelDescriptor() [1/3]

template<typename VertexT , typename IndexT >
mage::rendering::ModelDescriptor::ModelDescriptor ( ID3D11Device &  device,
ResourceManager resource_manager,
std::wstring  fname,
const MeshDescriptor< VertexT, IndexT > &  desc = MeshDescriptor< VertexT, IndexT >(),
bool  export_as_MDL = false 
)
explicit

Constructs a model descriptor.

Template Parameters
VertexTThe vertex type.
IndexTThe index type.
Parameters
[in,out]deviceA reference to the device.
[in,out]resource_managerA reference to the resource manager.
[in]fnameThe filename (the globally unique identifier).
[in]descA reference to the mesh descriptor.
[in]export_as_MDLtrue if the model descriptor needs to be exported as MDL file. false otherwise.
Exceptions
ExceptionFailed to initialize the model descriptor.

◆ ModelDescriptor() [2/3]

mage::rendering::ModelDescriptor::ModelDescriptor ( const ModelDescriptor desc)
delete

Constructs a model descriptor from the given model descriptor.

Parameters
[in]descA reference to the model descriptor to copy.

◆ ModelDescriptor() [3/3]

mage::rendering::ModelDescriptor::ModelDescriptor ( ModelDescriptor &&  desc)
defaultnoexcept

Constructs a model descriptor by moving the given model descriptor.

Parameters
[in]descA reference to the model descriptor to move.

◆ ~ModelDescriptor()

mage::rendering::ModelDescriptor::~ModelDescriptor ( )
virtualdefault

Destructs a model descriptor.

Member Function Documentation

◆ ForEachMaterial()

template<typename ActionT >
void mage::rendering::ModelDescriptor::ForEachMaterial ( ActionT &&  action) const

Traverses all materials of this model descriptor.

Template Parameters
ActionTAn action to perform on all materials of this model descriptor. The action must accept const Material& values.

◆ ForEachModelPart()

template<typename ActionT >
void mage::rendering::ModelDescriptor::ForEachModelPart ( ActionT &&  action) const

Traverses all model parts of this model descriptor.

Template Parameters
ActionTAn action to perform on all model parts of this model descriptor. The action must accept const ModelPart& values.

◆ GetMaterial()

const Material * mage::rendering::ModelDescriptor::GetMaterial ( std::string_view  name) const
noexcept

Returns the material corresponding to the given name.

Parameters
[in]nameThe name of the material.
Returns
nullptr if this model descriptor contains no material matching the given name name.
A pointer to the material of this model descriptor matching the given name name.

◆ GetMesh()

SharedPtr< const Mesh > mage::rendering::ModelDescriptor::GetMesh ( ) const
noexcept

Returns the mesh of this model descriptor.

Returns
A pointer to the mesh of this model descriptor.

◆ GetModelPart()

const ModelPart * mage::rendering::ModelDescriptor::GetModelPart ( std::string_view  name) const
noexcept

Returns the model part corresponding to the given name.

Parameters
[in]nameThe name of the model part.
Returns
nullptr if this model descriptor contains no model part matching the given name name.
A pointer to the model part of this model descriptor matching the given name name.

◆ operator=() [1/2]

ModelDescriptor& mage::rendering::ModelDescriptor::operator= ( const ModelDescriptor desc)
delete

Copies the given model descriptor to this model descriptor.

Parameters
[in]descA reference to the model descriptor to copy.

◆ operator=() [2/2]

ModelDescriptor & mage::rendering::ModelDescriptor::operator= ( ModelDescriptor &&  desc)
defaultnoexcept

Moves the given model descriptor to this model descriptor.

Parameters
[in]descA reference to the model descriptor to move.

Member Data Documentation

◆ m_materials

std::vector< Material > mage::rendering::ModelDescriptor::m_materials
private

A vector containing all the materials of the model of this model descriptor.

◆ m_mesh

SharedPtr< const Mesh > mage::rendering::ModelDescriptor::m_mesh
private

A pointer to the mesh of the model of this model descriptor.

◆ m_model_parts

AlignedVector< ModelPart > mage::rendering::ModelDescriptor::m_model_parts
private

A vector containing all the model parts of the model of this model descriptor.