OBJ_Mesh Class Reference

The mesh files generated by OBJ_FileLoader. More...

#include <obj_loader.hpp>

List of all members.

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...


Detailed Description

The mesh files generated by OBJ_FileLoader.

Todo:
sophisticated parsing of face entries (e.g. vert//normal)
Note:
Note that the datasets for geometry, normals and texture coordinates are expected to have a size divisible by 3! Keep this in mind and ensure that you're only writing triples when using the respective Set*() and Add*() functions!

Constructor & Destructor Documentation

OBJ_Mesh::OBJ_Mesh ( char const *  name  ) 

Constructor.

Parameters:
[in] name Name of the mesh as null-terminated C-string (can be changed later invoking SetName() )
Exceptions:
std::bad_alloc 

OBJ_Mesh::OBJ_Mesh ( OBJ_Mesh const &  rhs  ) 

Copy Constructor.

Exceptions:
std::bad_alloc 


Member Function Documentation

void OBJ_Mesh::SetName ( char const *  name  ) 

Change the name of the mesh.

Parameters:
[in] name Name of the mesh as null-terminated C-string
Exceptions:
std::bad_alloc 

void OBJ_Mesh::SetGeometry ( std::vector< double > const &  data  ) 

Replace the current geometry data.

Parameters:
[in] data Vector holding new geometry data

template<typename T>
void OBJ_Mesh::SetGeometry ( T const *  data,
int  n_data 
) [inline]

Replace the current geometry data.

Parameters:
[in] data Field holding new geometry data
[in] n_data Size of field data

template<typename T>
void OBJ_Mesh::AddGeometry ( T const *  data,
int  n_data 
) [inline]

Append new geometry data.

Parameters:
[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.

Parameters:
[in] data Vector holding new normal data

template<typename T>
void OBJ_Mesh::SetNormals ( T const *  data,
int  n_data 
) [inline]

Replace the current normal data.

Parameters:
[in] data Field holding new normal data
[in] n_data Size of field data

template<typename T>
void OBJ_Mesh::AddNormals ( T const *  data,
int  n_data 
) [inline]

Append new normal data.

Parameters:
[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.

Parameters:
[in] data Vector holding new texture data

template<typename T>
void OBJ_Mesh::SetTextureData ( T const *  data,
int  n_data 
) [inline]

Replace the current texture data.

Parameters:
[in] data Field holding new texture data
[in] n_data Size of field data

template<typename T>
void OBJ_Mesh::AddTextureData ( T const *  data,
int  n_data 
) [inline]

Append new texture data.

Parameters:
[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.

Parameters:
[in] data Vector holding new face data

void OBJ_Mesh::SetFaceData ( Face const *  data,
int  n_data 
)

Replace the current face data.

Parameters:
[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.

Parameters:
[in] data Field holding new face data
[in] n_data Size of field data

char const * OBJ_Mesh::GetName (  )  const

Get the mesh name.

Returns:
The name as null terminated C-string

int OBJ_Mesh::GetNVertices (  )  const

Get the number of vertices currently in the mesh.

Returns:
The number of vertices of the mesh

int OBJ_Mesh::GetNFaces (  )  const

Get the number of faces currently in the mesh.

Returns:
The number of faces of the mesh

int OBJ_Mesh::GetNNormals (  )  const

Get the number of normals currently in the mesh.

Returns:
The number of normals of the mesh

int OBJ_Mesh::GetNTexture (  )  const

Get the number of texture coordinates currently in the mesh.

Returns:
The number of texture coordinates of the mesh

template<typename T>
void OBJ_Mesh::GetMeshGeometryUnindexed ( T *  mesh_geometry,
T *  mesh_normals,
T *  mesh_texture,
scale 
) const [inline]

Get an immediate (unindexed) representation of the mesh.

Parameters:
[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

template<typename T>
void OBJ_Mesh::GetMeshGeometry ( T *  mesh_geometry,
T *  mesh_normals,
T *  mesh_texture,
OBJ_Mesh::Face mesh_faces,
scale 
) const [inline]

Get a raw (indexed) representation of the mesh.

Parameters:
[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.

Parameters:
index Vertex index (0..n_vertices-1)
Returns:
The X coordinate of the vertex

double const * OBJ_Mesh::GetVertexY ( int  index  )  const

Get the Y-coordinate of a vertex.

Parameters:
index Vertex index (0..n_vertices-1)
Returns:
The Y coordinate of the vertex

double const * OBJ_Mesh::GetVertexZ ( int  index  )  const

Get the Z-coordinate of a vertex.

Parameters:
index Vertex index (0..n_vertices-1)
Returns:
The Y coordinate of the vertex

double const * OBJ_Mesh::GetNormalX ( int  index  )  const

Get the X-coordinate of a normal vector.

Parameters:
index Normal vector index (0..n_normals-1)
Returns:
The X coordinate of the normal vector

double const * OBJ_Mesh::GetNormalY ( int  index  )  const

Get the Y-coordinate of a normal vector.

Parameters:
index Normal vector index (0..n_normals-1)
Returns:
The Y coordinate of the normal vector

double const * OBJ_Mesh::GetNormalZ ( int  index  )  const

Get the Z-coordinate of a normal vector.

Parameters:
index Normal vector index (0..n_normals-1)
Returns:
The Z coordinate of the normal vector

double const * OBJ_Mesh::GetTextureX ( int  index  )  const

Get the X-coordinate (U) of a texture coordinate.

Parameters:
index Texture index (0..n_texture-1)
Returns:
The X texture coordinate (U)

double const * OBJ_Mesh::GetTextureY ( int  index  )  const

Get the X-coordinate (V) of a texture coordinate.

Parameters:
index Texture index (0..n_texture-1)
Returns:
The Y texture coordinate (V)

double const * OBJ_Mesh::GetTextureZ ( int  index  )  const

Get the Z-coordinate (W) of a texture coordinate.

Parameters:
index Texture index (0..n_texture-1)
Returns:
The Z texture coordinate (W)

OBJ_Mesh::Face const * OBJ_Mesh::GetFace ( int  index  )  const

Get the face indices for a specific face.

Parameters:
index Face index (0..n_faces-1)
Returns:
A Face structure containing all index information


The documentation for this class was generated from the following files:
Generated on Sat Jan 19 18:58:21 2008 for PS2 IconSys Library by  doxygen 1.5.4