Simulant  21.06-50
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
Public Types | Public Member Functions | Friends | List of all members
smlt::Mesh Class Reference
Inheritance diagram for smlt::Mesh:
smlt::Boundable smlt::Asset smlt::Loadable smlt::RefCounted< Mesh > smlt::generic::Identifiable< MeshID > smlt::KeyFrameAnimated smlt::ChainNameable< Mesh > smlt::Nameable smlt::TwoPhaseConstructed smlt::Nameable

Public Types

typedef sig::signal< void(Skeleton *)> SkeletonAddedSignal
 
typedef sig::signal< void(MeshID, SubMeshPtr)> SubMeshCreatedCallback
 
typedef sig::signal< void(MeshID, SubMeshPtr)> SubMeshDestroyedCallback
 
typedef sig::signal< void(MeshID, SubMeshPtr, MaterialSlot, MaterialID, MaterialID)> SubMeshMaterialChangedCallback
 
- Public Types inherited from smlt::RefCounted< Mesh >
typedef std::shared_ptr< Meshptr
 
typedef std::weak_ptr< Meshwptr
 
- Public Types inherited from smlt::generic::Identifiable< MeshID >
typedef MeshID id_type
 

Public Member Functions

 Mesh (MeshID id, AssetManager *asset_manager, VertexDataPtr vertex_data)
 
 Mesh (MeshID id, AssetManager *asset_manager, VertexSpecification vertex_specification)
 
void reset (VertexDataPtr vertex_data)
 
void reset (VertexSpecification vertex_specification)
 
bool add_skeleton (uint32_t num_joints)
 
bool has_skeleton () const
 
SubMeshPtr new_submesh_with_material (const std::string &name, MaterialID material, MeshArrangement arrangement=MESH_ARRANGEMENT_TRIANGLES, IndexType=INDEX_TYPE_16_BIT)
 
SubMeshPtr new_submesh_with_material (const std::string &name, MaterialID material, IndexDataPtr index_data, MeshArrangement arrangement=MESH_ARRANGEMENT_TRIANGLES)
 
SubMeshPtr new_submesh (const std::string &name, MeshArrangement arrangement=MESH_ARRANGEMENT_TRIANGLES, IndexType=INDEX_TYPE_16_BIT)
 
SubMeshPtr new_submesh (const std::string &name, IndexDataPtr index_data, MeshArrangement arrangement=MESH_ARRANGEMENT_TRIANGLES)
 
SubMeshPtr new_submesh_as_capsule (const std::string &name, MaterialID material, float diameter, float length, std::size_t segment_count, std::size_t vertical_segment_count, std::size_t ring_count)
 
SubMeshPtr new_submesh_as_sphere (const std::string &name, MaterialID material, float diameter, std::size_t slices, std::size_t stacks)
 
SubMeshPtr new_submesh_as_icosphere (const std::string &name, MaterialID material, float diameter, uint32_t subdivisions)
 
SubMeshPtr new_submesh_as_rectangle (const std::string &name, MaterialID material, float width, float height, const Vec3 &offset=Vec3())
 
SubMeshPtr new_submesh_as_cube (const std::string &name, MaterialID material, float size)
 
SubMeshPtr new_submesh_as_box (const std::string &name, MaterialID material, float width, float height, float depth, const Vec3 &offset=Vec3())
 
uint32_t submesh_count () const
 
bool has_submesh (const std::string &name) const
 
SubMeshPtr find_submesh (const std::string &name) const
 
SubMeshPtr first_submesh () const
 
void destroy_submesh (const std::string &name)
 
void set_material (MaterialPtr material)
 Apply material to all submeshes.
 
void set_diffuse (const smlt::Colour &colour)
 Override vertex colour on all vertices.
 
void reverse_winding ()
 Reverse the winding of all submeshes.
 
const AABBaabb () const
 
void normalize ()
 
void transform_vertices (const smlt::Mat4 &transform)
 
SubMeshIteratorPair each_submesh () const
 
void enable_animation (MeshAnimationType animation_type, uint32_t animation_frames, FrameUnpackerPtr data)
 
bool is_animated () const
 
uint32_t animation_frames () const
 
MeshAnimationType animation_type () const
 
void generate_adjacency_info ()
 
bool has_adjacency_info () const
 
 DEFINE_SIGNAL (SkeletonAddedSignal, signal_skeleton_added)
 
SubMeshCreatedCallbacksignal_submesh_created ()
 
SubMeshDestroyedCallbacksignal_submesh_destroyed ()
 
SubMeshMaterialChangedCallbacksignal_submesh_material_changed ()
 
 S_DEFINE_PROPERTY (adjacency_info, &Mesh::adjacency_)
 
 S_DEFINE_PROPERTY (vertex_data, &Mesh::vertex_data_)
 
 S_DEFINE_PROPERTY (skeleton, &Mesh::skeleton_)
 
- Public Member Functions inherited from smlt::Boundable
virtual float width () const
 
virtual float height () const
 
virtual float depth () const
 
virtual float half_width () const
 
virtual float half_height () const
 
virtual float half_depth () const
 
virtual float diameter () const
 
virtual float radius () const
 
- Public Member Functions inherited from smlt::Asset
 Asset (AssetManager *manager)
 
AssetManagerasset_manager ()
 
const AssetManagerasset_manager () const
 
int age () const
 
void set_garbage_collection_method (GarbageCollectMethod method)
 
- Public Member Functions inherited from smlt::Nameable
void set_name (const std::string &name)
 
const std::string & name () const
 
bool has_name () const
 
- Public Member Functions inherited from smlt::TwoPhaseConstructed
virtual bool init ()
 
virtual void clean_up ()
 
- Public Member Functions inherited from smlt::generic::Identifiable< MeshID >
 Identifiable (MeshID id)
 
MeshID id () const
 
virtual bool operator== (const Identifiable< MeshID > &rhs) const
 
virtual bool operator< (const Identifiable< MeshID > &rhs) const
 
void _bind_id_pointer (ResourceTypePtr ptr)
 
void _overwrite_id (MeshID new_id)
 
- Public Member Functions inherited from smlt::KeyFrameAnimated
void add_sequence (const std::string &name, const std::vector< AnimationSequenceStage > &stages)
 
void add_animation (const std::string &name, uint32_t start_frame, uint32_t end_frame, float fps)
 
void add_animation (const std::string &name, uint32_t start_frame, uint32_t end_frame)
 
bool has_animations () const
 
uint32_t animation_count () const
 
void set_default_fps (float fps)
 
float default_fps () const
 
- Public Member Functions inherited from smlt::ChainNameable< Mesh >
Meshset_name_and_get (const std::string &name)
 

Friends

class SubMesh
 
class Actor
 

Additional Inherited Members

- Static Public Member Functions inherited from smlt::RefCounted< Mesh >
static RefCounted< Mesh >::ptr create (Args &&... args)
 
static RefCounted< Mesh >::ptr create ()
 
- Public Attributes inherited from smlt::Asset
Property< generic::DataCarrier Asset::* > data = {this, &Asset::data_}
 
- Protected Types inherited from smlt::KeyFrameAnimated
typedef std::unordered_map< std::string, std::shared_ptr< Animation > > AnimationMap
 
- Protected Member Functions inherited from smlt::Asset
 Asset (const Asset &rhs)
 
Assetoperator= (const Asset &rhs)
 
- Protected Member Functions inherited from smlt::RefCounted< Mesh >
 RefCounted (Args &&...)
 
- Protected Member Functions inherited from smlt::KeyFrameAnimated
Animationanimation (const std::string &name)
 
- Protected Attributes inherited from smlt::KeyFrameAnimated
AnimationMap animations_
 
std::string first_animation_
 

Constructor & Destructor Documentation

◆ Mesh() [1/2]

smlt::Mesh::Mesh ( MeshID  id,
AssetManager asset_manager,
VertexDataPtr  vertex_data 
)

Construct a mesh using a shared VertexData instance.

This is useful for having different resolutions of mesh (e.g. same vertex data, different indices)

◆ Mesh() [2/2]

smlt::Mesh::Mesh ( MeshID  id,
AssetManager asset_manager,
VertexSpecification  vertex_specification 
)

Construct a mesh using a VertexSpecification.

This creates a unique VertexData instance for this mesh.


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