24 #ifndef PXR_IMAGING_HD_MESH_UTIL_H
25 #define PXR_IMAGING_HD_MESH_UTIL_H
39 #include "pxr/base/vt/array.h"
86 : _topology(topology), _id(id) {}
117 VtIntArray *primitiveParams,
118 VtIntArray *edgeIndices =
nullptr)
const;
169 VtIntArray *primitiveParams,
170 VtVec2iArray *edgeIndices =
nullptr)
const;
176 VtIntArray *primitiveParams,
177 VtVec2iArray *edgeIndices =
nullptr)
const;
189 VtValue *quadrangulated)
const;
200 VtValue *quadrangulated)
const;
212 void EnumerateEdges(std::vector<GfVec2i> * edgeVerticesOut)
const;
237 return ((faceIndex << 2) | (edgeFlag & 3));
240 return (coarseFaceParam >> 2);
243 return (coarseFaceParam & 3);
251 int _ComputeNumQuads(VtIntArray
const &numVerts,
252 VtIntArray
const &holeIndices,
253 bool *invalidFaceFound =
nullptr)
const;
256 void _ComputeQuadIndices(
258 VtIntArray *primitiveParams,
259 VtVec2iArray *edgeIndices,
260 bool triangulate =
false)
const;
321 std::vector<int>
const & edgeIndices,
322 std::vector<GfVec2i> * edgeVerticesOut)
const;
325 std::vector<int> * edgeIndicesOut)
const;
334 if (verts[0] > verts[1]) {
343 struct _CompareEdgeVertices {
344 bool operator() (_Edge
const &lhs, _Edge
const & rhs)
const {
345 return (lhs.verts[0] < rhs.verts[0] ||
346 (lhs.verts[0] == rhs.verts[0] &&
347 lhs.verts[1] < rhs.verts[1]));
351 struct _EdgeVerticesHash {
353 inline size_t operator()(
GfVec2i const&
v)
const {
355 int theMin = v[0], theMax = v[1];
356 if (theMin > theMax) {
360 size_t y = x + theMax;
361 return x + (y * (y + 1)) / 2;
365 std::vector<GfVec2i> _edgeVertices;
366 std::vector<_Edge> _edgesByIndex;
381 : _outputPtr(indicesBuffer)
382 , _triangulate(triangulate)
387 *_outputPtr++ = quadIndices[0];
388 *_outputPtr++ = quadIndices[1];
389 *_outputPtr++ = quadIndices[2];
390 *_outputPtr++ = quadIndices[2];
391 *_outputPtr++ = quadIndices[3];
392 *_outputPtr++ = quadIndices[0];
394 *_outputPtr++ = quadIndices[0];
395 *_outputPtr++ = quadIndices[1];
396 *_outputPtr++ = quadIndices[2];
397 *_outputPtr++ = quadIndices[3];
403 bool const _triangulate;
409 #endif // PXR_IMAGING_HD_MESH_UTIL_H
bool GetVerticesForEdgeIndex(int edgeId, GfVec2i *edgeVerticesOut) const
HD_API bool ComputeTriangulatedFaceVaryingPrimvar(void const *source, int numElements, HdType dataType, VtValue *triangulated) const
std::vector< int > numVerts
GLsizei GLenum const void * indices
HD_API void ComputeTriQuadIndices(VtIntArray *indices, VtIntArray *primitiveParams, VtVec2iArray *edgeIndices=nullptr) const
HD_API void ComputeTriangleIndices(VtVec3iArray *indices, VtIntArray *primitiveParams, VtIntArray *edgeIndices=nullptr) const
void swap(UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &a, UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &b)
HD_API bool ComputeQuadrangulatedFaceVaryingPrimvar(void const *source, int numElements, HdType dataType, VtValue *quadrangulated) const
static int DecodeFaceIndexFromCoarseFaceParam(int coarseFaceParam)
}@
bool IsAllQuads() const
Returns true if the mesh is all-quads.
void EmitQuadFace(GfVec4i const &quadIndices)
static int DecodeEdgeFlagFromCoarseFaceParam(int coarseFaceParam)
}@
bool GetVerticesForEdgeIndices(std::vector< int > const &edgeIndices, std::vector< GfVec2i > *edgeVerticesOut) const
HdMeshTriQuadBuilder(int *indicesBuffer, bool triangulate)
GT_API const UT_StringHolder topology
GLsizei GLsizei GLchar * source
static int const NumIndicesPerQuad
bool GetEdgeIndices(GfVec2i const &edgeVertices, std::vector< int > *edgeIndicesOut) const
HD_API void ComputeQuadIndices(VtIntArray *indices, VtIntArray *primitiveParams, VtVec2iArray *edgeIndices=nullptr) const
HD_API void EnumerateEdges(std::vector< GfVec2i > *edgeVerticesOut) const
static int const NumIndicesPerTriQuad
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
static int EncodeCoarseFaceParam(int faceIndex, int edgeFlag)
}@
#define PXR_NAMESPACE_CLOSE_SCOPE
HD_API bool ComputeQuadrangulatedPrimvar(HdQuadInfo const *qi, void const *source, int numElements, HdType dataType, VtValue *quadrangulated) const
HdMeshUtil(HdMeshTopology const *topology, SdfPath const &id)
HdMeshEdgeIndexTable(HdMeshTopology const *topology)
HUSD_API const char * dataType()
HD_API void ComputeQuadInfo(HdQuadInfo *quadInfo) const
Generate a quadInfo struct for the input topology.