PxOsdMeshTopology Class Reference

Topology data for meshes. More...

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

Returns the hole face indices.

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

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());

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

Definition at line 69 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.

◆ 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.");
{
PxOsdMeshTopologyValidation validation = topology.Validate();
if (!validation){
for (auto const& elem: validation){
TF_WARN(elem.message);
}
}
}
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: