16 #ifndef __GEO_Primitive_H__
17 #define __GEO_Primitive_H__
37 template<
typename T,
bool B>
class GA_EdgeT;
64 bool copy_groups=
true)
66 copyAttributeData(src);
68 copyGroupMembership(src);
72 bool copy_groups=
true)
74 copyAttributeData(src, gah);
76 copyGroupMembership(src);
81 bool copy_groups=
true)
83 copyAttributeData(src, wrangler);
85 copyGroupMembership(src);
113 #if GA_PRIMITIVE_VERTEXLIST
118 virtual GEO_Primitive *copy(
int preserve_shared_pts = 0)
const;
128 virtual void realToUnitPair(
float ureal,
float vreal,
129 float &uunit,
float &vunit)
const;
132 virtual void unitToRealPair(
float uunit,
float vunit,
133 float &ureal,
float &vreal)
const;
137 virtual void unitLengthToUnitPair(
float ulength,
float vlength,
138 float &uparm,
float &vparm)
const;
139 virtual void unitLengthToUnitPair(
float ulength,
float vlength,
140 float &uparm,
float &vparm,
float tolerance)
const;
142 virtual void unitToUnitLengthPair(
float uparm,
float vparm,
143 float &ulength,
float &vlength)
150 {
return evaluateBaryCenterRefMap(result_vtx, map); }
159 {
return evaluatePointRefMap(result_vtx, map, u,
v, du, dv); }
166 unsigned du=0,
unsigned dv=0)
const
167 {
return evaluatePointV4(pos, u,
v, du, dv); }
169 virtual int evaluateNormalVector(
UT_Vector3 &nml,
float u,
170 float v = 0,
float w = 0)
const;
181 {
return evaluateInteriorPointRefMap(
182 result_vtx, map, u, v,
w); }
185 {
return evaluateInteriorPointV4(pos, u, v,
w); }
198 virtual void computeInteriorPointWeights(
207 return reinterpret_cast<GEO_Detail *
>(&getDetail());
233 bool enlargeBoundingBox(
236 bool enlargeBoundingBox(
245 bool enlargeVisibleBoundingBox(
261 template <
typename T>
267 return baryCenterD();
287 bool hasEdge(
const GA_Edge &edge)
const override;
292 virtual bool hasGuideEdge(
int edgeid,
UT_Vector3 &
a,
294 virtual bool hasXsectPoint(
int pointid,
UT_Vector3 &p)
const;
300 #if !GA_PRIMITIVE_VERTEXLIST
301 virtual bool vertexApply(
bool (*apply)(
GA_Offset vtx,
void *),
302 void *
data = 0)
const;
316 virtual
int parametricBBox(
float u,
float v,
317 float *u0,
float *
u1,
318 float *
v0,
float *
v1);
322 virtual
float uvDist(
float u1,
float v1,
float u2,
float v2) const;
326 int bboxIntersectRay(const
UT_Vector3 &rayorig,
347 template <
typename T>
357 template <
typename T>
362 , myOutput(output) {}
364 { myOutput(myGdp.pointIndex(offset)) += nml; }
366 { myOutput(myGdp.pointIndex(offset)) -= nml; }
374 template <
typename T>
378 : myHandle(attr.getAttribute()) {}
382 { myHandle.add(offset, nml); }
384 { myHandle.add(offset, -nml); }
393 template <
typename T>
408 myOffsetBuffer[myBufferEntries] =
offset;
409 myDataBuffer[myBufferEntries] = nml;
411 if (myBufferEntries == theBufferSize)
417 myOffsetBuffer[myBufferEntries] =
offset;
418 myDataBuffer[myBufferEntries] = -nml;
420 if (myBufferEntries == theBufferSize)
427 for (
GA_Size i = 0; i < myBufferEntries; ++i)
429 myParent.add(myOffsetBuffer[i], myDataBuffer[i]);
435 static const GA_Size theBufferSize = 1024;
454 virtual void normal(
NormalComp &output)
const = 0;
455 virtual void normal(
NormalCompD &output)
const = 0;
478 float tmax = 1E17F,
float tol = 1E-12F,
481 float *u = 0,
float *
v = 0,
482 int ignoretrim = 1)
const;
494 {
return GA_Primitive::registerIntrinsics(defn); }
496 virtual bool evaluatePointRefMap(
GA_Offset result_vtx,
504 virtual int evaluatePointV4(
UT_Vector4 &pos,
float u,
float v = 0,
505 unsigned du=0,
unsigned dv=0)
const;
510 virtual bool evaluateBaryCenterRefMap(
GA_Offset result_vtx,
513 virtual bool evaluateInteriorPointRefMap(
GA_Offset result_vtx,
516 virtual int evaluateInteriorPointV4(
UT_Vector4 &pos,
fpreal calcPerimeter() const override
Definition of a geometry attribute.
UT_Vector3T< T > baryCenterT() const
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
NormalCompAttrT(const GA_RWHandleT< UT_Vector3T< T >> &attr)
#define SYS_DEPRECATED_PUSH_DISABLE()
void copyAttributesAndGroups(const GEO_Primitive &src, GA_AttributeRefMap &gah, bool copy_groups=true)
#define SYS_DEPRECATED_POP_DISABLE()
GLsizei const GLfloat * value
bool evaluateInteriorPoint(GA_Offset result_vtx, GA_AttributeRefMap &map, fpreal u, fpreal v, fpreal w=0) const
GA_RWHandleT< UT_Vector3T< T > > & getHandle()
void copyAttributesAndGroups(const GEO_Primitive &src, bool copy_groups=true)
GLboolean GLboolean GLboolean GLboolean a
PUGI__FN void reverse(I begin, I end)
SYS_FORCE_INLINE GEO_Detail * getParent() const
~GEO_Primitive() override
Tto convert(const Tfrom &source)
GLfloat GLfloat GLfloat v2
fpreal calcArea() const override
exint GA_Size
Defines the bit width for index and offset types in GA.
virtual void add(GA_Offset offset, const UT_Vector3T< T > &nml)
#define GA_INVALID_OFFSET
This class provides a way to manage a reference to an attribute permitting Read-Write access...
NormalCompBufferedT(NormalCompT< T > &parent, UT_Lock &lock)
GA_RWHandleT< UT_Vector3T< T > > myHandle
~NormalCompBufferedT() override
int evaluateInteriorPoint(UT_Vector4 &pos, fpreal u, fpreal v, fpreal w=0) const
bool evaluatePoint(GA_Offset result_vtx, GA_AttributeRefMap &map, fpreal u, fpreal v=0, uint du=0, uint dv=0) const
void sub(GA_Offset offset, const UT_Vector3T< T > &nml) override
A handle to simplify manipulation of multiple attributes.
void sub(GA_Offset offset, const UT_Vector3T< T > &nml) override
#define SYS_DEPRECATED_HDK(__V__)
NormalCompArrayT(const GA_Detail &gdp, UT_ValArray< UT_Vector3T< T >> &output)
GLboolean GLboolean GLboolean b
GA_API const UT_StringHolder transform
virtual bool saveH9(std::ostream &os, bool binary, const UT_Array< GA_AttribSaveDataH9 > &prim_attribs, const UT_Array< GA_AttribSaveDataH9 > &vtx_attribs) const
void add(GA_Offset offset, const UT_Vector3T< T > &nml) override
void sub(GA_Offset offset, const UT_Vector3T< T > &nml) override
GA_API const UT_StringHolder parms
SYS_FORCE_INLINE GEO_Primitive(GA_Detail *d, GA_Offset offset=GA_INVALID_OFFSET)
int evaluatePoint(UT_Vector4 &pos, float u, float v=0, unsigned du=0, unsigned dv=0) const
static const UT_Array< GA_AttribSaveDataH9 > & theEmptySaveAttribs
Convience objects to pass as arguments to saveH9()/loadH9().
void add(GA_Offset offset, const UT_Vector3T< T > &nml) override
bool evaluateBaryCenter(GA_Offset result_vtx, GA_AttributeRefMap &map) const
NormalCompAttrT(const GA_RWAttributeRef &attr)
void add(GA_Offset offset, const UT_Vector3T< T > &nml) override
Container class for all geometry.
friend std::ostream & operator<<(std::ostream &os, const GEO_Primitive &d)
GLubyte GLubyte GLubyte GLubyte w
Definition of a geometric primitive.
SIM_API const UT_StringHolder distance
virtual bool isQuadric() const
void copyAttributesAndGroups(const GEO_Primitive &src, GA_PrimitiveWrangler &wrangler, bool copy_groups=true)
NOTE: The copying of groups only works if src is in the same detail.
static GA_IntrinsicManager::Registrar registerIntrinsics(GA_PrimitiveDefinition &defn)
IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T clip(const T &p, const Box< T > &box) IMATH_NOEXCEPT
virtual void sub(GA_Offset offset, const UT_Vector3T< T > &nml)
virtual void isolate()
Method to isolate a pasted surface.