Polycode::SceneMesh Class Reference

3D polygonal mesh instance. More...

Inherits Polycode::SceneEntity.

Inherited by Polycode::ScenePrimitive.

List of all members.

Public Member Functions

 SceneMesh (const String &fileName)
 Construct a scene mesh from a mesh file.
 SceneMesh (int meshType)
 Construct an empty scene mesh with the specified type.
 SceneMesh (Mesh *mesh)
 Construct scene mesh from an existing Mesh instance.
void Render ()
 Main render method.
MeshgetMesh ()
 Returns the Mesh instance of the actual mesh.
Texture * getTexture ()
 Returns the texture applied.
Material * getMaterial ()
 Returns the material applied.
void loadTexture (const String &fileName, bool clamp=true)
 Loads a simple texture from a file name and applies it to the mesh.
void loadSkeleton (const String &fileName)
 Loads a skeleton from a file and applies it to the scene mesh.
void setTexture (Texture *texture)
 Sets the texture from an existing Texture instance.
void setMaterial (Material *material)
 Set material from existing Material instance.
void setMaterialByName (const String &materialName)
 Set material by name.
void setMesh (Mesh *mesh)
 Set the mesh this scene mesh renders.
void setSkeleton (Skeleton *skeleton)
 Sets a skeleton from an existing skeleton instance.
SkeletongetSkeleton ()
 Returns the skeleton applied to this scene mesh.
void cacheToVertexBuffer (bool cache)
 If this is set to true, the mesh will be cached to a hardware vertex buffer if those are available.

Public Attributes

bool ownsMesh
 If true, will delete its Mesh upon destruction.
bool ownsSkeleton
 If true, will delete its Skeleton upon destruction.
bool ownsTexture
 If true, will delete its Texture upon destruction.

Detailed Description

3D polygonal mesh instance.

The SceneMesh is the base for all polygonal 3d geometry. It can have simple textures or complex materials applied to it.


Constructor & Destructor Documentation

SceneMesh::SceneMesh ( const String fileName  ) 

Construct a scene mesh from a mesh file.

Parameters:
fileName Path to mesh file to load.
SceneMesh::SceneMesh ( int  meshType  ) 

Construct an empty scene mesh with the specified type.

Parameters:
meshType Mesh type to create. Possible values are: Mesh::QUAD_MESH, Mesh::TRI_MESH, Mesh::TRIFAN_MESH, Mesh::TRISTRIP_MESH, Mesh::LINE_MESH, Mesh::POINT_MESH.

Member Function Documentation

void SceneMesh::cacheToVertexBuffer ( bool  cache  ) 

If this is set to true, the mesh will be cached to a hardware vertex buffer if those are available.

This can dramatically speed up rendering.

void SceneMesh::loadSkeleton ( const String fileName  ) 

Loads a skeleton from a file and applies it to the scene mesh.

Parameters:
fileName Filename to load the skeleton from.
void SceneMesh::loadTexture ( const String fileName,
bool  clamp = true 
)

Loads a simple texture from a file name and applies it to the mesh.

Parameters:
fileName Filename to load the mesh from.
clamp If true, clamps the texture to edges. See Texture for details on that.
void SceneMesh::Render (  )  [virtual]

Main render method.

Override this to do your own drawing.

Reimplemented from Polycode::Entity.

void SceneMesh::setMaterial ( Material *  material  ) 

Set material from existing Material instance.

Parameters:
material Material to apply.
void SceneMesh::setMaterialByName ( const String materialName  ) 

Set material by name.

You can create materials in material files and name them there, then use this to set a material by name to a scene mesh.

Parameters:
materialName Name of material to apply.
void SceneMesh::setMesh ( Mesh mesh  ) 

Set the mesh this scene mesh renders.

Parameters:
mesh Set a new mesh to render.
void SceneMesh::setSkeleton ( Skeleton skeleton  ) 

Sets a skeleton from an existing skeleton instance.

Parameters:
skeleton Skeleton to set to this mesh.
void SceneMesh::setTexture ( Texture *  texture  ) 

Sets the texture from an existing Texture instance.

Parameters:
texture Texture to set.

Member Data Documentation

If true, will delete its Mesh upon destruction.

(defaults to true)

If true, will delete its Skeleton upon destruction.

(defaults to true)

If true, will delete its Texture upon destruction.

(defaults to false)

Generated on Sat Aug 11 18:04:11 2012 for Polycode by  doxygen 1.6.3