RaySupreme Script API
 All Data Structures Functions Pages
Public Member Functions
Mesh Class Reference

Public Member Functions

FaceHandleaddFace (VertexHandleList *verticesList)
 
FaceHandleaddFace (VertexHandle *v0, VertexHandle *v1, VertexHandle *v2)
 
FaceHandleaddFace (VertexHandle *v0, VertexHandle *v1, VertexHandle *v2, VertexHandle *v3)
 
void deleteVertex (VertexHandle *handle, bool deleteIsolatedVertices=false)
 
VertexHandleListface (unsigned int index)
 
VertexHandleListface (FaceHandle &handle)
 
Vector3faceNormal (unsigned int index)
 
Vector3faceNormal (FaceHandle *handle)
 
void setFaceNormal (FaceHandle *handle, Vector3 *vertexValue)
 
VertexHandleListedge (unsigned int index)
 
VertexHandleListedge (EdgeHandle &handle)
 
uint edgeCount (void) const
 
void deleteEdge (EdgeHandle *handle, bool deleteIsolatedVertices=false)
 
VertexHandleaddVertex (Vector3 *vertexValue)
 
void setVertex (VertexHandle *handle, Vector3 *vertexValue)
 
void setVertexNormal (VertexHandle *handle, Vector3 *vertexValue)
 
void deleteVertex (VertexHandle *handle, bool deleteIsolatedVertices=false)
 
uint vertexCount (void) const
 
Vector3vertex (unsigned int index)
 
Vector3vertex (VertexHandle *handle)
 
Vector3vertexNormal (unsigned int index)
 
Vector3vertexNormal (VertexHandle *handle)
 
int materialId (int face_idx)
 
int materialsCount (void)
 
void setMaterialId (int face_idx, int matId)
 
void removeMaterial (int matId)
 
int textureId (int face_idx)
 
int texturesCount (void)
 
void setTextureId (int face_idx, int texId)
 
void removeTexture (int texId)
 
void collectGarbage (void)
 
void deleteIsolatedVertices (void)
 
void update (void)
 
void updateNormals (bool updateFace=true, bool updateVertex=true)
 
void subtract (Mesh *second_arg, bool reorient, float tolerance)
 

Detailed Description

The Mesh class wraps all Mesh functionality for a given NodeGraph. Note that child NodeGraphs can have their own Mesh. A Mesh is represented by a Mesh Editor node inside a NodeGraph.

Member Function Documentation

FaceHandle* Mesh::addFace ( VertexHandleList verticesList)

Adds a face to the mesh.

Parameters
verticesListThe list of vertices which make up the new face.
Returns
The FaceHandle of the created face.
FaceHandle* Mesh::addFace ( VertexHandle v0,
VertexHandle v1,
VertexHandle v2 
)

This function overloads NGMesh::addFace(NGVertexHandleList *list)

Parameters
Thelist of vertices which make up the new face.
Returns
The FaceHandle of the created face.
FaceHandle* Mesh::addFace ( VertexHandle v0,
VertexHandle v1,
VertexHandle v2,
VertexHandle v3 
)

This function overloads NGMesh::addFace(NGVertexHandleList *list)

Parameters
Thelist of vertices which make up the new face.
Returns
The FaceHandle of the created face.
VertexHandle* Mesh::addVertex ( Vector3 vertexValue)

Adds a vertex to the mesh.

Parameters
vertexValueThe Vector3 values to be applied to the new vertex.
Returns
The VertexHandle of the created Vertex.
void Mesh::collectGarbage ( void  )

Removes items marked as deleted from the mesh. Always call this method after deleting items. Note that all handles will be invalid after using this function.

void Mesh::deleteEdge ( EdgeHandle handle,
bool  deleteIsolatedVertices = false 
)

Deletes the given edge, optionally also deletes all isolated vertices too.

See Also
collectGarbage()
Parameters
handleThe EdgeHandle of the edge to be deleted.
deleteIsolatedVerticesIf set, isolated vertices will also be deleted.
void Mesh::deleteIsolatedVertices ( void  )

Deletes isolated vertices from the mesh.

See Also
collectGarbage()
void Mesh::deleteVertex ( VertexHandle handle,
bool  deleteIsolatedVertices = false 
)

Deletes the given face, optionally also deletes all isolated vertices too.

See Also
collectGarbage()
Parameters
handleThe FaceHandle of the face to be deleted.
deleteIsolatedVerticesIf set, isolated vertices will also be deleted.
void Mesh::deleteVertex ( VertexHandle handle,
bool  deleteIsolatedVertices = false 
)

Deletes the given vertex, optionally also deletes all isolated vertices too.

See Also
collectGarbage()
Parameters
handleThe VertexHandle of the vertex to be deleted.
deleteIsolatedVerticesIf set, isolated vertices will also be deleted.
VertexHandleList* Mesh::edge ( unsigned int  index)

Returns two VertexHandles which define the edge at the given index.

Parameters
indexThe index of the edge. Must be smaller than edgeCount().
Returns
The VertexHandleList which contains the two vertices of the edge.
VertexHandleList* Mesh::edge ( EdgeHandle handle)

Returns two VertexHandles which define the edge for the given EdgeHandle.

Parameters
handleThe EdgeHandle of the edge.
Returns
The VertexHandleList which contains the two vertices of the edge.
uint Mesh::edgeCount ( void  ) const

Returns the number of edges in the mesh.

Returns
The number of edges in the mesh.
VertexHandleList* Mesh::face ( unsigned int  index)

Returns a list of VertexHandles which form the face at the given index.

Parameters
indexThe index of the face. Mus be smaller than faceCount().
Returns
The VertexHandleList which list all vertices used by the face.
VertexHandleList* Mesh::face ( FaceHandle handle)

Returns a list of VertexHandles which form the face of the given handle.

Parameters
handleThe FaceHandle of the face.
Returns
The VertexHandleList which list all vertices used by the face.
Vector3* Mesh::faceNormal ( unsigned int  index)

Returns a Vector3 representing the face normal for the face at the given index.

Parameters
indexThe index of the face, has to be smaller than the value returned by faceCount().
Returns
The Vector3 value of the normal of the face.
Vector3* Mesh::faceNormal ( FaceHandle handle)

Returns a Vector3 for the face normal of the given FaceHandle.

Parameters
handleThe FaceHandle representing the face.
Returns
The Vector3 value of the normal of the face.
int Mesh::materialId ( int  face_idx)

Returns the material id of the given face.

Parameters
face_idxThe index of the face.
Returns
The material id of the face.
int Mesh::materialsCount ( void  )

Returns the number of materials in the mesh.

Returns
The number of materials.
void Mesh::removeMaterial ( int  matId)

Removes the given material id from the mesh. If face has an material id equal to matId, this material id is set to 0. Otherwise material id is decremented.

Parameters
matIdThe material id to remove from the mesh.
void Mesh::removeTexture ( int  texId)

Removes the given texture id from the mesh. If face has an texture id equal to texId, this texture id is set to 0. Otherwise the texture id is decremented.

Parameters
texIdThe texture id to remove from the mesh.
void Mesh::setFaceNormal ( FaceHandle handle,
Vector3 vertexValue 
)

Assigns a new value to the normal of the given face.

Parameters
handleThe FaceHandle of the face to be changed.
faceValueThe Vector3 values to be applied as the new normal of the face.
void Mesh::setMaterialId ( int  face_idx,
int  matId 
)

Sets the material id of the given face to a new value.

Parameters
face_idxThe face index of the material to assign a new materal id to.
matIdThe new material id to assign to the face.
void Mesh::setTextureId ( int  face_idx,
int  texId 
)

Sets the texture id of the given face to a new value.

Parameters
face_idxThe face index of the texture to assign a new texture id to.
texIdThe new texture id to assign to the face.
void Mesh::setVertex ( VertexHandle handle,
Vector3 vertexValue 
)

Assigns a new value to the given vertex.

Parameters
handleThe VertexHandle of the vertex to be changed.
vertexValueThe Vector3 values to be applied to the vertex.
void Mesh::setVertexNormal ( VertexHandle handle,
Vector3 vertexValue 
)

Assigns a new value to the normal of the given vertex.

Parameters
handleThe VertexHandle of the vertex to be changed.
vertexValueThe Vector3 values to be applied to the normal of the vertex.
void Mesh::subtract ( Mesh second_arg,
bool  reorient,
float  tolerance 
)

Subtracts second_arg from "this".

Parameters
second_argDeduction.
reorientTurn on/off cell reorientation of the intersection portion of the surface. Defaults to on.
toleranceThe tolerance used to determine when a point's absolute distance is considered to be zero. Defaults to 1e-6.
int Mesh::textureId ( int  face_idx)

Returns the texture id of the given face.

Parameters
face_idxThe index of the face.
Returns
The texture id of the face.
int Mesh::texturesCount ( void  )

Returns the number of textures in the mesh.

Returns
The number of textures.
void Mesh::update ( void  )

Upates the structure of the mesh and also calls updateNormals(). You need to call this function after you have finalized work on a given mesh to make it work in RaySupreme.

See Also
updateNormals
void Mesh::updateNormals ( bool  updateFace = true,
bool  updateVertex = true 
)

Updates the normals in the mesh.

Parameters
updateFaceIf true, updates the face normals.
updateVertexIf true, updates the vertex normals.
See Also
updateNormals
Vector3* Mesh::vertex ( unsigned int  index)

Returns a Vector3 representing the vertex at the given index.

Parameters
indexThe index of the vertex, has to be smaller than the value returned by vertexCount().
Returns
The Vector3 value of the vertex.
Vector3* Mesh::vertex ( VertexHandle handle)

Returns a Vector3 containing the coordinates of the vertex represented by the given VertexHandle.

Parameters
handleThe VertexHandle representing the vertex.
Returns
The Vector3 value of the vertex.
uint Mesh::vertexCount ( void  ) const

Returns the number of vertices in the mesh.

Returns
The number of vertices in the mesh.
Vector3* Mesh::vertexNormal ( unsigned int  index)

Returns a Vector3 representing the vertex normal for the vertex at the given index.

Parameters
indexThe index of the vertex, has to be smaller than the value returned by vertexCount().
Returns
The Vector3 value of the normal of the vertex.
Vector3* Mesh::vertexNormal ( VertexHandle handle)

Returns a Vector3 containing the coordinates of the vertex normal for the vertex of the given VertexHandle.

Parameters
handleThe VertexHandle representing the vertex.
Returns
The Vector3 value of the normal of the vertex.