DzPolyMesh Class Reference
[Object and Geometry Objects]

A general polygon mesh. More...

Inheritance diagram for DzPolyMesh:

DzVertexMesh DzGeometry DzStorable DzBase QObject Object DzMRMMesh List of all members.

Methods

void activateFaceGroup (String name)
void activateMaterial (Number idx)
void addFaceEdge (Number vertIdx, Number uvwIdx)
void applySmoothing (Number angle)
void applyUVSet (DzVertexMap uvSet)
void deactivateAllFaceGroups ()
void deactivateFaceGroup (String name)
DzFaceGroup findFaceGroup (String name)
Number finishFace ()
DzFaceGroup getActiveFaceGroup (Number which)
DzFaceGroup getFaceGroup (Number i)
DzFaceGroup getMaterialGroup (Number which)
DzVec3 getNormal (Number i)
Number getNumActiveFaceGroups ()
Number getNumFaceGroups ()
Number getNumMaterialGroups ()
Number getNumNormals ()
Number getNumPolys ()
Number getNumQuads ()
Number getNumTris ()
DzPolygon getPoly (Number i)
DzQuad getQuad (Number i)
DzTriangle getTri (Number i)
bool getUseVBORendering ()
void invalidateVBOs (Boolean vertexes, Boolean normals, Boolean uvs)
void invalidateVBOs (Boolean clearVBOs=false)
void removeAllFaces ()
void removeFaces (DzFaceGroup faces, Boolean removeVerts=true)
void removePoly (Number polyIdx)
void removeQuad (Number quadIdx)
void removeTri (Number triIdx)
void setUseVBORendering (Boolean use)
void startFace ()
void updateVBOs ()

Constructors

 DzPolyMesh ()

Detailed Description

A general polygon mesh.


Constructor & Destructor Documentation

DzPolyMesh::DzPolyMesh (  ) 

Default Constructor.


Member Function Documentation

void DzPolyMesh::activateFaceGroup ( String  name  ) 

Activates a face group, creating it if it does not exist yet. All faces added after this call will be added to the given group. To stop adding faces to the group, you must call deactivateFaceGroup(). More than one face group can be active at a time.

void DzPolyMesh::activateMaterial ( Number  idx  ) 

Activates the given material. Any faces added after this call will use this material. Only ONE material can be active at a time, so this call will replace the currently active material.

void DzPolyMesh::addFaceEdge ( Number  vertIdx,
Number  uvwIdx 
)

Adds a vertex (edge) to the current polygon. This method implicitly defines a new edge in the current polygon from the last vertex to the given vertex. The first vertex in the face is considered to form an edge with the last vertex in the face. DZ_MAX_FACE_EDGES defines the maximum number of edges (vertices) that are allowed for a single polygon. Once the current polygon has reached this number of edges, it is added to the shape, and a new polygon is started, effectively splitting polygons with more than the maximum number of edges.

Parameters:
vertIdx An index into the mesh's vertex list for the vertex to add to the polygon.
uvwIdx An index into the mesh's uv map for the texture coordinate of the vertex.
See also:
startFace(), finishFace()

void DzPolyMesh::applySmoothing ( Number  angle  ) 

Recalculates the normals in the mesh based on the given smoothing angle

void DzPolyMesh::applyUVSet ( DzVertexMap  uvSet  ) 

Creates a new mesh by copying only the faces in the given group.

Parameters:
group The faces to copy from this mesh into the new mesh.
materialMap If not NULL, this will recieve the list of material indices from this mesh that were used in the output mesh.
Returns:
A new mesh containing only the faces in the given group. The new mesh does not share any data with the original mesh, it is essentially a 'deep copy' of a subset of this mesh. This function will return NULL if an error occured.

void DzPolyMesh::deactivateAllFaceGroups (  ) 

Deactivates all face groups

void DzPolyMesh::deactivateFaceGroup ( String  name  ) 

Deactivates a face group

DzFaceGroup DzPolyMesh::findFaceGroup ( String  name  ) 

Returns:
The first face group it finds that has the given name, or NULL if no group with this name is found.

int DzPolyMesh::finishFace (  ) 

Finishes a face definition and adds the face to the face list. Faces must have at least three edges to be valid. This function will do nothing and return -1 if less than three edges have been added to the current face. This function only succeeds when the mesh is in an editing operation. Make sure that you call beginEdit() before adding any faces, and finishEdit() after the faces have been added.

Returns:
On success, the number of edges in the face. -1 on failure, i.e the face was invalid or the mesh has not been set up for an edit.
See also:
startFace(), addFaceEdge()

DzFaceGroup DzPolyMesh::getActiveFaceGroup ( Number  which  ) 

Returns:
The i'th Active face group

DzFaceGroup DzPolyMesh::getFaceGroup ( Number  i  ) 

Returns:
The i'th Face group

DzFaceGroup DzPolyMesh::getMaterialGroup ( Number  which  ) 

Returns:
The face group that corresponds to a material grouping. The index of each material group corresponds exactly to the material index given in each face.

DzPoly DzPolyMesh::getNormal ( Number  i  ) 

Returns:
Normal at the given index

Number DzPolyMesh::getNumActiveFaceGroups (  ) 

Returns:
The number of Active face groups

Number DzPolyMesh::getNumFaceGroups (  ) 

Returns:
The number of Face groups

Number DzPolyMesh::getNumMaterialGroups (  ) 

Returns:
The number of Material groups

Number DzPolyMesh::getNumNormals (  ) 

Returns:
The number of normals

Number DzPolyMesh::getNumPolys (  ) 

Returns:
The number of polygons

Number DzPolyMesh::getNumQuads (  ) 

Returns:
The number of quads

Number DzPolyMesh::getNumTris (  ) 

Returns:
The number of triangles

DzPoly DzPolyMesh::getPoly ( Number  i  ) 

Returns:
Polygon at the given index

DzQuad DzPolyMesh::getQuad ( Number  i  ) 

Returns:
Quad at the given index

DzTriangle DzPolyMesh::getTri ( Number  i  ) 

Returns:
Triangle at the given index

bool DzPolyMesh::getUseVBORendering (  ) 

Gets the flag of using VBO rendering for mesh.

Returns:
True if VBOs can be used for rendering the data of the mesh. This means that VBOs are supported and the mesh is large enough to create VBOs for it. False if VBOs can not be used for rendering the data of the mesh. This means that VBOs are not supported at all or the mesh is too small to draw it using VBOs.

void DzPolyMesh::invalidateVBOs ( Boolean  vertexes,
Boolean  normals,
Boolean  uvs 
)

Invalidates chosen buffer objects. This makes them to be fully updated on next draw.

Parameters:
vertexes Defines whether to invalidate vertex buffer object.
normals Defines whether to invalidate normal buffer object.
uvs Defines whether to invalidate texture buffer object.

void DzPolyMesh::invalidateVBOs ( Boolean  clearVBOs = false  ) 

Invalidates VBOs. This makes VBOs to be fully updated on next draw.

Parameters:
clearVBOs Defines whether to clear (delete) VBOs after invalidation. Usually we do not need to delete VBOs as their will be used in future. If VBOs are cleared, they will be recreated next time they are needed. Setting cleatVBOs to true has sense when VBOs are disabled and will not be needed soon.

void DzPolyMesh::removeAllFaces (  ) 

Removes all faces from this shape without removing any vertices or materials.

void DzPolyMesh::removeFaces ( DzFaceGroup  faces,
Boolean  removeVerts = true 
)

Removes the faces in the given group from this mesh object. This will traverse all the face and material groups and removes the faces referred to. If removeVerts is true, the function will also remove any verts that were exclusively referrenced by faces in the given group. Also supports a progress indicator, since this can be a lengthy process.

void DzPolyMesh::removePoly ( Number  polyIdx  ) 

Removes the given polygon from this mesh object. This will traverse all the face and material groups to remove the polygon.

void DzPolyMesh::removeQuad ( Number  quadIdx  ) 

Removes the given quad from this mesh object. This will traverse all the face and material groups to remove the quad.

void DzPolyMesh::removeTri ( Number  triIdx  ) 

Removes the given triangle from this mesh object. This will traverse all the face and material groups to remove the triangle.

void DzPolyMesh::setUseVBORendering ( Boolean  use  ) 

Sets the flag of using VBO rendering for mesh.

Parameters:
use The flag of using VBO rendering for mesh. It should be true if VBOs can be used for rendering the data of the mesh. This means that VBOs are supported and the mesh is large enough to create VBOs for it. It should be false if VBOs can not be used for rendering the data of the mesh. This means that VBOs are not supported at all or the mesh is too small to draw it using VBOs.

void DzPolyMesh::startFace (  ) 

Starts a new polygon definition. Vertices can be added to this face by subsequent calls to addFaceEdge(). This function only succeeds when the mesh is in an editing operation. Make sure that you call beginEdit() before adding any faces, and finishEdit() after the faces have been added.

See also:
addFaceEdge(), finishFace()

void DzPolyMesh::updateVBOs (  ) 

Does all necessary update for VBO rendering. Updates vertex buffer objects and index buffers (if needed). This method must only be called when there is an active OpenGL context!


Generated on Thu Sep 24 12:21:14 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.