Polycode
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:
fileNamePath to mesh file to load.
SceneMesh::SceneMesh ( int  meshType)

Construct an empty scene mesh with the specified type.

Parameters:
meshTypeMesh 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:
fileNameFilename 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:
fileNameFilename to load the mesh from.
clampIf 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:
materialMaterial 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:
materialNameName of material to apply.
void SceneMesh::setMesh ( Mesh mesh)

Set the mesh this scene mesh renders.

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

Sets a skeleton from an existing skeleton instance.

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

Sets the texture from an existing Texture instance.

Parameters:
textureTexture 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)