Polycode
|
3D polygonal mesh instance. More...
Inherits Polycode::SceneEntity.
Inherited by Polycode::ScenePrimitive.
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. | |
Mesh * | getMesh () |
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. | |
Skeleton * | getSkeleton () |
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. |
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.
SceneMesh::SceneMesh | ( | const String & | fileName | ) |
Construct a scene mesh from a mesh file.
fileName | Path to mesh file to load. |
SceneMesh::SceneMesh | ( | int | meshType | ) |
Construct an empty scene mesh with the specified type.
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. |
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.
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.
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] |
void SceneMesh::setMaterial | ( | Material * | material | ) |
Set material from existing Material instance.
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.
materialName | Name of material to apply. |
void SceneMesh::setMesh | ( | Mesh * | mesh | ) |
Set the mesh this scene mesh renders.
mesh | Set a new mesh to render. |
void SceneMesh::setSkeleton | ( | Skeleton * | skeleton | ) |
Sets a skeleton from an existing skeleton instance.
skeleton | Skeleton to set to this mesh. |
void SceneMesh::setTexture | ( | Texture * | texture | ) |
Sets the texture from an existing Texture instance.
texture | Texture to set. |
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)