11 #ifndef __GT_PrimSubdivisionMesh__
12 #define __GT_PrimSubdivisionMesh__
65 shared, vertex, uniform, detail, indexing,
66 min_vertex_count, max_vertex_count)
78 shared, vertex, uniform, detail)
91 , myScheme(mesh.myScheme)
99 , myScheme(mesh.myScheme)
104 , myTags(mesh.myTags)
105 , myScheme(mesh.myScheme)
123 {
return "GT_PrimSubdivisionMesh"; }
130 void overrideAttributes(
133 void clearOverrideAttributes();
158 : myName(src.myName, true)
161 , myString(src.myString)
168 myName.
harden(src.myName);
171 myString = src.myString;
177 bool valid()
const {
return myName.isstring(); }
180 int64 mem =
sizeof(*this) + myName.getMemoryUsage();
181 for (
exint i = 0; i < myInt.entries(); ++i)
182 mem += myInt(i)->getMemoryUsage();
183 for (
exint i = 0; i < myReal.entries(); ++i)
184 mem += myReal(i)->getMemoryUsage();
185 for (
exint i = 0; i < myString.entries(); ++i)
186 mem += myString(i)->getMemoryUsage();
192 myInt.setCapacity(0);
193 myReal.setCapacity(0);
194 myString.setCapacity(0);
196 const char *
name()
const {
return myName; }
204 {
return myReal(i); }
206 {
return myString(i); }
211 { myInt.append(data); }
213 { myReal.append(data); }
215 { myString.append(data); }
246 if (atEnd() && tag.
atEnd())
248 if (atEnd() || tag.
atEnd())
250 return myTags == tag.myTags && myCurr == tag.myCurr;
260 {
return (*myTags)(myCurr); }
263 int index()
const {
return myCurr; }
267 return !myTags || myCurr >= myTags->entries();
305 for (
int i = 0; i < myTags.entries(); ++i)
307 if (myTags(i).match(name))
315 for (
int i = 0; i < myTags.entries(); ++i)
317 if (myTags(i).match(name))
319 myTags.removeIndex(i);
328 myTags.setCapacity(0);
356 smesh->myTags = myTags;
357 smesh->myScheme = myScheme;
368 GT_Size max_vertex_count=0)
const override
371 shared, vertex, uniform, detail, indexing,
372 min_vertex_count, max_vertex_count);
383 shared, vertex, uniform, detail);
401 Tag *findOrCreateTag(
const char *
name,
bool replace)
403 for (
int i = 0; i < myTags.entries(); ++i)
405 if (myTags(i).match(name))
412 myTags.append(Tag(name));
413 return &myTags(myTags.entries()-1);
tag_iterator endTag() const
SIM_API const UT_StringHolder vertex
const Tag * findTag(const char *name) const
GT_PrimitiveHandle triangulate() const
Triangulate (for Loop subdivision)
void appendString(const GT_DataArrayHandle &data)
void appendRealTag(const char *name, const GT_DataArrayHandle &v, bool replace=false)
const UT_Array< GT_DataArrayHandle > & getAllReal() const
void appendStringTag(const char *name, const GT_DataArrayHandle &v, bool replace=false)
bool delTag(const char *name)
Delete a tag.
GT_PrimSubdivisionMesh(const GT_PrimSubdivisionMesh &mesh, const GT_DataArrayHandle &vtx_index, const GT_AttributeListHandle &shared)
Class which writes ASCII or binary JSON streams.
GA_API const UT_StringHolder P
tag_iterator beginTags() const
GT_PrimitiveHandle doSoftCopy() const override
bool operator==(const tag_iterator &tag) const
GT_PrimPolygonMesh * clone(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) const override
int64 getMemoryUsage() const override
void appendTag(const Tag &src)
Tag & operator=(const Tag &src)
GT_PrimPolygonMesh * clone(const GT_DataArrayHandle &vtx_indices, const GT_AttributeListHandle &shared) const override
GT_PrimSubdivisionMesh(const GT_PrimSubdivisionMesh &mesh, const GT_AttributeListHandle &shared, const GT_AttributeListHandle &vertex, const GT_AttributeListHandle &uniform, const GT_AttributeListHandle &detail)
GT_Scheme
Subdivision schemes.
GT_PrimitiveHandle doAttributeMerge(const GT_Primitive &src, const UT_StringMMPattern *vertex, const UT_StringMMPattern *point, const UT_StringMMPattern *uniform, const UT_StringMMPattern *detail) const override
The virtual implementation of attribute merging.
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...
std::string OIIO_UTIL_API replace(string_view str, string_view pattern, string_view replacement, bool global=false)
exint stringCount() const
const GT_DataArrayHandle & realArray(exint i=0) const
void clearTags()
Clear all tags.
void appendInt(const GT_DataArrayHandle &data)
GT_PrimSubdivisionMesh(const GT_PrimSubdivisionMesh &mesh)
tag_iterator & operator++()
const char * className() const override
const GT_PrimSubdivisionMesh::Tag & operator*() const
GT_PrimSubdivisionMesh(const GT_PrimPolygonMesh &mesh, GT_Scheme scheme)
Construct from a GT_PrimPolygonMesh.
GLuint const GLchar * name
const UT_Array< GT_DataArrayHandle > & getAllInt() const
The base class for all GT primitive types.
void appendIntTag(const char *name, const GT_DataArrayHandle &v, bool replace=false)
int getPrimitiveType() const override
void setScheme(GT_Scheme s)
Processes primitives generated by refinement process.
GT_PrimitiveHandle refineToHull() const
Return a polygon mesh of the subdivision hull.
bool refine(GT_Refine &refiner, const GT_RefineParms *parms) const override
GT_PrimPolygonMesh * clone(const GT_AttributeListHandle &shared, const GT_AttributeListHandle &vertex, const GT_AttributeListHandle &uniform, const GT_AttributeListHandle &detail) const override
bool match(const char *name) const
tag_iterator(const tag_iterator &s)
GT_PrimitiveHandle doHarden() const override
Harden all attributes so there are no dangling dependencies.
const UT_Array< GT_DataArrayHandle > & getAllString() const
GT_PrimSubdivisionMesh * copySubd(GT_PrimSubdivisionMesh *smesh) const
const GT_DataArrayHandle & intArray(exint i=0) const
int64 getMemoryUsage() const
GLubyte GLubyte GLubyte GLubyte w
const GT_DataArrayHandle & stringArray(exint i=0) const
const GT_PrimSubdivisionMesh::Tag & tag() const
bool save(UT_JSONWriter &w) const override
GT_PrimSubdivisionMesh(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)
tag_iterator & operator=(const tag_iterator &src)
const char * name() const
void appendReal(const GT_DataArrayHandle &data)
GT_PrimSubdivisionMesh(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)
constexpr T normalize(UT_FixedVector< T, D > &a) noexcept
GT_PrimPolygonMesh * clone(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) const override