Loading...
Searching...
No Matches
PxOsdMeshTopology Class Reference

Topology data for meshes. More...

#include <meshTopology.h>

Public Types

typedef uint64_t ID
 

Public Member Functions

PxOsdMeshTopologyoperator= (const PxOsdMeshTopology &)=default
 
 PxOsdMeshTopology (const PxOsdMeshTopology &)=default
 
 PxOsdMeshTopology (PxOsdMeshTopology &&)=default
 
PxOsdMeshTopologyoperator= (PxOsdMeshTopology &&)=default
 
PXOSD_API PxOsdMeshTopology (TfToken const &scheme, TfToken const &orientation, VtIntArray const &faceVertexCounts, VtIntArray const &faceVertexIndices)
 Construct a topology without holes or subdiv tags.
 
PXOSD_API PxOsdMeshTopology (TfToken const &scheme, TfToken const &orientation, VtIntArray const &faceVertexCounts, VtIntArray const &faceVertexIndices, VtIntArray const &holeIndices)
 Construct a topology with holes.
 
PXOSD_API PxOsdMeshTopology (TfToken const &scheme, TfToken const &orientation, VtIntArray const &faceVertexCounts, VtIntArray const &faceVertexIndices, VtIntArray const &holeIndices, PxOsdSubdivTags const &subdivTags)
 Construct a topology with holes and subdiv tags.
 
PXOSD_API PxOsdMeshTopology (TfToken const &scheme, TfToken const &orientation, VtIntArray const &faceVertexCounts, VtIntArray const &faceVertexIndices, PxOsdSubdivTags const &subdivTags)
 Construct a topology with subdiv tags.
 
TfToken const GetScheme () const
 Returns the subdivision scheme.
 
VtIntArray const & GetFaceVertexCounts () const
 Returns face vertex counts.
 
VtIntArray const & GetFaceVertexIndices () const
 Returns face vertex indices.
 
TfToken const & GetOrientation () const
 Returns orientation.
 
PXOSD_API PxOsdMeshTopology WithScheme (TfToken const &scheme) const
 Return a copy of the topology, changing only the scheme.
 
PXOSD_API PxOsdMeshTopology WithSubdivTags (PxOsdSubdivTags const &tags) const
 Return a copy of the topology, changing only the subdiv tags.
 
PXOSD_API PxOsdMeshTopology WithHoleIndices (VtIntArray const &holeIndices) const
 Return a copy of the topology, changing only the hole indices.
 
PXOSD_API ID ComputeHash () const
 Returns the hash value of this topology to be used for instancing.
 
PXOSD_API bool operator== (PxOsdMeshTopology const &other) const
 Equality check between two mesh topologies.
 
PXOSD_API PxOsdMeshTopologyValidation Validate () const
 Returns a validation object which is empty if the topology is valid.
 
Holes

Returns the hole face indices.

VtIntArray const & GetHoleIndices () const
 
Tags
PxOsdSubdivTags const & GetSubdivTags () const
 Returns subdivision tags.
 

Detailed Description

Topology data for meshes.

Once constructed, this class is immutable (except when assigned or moved).

To make changing certain properties easier, several methods are provided. WithScheme, WithHoleIndices, and WithSubdivTags will return copies of the object with certain specific properites changed.

PxOsdMeshTopology otherTopology =
originalTopology.WithScheme(PxOsdOpenSubdivTokens->catmullClark);
TF_VERIFY(otherTopology.GetScheme() ==
PxOsdOpenSubdivTokens->catmullClark);
TF_VERIFY(otherTopology.GetOrientation() ==
originalTopology.GetOrientation());
TF_VERIFY(otherTopology.GetSubdivTags() ==
originalTopology.GetSubdivTags());
TF_VERIFY(otherTopology.GetFaceVertexCounts() ==
originalTopology.GetFaceVertexCounts());
TF_VERIFY(otherTopology.GetFaceVertexIndices() ==
originalTopology.GetFaceVertexIndices());
Topology data for meshes.
Definition: meshTopology.h:69
TfToken const & GetOrientation() const
Returns orientation.
Definition: meshTopology.h:138
PXOSD_API PxOsdMeshTopology WithScheme(TfToken const &scheme) const
Return a copy of the topology, changing only the scheme.
Definition: meshTopology.h:169
PxOsdSubdivTags const & GetSubdivTags() const
Returns subdivision tags.
Definition: meshTopology.h:158
TfToken const GetScheme() const
Returns the subdivision scheme.
Definition: meshTopology.h:123
VtIntArray const & GetFaceVertexCounts() const
Returns face vertex counts.
Definition: meshTopology.h:128
VtIntArray const & GetFaceVertexIndices() const
Returns face vertex indices.
Definition: meshTopology.h:133
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
Definition: diagnostic.h:283

The cost of copying should be mitigated by the copy semantics of VtArray and TfToken.

Definition at line 69 of file meshTopology.h.

Member Typedef Documentation

◆ ID

typedef uint64_t ID

Definition at line 73 of file meshTopology.h.

Constructor & Destructor Documentation

◆ PxOsdMeshTopology() [1/4]

PXOSD_API PxOsdMeshTopology ( TfToken const &  scheme,
TfToken const &  orientation,
VtIntArray const &  faceVertexCounts,
VtIntArray const &  faceVertexIndices 
)

Construct a topology without holes or subdiv tags.

◆ PxOsdMeshTopology() [2/4]

PXOSD_API PxOsdMeshTopology ( TfToken const &  scheme,
TfToken const &  orientation,
VtIntArray const &  faceVertexCounts,
VtIntArray const &  faceVertexIndices,
VtIntArray const &  holeIndices 
)

Construct a topology with holes.

◆ PxOsdMeshTopology() [3/4]

PXOSD_API PxOsdMeshTopology ( TfToken const &  scheme,
TfToken const &  orientation,
VtIntArray const &  faceVertexCounts,
VtIntArray const &  faceVertexIndices,
VtIntArray const &  holeIndices,
PxOsdSubdivTags const &  subdivTags 
)

Construct a topology with holes and subdiv tags.

◆ PxOsdMeshTopology() [4/4]

PXOSD_API PxOsdMeshTopology ( TfToken const &  scheme,
TfToken const &  orientation,
VtIntArray const &  faceVertexCounts,
VtIntArray const &  faceVertexIndices,
PxOsdSubdivTags const &  subdivTags 
)

Construct a topology with subdiv tags.

Member Function Documentation

◆ ComputeHash()

PXOSD_API ID ComputeHash ( ) const

Returns the hash value of this topology to be used for instancing.

◆ GetFaceVertexCounts()

VtIntArray const & GetFaceVertexCounts ( ) const
inline

Returns face vertex counts.

Definition at line 128 of file meshTopology.h.

◆ GetFaceVertexIndices()

VtIntArray const & GetFaceVertexIndices ( ) const
inline

Returns face vertex indices.

Definition at line 133 of file meshTopology.h.

◆ GetHoleIndices()

VtIntArray const & GetHoleIndices ( ) const
inline

Definition at line 147 of file meshTopology.h.

◆ GetOrientation()

TfToken const & GetOrientation ( ) const
inline

Returns orientation.

Definition at line 138 of file meshTopology.h.

◆ GetScheme()

TfToken const GetScheme ( ) const
inline

Returns the subdivision scheme.

Definition at line 123 of file meshTopology.h.

◆ GetSubdivTags()

PxOsdSubdivTags const & GetSubdivTags ( ) const
inline

Returns subdivision tags.

Definition at line 158 of file meshTopology.h.

◆ operator==()

PXOSD_API bool operator== ( PxOsdMeshTopology const &  other) const

Equality check between two mesh topologies.

◆ Validate()

PXOSD_API PxOsdMeshTopologyValidation Validate ( ) const

Returns a validation object which is empty if the topology is valid.

// Validation with minimal reporting
if (!topology.Validate()) TF_CODING_ERROR("Invalid topology.");
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
Definition: diagnostic.h:85
{
PxOsdMeshTopologyValidation validation = topology.Validate();
if (!validation){
for (auto const& elem: validation){
TF_WARN(elem.message);
}
}
}
Utility to help validate an OpenSubdiv Mesh topology.
#define TF_WARN(...)
Issue a warning, but continue execution.
Definition: diagnostic.h:149
Note
Internally caches the result of the validation if the topology is valid

◆ WithHoleIndices()

PXOSD_API PxOsdMeshTopology WithHoleIndices ( VtIntArray const &  holeIndices) const
inline

Return a copy of the topology, changing only the hole indices.

Definition at line 183 of file meshTopology.h.

◆ WithScheme()

PXOSD_API PxOsdMeshTopology WithScheme ( TfToken const &  scheme) const
inline

Return a copy of the topology, changing only the scheme.

Valid values include: catmullClark, loop, bilinear.

Note that the token "catmark" is also supported for backward compatibility, but has been deprecated.

Definition at line 169 of file meshTopology.h.

◆ WithSubdivTags()

PXOSD_API PxOsdMeshTopology WithSubdivTags ( PxOsdSubdivTags const &  tags) const
inline

Return a copy of the topology, changing only the subdiv tags.

Definition at line 176 of file meshTopology.h.


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