16 #ifndef __GEO_Primitive_H__
17 #define __GEO_Primitive_H__
36 template<
typename T,
bool B>
class GA_EdgeT;
63 bool copy_groups=
true)
65 copyAttributeData(src);
67 copyGroupMembership(src);
71 bool copy_groups=
true)
73 copyAttributeData(src, gah);
75 copyGroupMembership(src);
80 bool copy_groups=
true)
82 copyAttributeData(src, wrangler);
84 copyGroupMembership(src);
112 #if GA_PRIMITIVE_VERTEXLIST
127 virtual void realToUnitPair(
float ureal,
float vreal,
128 float &uunit,
float &vunit)
const;
131 virtual void unitToRealPair(
float uunit,
float vunit,
132 float &ureal,
float &vreal)
const;
136 virtual void unitLengthToUnitPair(
float ulength,
float vlength,
137 float &uparm,
float &vparm)
const;
138 virtual void unitLengthToUnitPair(
float ulength,
float vlength,
139 float &uparm,
float &vparm,
float tolerance)
const;
141 virtual void unitToUnitLengthPair(
float uparm,
float vparm,
142 float &ulength,
float &vlength)
149 {
return evaluateBaryCenterRefMap(result_vtx, map); }
158 {
return evaluatePointRefMap(result_vtx, map, u,
v, du, dv); }
165 unsigned du=0,
unsigned dv=0)
const
166 {
return evaluatePointV4(pos, u,
v, du, dv); }
168 virtual int evaluateNormalVector(
UT_Vector3 &nml,
float u,
169 float v = 0,
float w = 0)
const;
180 {
return evaluateInteriorPointRefMap(
181 result_vtx, map, u, v,
w); }
184 {
return evaluateInteriorPointV4(pos, u, v,
w); }
197 virtual void computeInteriorPointWeights(
206 return reinterpret_cast<GEO_Detail *
>(&getDetail());
232 bool enlargeBoundingBox(
235 bool enlargeBoundingBox(
244 bool enlargeVisibleBoundingBox(
260 template <
typename T>
266 return baryCenterD();
286 bool hasEdge(
const GA_Edge &edge)
const override;
291 virtual bool hasGuideEdge(
int edgeid,
UT_Vector3 &
a,
293 virtual bool hasXsectPoint(
int pointid,
UT_Vector3 &p)
const;
299 #if !GA_PRIMITIVE_VERTEXLIST
300 virtual bool vertexApply(
bool (*apply)(
GA_Offset vtx,
void *),
301 void *
data = 0)
const;
315 virtual
int parametricBBox(
float u,
float v,
316 float *u0,
float *
u1,
317 float *
v0,
float *
v1);
321 virtual
float uvDist(
float u1,
float v1,
float u2,
float v2) const;
325 int bboxIntersectRay(const
UT_Vector3 &rayorig,
346 template <
typename T>
356 template <
typename T>
361 , myOutput(output) {}
363 { myOutput(myGdp.pointIndex(offset)) += nml; }
365 { myOutput(myGdp.pointIndex(offset)) -= nml; }
373 template <
typename T>
377 : myHandle(attr.getAttribute()) {}
381 { myHandle.add(offset, nml); }
383 { myHandle.add(offset, -nml); }
392 template <
typename T>
407 myOffsetBuffer[myBufferEntries] =
offset;
408 myDataBuffer[myBufferEntries] = nml;
410 if (myBufferEntries == theBufferSize)
416 myOffsetBuffer[myBufferEntries] =
offset;
417 myDataBuffer[myBufferEntries] = -nml;
419 if (myBufferEntries == theBufferSize)
426 for (
GA_Size i = 0; i < myBufferEntries; ++i)
428 myParent.add(myOffsetBuffer[i], myDataBuffer[i]);
434 static const GA_Size theBufferSize = 1024;
453 virtual void normal(
NormalComp &output)
const = 0;
454 virtual void normal(
NormalCompD &output)
const = 0;
477 float tmax = 1E17F,
float tol = 1E-12F,
480 float *u = 0,
float *
v = 0,
481 int ignoretrim = 1)
const;
493 {
return GA_Primitive::registerIntrinsics(defn); }
495 virtual bool evaluatePointRefMap(
GA_Offset result_vtx,
503 virtual int evaluatePointV4(
UT_Vector4 &pos,
float u,
float v = 0,
504 unsigned du=0,
unsigned dv=0)
const;
509 virtual bool evaluateBaryCenterRefMap(
GA_Offset result_vtx,
512 virtual bool evaluateInteriorPointRefMap(
GA_Offset result_vtx,
515 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
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
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
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
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.