ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
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.
void setBounds (const ObjectBounds &newBounds)
 Sets a new object oriented bounding box for this object.
ObjectBounds getBounds () const
 Returns the latest computed bounding box encapsulating the model in its untransformed state.
const bool boundsNeedRecompute () const
 Indicates whether this static model requires its bounding box recomputed.
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.
ObjectBounds mCoarseBounds {}
 The coarse object bounds for this model, used mainly for mouse picking.
bool mCoarseBoundsDirty { true }
 Whether any of the meshes under this object has been modified, requiring a recompute of this object's bounds.

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

◆ boundsNeedRecompute()

const bool ToyMaker::StaticModel::boundsNeedRecompute ( ) const
inline

Indicates whether this static model requires its bounding box recomputed.

Usually done at start up, or when an underlying mesh has been modified.

◆ getComponentTypeName()

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()

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

Gets the resource type string for this object.

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

◆ setBounds()

void ToyMaker::StaticModel::setBounds ( const ObjectBounds & newBounds)
inline

Sets a new object oriented bounding box for this object.

This is usually done once at start up, or when an underlying mesh has been modified.


The documentation for this class was generated from the following files:
  • ToyMaker_Main/include/toymaker/engine/model.hpp
  • ToyMaker_Main/src/model.cpp