Couch
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Mesh Class Reference

#include <Mesh.h>

Inheritance diagram for Mesh:
Inheritance graph
[legend]
Collaboration diagram for Mesh:
Collaboration graph
[legend]

Public Member Functions

int GetNumSubmeshes ()
 
Material GetMaterial (int submesh)
 
void SetMaterial (int submesh, Material material)
 
virtual void Draw (Shader *shader)
 
virtual MeshCreate ()
 
virtual MeshDuplicate ()
 
virtual MeshInstance ()
 
virtual Name GetType () const
 
- Public Member Functions inherited from Spatial
Transform GetTransform ()
 
void SetTransform (Transform transform)
 
Transform GetGlobalTransform ()
 
void SetGlobalTransform (Transform globalTransform)
 
virtual void Translate (Vector3 offset)
 
void RotateX (float phi)
 
void RotateY (float phi)
 
void RotateZ (float phi)
 
void UniformScale (float scale)
 
- Public Member Functions inherited from Node
 Node (bool isPrefab)
 
bool IsPrefab ()
 
NodeList GetChildren ()
 
void AddChild (Node *child)
 
NodeGetParent ()
 
void QueueFree ()
 
void DoFree ()
 

Static Public Member Functions

static MeshFromFile (const char *filename)
 
- Static Public Member Functions inherited from Node
static NodeGetRoot ()
 

Protected Member Functions

virtual void SetupMesh ()
 

Protected Attributes

SubMeshList submeshes
 

Friends

class MeshCollisionShape
 

Detailed Description

Mesh and its subclasses are anything that can be rendered on screen. A mesh is made up of submeshes, each of which can have one material property.

Member Function Documentation

◆ Create()

Mesh * Mesh::Create ( )
virtual

Allocates a new "default" version of this node.

Returns
A reference to the node.

Reimplemented from Spatial.

◆ Draw()

void Mesh::Draw ( Shader shader)
virtual

Draw this mesh, by calling Draw on all submeshes. The shader will be updated on each call to the material property of the submesh

Parameters
shaderThe shader program to use to draw

◆ Duplicate()

Mesh * Mesh::Duplicate ( )
virtual

Copies the properties of this node to a newly allocated node, created via Create. Subclasses should override this to copy additional class attributes

Returns
A reference to the duplicate

Reimplemented from Spatial.

◆ FromFile()

Mesh * Mesh::FromFile ( const char *  filename)
static

Create a new mesh from a Wavefront file. A submesh will be generated for each material on the mesh. Material properties will be generated based on the .mat file, if present

Parameters
filenameThe name of the file containing the mesh.
Returns
A new mesh prefab

◆ GetMaterial()

Material Mesh::GetMaterial ( int  submesh)

Get the material property of a submesh

Parameters
submeshThe index of the submesh who's material is desired
Returns
The material property

◆ GetNumSubmeshes()

int Mesh::GetNumSubmeshes ( )
Returns
The number of submeshes this mesh is made up of

◆ Instance()

Mesh * Mesh::Instance ( )
virtual

Creates an instanced version of this node, by calling Duplicate. Subclasses should override this to perform neccesary tasks for instantiation, i.e. adding a physic object to the physics world. Any children of this node will also be instanced.

Returns
an instanced version of this node.

Reimplemented from Spatial.

◆ SetMaterial()

void Mesh::SetMaterial ( int  submesh,
Material  material 
)

Set the material property of a submesh

Parameters
submeshThe index of the submesh to update
materialThe desired material property

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