#include <topology.h>
Represents the topology data of a mesh, providing information about the structure of a surface, e.g. how faces are layed down.
The class Mesh is inherited from this class, and provides information about the vertices. Since only full triangle or quad meshes are allowed in Mudbox, an instance of this class is basically an array of triangles and quads. When a mixed triangle-quad or n-sided mesh is imported into mudbox, then the mesh is converted to a full triangle topology, see the member functions IsFakeTriangle and SetFakeTriangle. The Topology class can hold different type of data for the polygons, like position indices, adjacency, texture coordinate indices etc. These are called face components. To save memory not every buffer is allocated at the beginning. You can control which buffers will be allocated by calling the AddFaceComponent() and RemoveFaceComponent() functions.
Definition at line 45 of file topology.h.
Public Types | |
enum | FaceState { fsSelected = 0x01, fsVisible = 0x02, fsFake = 0x04, fsActive = 0x08, fsMapped = 0x10, fsIsolated = 0x20 } |
enum | FaceComponent { fcIndex = 1, fcAdjacency = 2, fcTCIndex = 4, fcNormal = 8, fcID = 16, fcOctree = 32, fcFreeze = 64, fcState = 128 } |
enum | FaceType { typeTriangular, typeQuadric } |
enum | TopologyHint { eStaticTopology, eDynamicTopology } |
Public Types inherited from Node | |
enum | DiagnosticLevel { dgnLevel1, dgnLevel2, dgnLevel3 } |
Indicates the level of validity checking that is performed in CheckValidity() More... | |
Public Member Functions | |
void | MoveTo (Topology *pDestination) |
Move the content of this object to another one. This is a fast function. More... | |
void | CopyTo (Node *pNode) const |
Copy the content of this object to another one, while keeps the content of the current object. More... | |
void | Serialize (Stream &s) |
serializes the content of the object into/from a stream. More... | |
FaceType | Type (void) const |
Returns the type of the topology. Can be full triangular or full quadric. More... | |
void | SetType (FaceType eType) |
Sets the type of the object. This call also clears all the content of the object. More... | |
int | SideCount (void) const |
Returns the number of sides in the faces. This is three if the topology is triangle based, and four if its quad based. More... | |
unsigned int | FaceCount (void) const |
Returns the number of faces in the topology. More... | |
virtual Vector | FaceNormal (unsigned int iFaceIndex) const |
Returns the normal vector for a face in the topology. More... | |
void | SetFaceID (unsigned int iFaceIndex, unsigned int iID) |
This function is used only internally. More... | |
unsigned int | FaceID (unsigned int iFaceIndex) const |
This function is used only internally. More... | |
virtual void | SetFakeTriangleCount (unsigned int iFakeTriangleCount) |
Call this method to indicate how many fake triangles are in the topology. More... | |
unsigned int | QuadIndex (unsigned int iFaceIndex, unsigned int iCornerIndex) const |
Returns the vertex position index of a corner of a quad. More... | |
void | SetQuadIndex (unsigned int iFaceIndex, unsigned int iCornerIndex, unsigned int iValue) |
Sets the vertex position index of a corner of a quad. More... | |
unsigned int | QuadCreaseNormalIndex (unsigned int iFaceIndex, unsigned int iCornerIndex) const |
Returns the vertex crease/hard normal index of a corner of quad, if there is crease/hard normal of this corner, otherwise it is the vertex normal index. More... | |
void | SetQuadCreaseNormalIndex (unsigned int iFaceIndex, unsigned int iCornerIndex, unsigned int iValue) |
Sets the vertex normal index of a corner of a quad. More... | |
unsigned int | QuadTCI (unsigned int iFaceIndex, unsigned int iCornerIndex) const |
Returns the vertex texture coordinate index of a corner of a quad. More... | |
void | SetQuadTCI (unsigned int iFaceIndex, unsigned int iCornerIndex, unsigned int iValue) |
Sets the vertex texture coordinate index of a corner of a quad. More... | |
virtual unsigned int | QuadAdjacency (unsigned int iFaceIndex, unsigned int iSideIndex) const |
Returns the vertex adjacency information index of a side of a quad. More... | |
unsigned int | QuadAdjacency_ForcedInline (unsigned int iFaceIndex, unsigned int iSideIndex) const |
virtual void | SetQuadAdjacency (unsigned int iFaceIndex, unsigned int iSideIndex, unsigned int iValue) |
Sets the adjacency info for a side of a quad. See QuadAdjacency for details. More... | |
bool | HasAdjacentQuad (unsigned int iFaceIndex, unsigned int iSideIndex) const |
Returns true if the given edge of a quad has an adjacent quad on the other side. More... | |
unsigned int | TriangleIndex (unsigned int iFaceIndex, unsigned int iCornerIndex) const |
Returns the vertex position index of a corner of a triangle. More... | |
void | SetTriangleIndex (unsigned int iFaceIndex, unsigned int iCornerIndex, unsigned int iValue) |
Sets the vertex position index of a corner of a triangle. More... | |
unsigned int | TriangleCreaseNormalIndex (unsigned int iFaceIndex, unsigned int iCornerIndex) const |
Returns the vertex crease/hard normal index of a corner of triangle, if there is crease/hard normal of this corner, otherwise it is the vertex normal index. More... | |
void | SetTriangleCreaseNormalIndex (unsigned int iFaceIndex, unsigned int iCornerIndex, unsigned int iValue) |
Sets the vertex normal index of a corner of a triangle. More... | |
unsigned int | TriangleTCI (unsigned int iFaceIndex, unsigned int iCornerIndex) const |
Returns the vertex texture coordinate index of a corner of a triangle. More... | |
void | SetTriangleTCI (unsigned int iFaceIndex, unsigned int iCornerIndex, unsigned int iValue) |
Sets the vertex texture coordinate index of a corner of a triangle. More... | |
virtual unsigned int | TriangleAdjacency (unsigned int iFaceIndex, unsigned int iSideIndex) const |
Returns the vertex adjacency information index of a side of a triangle. More... | |
virtual void | SetTriangleAdjacency (unsigned int iFaceIndex, unsigned int iSideIndex, unsigned int iValue) |
Sets the adjacency info for a side of a triangle. See TriangleAdjacency for details. More... | |
bool | HasAdjacentTriangle (unsigned int iFaceIndex, unsigned int iSideIndex) const |
Returns true if the given edge of a triangle has an adjacent triangle on the other side. More... | |
unsigned char & | FaceState (unsigned int iFaceIndex) |
Returns the state of a face. See FaceState. More... | |
unsigned char | FaceState (unsigned int iFaceIndex) const |
Sets the state of a face. More... | |
bool | IsFaceSelected (unsigned int iFaceIndex) const |
Returns true if the given face is selected. More... | |
virtual void | SetFaceSelected (unsigned int iFaceIndex, bool bSelected=true, bool bUpdateVertexSelection=false, bool bBatchSelection=false) |
Sets selection state for a face. More... | |
virtual unsigned int | SelectedFaceCount () const |
Returns the number of selected faces. More... | |
bool | IsFaceVisible (unsigned int iFaceIndex) const |
Returns true if the given face is visible. More... | |
virtual void | SetFaceVisible (unsigned int iFaceIndex, bool bVisible=true) |
Sets the visibility of a given face. More... | |
bool | IsFaceActive (unsigned int iFaceIndex) const |
void | SetFaceActive (unsigned int iFaceIndex, bool bSelected=true) |
bool | IsFaceMapped (unsigned int iFaceIndex) const |
Used only internally. More... | |
void | SetFaceMapped (unsigned int iFaceIndex, bool bSelected=true) |
Used only internally. More... | |
bool | IsFaceIsolated (unsigned int iFaceIndex) const |
Returns true if the given face is in the set of Isolated faces. More... | |
virtual void | SetFaceIsolated (unsigned int iFaceIndex, bool bIsolated=true) |
Sets the Isolation state of a given face. More... | |
bool | IsFakeTriangle (unsigned int iTriangleIndex) const |
This function can only be used for triangular meshes. More... | |
void | SetFakeTriangle (unsigned int iTriangleIndex, bool b) |
bool | IsFaceTemp (unsigned int iFaceIndex) const |
void | SetFaceTemp (unsigned int iFaceIndex, bool bSelected=true) |
void | ClearFaceTempStates () |
virtual void | AddFaceComponent (FaceComponent eComponentToAdd) |
Adds new face component(s) to the object. More... | |
virtual void | RemoveFaceComponent (FaceComponent eComponentToRemove) |
Removes face component(s) from the object. This might delete some data from the memory. More... | |
unsigned int | FaceComponents (void) const |
Returns the current face components for the object. More... | |
virtual void | SetFaceCount (unsigned int iFaceCount) |
Sets the number of faces in the object. Existing face data will be kept. More... | |
virtual bool | SetAdjacencyCount (unsigned int iCount, bool bKeepContent=true, bool bForced=false) |
Sets the size of the adjacency array. More... | |
unsigned int | AdjacencyCount (void) const |
Returns the size of the adjacency matrix. More... | |
virtual bool | HasTShape () const |
Returns true if these is edge shared by more than two faces. More... | |
virtual const Store< unsigned int > & | TShapeFaces (void) const |
Returns the list of faces contained in T-shapes. More... | |
virtual void | SetTopologyHint (TopologyHint eHint) |
Sets the usage hint for this Topology. More... | |
virtual enum TopologyHint | TopologyHint () const |
virtual void | CheckValidity (DiagnosticLevel iLevel=dgnLevel2) const |
See the documentation for Node::CheckValidity. More... | |
Public Member Functions inherited from TreeNode | |
TreeNode (void) | |
~TreeNode (void) | |
virtual void | AddChild (TreeNode *pChild, bool bFirst=false) const |
Adds a node/subtree to the list of children. The added node will be removed from the current parent if it has one. More... | |
virtual void | RemoveChild (TreeNode *pChild) const |
Removes a node/subtree from the list of children. More... | |
virtual TreeNode * | FirstChild (void) const |
Returns the first node from the child list. More... | |
virtual TreeNode * | Parent (void) const |
Returns the parent node. More... | |
virtual TreeNode * | NextSibling (void) const |
Returns the next linked node with the same parent. More... | |
virtual TreeNode * | PrevSibling (void) const |
Returns the previous linked node with the same parent. More... | |
virtual void | MoveChild (TreeNode *pChild, TreeNode *pAfter) |
Moves the child after the given node in order. More... | |
virtual TreeNode * | ChildByClass (const ClassDesc *pClass, bool bAutoCreate=true) const |
Returns the first child with the specified type. When the bAutoCreate parameter is true and such a child does not exists, it creates it with the preferred descedant type. More... | |
template<typename type > | |
type * | ChildByClass (bool bAutoCreate=true) const |
Same as above, a most confortable version. More... | |
virtual TreeNode * | ChildByClass (const ClassDesc *pClass, unsigned int iIndex=0) const |
Returns the first child with the specified type, or returns zero if no child found. More... | |
template<typename type > | |
type * | ChildByClass (unsigned int iIndex=0) const |
Same as above, a most confortable version. More... | |
virtual void | DeleteChildByClass (const ClassDesc *pClass) |
Deletes all child which is derived from a specific class. More... | |
virtual QString | Info (void) const |
Returns descriptive information about the node. More... | |
virtual bool | Visible (void) const |
Returns if the node is visible. Should be overridden in derived classes. More... | |
virtual void | SetVisible (bool b) |
Sets the node visibility Should be overridden in derived classes. More... | |
virtual bool | Locked (void) const |
Returns if the node is locked. Should be overridden in derived classes. More... | |
virtual void | SetLocked (bool b) |
Sets the locking of the node. Should be overridden in derived classes. More... | |
virtual bool | HiddenFromUI (void) const |
Returns true if the node cannot be seen from UI. More... | |
virtual void | SetHiddenFromUI (bool b) |
Sets visibility in UI. More... | |
virtual void | OnLinked (const TreeNode *pOldParent) |
This function is called then the node is linked to a new parent. More... | |
QString | UniqueChildName (const TreeNode *pChild, const QString &sPrefix="") const |
Finds a node name that is unique among the children of this node. More... | |
virtual void | SetStringID (const QString &sName) |
This method does the same thing as Node::SetStringID, except it ensures the name is unique among this node's siblings. More... | |
Public Member Functions inherited from Node | |
Node (const QString &sStringID="", const QString &sDisplayName="") | |
Standard constructor. More... | |
virtual | ~Node (void) |
virtual void | Initialize (void) |
void | LoadTemplate (const QString &sFileName="", bool bStartEvent=false) |
Use an external XML file to initialize the attributes. More... | |
void | SaveTemplate (const QString &sFileName="", bool bSaveOnlyVisible=false) |
Save current attributes as an XML template. More... | |
unsigned int | Version (void) const |
Returns the current version of the node. This number increases when the content of the node changed (when ContentChanged() called). More... | |
void | SetVersion (unsigned int iVersion) |
Sets the current version number for the node. More... | |
unsigned int | ReferenceCount (void) const |
Returns the number of pointers referencing this node. More... | |
Attribute * | ReferencePointer (unsigned int iIndex) const |
Returns the address of an attribute which refers to this node. The type of the attribute is always aptr. More... | |
Node * | ReferenceNode (unsigned int iIndex) const |
Returns the address of a node referencing this node. More... | |
virtual QString | Name (const ClassDesc *pClass=0) const |
Deprecated. More... | |
virtual void | SetName (const QString &sName) |
Deprecated. More... | |
virtual QString | StringID (const ClassDesc *pClass=0) const |
Returns the string id of the node. More... | |
virtual QString | DisplayName (void) const |
Returns the display name of the node. More... | |
virtual void | SetDisplayName (const QString &sDisplayName) |
Sets the display name of the node. More... | |
virtual QString | HelpID (void) const |
Returns the help entry id of the node. Can be overwritten in derived classes. More... | |
virtual void | SetHelpID (const QString &sHelpID) |
Sets the help entry id of the node. More... | |
void | Annex (Node *pSource, const QString &sCategory="") |
Relink all the attributes of the source node to this one. More... | |
bool | IsKindOf (const ClassDesc *pClass) const |
Returns true if this node is derived from the pClass class. More... | |
void | ContentChanged (void) const |
This function must be called if the content of the node is changed. More... | |
virtual Node * | Duplicate (void) const |
virtual void | OnNodeEvent (const Attribute &cAttribute, NodeEventType cType) |
This function is called if an event occurs with any of the attributes of the node. More... | |
virtual void | OnEvent (const EventGate &cEvent) |
This function is called when a generic event occurs. See EventGate class. More... | |
void | RequestDeferredEvent (Attribute &cAttribute) |
Request for a deferred event, which will occur only in the main loop. More... | |
unsigned int | AttributeCount (void) const |
Returns the number of attributes owned by the node. More... | |
Attribute * | AttributeByIndex (int iIndex) const |
Returns a specified attribute (or 0 if iIndex is greater than the number of attributes). More... | |
Attribute * | AttributeByName (const QString &sName) const |
Returns a specified attribute by its name. Returns 0 if the attribute not found. More... | |
Attribute * | AttributeByID (const QString &sID) const |
Returns a specified attribute by its ID. Returns 0 if the attribute not found. More... | |
void | SetAttributeValue (const QString &sAttributeID, const QString &sNewValue) |
Set the value of an attribute from a string. More... | |
QString | AttributeValue (const QString &sAttributeID) const |
Returns the current value of an attribute as a string. More... | |
void | LogAttributes (void) const |
Write all attributes into the log file. More... | |
virtual QWidget * | CreatePropertiesWindow (QWidget *pParent) |
Create a window which displays the attributes of the node. Can be overriden to provide a custom interface. More... | |
Attribute * | AddAttribute (Attribute::AttributeType type, const QString &id) |
Allows SDK users to add attributes at runtime. More... | |
Node * | Next (void) const |
Returns the next node in the chain. Used to enumerate the current nodes. See also First(). More... | |
int | ID (void) const |
Returns an ID for the node. The ID is unique in the whole application life. More... | |
bool | SetID (int iID) |
Set ID for the node. More... | |
Public Attributes | |
Store< unsigned int > | m_pIndices |
Public Attributes inherited from TreeNode | |
DECLARE_CLASS | |
Public Attributes inherited from Node | |
AttributeThisPointer | m_pThis |
DECLARE_CLASS | |
Protected Member Functions | |
Topology (void) | |
Do not use constructors directly. Use CreateInstances() instead. More... | |
Topology (FaceType eType) | |
Constructs the object with zero faces. More... | |
Protected Attributes | |
Store< unsigned int > | m_pTCI |
Store< unsigned int > | m_pAdjacency |
Store< unsigned int > | m_pNormalIndices |
TopologyHint | m_eTopologyHint |
Friends | |
class | ::XMesh |
Additional Inherited Members | |
Static Public Member Functions inherited from Node | |
static void | StartHashing () |
This is called once in main once static ctors are done. More... | |
static Node * | First (void) |
This function will return the first node in the memory. Used to enumerate all the current nodes. See also Next(). More... | |
static Node * | ByID (int iID) |
Returns the node with the specified ID, or zero if such a node does not exists. More... | |
static Node * | ByName (const QString &sClass, const QString &sName) |
Search for a node with the name sName. More... | |
enum FaceState |
Enumerator | |
---|---|
fsSelected | |
fsVisible | |
fsFake | |
fsActive | |
fsMapped | |
fsIsolated |
Definition at line 48 of file topology.h.
enum FaceComponent |
Enumerator | |
---|---|
fcIndex | |
fcAdjacency | |
fcTCIndex | |
fcNormal | |
fcID | |
fcOctree | |
fcFreeze | |
fcState |
Definition at line 58 of file topology.h.
enum FaceType |
Enumerator | |
---|---|
typeTriangular | |
typeQuadric |
Definition at line 70 of file topology.h.
enum TopologyHint |
Definition at line 76 of file topology.h.
Move the content of this object to another one. This is a fast function.
This object will loose all data and become an empty topology.
Copy the content of this object to another one, while keeps the content of the current object.
This function is similar to MoveTo, but since it is copying all the data, it is slower. You can use this function when you want to do some temporary change to a mesh (like you want to change the vertex ordering inside faces) but then you want to restore the original state. In that case you can simply create a copy of the mesh, do the modifications, and when you don't need it any longer, just delete it.
Reimplemented from TreeNode.
serializes the content of the object into/from a stream.
Reimplemented from TreeNode.
Returns the type of the topology. Can be full triangular or full quadric.
Definition at line 122 of file topology.h.
Sets the type of the object. This call also clears all the content of the object.
Returns the number of sides in the faces. This is three if the topology is triangle based, and four if its quad based.
Definition at line 126 of file topology.h.
Returns the normal vector for a face in the topology.
This function is used only internally.
Definition at line 134 of file topology.h.
This function is used only internally.
Definition at line 136 of file topology.h.
Call this method to indicate how many fake triangles are in the topology.
Call SetFaceCount before calling this method. Note this has no effect on quadric meshes.
Returns the vertex position index of a corner of a quad.
The value returned by this call can be used as a parameter for the VertexPosition() function in class Mesh.
Definition at line 144 of file topology.h.
|
inline |
Sets the vertex position index of a corner of a quad.
The value returned by this call can be used as parameter for the VertexTC() function in class Mesh.
Definition at line 147 of file topology.h.
|
inline |
Returns the vertex crease/hard normal index of a corner of quad, if there is crease/hard normal of this corner, otherwise it is the vertex normal index.
The value returned by this call can be used as a parameter for the VertexNormal() function in class Mesh. Or you can use QuadVertexCreaseNormal() function in class Mesh directly.
Definition at line 152 of file topology.h.
|
inline |
Returns the vertex texture coordinate index of a corner of a quad.
Definition at line 156 of file topology.h.
Sets the vertex texture coordinate index of a corner of a quad.
Definition at line 158 of file topology.h.
|
inlinevirtual |
Returns the vertex adjacency information index of a side of a quad.
If the returned value is x, then x/4 is the index of the adjacent quad, while x%4 is the side in the adjacent quad which is common with the given one.
Definition at line 162 of file topology.h.
|
inline |
Definition at line 163 of file topology.h.
|
inlinevirtual |
Sets the adjacency info for a side of a quad. See QuadAdjacency for details.
Definition at line 165 of file topology.h.
Returns true if the given edge of a quad has an adjacent quad on the other side.
Definition at line 168 of file topology.h.
Returns the vertex position index of a corner of a triangle.
The value returned by this call can be used as a parameter for the VertexPosition() function in class Mesh.
Definition at line 173 of file topology.h.
|
inline |
Sets the vertex position index of a corner of a triangle.
Definition at line 175 of file topology.h.
|
inline |
Returns the vertex crease/hard normal index of a corner of triangle, if there is crease/hard normal of this corner, otherwise it is the vertex normal index.
The value returned by this call can be used as a parameter for the VertexNormal() function in class Mesh. Or you can use TriangleVertexCreaseNormal() function in class Mesh directly.
Definition at line 180 of file topology.h.
|
inline |
Returns the vertex texture coordinate index of a corner of a triangle.
Definition at line 184 of file topology.h.
|
inline |
Sets the vertex texture coordinate index of a corner of a triangle.
The value returned by this call can be used as parameter for the VertexTC() function in class Mesh.
Definition at line 187 of file topology.h.
|
inlinevirtual |
Returns the vertex adjacency information index of a side of a triangle.
If the returned value is x, then x/3 is the index of the adjacent triangle, while x%3 is the side in the adjacent triangle which is common with the given one.
Definition at line 191 of file topology.h.
|
inlinevirtual |
Sets the adjacency info for a side of a triangle. See TriangleAdjacency for details.
Definition at line 193 of file topology.h.
Returns true if the given edge of a triangle has an adjacent triangle on the other side.
Definition at line 196 of file topology.h.
Returns the state of a face. See FaceState.
Definition at line 200 of file topology.h.
Sets the state of a face.
Definition at line 202 of file topology.h.
|
inline |
Returns true if the given face is selected.
Definition at line 205 of file topology.h.
|
virtual |
Sets selection state for a face.
The parameter bUpdateVertexSelection controls if the internal buffers should be updated or not. Passing true as this parameter makes the function slow, so do that only if you want to change the selection status for a few faces only. Otherwise use false, and after you changed all the vertices, update the buffers once only. [HOW? OPEN QUESTION]
|
virtual |
Returns the number of selected faces.
|
inline |
Returns true if the given face is visible.
Definition at line 216 of file topology.h.
Sets the visibility of a given face.
Definition at line 218 of file topology.h.
|
inline |
Definition at line 220 of file topology.h.
Definition at line 221 of file topology.h.
|
inline |
Used only internally.
Definition at line 226 of file topology.h.
|
inline |
Returns true if the given face is in the set of Isolated faces.
Definition at line 229 of file topology.h.
Sets the Isolation state of a given face.
Definition at line 231 of file topology.h.
|
inline |
This function can only be used for triangular meshes.
If the mesh only contains triangles, then this function always return false. When the original mesh was a mixed tri-quad or n-sided one, then during import it gets converted into a triangular mesh. Each polygon which has more than three sides are converted into N-2 triangles where N is the number of sides in the polygon. The first triangle is marked as real, but the other ones are marked as fake by this function. So this function makes it possible to restore the original polygon structure of the mesh.
Definition at line 239 of file topology.h.
Definition at line 241 of file topology.h.
|
inline |
Definition at line 248 of file topology.h.
Definition at line 249 of file topology.h.
|
inline |
Definition at line 253 of file topology.h.
|
virtual |
Adds new face component(s) to the object.
If the specified components did not exist yet, memory will be allocated for them.
|
virtual |
Removes face component(s) from the object. This might delete some data from the memory.
Returns the current face components for the object.
Definition at line 268 of file topology.h.
Sets the number of faces in the object. Existing face data will be kept.
|
virtual |
Sets the size of the adjacency array.
Returns the size of the adjacency matrix.
Definition at line 274 of file topology.h.
|
virtual |
Returns true if these is edge shared by more than two faces.
Returns the list of faces contained in T-shapes.
|
virtual |
Sets the usage hint for this Topology.
This allows Mudbox to optimize its internal data for the type of usage specified by the hint passed into this method.
|
virtual |
|
virtual |
See the documentation for Node::CheckValidity.
Reimplemented from TreeNode.
Reimplemented in Mesh, and SubdivisionLevel.
|
friend |
Definition at line 291 of file topology.h.
Definition at line 83 of file topology.h.
Definition at line 84 of file topology.h.
Definition at line 85 of file topology.h.
Definition at line 87 of file topology.h.
|
protected |
Definition at line 98 of file topology.h.