22 #ifndef __GA_GenericHandle__
23 #define __GA_GenericHandle__
45 namespace GA_Homogenize
47 template <
typename T>
static inline void homogenize(
T &
val) {}
51 template <
typename T>
static inline void dehomogenize(T &val) {}
53 { val.dehomogenize(); }
55 static bool isAttribRational(
const GA_Attribute *attr,
bool forceisp)
89 template <
typename T, GA_AttributeOwner T_OWNER>
97 ,
myIsRational(GA_Homogenize::isAttribRational(attr, forceisp))
118 val =
myHandle.
get(attr->getDetail().vertexPoint(off),
144 template <
typename T>
156 template <
typename T>
176 template <
typename T, GA_AttributeOwner T_OWNER>
211 template <
typename T>
223 template <
typename T>
241 template <
typename T, GA_AttributeOwner T_OWNER>
249 { myDest = &
val;
return true; }
253 { *myDest = myHandle.getValue(source_index); }
259 *myDest += myHandle.getValue(source_index)*
w;
266 *myDest += myHandle.getHomogeneous(source_index)*
w;
275 fpreal normalization=1)
const
277 *myDest *= normalization;
280 fpreal normalization=1)
const
282 *myDest *= normalization;
287 {
return *myDest ==
val; }
289 {
return *myDest ==
val; }
292 void zero()
const { *myDest = 0; }
295 { *myDest *=
scale; }
302 { *myDest = s0 + (s1-s0)*t; }
312 *myDest += GA_Homogenize::homogenize(val)*
w;
316 if (myHandle.isRational())
318 for (
int i = 0; i <
size; i++)
319 GA_Homogenize::dehomogenize(data[i]);
329 template <
typename T>
341 template <
typename T>
355 template <
typename T, GA_AttributeOwner T_OWNER>
365 template <
typename T>
376 template <
typename T>
391 template <GA_AttributeOwner T_OWNER>
399 "component operations not supported on GA_Offset handles");
435 template <GA_AttributeOwner T_OWNER>
464 template <GA_AttributeOwner T_OWNER>
476 for (
int i = 0; i <
size; i++)
478 Base::setElement(data[i]);
479 Base::dehomogenize();
510 template <GA_AttributeOwner T_OWNER>
515 : myBuffer(gah.getMap().getVertexPool()) {}
520 myBuffer.appendPoints(data, size);
522 myBuffer.appendVertices(data, size);
525 { myBuffer.clear(); }
554 template <GA_AttributeOwner T_OWNER>
561 ,
myIsRational(GA_Homogenize::isAttribRational(attr, forceisp))
585 : myPwHandle.get(off);
589 GA_Offset ptoff = attr->getDetail().vertexPoint(off);
592 : myPwHandle.get(ptoff);
597 : myPwHandle.get(off);
618 template <GA_AttributeOwner T_OWNER>
626 using Base::myPwHandle;
630 :
Base(attr, component)
646 myPwHandle.set(off, val);
654 myPwHandle.set(ptoff, val);
661 myPwHandle.set(off, val);
GA_ROGenericHandle< UT_Vector4, T_OWNER > Base
SYS_FORCE_INLINE const GA_Detail & getDetail() const
Definition of a geometry attribute.
void finishSum(const GA_WeightedSum &sum, fpreal normalization=1) const
GA_RWGenericHandle< GA_Offset, T_OWNER > Base
void startSum(const GA_WeightedSum &sum) const
GA_GenericMath(const GA_ROGenericHandle< GA_Offset, T_OWNER > &h)
Specialization of GA_RWGenericHandle for GA_ATTRIB_POINT offsets.
Specialization of GA_GenericMath for GA_ATTRIB_POINT offsets.
GA_ROGenericHandleVertex(GA_AttributeRefMap &map, int component=0)
void dehomogenizeData(GA_Offset *data, int size)
bool isAlmostEqual(const T &val) const
void homogenize()
Express the point in homogeneous coordinates or vice-versa.
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
Specialization of GA_ROGenericHandleVertex for GA_Offset.
void add(GA_WeightedSum &sum, GA_Offset source_index, fpreal w) const
GA_RWGenericHandle(GA_AttributeRefMap &map, int component=0)
GA_Attribute * getP()
Convenience method to access the P attribute.
Specialization of GA_RWGenericHandle for GA_ATTRIB_VERTEX offsets.
GA_ROGenericHandleVertex(const GA_Attribute *attr, int component=0)
GA_RWGenericHandle(GA_Attribute *attr, int component=0)
Context to keep track of weighted sums.
__hostdev__ void setValue(uint32_t offset, bool v)
GA_ROGenericHandle(const GA_Attribute *attr, int component=0, bool forceisp=false)
Specialization of GA_RWGenericHandle for GA_Offset.
const GA_Attribute * getAttribute() const
Specialization of GA_ROGenericHandle for GA_Offset.
GA_ATINumeric * getAttribute() const
void startHSum(const GA_WeightedSum &sum) const
void copyDest(T val) const
void lerpDest(T s0, T s1, fpreal t) const
void appendVertices(GA_Offset *data, int size)
GA_GenericTemp(const GA_ROGenericHandle< T, T_OWNER > &)
GA_API const UT_StringHolder scale
void homogenize< UT_Vector4 >(UT_Vector4 &val)
void appendVertices(T *, int)
GA_GenericTempPoint(const GA_ROGenericHandlePoint< T > &h)
GA_AttributeRefMap & getMap() const
void setValue(GA_Offset off, const UT_Vector4 &val) const
GA_ROGenericHandle(GA_AttributeRefMap &map, int component)
GA_GenericTemp(const GA_ROGenericHandle< GA_Offset, T_OWNER > &gah)
void addDest(GA_WeightedSum &sum, T val, fpreal w) const
void addH(GA_WeightedSum &sum, GA_Offset source_index, fpreal w) const
void setValue(GA_Offset off, const T &val) const
GA_ROGenericHandle< T, T_OWNER > Base
void copy(GA_Offset source_index) const
A handle to simplify manipulation of multiple attributes.
Specialization of GA_GenericTemp for GA_ATTRIB_POINT types.
SYS_FORCE_INLINE T get(GA_Offset off, int comp=0) const
SYS_FORCE_INLINE GA_Offset vertexPoint(GA_Offset vertex) const
Given a vertex, return the point it references.
void multiply(fpreal scale) const
GA_ROGenericHandlePoint(const GA_Attribute *attr, int component=0)
void dehomogenize< UT_Vector4 >(UT_Vector4 &val)
T getHomogeneous(GA_Offset off) const
GA_RWGenericHandle(GA_Attribute *attr, int component=0)
GA_GenericTempPoint(const GA_ROGenericHandlePoint< GA_Offset > &h)
SYS_FORCE_INLINE bool isValid() const
GA_RWGenericHandleVertex(GA_Attribute *attr, int component=0)
void addDest(T val) const
const GA_Attribute * getAttribute() const
GLfloat GLfloat GLfloat GLfloat h
Specialization of GA_ROGenericHandle for GA_ATTRIB_POINT offsets.
GA_RWHandleT< T > myHandle
GA_GenericMath(const GA_ROGenericHandle< T, T_OWNER > &h)
GA_ROGenericHandleVertex(const GA_Attribute *attr, bool forceisp)
SYS_FORCE_INLINE GA_TypeInfo getTypeInfo() const
SYS_FORCE_INLINE void set(GA_Offset off, const T &val) const
Specialization of GA_GenericMath for GA_ATTRIB_VERTEX offsets.
GA_GenericMathPoint(const GA_ROGenericHandlePoint< T > &h)
Specialization for UT_Vector4, so that (P,Pw) attribute pair will work.
void advance(fpreal weight)
UT_Vector4 getValue(GA_Offset off) const
GA_RWGenericHandlePoint(GA_Attribute *attr, int component=0)
A handle to simplify manipulation of multiple attributes.
GA_GenericTempVertex(const GA_ROGenericHandleVertex< GA_Offset > &h)
GA_GenericMathVertex(const GA_ROGenericHandleVertex< T > &h)
const GA_Attribute * getPwAttribute() const
GA_GenericTempVertex(const GA_ROGenericHandleVertex< T > &h)
Specialization of GA_GenericTemp for GA_ATTRIB_POINT types.
SYS_FORCE_INLINE GA_AttributeOwner getOwner() const
void setValue(GA_Offset dest, const GA_Offset &src) const
GLubyte GLubyte GLubyte GLubyte w
Specialization of GA_ROGenericHandle for GA_ATTRIB_VERTEX offsets.
GA_RWHandleT< UT_Vector4 > myHandle
UT_Vector4 getHomogeneous(GA_Offset off) const
const GA_Attribute * getAttribute() const
GA_GenericMathPoint(const GA_ROGenericHandlePoint< GA_Offset > &h)
void dehomogenizeData(T *data, int size)
Specialization of GA_ROGenericHandlePoint for GA_Offset.
bool isEqual(const T &val) const
void finishHSum(const GA_WeightedSum &sum, fpreal normalization=1) const
GA_ROGenericHandlePoint(GA_AttributeRefMap &map, int component=0)
void addHDest(GA_WeightedSum &sum, T val, fpreal w) const
T getValue(GA_Offset off) const
void subDest(T val) const
GA_AttributeRefMapDestHandle< T_OWNER > Base
GA_ROGenericHandle(const GA_Attribute *attr, int component=0, bool forceisp=false)
GA_GenericMathVertex(const GA_ROGenericHandleVertex< GA_Offset > &h)