OpenWalnut
1.3.1
|
Triangle mesh data structure allowing for convenient access of the elements. More...
#include <WTriangleMesh.h>
Public Types | |
typedef boost::shared_ptr < WTriangleMesh > | SPtr |
Shared pointer. More... | |
typedef boost::shared_ptr < const WTriangleMesh > | ConstSPtr |
Const shared pointer. More... | |
Public Member Functions | |
WTriangleMesh (size_t vertNum, size_t triangleNum) | |
constructor that already reserves space for a given number of triangles and vertexes More... | |
WTriangleMesh (osg::ref_ptr< osg::Vec3Array > vertices, const std::vector< size_t > &triangles) | |
Constructs a new mesh out of the given vertices and triangles. More... | |
virtual | ~WTriangleMesh () |
destructor More... | |
virtual const std::string | getName () const |
Gets the name of this prototype. More... | |
virtual const std::string | getDescription () const |
Gets the description for this prototype. More... | |
void | addVertex (osg::Vec3 vert) |
adds a vertex position to the mesh More... | |
void | addVertex (float x, float y, float z) |
adds a vertex position to the mesh More... | |
void | addVertex (WPosition vert) |
adds a vertex position to the mesh More... | |
void | addTextureCoordinate (osg::Vec3 texCoord) |
Adds a texture coordinate for the vertex. More... | |
void | addTextureCoordinate (float x, float y, float z) |
Adds a texture coordinate for the vertex. More... | |
void | addTriangle (size_t vert0, size_t vert1, size_t vert2) |
adds a tringle to the mesh More... | |
void | addTriangle (osg::Vec3 vert0, osg::Vec3 vert1, osg::Vec3 vert2) |
adds a tringle and its 3 vertexes to the mesh More... | |
void | setVertex (size_t index, osg::Vec3 vert) |
sets a vertex to a new position More... | |
void | setVertexNormal (size_t index, osg::Vec3 normal) |
sets the normal for a given vertex More... | |
void | setVertexNormal (size_t index, WPosition normal) |
sets the normal for a given vertex More... | |
void | setVertexColor (size_t index, osg::Vec4 color) |
sets the color for a given vertex More... | |
void | setTriangleColor (size_t index, osg::Vec4 color) |
sets the color for a given triangle More... | |
osg::ref_ptr< osg::Vec4Array > | getTriangleColors () const |
Return triangle colors. More... | |
osg::ref_ptr< osg::Vec3Array > | getVertexArray () |
getter More... | |
osg::ref_ptr< const osg::Vec3Array > | getVertexArray () const |
Returns a const reference pointer to the vertex array. More... | |
osg::ref_ptr< osg::Vec3Array > | getTextureCoordinateArray () |
Returns a reference pointer to the texture coordinate array. More... | |
osg::ref_ptr< const osg::Vec3Array > | getTextureCoordinateArray () const |
Returns a const reference pointer to the texture coordinate array. More... | |
osg::ref_ptr< osg::Vec3Array > | getVertexNormalArray (bool forceRecalc=false) |
getter More... | |
osg::ref_ptr< osg::Vec4Array > | getVertexColorArray () |
getter More... | |
const std::vector< size_t > & | getTriangles () const |
Returns a const reference to the vertex ids of the triangles. More... | |
osg::ref_ptr< osg::Vec3Array > | getTriangleNormalArray (bool forceRecalc=false) |
getter More... | |
osg::Vec3 | getVertex (size_t index) const |
getter More... | |
osg::Vec4 | getVertColor (size_t index) const |
getter More... | |
osg::Vec3 | getTriVert (size_t triId, size_t vertNum) |
getter More... | |
WVector3d | getNormal (size_t index) |
getter More... | |
size_t | vertSize () const |
getter More... | |
size_t | triangleSize () const |
getter More... | |
void | doLoopSubD () |
performs a loop subdivision on the triangle mesh More... | |
size_t | getTriVertId0 (size_t triId) const |
returns the id of the first vertex of a triangle More... | |
size_t | getTriVertId1 (size_t triId) const |
returns the id of the second vertex of a triangle More... | |
size_t | getTriVertId2 (size_t triId) const |
return the id of the third vertex of a triangle More... | |
void | addMesh (boost::shared_ptr< WTriangleMesh > mesh, float xOff=0., float yOff=0., float zOff=0.) |
adds a mesh to the existing, no check for duplicate vertexes is performed, an additional vector may be specified to move the mesh to add More... | |
void | translateMesh (float xOff, float yOff, float zOff) |
moves the entire mesh to a new postion More... | |
void | zoomMesh (float zoom) |
multiplies the vertex vectors of the mesh with a given number More... | |
bool | operator== (const WTriangleMesh &rhs) const |
Checks if two meshes are exactly the same. More... | |
void | rescaleVertexColors () |
Rescale the vertex colors so that the maximum of all r, g and b values is 1. More... | |
![]() | |
WTransferable () | |
Default constructor. More... | |
virtual | ~WTransferable () |
Destructor. More... | |
![]() | |
WPrototyped () | |
Default constructor. More... | |
virtual | ~WPrototyped () |
Destructor. More... | |
template<typename T > | |
bool | isA () |
Checks whether the actual prototype has the specified runtime type. More... | |
Static Public Member Functions | |
static boost::shared_ptr < WPrototyped > | getPrototype () |
Returns a prototype instantiated with the true type of the deriving class. More... | |
Static Protected Attributes | |
static boost::shared_ptr < WPrototyped > | m_prototype = boost::shared_ptr< WPrototyped >() |
The prototype as singleton. More... | |
Private Member Functions | |
WTriangleMesh () | |
we don't allow the standard constructor More... | |
void | removeVertex (size_t index) |
removes a vertex from the vertex array, if any triangles still index that vertex they will be removed if forceRemoveTriangle is true More... | |
void | removeTriangle (size_t index) |
removes a triangle from the mesh More... | |
void | recalcVertNormals () |
recalculates the vertex normals More... | |
osg::Vec3 | calcTriangleNormal (size_t triangle) |
calculates a normal from the 3 points in space defining a triangle More... | |
osg::Vec3 | calcNormal (osg::Vec3 vert0, osg::Vec3 vert1, osg::Vec3 vert2) |
calculates a normal from the 3 points in space More... | |
void | updateVertsInTriangles () |
updates the list for which vertexes appear in which triangle More... | |
void | calcNeighbors () |
calculates neighbor information for triangles More... | |
size_t | getNeighbor (const size_t coVert1, const size_t coVert2, const size_t triangleNum) |
returns the triangle index of a triangle neighboring a given edge of a vertex More... | |
void | setTriVert0 (size_t triId, size_t vertId) |
higher level access function to the triangle vector, sets the first vertex of a triangle to a given vertex id More... | |
void | setTriVert1 (size_t triId, size_t vertId) |
higher level access function to the triangle vector, sets the second vertex of a triangle to a given vertex id More... | |
void | setTriVert2 (size_t triId, size_t vertId) |
higher level access function to the triangle vector, sets the third vertex of a triangle to a given vertex id More... | |
void | loopSetTriangle (size_t triId, size_t vertId1, size_t vertId2, size_t vertId3) |
changes the vertex ids of a triangle More... | |
void | loopEraseTriangleFromVertex (size_t triId, size_t vertId) |
erases a triangle from the vertexe's list of triangles it is part of More... | |
osg::Vec3 | loopCalcNewPosition (size_t vertId) |
calculates the new position of a vertex depending on it's location in the grid and number of neighbors More... | |
void | loopInsertCenterTriangle (size_t triId) |
inserts the center triangle in a given triangle, More... | |
void | loopInsertCornerTriangles (size_t triId) |
inserts the 3 corner triangles in a given triangle More... | |
size_t | loopCalcEdgeVert (size_t triId, size_t edgeV1, size_t edgeV2, size_t V3) |
calculates the vertex id for a given edge, inserts a new vertex of none exists yet More... | |
double | loopGetAlpha (int n) |
loop helper function More... | |
size_t | loopGetNextVertex (size_t triNum, size_t vertNum) |
returns the id of the next vertex int he triangle More... | |
size_t | loopGetThirdVert (size_t coVert1, size_t coVert2, size_t triangleNum) |
returns the id of the third vertex of a triangle for two given vertexes More... | |
Private Attributes | |
size_t | m_countVerts |
number of vertexes in the mesh More... | |
size_t | m_countTriangles |
number of triangles in the mesh More... | |
bool | m_meshDirty |
flag indicating a change took place which requires a recalculation of components More... | |
bool | m_neighborsCalculated |
flag indicating whether the neighbor information has been calculated yet More... | |
osg::ref_ptr< osg::Vec3Array > | m_verts |
array containing the vertices More... | |
osg::ref_ptr< osg::Vec3Array > | m_textureCoordinates |
array containing the texture coordinates More... | |
osg::ref_ptr< osg::Vec3Array > | m_vertNormals |
array containing the vertex normals More... | |
osg::ref_ptr< osg::Vec4Array > | m_vertColors |
array containing vertex colors More... | |
std::vector< size_t > | m_triangles |
array containing the triangles More... | |
osg::ref_ptr< osg::Vec3Array > | m_triangleNormals |
array containing the triangle normals More... | |
osg::ref_ptr< osg::Vec4Array > | m_triangleColors |
array containing the triangle colors More... | |
std::vector< std::vector < size_t > > | m_vertexIsInTriangle |
for each vertex, list of triangles it is part of More... | |
std::vector< std::vector < size_t > > | m_triangleNeighbors |
edge neighbors for each triangle More... | |
size_t | m_numTriVerts |
stores the number of vertexes before the loop subdivion is run, needed by the loop algorithm More... | |
size_t | m_numTriFaces |
stores the number of triangles before the loop subdivion is run, needed by the loop algorithm More... | |
Friends | |
class | WTriangleMeshTest |
Triangle mesh data structure allowing for convenient access of the elements.
Definition at line 43 of file WTriangleMesh.h.
typedef boost::shared_ptr< const WTriangleMesh > WTriangleMesh::ConstSPtr |
Const shared pointer.
Definition at line 55 of file WTriangleMesh.h.
typedef boost::shared_ptr< WTriangleMesh > WTriangleMesh::SPtr |
Shared pointer.
Definition at line 50 of file WTriangleMesh.h.
WTriangleMesh::WTriangleMesh | ( | size_t | vertNum, |
size_t | triangleNum | ||
) |
constructor that already reserves space for a given number of triangles and vertexes
vertNum | |
triangleNum |
Definition at line 53 of file WTriangleMesh.cpp.
References m_textureCoordinates, m_triangleColors, m_triangleNormals, m_triangles, m_vertColors, m_vertNormals, and m_verts.
WTriangleMesh::WTriangleMesh | ( | osg::ref_ptr< osg::Vec3Array > | vertices, |
const std::vector< size_t > & | triangles | ||
) |
Constructs a new mesh out of the given vertices and triangles.
vertices | Vec3Array storing all vertices |
triangles | Vector of consecutive vertex indices where each 3 IDs are a triangle starting at 0,1,2 for first triangle 3,4,5 for the second |
Definition at line 69 of file WTriangleMesh.cpp.
|
virtual |
destructor
Definition at line 85 of file WTriangleMesh.cpp.
|
private |
we don't allow the standard constructor
Referenced by getPrototype().
void WTriangleMesh::addMesh | ( | boost::shared_ptr< WTriangleMesh > | mesh, |
float | xOff = 0. , |
||
float | yOff = 0. , |
||
float | zOff = 0. |
||
) |
adds a mesh to the existing, no check for duplicate vertexes is performed, an additional vector may be specified to move the mesh to add
mesh | |
xOff | |
yOff | |
zOff |
Definition at line 581 of file WTriangleMesh.cpp.
References addTriangle(), addVertex(), m_countVerts, m_meshDirty, and setVertexColor().
|
inline |
Adds a texture coordinate for the vertex.
texCoord | the texture coordinate |
Definition at line 624 of file WTriangleMesh.h.
References m_countVerts.
Referenced by addTextureCoordinate().
|
inline |
Adds a texture coordinate for the vertex.
x | texture coordinate X |
y | texture coordinate Y |
z | texture coordinate Z |
Definition at line 629 of file WTriangleMesh.h.
References addTextureCoordinate().
void WTriangleMesh::addTriangle | ( | size_t | vert0, |
size_t | vert1, | ||
size_t | vert2 | ||
) |
adds a tringle to the mesh
vert0 | index of the first vertex |
vert1 | index of the second vertex |
vert2 | index of the third vertex |
Definition at line 99 of file WTriangleMesh.cpp.
References m_countTriangles, and m_triangles.
Referenced by addMesh(), addTriangle(), loopInsertCenterTriangle(), loopInsertCornerTriangles(), WTriangleMeshTest::testComponentDecomposition(), and WTriangleMeshTest::testEqualityOperator().
void WTriangleMesh::addTriangle | ( | osg::Vec3 | vert0, |
osg::Vec3 | vert1, | ||
osg::Vec3 | vert2 | ||
) |
adds a tringle and its 3 vertexes to the mesh
vert0 | position of the first vertex |
vert1 | position of the second vertex |
vert2 | position of the third vertex |
Definition at line 111 of file WTriangleMesh.cpp.
References addTriangle(), addVertex(), and m_countVerts.
|
inline |
adds a vertex position to the mesh
vert |
Definition at line 634 of file WTriangleMesh.h.
References m_countVerts.
Referenced by addMesh(), addTriangle(), addVertex(), loopCalcEdgeVert(), WTriangleMeshTest::testComponentDecomposition(), and WTriangleMeshTest::testEqualityOperator().
void WTriangleMesh::addVertex | ( | float | x, |
float | y, | ||
float | z | ||
) |
adds a vertex position to the mesh
x | |
y | |
z |
Definition at line 89 of file WTriangleMesh.cpp.
References addVertex().
void WTriangleMesh::addVertex | ( | WPosition | vert | ) |
adds a vertex position to the mesh
vert |
Definition at line 94 of file WTriangleMesh.cpp.
References addVertex().
|
private |
calculates neighbor information for triangles
Definition at line 324 of file WTriangleMesh.cpp.
References getNeighbor(), getTriVertId0(), getTriVertId1(), getTriVertId2(), m_countTriangles, m_neighborsCalculated, and m_triangleNeighbors.
|
private |
calculates a normal from the 3 points in space
vert0 | vertex 1 |
vert1 | vertex 2 |
vert2 | vertex 3 |
Definition at line 298 of file WTriangleMesh.cpp.
|
private |
calculates a normal from the 3 points in space defining a triangle
triangle |
Definition at line 282 of file WTriangleMesh.cpp.
References getTriVert().
Referenced by recalcVertNormals().
void WTriangleMesh::doLoopSubD | ( | ) |
performs a loop subdivision on the triangle mesh
Definition at line 360 of file WTriangleMesh.cpp.
References loopCalcNewPosition(), loopInsertCenterTriangle(), loopInsertCornerTriangles(), m_countTriangles, m_countVerts, m_meshDirty, m_numTriFaces, m_numTriVerts, m_triangleColors, m_triangles, m_vertColors, m_vertexIsInTriangle, m_vertNormals, m_verts, and updateVertsInTriangles().
|
inlinevirtual |
Gets the description for this prototype.
Implements WPrototyped.
Definition at line 658 of file WTriangleMesh.h.
|
inlinevirtual |
Gets the name of this prototype.
Implements WPrototyped.
Definition at line 653 of file WTriangleMesh.h.
|
private |
returns the triangle index of a triangle neighboring a given edge of a vertex
coVert1 | |
coVert2 | |
triangleNum |
Definition at line 342 of file WTriangleMesh.cpp.
References m_vertexIsInTriangle.
Referenced by calcNeighbors(), and loopCalcEdgeVert().
WVector3d WTriangleMesh::getNormal | ( | size_t | index | ) |
getter
index |
Definition at line 204 of file WTriangleMesh.cpp.
References m_countVerts, m_meshDirty, m_vertNormals, and recalcVertNormals().
|
static |
Returns a prototype instantiated with the true type of the deriving class.
Definition at line 41 of file WTriangleMesh.cpp.
References m_prototype, and WTriangleMesh().
osg::ref_ptr< osg::Vec3Array > WTriangleMesh::getTextureCoordinateArray | ( | ) |
Returns a reference pointer to the texture coordinate array.
Definition at line 153 of file WTriangleMesh.cpp.
References m_textureCoordinates.
osg::ref_ptr< const osg::Vec3Array > WTriangleMesh::getTextureCoordinateArray | ( | ) | const |
Returns a const reference pointer to the texture coordinate array.
Definition at line 158 of file WTriangleMesh.cpp.
References m_textureCoordinates.
osg::ref_ptr< osg::Vec4Array > WTriangleMesh::getTriangleColors | ( | ) | const |
Return triangle colors.
Definition at line 752 of file WTriangleMesh.cpp.
References m_triangleColors.
osg::ref_ptr< osg::Vec3Array > WTriangleMesh::getTriangleNormalArray | ( | bool | forceRecalc = false | ) |
getter
forceRecalc |
Definition at line 172 of file WTriangleMesh.cpp.
References m_meshDirty, m_triangleNormals, and recalcVertNormals().
const std::vector< size_t > & WTriangleMesh::getTriangles | ( | ) | const |
Returns a const reference to the vertex ids of the triangles.
Definition at line 187 of file WTriangleMesh.cpp.
References m_triangles.
Referenced by tm_utils::componentDecomposition(), and tm_utils::operator<<().
|
inline |
getter
triId | |
vertNum |
Definition at line 684 of file WTriangleMesh.h.
References m_countTriangles, m_triangles, and m_verts.
Referenced by calcTriangleNormal().
|
inline |
returns the id of the first vertex of a triangle
triId | id of the triangle |
Definition at line 690 of file WTriangleMesh.h.
References m_countTriangles, and m_triangles.
Referenced by calcNeighbors(), loopCalcEdgeVert(), loopGetNextVertex(), loopGetThirdVert(), loopInsertCenterTriangle(), loopInsertCornerTriangles(), and updateVertsInTriangles().
|
inline |
returns the id of the second vertex of a triangle
triId | id of the triangle |
Definition at line 696 of file WTriangleMesh.h.
References m_countTriangles, and m_triangles.
Referenced by calcNeighbors(), loopCalcEdgeVert(), loopGetNextVertex(), loopGetThirdVert(), loopInsertCenterTriangle(), loopInsertCornerTriangles(), loopSetTriangle(), and updateVertsInTriangles().
|
inline |
return the id of the third vertex of a triangle
triId | id of the triangle |
Definition at line 702 of file WTriangleMesh.h.
References m_countTriangles, and m_triangles.
Referenced by calcNeighbors(), loopCalcEdgeVert(), loopGetNextVertex(), loopGetThirdVert(), loopInsertCenterTriangle(), loopInsertCornerTriangles(), loopSetTriangle(), and updateVertsInTriangles().
osg::Vec4 WTriangleMesh::getVertColor | ( | size_t | index | ) | const |
getter
index |
Definition at line 198 of file WTriangleMesh.cpp.
References m_countVerts, and m_vertColors.
osg::Vec3 WTriangleMesh::getVertex | ( | size_t | index | ) | const |
getter
index |
Definition at line 192 of file WTriangleMesh.cpp.
References m_countVerts, and m_verts.
Referenced by loopCalcNewPosition().
osg::ref_ptr< osg::Vec3Array > WTriangleMesh::getVertexArray | ( | ) |
getter
Definition at line 143 of file WTriangleMesh.cpp.
References m_verts.
Referenced by tm_utils::componentDecomposition(), and tm_utils::operator<<().
osg::ref_ptr< const osg::Vec3Array > WTriangleMesh::getVertexArray | ( | ) | const |
Returns a const reference pointer to the vertex array.
Definition at line 148 of file WTriangleMesh.cpp.
References m_verts.
osg::ref_ptr< osg::Vec4Array > WTriangleMesh::getVertexColorArray | ( | ) |
getter
Definition at line 182 of file WTriangleMesh.cpp.
References m_vertColors.
osg::ref_ptr< osg::Vec3Array > WTriangleMesh::getVertexNormalArray | ( | bool | forceRecalc = false | ) |
getter
forceRecalc |
Definition at line 163 of file WTriangleMesh.cpp.
References m_meshDirty, m_vertNormals, and recalcVertNormals().
|
private |
calculates the vertex id for a given edge, inserts a new vertex of none exists yet
triId | the triangle id |
edgeV1 | |
edgeV2 | |
V3 |
Definition at line 445 of file WTriangleMesh.cpp.
References addVertex(), getNeighbor(), getTriVertId0(), getTriVertId1(), getTriVertId2(), loopGetThirdVert(), m_countVerts, and m_numTriFaces.
Referenced by loopInsertCenterTriangle().
|
private |
calculates the new position of a vertex depending on it's location in the grid and number of neighbors
vertId | the vertex id |
Definition at line 409 of file WTriangleMesh.cpp.
References getVertex(), loopGetAlpha(), loopGetNextVertex(), and m_vertexIsInTriangle.
Referenced by doLoopSubD().
|
private |
erases a triangle from the vertexe's list of triangles it is part of
triId | |
vertId |
Definition at line 529 of file WTriangleMesh.cpp.
References m_vertexIsInTriangle.
Referenced by loopSetTriangle().
|
private |
loop helper function
n |
Definition at line 540 of file WTriangleMesh.cpp.
Referenced by loopCalcNewPosition().
|
private |
returns the id of the next vertex int he triangle
triNum | id of the triangle |
vertNum | id of the vertex |
Definition at line 555 of file WTriangleMesh.cpp.
References getTriVertId0(), getTriVertId1(), and getTriVertId2().
Referenced by loopCalcNewPosition().
|
private |
returns the id of the third vertex of a triangle for two given vertexes
coVert1 | |
coVert2 | |
triangleNum |
Definition at line 568 of file WTriangleMesh.cpp.
References getTriVertId0(), getTriVertId1(), and getTriVertId2().
Referenced by loopCalcEdgeVert().
|
private |
inserts the center triangle in a given triangle,
triId | the triangle id |
Definition at line 433 of file WTriangleMesh.cpp.
References addTriangle(), getTriVertId0(), getTriVertId1(), getTriVertId2(), and loopCalcEdgeVert().
Referenced by doLoopSubD().
|
private |
inserts the 3 corner triangles in a given triangle
triId | the triangle id |
Definition at line 494 of file WTriangleMesh.cpp.
References addTriangle(), getTriVertId0(), getTriVertId1(), getTriVertId2(), loopSetTriangle(), and m_numTriFaces.
Referenced by doLoopSubD().
|
private |
changes the vertex ids of a triangle
triId | |
vertId1 | |
vertId2 | |
vertId3 |
Definition at line 516 of file WTriangleMesh.cpp.
References getTriVertId1(), getTriVertId2(), loopEraseTriangleFromVertex(), m_vertexIsInTriangle, setTriVert0(), setTriVert1(), and setTriVert2().
Referenced by loopInsertCornerTriangles().
|
inline |
Checks if two meshes are exactly the same.
Same number of triangles, and points, and indices as well as same ordering. Keep in mind different ordering might result in the same structure but is considered different here.
rhs | The other mesh to compare with |
Definition at line 618 of file WTriangleMesh.h.
References m_triangles, and m_verts.
|
private |
recalculates the vertex normals
Definition at line 240 of file WTriangleMesh.cpp.
References calcTriangleNormal(), m_countTriangles, m_countVerts, m_meshDirty, m_vertexIsInTriangle, and updateVertsInTriangles().
Referenced by getNormal(), getTriangleNormalArray(), and getVertexNormalArray().
|
private |
removes a triangle from the mesh
index | the triangle to remove |
Definition at line 233 of file WTriangleMesh.cpp.
References m_countTriangles, m_meshDirty, and m_triangles.
|
private |
removes a vertex from the vertex array, if any triangles still index that vertex they will be removed if forceRemoveTriangle is true
index | the index of the vertex to remove |
Definition at line 214 of file WTriangleMesh.cpp.
References m_countTriangles, m_countVerts, m_meshDirty, m_triangles, and m_vertexIsInTriangle.
void WTriangleMesh::rescaleVertexColors | ( | ) |
Rescale the vertex colors so that the maximum of all r, g and b values is 1.
Definition at line 619 of file WTriangleMesh.cpp.
References m_vertColors.
void WTriangleMesh::setTriangleColor | ( | size_t | index, |
osg::Vec4 | color | ||
) |
sets the color for a given triangle
index | |
color |
Definition at line 137 of file WTriangleMesh.cpp.
References m_countTriangles.
|
inlineprivate |
higher level access function to the triangle vector, sets the first vertex of a triangle to a given vertex id
triId | the id of the triangle to modify |
vertId | new id of the first vertex |
Definition at line 663 of file WTriangleMesh.h.
References m_countTriangles, m_countVerts, and m_triangles.
Referenced by loopSetTriangle().
|
inlineprivate |
higher level access function to the triangle vector, sets the second vertex of a triangle to a given vertex id
triId | the id of the triangle to modify |
vertId | new id of the second vertex |
Definition at line 670 of file WTriangleMesh.h.
References m_countTriangles, m_countVerts, and m_triangles.
Referenced by loopSetTriangle().
|
inlineprivate |
higher level access function to the triangle vector, sets the third vertex of a triangle to a given vertex id
triId | the id of the triangle to modify |
vertId | new id of the third vertex |
Definition at line 677 of file WTriangleMesh.h.
References m_countTriangles, m_countVerts, and m_triangles.
Referenced by loopSetTriangle().
|
inline |
sets a vertex to a new position
index | |
vert |
Definition at line 708 of file WTriangleMesh.h.
void WTriangleMesh::setVertexColor | ( | size_t | index, |
osg::Vec4 | color | ||
) |
sets the color for a given vertex
index | |
color |
Definition at line 131 of file WTriangleMesh.cpp.
References m_countVerts.
Referenced by addMesh().
void WTriangleMesh::setVertexNormal | ( | size_t | index, |
osg::Vec3 | normal | ||
) |
sets the normal for a given vertex
index | |
normal |
Definition at line 119 of file WTriangleMesh.cpp.
References m_countVerts.
Referenced by setVertexNormal().
void WTriangleMesh::setVertexNormal | ( | size_t | index, |
WPosition | normal | ||
) |
sets the normal for a given vertex
index | |
normal |
Definition at line 125 of file WTriangleMesh.cpp.
References m_countVerts, and setVertexNormal().
void WTriangleMesh::translateMesh | ( | float | xOff, |
float | yOff, | ||
float | zOff | ||
) |
moves the entire mesh to a new postion
xOff | |
yOff | |
zOff |
Definition at line 602 of file WTriangleMesh.cpp.
size_t WTriangleMesh::triangleSize | ( | ) | const |
getter
Definition at line 319 of file WTriangleMesh.cpp.
References m_countTriangles.
Referenced by tm_utils::componentDecomposition(), and tm_utils::operator<<().
|
private |
updates the list for which vertexes appear in which triangle
Definition at line 268 of file WTriangleMesh.cpp.
References getTriVertId0(), getTriVertId1(), getTriVertId2(), m_countTriangles, and m_vertexIsInTriangle.
Referenced by doLoopSubD(), and recalcVertNormals().
size_t WTriangleMesh::vertSize | ( | ) | const |
getter
Definition at line 314 of file WTriangleMesh.cpp.
References m_countVerts.
Referenced by tm_utils::componentDecomposition(), and tm_utils::operator<<().
void WTriangleMesh::zoomMesh | ( | float | zoom | ) |
multiplies the vertex vectors of the mesh with a given number
zoom |
Definition at line 611 of file WTriangleMesh.cpp.
|
private |
number of triangles in the mesh
Definition at line 563 of file WTriangleMesh.h.
Referenced by addTriangle(), calcNeighbors(), doLoopSubD(), getTriVert(), getTriVertId0(), getTriVertId1(), getTriVertId2(), recalcVertNormals(), removeTriangle(), removeVertex(), setTriangleColor(), setTriVert0(), setTriVert1(), setTriVert2(), triangleSize(), and updateVertsInTriangles().
|
private |
number of vertexes in the mesh
Definition at line 561 of file WTriangleMesh.h.
Referenced by addMesh(), addTextureCoordinate(), addTriangle(), addVertex(), doLoopSubD(), getNormal(), getVertColor(), getVertex(), loopCalcEdgeVert(), recalcVertNormals(), removeVertex(), setTriVert0(), setTriVert1(), setTriVert2(), setVertexColor(), setVertexNormal(), and vertSize().
|
private |
flag indicating a change took place which requires a recalculation of components
Definition at line 565 of file WTriangleMesh.h.
Referenced by addMesh(), doLoopSubD(), getNormal(), getTriangleNormalArray(), getVertexNormalArray(), recalcVertNormals(), removeTriangle(), and removeVertex().
|
private |
flag indicating whether the neighbor information has been calculated yet
Definition at line 567 of file WTriangleMesh.h.
Referenced by calcNeighbors().
|
private |
stores the number of triangles before the loop subdivion is run, needed by the loop algorithm
Definition at line 590 of file WTriangleMesh.h.
Referenced by doLoopSubD(), loopCalcEdgeVert(), and loopInsertCornerTriangles().
|
private |
stores the number of vertexes before the loop subdivion is run, needed by the loop algorithm
Definition at line 588 of file WTriangleMesh.h.
Referenced by doLoopSubD().
|
staticprotected |
The prototype as singleton.
Definition at line 383 of file WTriangleMesh.h.
Referenced by getPrototype().
|
private |
array containing the texture coordinates
Definition at line 571 of file WTriangleMesh.h.
Referenced by getTextureCoordinateArray(), and WTriangleMesh().
|
private |
array containing the triangle colors
Definition at line 581 of file WTriangleMesh.h.
Referenced by doLoopSubD(), getTriangleColors(), and WTriangleMesh().
|
private |
edge neighbors for each triangle
Definition at line 586 of file WTriangleMesh.h.
Referenced by calcNeighbors().
|
private |
array containing the triangle normals
Definition at line 579 of file WTriangleMesh.h.
Referenced by getTriangleNormalArray(), and WTriangleMesh().
|
private |
array containing the triangles
Definition at line 577 of file WTriangleMesh.h.
Referenced by addTriangle(), doLoopSubD(), getTriangles(), getTriVert(), getTriVertId0(), getTriVertId1(), getTriVertId2(), operator==(), removeTriangle(), removeVertex(), setTriVert0(), setTriVert1(), setTriVert2(), WTriangleMeshTest::testEqualityOperator(), and WTriangleMesh().
|
private |
array containing vertex colors
Definition at line 575 of file WTriangleMesh.h.
Referenced by doLoopSubD(), getVertColor(), getVertexColorArray(), rescaleVertexColors(), and WTriangleMesh().
|
private |
for each vertex, list of triangles it is part of
Definition at line 584 of file WTriangleMesh.h.
Referenced by doLoopSubD(), getNeighbor(), loopCalcNewPosition(), loopEraseTriangleFromVertex(), loopSetTriangle(), recalcVertNormals(), removeVertex(), and updateVertsInTriangles().
|
private |
array containing the vertex normals
Definition at line 573 of file WTriangleMesh.h.
Referenced by doLoopSubD(), getNormal(), getVertexNormalArray(), and WTriangleMesh().
|
private |
array containing the vertices
Definition at line 569 of file WTriangleMesh.h.
Referenced by doLoopSubD(), getTriVert(), getVertex(), getVertexArray(), operator==(), and WTriangleMesh().