HDK
|
A mesh of polygons. More...
#include <GT_PrimPolygonMesh.h>
Protected Attributes | |
GT_AttributeListHandle | myShared |
GT_AttributeListHandle | myVertex |
GT_AttributeListHandle | myUniform |
GT_AttributeListHandle | myDetail |
Additional Inherited Members | |
![]() | |
static int | createPrimitiveTypeId () |
static GT_AttributeListHandle | mergeAttributeLists (bool &changed, const GT_AttributeListHandle &src, const GT_AttributeListHandle &merge, const UT_StringMMPattern *pattern, const UT_StringMMPattern *alternate=NULL) |
static bool | computeVelocityRange (UT_Vector3 &vmin, UT_Vector3 &vmax, const GT_DataArrayHandle &v) |
static GT_PrimitiveHandle | refineDetail (const GU_ConstDetailHandle &detail, const GT_RefineParms *parms) |
static GT_PrimitiveHandle | refinePrimitive (const GT_PrimitiveHandle &primh, const GT_RefineParms *parms) |
static void * | operator new (size_t size) |
static void * | operator new (size_t size, void *p) |
static void | operator delete (void *p, size_t size) |
A mesh of polygons.
Definition at line 35 of file GT_PrimPolygonMesh.h.
|
inline |
Default constructor.
Definition at line 39 of file GT_PrimPolygonMesh.h.
|
inline |
Useful constructor.
Definition at line 46 of file GT_PrimPolygonMesh.h.
|
inline |
Definition at line 63 of file GT_PrimPolygonMesh.h.
GT_PrimPolygonMesh::GT_PrimPolygonMesh | ( | const GT_PrimPolygonMesh & | pmesh, |
const GT_AttributeListHandle & | shared, | ||
const GT_AttributeListHandle & | vertex, | ||
const GT_AttributeListHandle & | uniform, | ||
const GT_AttributeListHandle & | detail | ||
) |
Copy the topology information from the source pmesh, but use different attribute lists.
GT_PrimPolygonMesh::GT_PrimPolygonMesh | ( | const GT_PrimPolygonMesh & | pmesh, |
const GT_DataArrayHandle & | vtx_indices, | ||
const GT_AttributeListHandle & | shared | ||
) |
Create a new polygon mesh with re-mapped vertices (used by removeUnusedPoints).
Since the polygon faces are remapped you'll have to pass in a new face set map.
GT_PrimPolygonMesh::GT_PrimPolygonMesh | ( | const GT_PrimPolygonMesh & | pmesh | ) |
Copy c-tor.
GT_PrimPolygonMesh::GT_PrimPolygonMesh | ( | const GT_PrimPolygon & | poly | ) |
Construct a polygon mesh from a GT_PrimPolygon.
void GT_PrimPolygonMesh::addFaceSet | ( | const UT_StringHolder & | name, |
const GT_FaceSetPtr & | set | ||
) |
Access to the face sets
GT_PrimitiveHandle GT_PrimPolygonMesh::adoptConvexing | ( | const GT_DataArrayHandle & | verts, |
const GT_DataArrayHandle & | uniform_indexing, | ||
const GT_DataArrayHandle & | vertex_indexing, | ||
const GT_DataArrayHandle & | vert_info, | ||
const GT_DataArrayHandle & | prim_info | ||
) | const |
Using the indirect arrays and vertex list from a convexed mesh, convex this mesh (assumes topology is the same).
|
inlineoverridevirtual |
Implements GT_Primitive.
Reimplemented in GT_PrimSubdivisionMesh.
Definition at line 99 of file GT_PrimPolygonMesh.h.
|
inlineprotectedvirtual |
Reimplemented in GT_PrimSubdivisionMesh.
Definition at line 431 of file GT_PrimPolygonMesh.h.
|
inlineprotectedvirtual |
Reimplemented in GT_PrimSubdivisionMesh.
Definition at line 445 of file GT_PrimPolygonMesh.h.
|
inlineprotectedvirtual |
Reimplemented in GT_PrimSubdivisionMesh.
Definition at line 455 of file GT_PrimPolygonMesh.h.
|
inlineprotectedvirtual |
Reimplemented in GT_PrimSubdivisionMesh.
Definition at line 462 of file GT_PrimPolygonMesh.h.
Methods for GEO/GU support.
Reimplemented from GT_Primitive.
Methods for GEO/GU support.
Reimplemented from GT_Primitive.
|
overridevirtual |
Methods for GEO/GU support.
Reimplemented from GT_Primitive.
GT_PrimitiveHandle GT_PrimPolygonMesh::convex | ( | int | max_points_per_poly = 3 , |
bool | keep_degenerate = false , |
||
bool | allow_interrupt = true , |
||
bool | allow_indirect_flattening = false , |
||
const UT_Set< int > * | holes = nullptr |
||
) | const |
Ensure all polygons in the mesh are convex
If the holes
set is passed in, then the faces in that set will be excluded from the convexed result.
bool GT_PrimPolygonMesh::createFastTangents | ( | GT_DataArrayHandle * | tanu_h, |
GT_DataArrayHandle * | tanv_h | ||
) | const |
Create quick tangents (not MikkT) for fast viewer tangent generation. Tangents are not created in this mesh. NOTE: Not working very well yet.
|
overridevirtual |
Compute shared normals. This will use the shared attribute named P to compute the normals for each shared point.
Reimplemented from GT_Primitive.
GT_PrimPolygonMesh* GT_PrimPolygonMesh::createPointNormalsIfMissing | ( | const UT_StringRef & | P = GA_Names::P , |
bool | normalize = true , |
||
bool * | error = nullptr |
||
) | const |
Create point normals on a new mesh if no normals are found. If no point or vertex normals are found, generate point normals from P and return a new mesh. If normals are found, return NULL.
If the segement is less than 0, normals for all segments will be computed (if required)
GT_PrimPolygonMesh* GT_PrimPolygonMesh::createTangentsIfMissing | ( | bool * | error = nullptr | ) |
Create point normals and MikkT tangents on a new mesh if not found. If either normals or tangents are not found, return a new mesh with both generated. If both exist, return NULL.
|
virtual |
Compute vertex normals. This will use the shared attribute named P to compute the normals for each vertex.
GT_PrimPolygonMesh* GT_PrimPolygonMesh::createVertexNormalsIfMissing | ( | const UT_StringRef & | P = GA_Names::P , |
fpreal | cuspangledegrees = GT_DEFAULT_ADJUSTED_CUSP_ANGLE , |
||
bool | normalize = true , |
||
bool * | error = nullptr |
||
) | const |
|
overridevirtual |
The virtual implementation of attribute merging.
Reimplemented from GT_Primitive.
Reimplemented in GT_PrimSubdivisionMesh.
|
overridevirtual |
Harden all attributes so there are no dangling dependencies.
Reimplemented from GT_Primitive.
Reimplemented in GT_PrimSubdivisionMesh.
|
inlineoverridevirtual |
Create a copy of the primitive, referencing all the source data This can return a NULL pointer, but it would be better to implement it properly.
Implements GT_Primitive.
Reimplemented in GT_PrimSubdivisionMesh.
Definition at line 204 of file GT_PrimPolygonMesh.h.
|
overridevirtual |
Methods defined on GT_Primitive
Implements GT_Primitive.
bool GT_PrimPolygonMesh::faceNormals | ( | UT_Vector3 * | N, |
int | segment = 0 , |
||
const UT_StringRef & | P = GA_Names::P |
||
) | const |
Compute face normals. This will use the shared attribute named P to compute the normals for each face. fpreal16 must have the proper vector length
bool GT_PrimPolygonMesh::faceNormals | ( | UT_Vector3D * | N64, |
int | segment = 0 , |
||
const UT_StringRef & | P = GA_Names::P |
||
) | const |
Compute face normals. This will use the shared attribute named P to compute the normals for each face. fpreal16 must have the proper vector length
bool GT_PrimPolygonMesh::faceNormals | ( | fpreal16 * | N16, |
int | segment = 0 , |
||
const UT_StringRef & | P = GA_Names::P |
||
) | const |
Compute face normals. This will use the shared attribute named P to compute the normals for each face. fpreal16 must have the proper vector length
GT_DataArrayHandle GT_PrimPolygonMesh::faceNormals | ( | int | segment = 0 , |
const UT_StringRef & | P = GA_Names::P , |
||
GT_Storage | store = GT_STORE_REAL32 |
||
) | const |
Compute face normals. This will use the shared attribute named P to compute the normals for each face. fpreal16 must have the proper vector length
|
inline |
Access to the face sets
Definition at line 195 of file GT_PrimPolygonMesh.h.
void GT_PrimPolygonMesh::getConvexArrays | ( | GT_DataArrayHandle & | verts, |
GT_DataArrayHandle & | uniform_indexing, | ||
GT_DataArrayHandle & | vertex_indexing, | ||
GT_DataArrayHandle & | vert_info, | ||
GT_DataArrayHandle & | prim_info | ||
) | const |
Fetches the convexed arrays from the mesh, to be used by adoptConvexing on a different mesh with the same topology.
|
inline |
Accessor
Definition at line 189 of file GT_PrimPolygonMesh.h.
|
inlineoverridevirtual |
Access attributes
Reimplemented from GT_Primitive.
Definition at line 224 of file GT_PrimPolygonMesh.h.
void GT_PrimPolygonMesh::getEdgePoints | ( | GT_Offset | face, |
GT_Offset | vertex, | ||
GT_Offset & | p0, | ||
GT_Offset & | p1 | ||
) | const |
For a given face, find the shared point numbers for the given vertex and the next vertex (i.e. the edge starting from the given vertex).
GT_PrimitiveHandle GT_PrimPolygonMesh::getFace | ( | GT_Offset | i | ) | const |
Return a pointer to the individual face.
GT_Size GT_PrimPolygonMesh::getFaceCount | ( | ) | const |
Return the number of faces in the mesh.
|
inline |
Accessor
Definition at line 177 of file GT_PrimPolygonMesh.h.
GT_DataArrayHandle GT_PrimPolygonMesh::getFaceCounts | ( | GT_IndexingMode | indexing = GT_INDEXING_QUICK | ) | const |
Return an array containing the face counts per-face.
|
inline |
Query the minimum/maximum number of vertices per face
Definition at line 170 of file GT_PrimPolygonMesh.h.
|
overridevirtual |
|
inline |
Query the minimum/maximum number of vertices per face
Definition at line 169 of file GT_PrimPolygonMesh.h.
|
overridevirtual |
Methods defined on GT_Primitive
Implements GT_Primitive.
Return the point index for a given face and vertex.
|
inlineoverridevirtual |
Access attributes
Reimplemented from GT_Primitive.
Definition at line 220 of file GT_PrimPolygonMesh.h.
|
inline |
Return the number of points.
Definition at line 162 of file GT_PrimPolygonMesh.h.
|
overridevirtual |
Methods defined on GT_Primitive
Reimplemented from GT_Primitive.
Reimplemented in GT_PrimSubdivisionMesh.
|
inline |
Accessor
Definition at line 183 of file GT_PrimPolygonMesh.h.
|
inline |
Accessor
Definition at line 187 of file GT_PrimPolygonMesh.h.
|
inlineoverridevirtual |
Access attributes
Reimplemented from GT_Primitive.
Definition at line 222 of file GT_PrimPolygonMesh.h.
const GT_DataArrayHandle GT_PrimPolygonMesh::getUsedPointList | ( | GT_IndexingMode | idx = GT_INDEXING_QUICK | ) | const |
The polygon mesh may have shared points which aren't used. That is, there may be elements in the shared element list which aren't referenced by any vertex. This method will build a list of indices for all the used points.
The list returned will be monotonically ascending.
|
inline |
Accessor
Definition at line 185 of file GT_PrimPolygonMesh.h.
|
inlineoverridevirtual |
Access attributes
Reimplemented from GT_Primitive.
Definition at line 218 of file GT_PrimPolygonMesh.h.
|
inline |
Return the number of vertices.
Definition at line 157 of file GT_PrimPolygonMesh.h.
Return the length of the vertex list for the given face.
Definition at line 235 of file GT_PrimPolygonMesh.h.
|
inlineoverridevirtual |
Return the offset into the vertex list for the given face.
Definition at line 232 of file GT_PrimPolygonMesh.h.
|
protected |
void GT_PrimPolygonMesh::init | ( | const GT_DataArrayHandle & | vtx_counts, |
const GT_DataArrayHandle & | vtx_indices, | ||
const GT_AttributeListHandle & | shared, | ||
const GT_AttributeListHandle & | vertex, | ||
const GT_AttributeListHandle & | uniform, | ||
const GT_AttributeListHandle & | detail, | ||
GT_IndexingMode | indexing = GT_INDEXING_QUICK , |
||
GT_Size | min_vertex_count = 0 , |
||
GT_Size | max_vertex_count = 0 |
||
) |
Initialize the mesh
vtx_counts
vtx_indices
shared
vertex
uniform
vtx_counts
array.detail
vtx_counts
array.indexing
void GT_PrimPolygonMesh::init | ( | const GT_CountArray & | vtx_counts, |
const GT_DataArrayHandle & | vtx_indices, | ||
const GT_AttributeListHandle & | shared, | ||
const GT_AttributeListHandle & | vertex, | ||
const GT_AttributeListHandle & | uniform, | ||
const GT_AttributeListHandle & | detail | ||
) |
Initialize the mesh
vtx_counts
vtx_indices
shared
vertex
uniform
vtx_counts
array.detail
vtx_counts
array.indexing
|
inline |
Returns true if this mesh has been convexed.
Definition at line 243 of file GT_PrimPolygonMesh.h.
bool GT_PrimPolygonMesh::partitionByMaterial | ( | const GT_DataArrayHandle & | mat_id, |
UT_Array< GT_PrimitiveHandle > & | sub_meshes, | ||
GT_Size | polygon_limit = SYS_INT32_MAX |
||
) | const |
Partition a mesh into submeshes by the shop_materialpath attribute, each with exact one material in a detail shop_materialpath attribute. Returns false if shop_materialpath doesn't exist, isn't a uniform attrib, or has only 1 material.
bool GT_PrimPolygonMesh::pointNormals | ( | UT_Vector3T< fpreal16 > * | N, |
GT_Size | npts, | ||
int | segment = 0 , |
||
const UT_StringRef & | P = GA_Names::P , |
||
bool | normalize = true , |
||
const fpreal32 * | pntdata = NULL |
||
) | const |
Compute shared normals. This will use the shared attribute named P to compute the normals for each shared point.
bool GT_PrimPolygonMesh::pointNormals | ( | UT_Vector3 * | N, |
GT_Size | npts, | ||
int | segment = 0 , |
||
const UT_StringRef & | P = GA_Names::P , |
||
bool | normalize = true , |
||
const fpreal32 * | pntdata = NULL |
||
) | const |
Compute shared normals. This will use the shared attribute named P to compute the normals for each shared point.
bool GT_PrimPolygonMesh::pointNormals | ( | UT_Vector3D * | N, |
GT_Size | npts, | ||
int | segment = 0 , |
||
const UT_StringRef & | P = GA_Names::P , |
||
bool | normalize = true , |
||
const fpreal32 * | pntdata = NULL |
||
) | const |
Compute shared normals. This will use the shared attribute named P to compute the normals for each shared point.
|
overridevirtual |
Methods defined on GT_Primitive
Reimplemented from GT_Primitive.
Reimplemented in GT_PrimSubdivisionMesh.
GT_PrimitiveHandle GT_PrimPolygonMesh::removeUnusedPoints | ( | const int32 * | idx = NULL | ) | const |
Remove unused points. This will collapse the varying point arrays, leaving only the points referenced by the vertices.
|
overridevirtual |
Save the primitive to a JSON stream. The default method does nothing and returns false.
Reimplemented from GT_Primitive.
Reimplemented in GT_PrimSubdivisionMesh.
|
inline |
Set the convex flag on the mesh.
Definition at line 246 of file GT_PrimPolygonMesh.h.
|
inline |
Access to the face sets
Definition at line 196 of file GT_PrimPolygonMesh.h.
bool GT_PrimPolygonMesh::splitMesh | ( | GT_Size | polygon_limit, |
UT_Array< GT_PrimitiveHandle > & | split_meshes, | ||
bool | remove_unused_points = true |
||
) | const |
Divide a mesh into smaller meshes if it exceeds the poly_limit. If this mesh has more than polygon_limit polygons, this will split the mesh into multiple sub-meshes, attempting to keep them all roughly the same number of polygons. If this mesh has fewer than polygon_limit polygons, it will return false and not add any meshes to split_meshes. If remove_unused_points is true, each submesh will have unused points removed.
|
overridevirtual |
update any cached data for geometry and its attributes
Reimplemented from GT_Primitive.
bool GT_PrimPolygonMesh::vertexNormals | ( | UT_Vector3T< fpreal16 > * | N, |
GT_Size | npts, | ||
int | segment = 0 , |
||
const UT_StringRef & | P = GA_Names::P , |
||
fpreal | maxangledegrees = GT_DEFAULT_ADJUSTED_CUSP_ANGLE , |
||
bool | normalize = true |
||
) | const |
Compute vertex normals. This will use the shared attribute named P to compute the normals for each vertex.
bool GT_PrimPolygonMesh::vertexNormals | ( | UT_Vector3 * | N, |
GT_Size | npts, | ||
int | segment = 0 , |
||
const UT_StringRef & | P = GA_Names::P , |
||
fpreal | maxangledegrees = GT_DEFAULT_ADJUSTED_CUSP_ANGLE , |
||
bool | normalize = true |
||
) | const |
Compute vertex normals. This will use the shared attribute named P to compute the normals for each vertex.
bool GT_PrimPolygonMesh::vertexNormals | ( | UT_Vector3D * | N, |
GT_Size | npts, | ||
int | segment = 0 , |
||
const UT_StringRef & | P = GA_Names::P , |
||
fpreal | maxangledegrees = GT_DEFAULT_ADJUSTED_CUSP_ANGLE , |
||
bool | normalize = true |
||
) | const |
Compute vertex normals. This will use the shared attribute named P to compute the normals for each vertex.
|
protected |
Definition at line 471 of file GT_PrimPolygonMesh.h.
|
protected |
Definition at line 468 of file GT_PrimPolygonMesh.h.
|
protected |
Definition at line 470 of file GT_PrimPolygonMesh.h.
|
protected |
Definition at line 469 of file GT_PrimPolygonMesh.h.