Topology Class Reference

#include <topology.h>

Class Description

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.

+ Inheritance diagram for Topology:

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 TreeNodeFirstChild (void) const
 Returns the first node from the child list. More...
 
virtual TreeNodeParent (void) const
 Returns the parent node. More...
 
virtual TreeNodeNextSibling (void) const
 Returns the next linked node with the same parent. More...
 
virtual TreeNodePrevSibling (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 TreeNodeChildByClass (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 >
typeChildByClass (bool bAutoCreate=true) const
 Same as above, a most confortable version. More...
 
virtual TreeNodeChildByClass (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 >
typeChildByClass (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...
 
AttributeReferencePointer (unsigned int iIndex) const
 Returns the address of an attribute which refers to this node. The type of the attribute is always aptr. More...
 
NodeReferenceNode (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 NodeDuplicate (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...
 
AttributeAttributeByIndex (int iIndex) const
 Returns a specified attribute (or 0 if iIndex is greater than the number of attributes). More...
 
AttributeAttributeByName (const QString &sName) const
 Returns a specified attribute by its name. Returns 0 if the attribute not found. More...
 
AttributeAttributeByID (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 QWidgetCreatePropertiesWindow (QWidget *pParent)
 Create a window which displays the attributes of the node. Can be overriden to provide a custom interface. More...
 
AttributeAddAttribute (Attribute::AttributeType type, const QString &id)
 Allows SDK users to add attributes at runtime. More...
 
NodeNext (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 intm_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 intm_pTCI
 
Store< unsigned intm_pAdjacency
 
Store< unsigned intm_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 NodeFirst (void)
 This function will return the first node in the memory. Used to enumerate all the current nodes. See also Next(). More...
 
static NodeByID (int iID)
 Returns the node with the specified ID, or zero if such a node does not exists. More...
 
static NodeByName (const QString &sClass, const QString &sName)
 Search for a node with the name sName. More...
 

Member Enumeration Documentation

enum FaceState
Enumerator
fsSelected 
fsVisible 
fsFake 
fsActive 
fsMapped 
fsIsolated 

Definition at line 48 of file topology.h.

49  {
50  fsSelected = 0x01,
51  fsVisible = 0x02,
52  fsFake = 0x04,
53  fsActive = 0x08,
54  fsMapped = 0x10,
55  fsIsolated = 0x20 // this bit is used to store the previous Visible state when mudbox is in Isolate mode (and vice-versa)
56  };
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.

Enumerator
eStaticTopology 
eDynamicTopology 

This hint indicates the topology will not unchange or will change infrequently.

This hint indicates the topology will change frequently. For example, if new faces are frequently added to the topology, use this hint.

Definition at line 76 of file topology.h.

77  {
80  };
This hint indicates the topology will not unchange or will change infrequently.
Definition: topology.h:79

Constructor & Destructor Documentation

Topology ( void  )
protected

Do not use constructors directly. Use CreateInstances() instead.

Topology ( FaceType  eType)
protected

Constructs the object with zero faces.

Member Function Documentation

void MoveTo ( Topology pDestination)

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.

void CopyTo ( Node pNode) const
virtual

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.

void Serialize ( Stream s)
virtual

serializes the content of the object into/from a stream.

Reimplemented from TreeNode.

FaceType Type ( void  ) const
inline

Returns the type of the topology. Can be full triangular or full quadric.

Definition at line 122 of file topology.h.

122 { return m_eType; };
void SetType ( FaceType  eType)

Sets the type of the object. This call also clears all the content of the object.

int SideCount ( void  ) const
inline

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.

126 { return Type() == typeTriangular ? 3 : 4; };
FaceType Type(void) const
Returns the type of the topology. Can be full triangular or full quadric.
Definition: topology.h:122
unsigned int FaceCount ( void  ) const
inline

Returns the number of faces in the topology.

+ Examples:

Definition at line 130 of file topology.h.

130 { return m_iFaceCount; };
virtual Vector FaceNormal ( unsigned int  iFaceIndex) const
virtual

Returns the normal vector for a face in the topology.

void SetFaceID ( unsigned int  iFaceIndex,
unsigned int  iID 
)
inline

This function is used only internally.

Definition at line 134 of file topology.h.

134 { m_pFaceIDs[iFaceIndex] = iID; };
unsigned int FaceID ( unsigned int  iFaceIndex) const
inline

This function is used only internally.

Definition at line 136 of file topology.h.

136 { return m_pFaceIDs[iFaceIndex]; };
virtual void SetFakeTriangleCount ( unsigned int  iFakeTriangleCount)
virtual

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.

+ Examples:
unsigned int QuadIndex ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex 
) const
inline

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.

144 { return m_pIndices[iFaceIndex*4+iCornerIndex]; };
Store< unsigned int > m_pIndices
Definition: topology.h:87
void SetQuadIndex ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex,
unsigned int  iValue 
)
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.

+ Examples:

Definition at line 147 of file topology.h.

147 { m_pIndices[iFaceIndex*4+iCornerIndex] = iValue; };
Store< unsigned int > m_pIndices
Definition: topology.h:87
unsigned int QuadCreaseNormalIndex ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex 
) const
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.

152 { return m_pNormalIndices[iFaceIndex*4+iCornerIndex]; }
Store< unsigned int > m_pNormalIndices
Definition: topology.h:85
void SetQuadCreaseNormalIndex ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex,
unsigned int  iValue 
)
inline

Sets the vertex normal index of a corner of a quad.

Definition at line 154 of file topology.h.

154 { m_pNormalIndices[iFaceIndex*4+iCornerIndex] = iValue; }
Store< unsigned int > m_pNormalIndices
Definition: topology.h:85
unsigned int QuadTCI ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex 
) const
inline

Returns the vertex texture coordinate index of a corner of a quad.

Definition at line 156 of file topology.h.

156 { return m_pTCI[iFaceIndex*4+iCornerIndex]; }
Store< unsigned int > m_pTCI
Definition: topology.h:83
void SetQuadTCI ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex,
unsigned int  iValue 
)
inline

Sets the vertex texture coordinate index of a corner of a quad.

Definition at line 158 of file topology.h.

158 { m_pTCI[iFaceIndex*4+iCornerIndex] = iValue; }
Store< unsigned int > m_pTCI
Definition: topology.h:83
virtual unsigned int QuadAdjacency ( unsigned int  iFaceIndex,
unsigned int  iSideIndex 
) const
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.

162 { return m_pAdjacency[iFaceIndex*4+iSideIndex]; }
Store< unsigned int > m_pAdjacency
Definition: topology.h:84
unsigned int QuadAdjacency_ForcedInline ( unsigned int  iFaceIndex,
unsigned int  iSideIndex 
) const
inline

Definition at line 163 of file topology.h.

163 { return m_pAdjacency[iFaceIndex*4+iSideIndex]; }
Store< unsigned int > m_pAdjacency
Definition: topology.h:84
virtual void SetQuadAdjacency ( unsigned int  iFaceIndex,
unsigned int  iSideIndex,
unsigned int  iValue 
)
inlinevirtual

Sets the adjacency info for a side of a quad. See QuadAdjacency for details.

Definition at line 165 of file topology.h.

166  { m_pAdjacency[iFaceIndex*4+iSideIndex] = iValue; }
Store< unsigned int > m_pAdjacency
Definition: topology.h:84
bool HasAdjacentQuad ( unsigned int  iFaceIndex,
unsigned int  iSideIndex 
) const
inline

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.

168 { return QuadAdjacency( iFaceIndex, iSideIndex ) < 0x80000000; };
virtual unsigned int QuadAdjacency(unsigned int iFaceIndex, unsigned int iSideIndex) const
Returns the vertex adjacency information index of a side of a quad.
Definition: topology.h:162
unsigned int TriangleIndex ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex 
) const
inline

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.

173 { return m_pIndices[iFaceIndex*3+iCornerIndex]; };
Store< unsigned int > m_pIndices
Definition: topology.h:87
void SetTriangleIndex ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex,
unsigned int  iValue 
)
inline

Sets the vertex position index of a corner of a triangle.

+ Examples:

Definition at line 175 of file topology.h.

175 { m_pIndices[iFaceIndex*3+iCornerIndex] = iValue; };
Store< unsigned int > m_pIndices
Definition: topology.h:87
unsigned int TriangleCreaseNormalIndex ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex 
) const
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.

180 { return m_pNormalIndices[iFaceIndex*3+iCornerIndex]; }
Store< unsigned int > m_pNormalIndices
Definition: topology.h:85
void SetTriangleCreaseNormalIndex ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex,
unsigned int  iValue 
)
inline

Sets the vertex normal index of a corner of a triangle.

Definition at line 182 of file topology.h.

182 { m_pNormalIndices[iFaceIndex*3+iCornerIndex] = iValue; }
Store< unsigned int > m_pNormalIndices
Definition: topology.h:85
unsigned int TriangleTCI ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex 
) const
inline

Returns the vertex texture coordinate index of a corner of a triangle.

Definition at line 184 of file topology.h.

184 { return m_pTCI[iFaceIndex*3+iCornerIndex]; }
Store< unsigned int > m_pTCI
Definition: topology.h:83
void SetTriangleTCI ( unsigned int  iFaceIndex,
unsigned int  iCornerIndex,
unsigned int  iValue 
)
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.

+ Examples:

Definition at line 187 of file topology.h.

187 { m_pTCI[iFaceIndex*3+iCornerIndex] = iValue; }
Store< unsigned int > m_pTCI
Definition: topology.h:83
virtual unsigned int TriangleAdjacency ( unsigned int  iFaceIndex,
unsigned int  iSideIndex 
) const
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.

191 { return m_pAdjacency[iFaceIndex*3+iSideIndex]; }
Store< unsigned int > m_pAdjacency
Definition: topology.h:84
virtual void SetTriangleAdjacency ( unsigned int  iFaceIndex,
unsigned int  iSideIndex,
unsigned int  iValue 
)
inlinevirtual

Sets the adjacency info for a side of a triangle. See TriangleAdjacency for details.

Definition at line 193 of file topology.h.

194  { m_pAdjacency[iFaceIndex*3+iSideIndex] = iValue; }
Store< unsigned int > m_pAdjacency
Definition: topology.h:84
bool HasAdjacentTriangle ( unsigned int  iFaceIndex,
unsigned int  iSideIndex 
) const
inline

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.

197  { return TriangleAdjacency( iFaceIndex, iSideIndex ) < 0x80000000; };
virtual unsigned int TriangleAdjacency(unsigned int iFaceIndex, unsigned int iSideIndex) const
Returns the vertex adjacency information index of a side of a triangle.
Definition: topology.h:191
unsigned char& FaceState ( unsigned int  iFaceIndex)
inline

Returns the state of a face. See FaceState.

Definition at line 200 of file topology.h.

200 { return m_pFaceState[iFaceIndex]; };
unsigned char FaceState ( unsigned int  iFaceIndex) const
inline

Sets the state of a face.

Definition at line 202 of file topology.h.

202 { return m_pFaceState[iFaceIndex]; };
bool IsFaceSelected ( unsigned int  iFaceIndex) const
inline

Returns true if the given face is selected.

Definition at line 205 of file topology.h.

205 { return (FaceState( iFaceIndex ) & fsSelected) != 0; };
virtual void SetFaceSelected ( unsigned int  iFaceIndex,
bool  bSelected = true,
bool  bUpdateVertexSelection = false,
bool  bBatchSelection = false 
)
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 unsigned int SelectedFaceCount ( ) const
virtual

Returns the number of selected faces.

bool IsFaceVisible ( unsigned int  iFaceIndex) const
inline

Returns true if the given face is visible.

Definition at line 216 of file topology.h.

216 { return (FaceState( iFaceIndex ) & fsVisible) != 0; };
virtual void SetFaceVisible ( unsigned int  iFaceIndex,
bool  bVisible = true 
)
inlinevirtual

Sets the visibility of a given face.

Definition at line 218 of file topology.h.

219  { if ( bVisible ) FaceState( iFaceIndex ) |= fsVisible; else FaceState( iFaceIndex ) &= 0xff-fsVisible; };
bool IsFaceActive ( unsigned int  iFaceIndex) const
inline

Definition at line 220 of file topology.h.

220 { return (FaceState( iFaceIndex ) & fsActive) != 0; };
void SetFaceActive ( unsigned int  iFaceIndex,
bool  bSelected = true 
)
inline

Definition at line 221 of file topology.h.

222  { if ( bSelected ) FaceState( iFaceIndex ) |= fsActive; else FaceState( iFaceIndex ) &= 0xff-fsActive; };
bool IsFaceMapped ( unsigned int  iFaceIndex) const
inline

Used only internally.

Definition at line 224 of file topology.h.

224 { return (FaceState( iFaceIndex ) & fsMapped) != 0; };
void SetFaceMapped ( unsigned int  iFaceIndex,
bool  bSelected = true 
)
inline

Used only internally.

Definition at line 226 of file topology.h.

227  { if ( bSelected ) FaceState( iFaceIndex ) |= fsMapped; else FaceState( iFaceIndex ) &= 0xff-fsMapped; };
bool IsFaceIsolated ( unsigned int  iFaceIndex) const
inline

Returns true if the given face is in the set of Isolated faces.

Definition at line 229 of file topology.h.

229 { return (FaceState( iFaceIndex ) & fsIsolated) != 0; };
virtual void SetFaceIsolated ( unsigned int  iFaceIndex,
bool  bIsolated = true 
)
inlinevirtual

Sets the Isolation state of a given face.

Definition at line 231 of file topology.h.

232  { if ( bIsolated ) FaceState( iFaceIndex ) |= fsIsolated; else FaceState( iFaceIndex ) &= 0xff-fsIsolated; };
bool IsFakeTriangle ( unsigned int  iTriangleIndex) const
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.

240  { return iTriangleIndex < FaceCount() && (FaceState( iTriangleIndex ) & fsFake); };
unsigned int FaceCount(void) const
Returns the number of faces in the topology.
Definition: topology.h:130
void SetFakeTriangle ( unsigned int  iTriangleIndex,
bool  b 
)
inline
+ Examples:

Definition at line 241 of file topology.h.

242  { if( iTriangleIndex < FaceCount() ) {
243  if ( b ) FaceState( iTriangleIndex ) |= fsFake;
244  else FaceState( iTriangleIndex ) &= 0xff-fsFake;
245  };
246  };
unsigned int FaceCount(void) const
Returns the number of faces in the topology.
Definition: topology.h:130
GLubyte GLubyte b
Definition: GLee.h:5404
bool IsFaceTemp ( unsigned int  iFaceIndex) const
inline

Definition at line 248 of file topology.h.

248 { return m_pFaceTemp[iFaceIndex]; };
void SetFaceTemp ( unsigned int  iFaceIndex,
bool  bSelected = true 
)
inline

Definition at line 249 of file topology.h.

250  { m_pFaceTemp[iFaceIndex] = bSelected; }
void ClearFaceTempStates ( )
inline

Definition at line 253 of file topology.h.

254  {
255  MB_ASSERT(m_iFaceCount <= m_pFaceTemp.ItemCount());
256  if( m_iFaceCount <= m_pFaceTemp.ItemCount() &&
257  m_pFaceTemp.ItemCount() > 0 )
258  memset(&m_pFaceTemp[0], 0, m_iFaceCount); // memset is the fastest way to clear the array.
259  }
#define MB_ASSERT(condition)
Definition: mudbox.h:73
unsigned int ItemCount(void) const
Returns the number of items in the array.
Definition: array.h:645
virtual void AddFaceComponent ( FaceComponent  eComponentToAdd)
virtual

Adds new face component(s) to the object.

If the specified components did not exist yet, memory will be allocated for them.

virtual void RemoveFaceComponent ( FaceComponent  eComponentToRemove)
virtual

Removes face component(s) from the object. This might delete some data from the memory.

unsigned int FaceComponents ( void  ) const
inline

Returns the current face components for the object.

Definition at line 268 of file topology.h.

268 { return m_eFaceComponents; };
virtual void SetFaceCount ( unsigned int  iFaceCount)
virtual

Sets the number of faces in the object. Existing face data will be kept.

+ Examples:
virtual bool SetAdjacencyCount ( unsigned int  iCount,
bool  bKeepContent = true,
bool  bForced = false 
)
virtual

Sets the size of the adjacency array.

unsigned int AdjacencyCount ( void  ) const
inline

Returns the size of the adjacency matrix.

Definition at line 274 of file topology.h.

274 { return m_pAdjacency.ItemCount(); };
unsigned int ItemCount(void) const
Returns the number of items in the array.
Definition: array.h:645
Store< unsigned int > m_pAdjacency
Definition: topology.h:84
virtual bool HasTShape ( ) const
virtual

Returns true if these is edge shared by more than two faces.

virtual const Store<unsigned int>& TShapeFaces ( void  ) const
virtual

Returns the list of faces contained in T-shapes.

virtual void SetTopologyHint ( TopologyHint  eHint)
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 enum TopologyHint TopologyHint ( ) const
virtual
virtual void CheckValidity ( DiagnosticLevel  iLevel = dgnLevel2) const
virtual

See the documentation for Node::CheckValidity.

Reimplemented from TreeNode.

Reimplemented in Mesh, and SubdivisionLevel.

Friends And Related Function Documentation

friend class ::XMesh
friend

Definition at line 291 of file topology.h.

Member Data Documentation

Store<unsigned int> m_pTCI
protected

Definition at line 83 of file topology.h.

Store<unsigned int> m_pAdjacency
protected

Definition at line 84 of file topology.h.

Store<unsigned int> m_pNormalIndices
protected

Definition at line 85 of file topology.h.

Store<unsigned int> m_pIndices

Definition at line 87 of file topology.h.

TopologyHint m_eTopologyHint
protected

Definition at line 98 of file topology.h.


The documentation for this class was generated from the following file: