Mesh Class Reference
Representation of a triangular mesh stored in the obj format. It consists of a list of vertices's and a list of faces that contain indices in the vertex list.
More...
#include <Mesh.h>
List of all members.
Detailed Description
Representation of a triangular mesh stored in the obj format. It consists of a list of vertices's and a list of faces that contain indices in the vertex list.
- Author:
- Travis Fischer (fisch0920@gmail.com)
Nong Li (nongli@gmail.com)
- Date:
- Spring 2008
Definition at line 34 of file Mesh.h.
Constructor & Destructor Documentation
| Mesh::Mesh |
( |
unsigned |
nVertices, |
|
|
unsigned |
nNormals, |
|
|
unsigned |
nUVs, |
|
|
unsigned |
nTriangles | |
|
) |
| | |
Constructs a mesh with the specified vertex/triangle count.
Definition at line 102 of file Mesh.cpp.
| Mesh::Mesh |
( |
const Mesh & |
mesh |
) |
|
Copy constructor.
Definition at line 146 of file Mesh.cpp.
| Mesh::~Mesh |
( |
|
) |
[virtual] |
Cleans up vertex and triangle data.
Definition at line 188 of file Mesh.cpp.
Member Function Documentation
| void Mesh::init |
( |
bool |
forceUpdate |
) |
[virtual] |
Initializes this Mesh and its underlying SpatialAccel.
- Parameters:
-
| forceUpdate | if true, reinitializes this mesh, including recreating the underlying SpatialAccel and dirtying this mesh's OpenGL preview display list |
Definition at line 200 of file Mesh.cpp.
| void Mesh::init |
( |
|
) |
[virtual] |
| void Mesh::preview |
( |
|
) |
[virtual] |
Displays an OpenGL preview of this mesh; optimized for repeated calls via a compiled OpenGL display list.
Reimplemented from Transformable.
Definition at line 247 of file Mesh.cpp.
Tests the given ray with this object for intersection. If a valid intersection exists, its "t" value will be returned and the given SurfacePoint will be initialized with enough data for this object to later fill in all relevant information lazily (world space normal at intersection point, uv coordinates, etc.).
- Note:
- if you only care about whether or not an intersection exists and don't actually need to know the exact intersection point, see the intersects method instead.
- Returns:
- the smallest positive "t" value of any intersections found, or INFINITY if no valid intersection exists
Implements Intersectable.
Definition at line 366 of file Mesh.cpp.
| bool Mesh::intersects |
( |
const Ray & |
ray, |
|
|
real_t |
tMax = INFINITY | |
|
) |
| | [virtual] |
Used for occlusion/visibility testing where you don't necessarily care about anything other than whether or not an intersection exists. (generally faster than getIntersection).
- Note:
- default implementation defers to getIntersection
- Returns:
- whether or not the given ray intersects this object with a positive "t" value greater than EPSILON and less than the given
tMax
Reimplemented from Intersectable.
Definition at line 384 of file Mesh.cpp.
| void Mesh::computeNormals |
( |
|
) |
|
Computes the normals. The vertex positions should be set. The normals will be averaged (Gourand Shading)
Definition at line 324 of file Mesh.cpp.
- Returns:
- the point on the surface of this shape corresponding to the given UV coordinates in 'pt'
Reimplemented from Shape.
Definition at line 422 of file Mesh.cpp.
| Point3 Mesh::getPosition |
( |
const UV & |
uv |
) |
[virtual] |
- Returns:
- the point on the surface of this shape corresponding to the given UV coordinates
Reimplemented from Transformable.
Definition at line 429 of file Mesh.cpp.
| unsigned Mesh::getNoVertices |
( |
|
) |
const [inline] |
- Returns:
- the number of vertices
Definition at line 113 of file Mesh.h.
| unsigned Mesh::getNoNormals |
( |
|
) |
const [inline] |
- Returns:
- the number of normals
Definition at line 118 of file Mesh.h.
| unsigned Mesh::getNoUVs |
( |
|
) |
const [inline] |
- Returns:
- the number of uvs
Definition at line 123 of file Mesh.h.
| unsigned Mesh::getNoTriangles |
( |
|
) |
const [inline] |
- Returns:
- the number of triangles
Definition at line 128 of file Mesh.h.
| Vertex* Mesh::getVertices |
( |
unsigned & |
nVertices |
) |
const [inline] |
- Returns:
- a pointer to the vertex data and the number of vertices
Definition at line 133 of file Mesh.h.
| Normal* Mesh::getNormals |
( |
unsigned & |
nNormals |
) |
const [inline] |
- Returns:
- a pointer to the normal data and the number of normals
Definition at line 140 of file Mesh.h.
| UV* Mesh::getUVs |
( |
unsigned & |
nUVs |
) |
const [inline] |
- Returns:
- a pointer to the uv data and the number of uvs
Definition at line 147 of file Mesh.h.
| MeshTriangle* Mesh::getTriangles |
( |
unsigned & |
nTriangles |
) |
const [inline] |
- Returns:
- a pointer to the triangle data and the number of triangles
Definition at line 154 of file Mesh.h.
| Vertex* Mesh::getVertices |
( |
|
) |
const [inline] |
- Returns:
- a pointer to the vertex data
Definition at line 161 of file Mesh.h.
| Normal* Mesh::getNormals |
( |
|
) |
const [inline] |
- Returns:
- a pointer to the normal data
Definition at line 166 of file Mesh.h.
| UV* Mesh::getUVs |
( |
|
) |
const [inline] |
- Returns:
- a pointer to the uv data
Definition at line 171 of file Mesh.h.
- Returns:
- a pointer to the triangle data
Definition at line 176 of file Mesh.h.
| void Mesh::setPreviewDirty |
( |
|
) |
|
| void Mesh::_getUV |
( |
SurfacePoint & |
pt |
) |
const [protected, virtual] |
| void Mesh::_getGeometricNormal |
( |
SurfacePoint & |
pt |
) |
const [protected, virtual] |
| real_t Mesh::_getSurfaceArea |
( |
|
) |
[protected, virtual] |
- Returns:
- the aggregate surface area of all triangles in this mesh
Reimplemented from Shape.
Definition at line 437 of file Mesh.cpp.
Member Data Documentation
The documentation for this class was generated from the following files: