#include <obj_loader.hpp>
Public Member Functions | |
OBJ_Mesh (char const *name) | |
Constructor. | |
~OBJ_Mesh () | |
Destructor. | |
OBJ_Mesh (OBJ_Mesh const &) | |
Copy Constructor. | |
void | SetName (char const *name) |
Change the name of the mesh. | |
void | SetGeometry (std::vector< double > const &data) |
Replace the current geometry data. | |
template<typename T> | |
void | SetGeometry (T const *data, int n_data) |
Replace the current geometry data. | |
template<typename T> | |
void | AddGeometry (T const *data, int n_data) |
Append new geometry data. | |
void | SetNormals (std::vector< double > const &data) |
Replace the current normal data. | |
template<typename T> | |
void | SetNormals (T const *data, int n_data) |
Replace the current normal data. | |
template<typename T> | |
void | AddNormals (T const *data, int n_data) |
Append new normal data. | |
void | SetTextureData (std::vector< double > const &data) |
Replace the current texture data. | |
template<typename T> | |
void | SetTextureData (T const *data, int n_data) |
Replace the current texture data. | |
template<typename T> | |
void | AddTextureData (T const *data, int n_data) |
Append new texture data. | |
void | SetFaceData (std::vector< Face > const &data) |
Replace the current face data. | |
void | SetFaceData (Face const *data, int n_data) |
Replace the current face data. | |
void | AddFaceData (Face const *data, int n_data) |
Append new face data. | |
void | ClearGeometry () |
Delete all geometry data. | |
void | ClearNormals () |
Delete all normal data. | |
void | ClearTextureData () |
Delete all texture data. | |
void | ClearFaceData () |
Delete all face data. | |
char const * | GetName () const |
Get the mesh name. | |
int | GetNVertices () const |
Get the number of vertices currently in the mesh. | |
int | GetNFaces () const |
Get the number of faces currently in the mesh. | |
int | GetNNormals () const |
Get the number of normals currently in the mesh. | |
int | GetNTexture () const |
Get the number of texture coordinates currently in the mesh. | |
template<typename T> | |
void | GetMeshGeometryUnindexed (T *mesh_geometry, T *mesh_normals, T *mesh_texture, T scale) const |
Get an immediate (unindexed) representation of the mesh. | |
template<typename T> | |
void | GetMeshGeometry (T *mesh_geometry, T *mesh_normals, T *mesh_texture, Face *mesh_faces, T scale) const |
Get a raw (indexed) representation of the mesh. | |
double const * | GetVertexX (int index) const |
Get the X-coordinate of a vertex. | |
double const * | GetVertexY (int index) const |
Get the Y-coordinate of a vertex. | |
double const * | GetVertexZ (int index) const |
Get the Z-coordinate of a vertex. | |
double const * | GetNormalX (int index) const |
Get the X-coordinate of a normal vector. | |
double const * | GetNormalY (int index) const |
Get the Y-coordinate of a normal vector. | |
double const * | GetNormalZ (int index) const |
Get the Z-coordinate of a normal vector. | |
double const * | GetTextureX (int index) const |
Get the X-coordinate (U) of a texture coordinate. | |
double const * | GetTextureY (int index) const |
Get the X-coordinate (V) of a texture coordinate. | |
double const * | GetTextureZ (int index) const |
Get the Z-coordinate (W) of a texture coordinate. | |
Face const * | GetFace (int index) const |
Get the face indices for a specific face. | |
Classes | |
struct | Face |
A data type for storing per-poly information. More... |
OBJ_Mesh::OBJ_Mesh | ( | char const * | name | ) |
Constructor.
[in] | name | Name of the mesh as null-terminated C-string (can be changed later invoking SetName() ) |
std::bad_alloc |
OBJ_Mesh::OBJ_Mesh | ( | OBJ_Mesh const & | rhs | ) |
Copy Constructor.
std::bad_alloc |
void OBJ_Mesh::SetName | ( | char const * | name | ) |
Change the name of the mesh.
[in] | name | Name of the mesh as null-terminated C-string |
std::bad_alloc |
void OBJ_Mesh::SetGeometry | ( | std::vector< double > const & | data | ) |
Replace the current geometry data.
[in] | data | Vector holding new geometry data |
void OBJ_Mesh::SetGeometry | ( | T const * | data, | |
int | n_data | |||
) | [inline] |
Replace the current geometry data.
[in] | data | Field holding new geometry data |
[in] | n_data | Size of field data |
void OBJ_Mesh::AddGeometry | ( | T const * | data, | |
int | n_data | |||
) | [inline] |
Append new geometry data.
[in] | data | Field holding new geometry data |
[in] | n_data | Size of field data |
void OBJ_Mesh::SetNormals | ( | std::vector< double > const & | data | ) |
Replace the current normal data.
[in] | data | Vector holding new normal data |
void OBJ_Mesh::SetNormals | ( | T const * | data, | |
int | n_data | |||
) | [inline] |
Replace the current normal data.
[in] | data | Field holding new normal data |
[in] | n_data | Size of field data |
void OBJ_Mesh::AddNormals | ( | T const * | data, | |
int | n_data | |||
) | [inline] |
Append new normal data.
[in] | data | Field holding new normal data |
[in] | n_data | Size of field data |
void OBJ_Mesh::SetTextureData | ( | std::vector< double > const & | data | ) |
Replace the current texture data.
[in] | data | Vector holding new texture data |
void OBJ_Mesh::SetTextureData | ( | T const * | data, | |
int | n_data | |||
) | [inline] |
Replace the current texture data.
[in] | data | Field holding new texture data |
[in] | n_data | Size of field data |
void OBJ_Mesh::AddTextureData | ( | T const * | data, | |
int | n_data | |||
) | [inline] |
Append new texture data.
[in] | data | Field holding new texture data |
[in] | n_data | Size of field data |
void OBJ_Mesh::SetFaceData | ( | std::vector< Face > const & | data | ) |
Replace the current face data.
[in] | data | Vector holding new face data |
void OBJ_Mesh::SetFaceData | ( | Face const * | data, | |
int | n_data | |||
) |
Replace the current face data.
[in] | data | Field holding new face data |
[in] | n_data | Size of field data |
void OBJ_Mesh::AddFaceData | ( | Face const * | data, | |
int | n_data | |||
) |
Append new face data.
[in] | data | Field holding new face data |
[in] | n_data | Size of field data |
char const * OBJ_Mesh::GetName | ( | ) | const |
Get the mesh name.
int OBJ_Mesh::GetNVertices | ( | ) | const |
Get the number of vertices currently in the mesh.
int OBJ_Mesh::GetNFaces | ( | ) | const |
Get the number of faces currently in the mesh.
int OBJ_Mesh::GetNNormals | ( | ) | const |
Get the number of normals currently in the mesh.
int OBJ_Mesh::GetNTexture | ( | ) | const |
Get the number of texture coordinates currently in the mesh.
void OBJ_Mesh::GetMeshGeometryUnindexed | ( | T * | mesh_geometry, | |
T * | mesh_normals, | |||
T * | mesh_texture, | |||
T | scale | |||
) | const [inline] |
Get an immediate (unindexed) representation of the mesh.
[out] | mesh_geometry | Pointer to a field of at least size (n_triangles*9) or NULL |
[out] | mesh_normals | Pointer to a field of at least size (n_triangles*9) or NULL |
[out] | mesh_texture | Pointer to a field of at least size (n_triangles*9) or NULL |
[in] | scale | A scale factor applied to each vertex |
void OBJ_Mesh::GetMeshGeometry | ( | T * | mesh_geometry, | |
T * | mesh_normals, | |||
T * | mesh_texture, | |||
OBJ_Mesh::Face * | mesh_faces, | |||
T | scale | |||
) | const [inline] |
Get a raw (indexed) representation of the mesh.
[out] | mesh_geometry | Pointer to a field of at least size (n_vertices*3) |
[out] | mesh_normals | Pointer to a field of at least size (n_normals*3) |
[out] | mesh_texture | Pointer to a field of at least size (n_texture*3) |
[out] | mesh_faces | Pointer to a field of at least size (n_faces) |
[in] | scale | A scale factor applied to each vertex |
double const * OBJ_Mesh::GetVertexX | ( | int | index | ) | const |
Get the X-coordinate of a vertex.
index | Vertex index (0..n_vertices-1) |
double const * OBJ_Mesh::GetVertexY | ( | int | index | ) | const |
Get the Y-coordinate of a vertex.
index | Vertex index (0..n_vertices-1) |
double const * OBJ_Mesh::GetVertexZ | ( | int | index | ) | const |
Get the Z-coordinate of a vertex.
index | Vertex index (0..n_vertices-1) |
double const * OBJ_Mesh::GetNormalX | ( | int | index | ) | const |
Get the X-coordinate of a normal vector.
index | Normal vector index (0..n_normals-1) |
double const * OBJ_Mesh::GetNormalY | ( | int | index | ) | const |
Get the Y-coordinate of a normal vector.
index | Normal vector index (0..n_normals-1) |
double const * OBJ_Mesh::GetNormalZ | ( | int | index | ) | const |
Get the Z-coordinate of a normal vector.
index | Normal vector index (0..n_normals-1) |
double const * OBJ_Mesh::GetTextureX | ( | int | index | ) | const |
Get the X-coordinate (U) of a texture coordinate.
index | Texture index (0..n_texture-1) |
double const * OBJ_Mesh::GetTextureY | ( | int | index | ) | const |
Get the X-coordinate (V) of a texture coordinate.
index | Texture index (0..n_texture-1) |
double const * OBJ_Mesh::GetTextureZ | ( | int | index | ) | const |
Get the Z-coordinate (W) of a texture coordinate.
index | Texture index (0..n_texture-1) |
OBJ_Mesh::Face const * OBJ_Mesh::GetFace | ( | int | index | ) | const |