Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
ToyMaker::StaticModel Class Reference

This engine's representation of a single unrigged 3D model. More...

#include <model.hpp>

Inheritance diagram for ToyMaker::StaticModel:
ToyMaker::Resource< StaticModel > ToyMaker::IResource

Public Member Functions

 StaticModel (const std::vector< std::shared_ptr< StaticMesh > > &meshHandles, const std::vector< std::shared_ptr< Material > > &materialHandles)
 Constructs a model out of a list of handles to meshes and materials.
 
 ~StaticModel ()
 Model destructor.
 
 StaticModel (StaticModel &&other)
 Move constructor.
 
 StaticModel (const StaticModel &other)
 Copy constructor.
 
StaticModeloperator= (StaticModel &&other)
 Move assignment.
 
StaticModeloperator= (const StaticModel &other)
 Copy assignment.
 
std::vector< std::shared_ptr< StaticMesh > > getMeshHandles () const
 Gets the list of StaticMeshes associated with this Model object.
 
std::vector< std::shared_ptr< Material > > getMaterialHandles () const
 Gets the materials associated with this model object.
 
- Public Member Functions inherited from ToyMaker::Resource< StaticModel >
std::string getResourceTypeName_ () const override
 Get the resource type string for this resource.
 
- Public Member Functions inherited from ToyMaker::IResource
virtual ~IResource ()=default
 Destroy the IResource object.
 

Static Public Member Functions

static std::string getResourceTypeName ()
 Gets the resource type string for this object.
 
static std::string getComponentTypeName ()
 Gets the component type string for this object.
 

Private Member Functions

void free ()
 Utility method for destroying resources associated with this model.
 
void stealResources (StaticModel &other)
 Utility method for taking resources from another instance of this class.
 
void copyResources (const StaticModel &other)
 Utility method for deeply replicating resources from another instance of this class.
 
void destroyResource ()
 Destroys the resources associated with this object.
 
void releaseResource ()
 Releases resources associated with this object so that they may be claimed by another part of the program.
 

Private Attributes

std::vector< std::shared_ptr< StaticMesh > > mMeshHandles {}
 The meshes that make up this model.
 
std::vector< std::shared_ptr< Material > > mMaterialHandles {}
 The materials that correspond to each mesh on this model.
 

Additional Inherited Members

- Protected Member Functions inherited from ToyMaker::Resource< StaticModel >
 Resource (int explicitlyInitializeMe)
 Construct a new resource object.
 
- Protected Member Functions inherited from ToyMaker::IResource
 IResource ()=default
 Construct a new IResource object.
 
- Static Protected Member Functions inherited from ToyMaker::IResource
template<typename TResource>
static void RegisterResource ()
 Registers this resource as a Resource type with the ResourceDatabase.
 

Detailed Description

This engine's representation of a single unrigged 3D model.

This object:

  • Stores references to all the meshes used by the model
  • Stores the hierarchical relationship between the meshes
  • Stores material properties used by shaders for each mesh
See also
toymaker/core/ecs_world_resource_ext.hpp

Constructor & Destructor Documentation

◆ StaticModel()

StaticModel::StaticModel ( const std::vector< std::shared_ptr< StaticMesh > > & meshHandles,
const std::vector< std::shared_ptr< Material > > & materialHandles )

Constructs a model out of a list of handles to meshes and materials.

Every mesh in the mesh list must have its material reference in the same index of the material list.

Parameters
meshHandlesList of meshes making up this model.
materialHandlesThe materials corresponding to each mesh.

Member Function Documentation

◆ getComponentTypeName()

static std::string ToyMaker::StaticModel::getComponentTypeName ( )
inlinestatic

Gets the component type string for this object.

Returns
std::string This type's component type string.

◆ getMaterialHandles()

std::vector< std::shared_ptr< Material > > StaticModel::getMaterialHandles ( ) const

Gets the materials associated with this model object.

Returns
std::vector<std::shared_ptr<Material>> This model's materials.

◆ getMeshHandles()

std::vector< std::shared_ptr< StaticMesh > > StaticModel::getMeshHandles ( ) const

Gets the list of StaticMeshes associated with this Model object.

Returns
std::vector<std::shared_ptr<StaticMesh>> This model's meshes.

◆ getResourceTypeName()

static std::string ToyMaker::StaticModel::getResourceTypeName ( )
inlinestatic

Gets the resource type string for this object.

Returns
std::string This type's resource type string.

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