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(); }
77 template <
typename T, GA_AttributeOwner T_OWNER>
86 ((attr == attr->getDetail().getP() || forceisp)
87 && attr->getDetail().getPwAttribute()))
108 val =
myHandle.
get(attr->getDetail().vertexPoint(off),
134 template <
typename T>
146 template <
typename T>
166 template <
typename T, GA_AttributeOwner T_OWNER>
201 template <
typename T>
213 template <
typename T>
231 template <
typename T, GA_AttributeOwner T_OWNER>
239 { myDest = &
val;
return true; }
243 { *myDest = myHandle.getValue(source_index); }
249 *myDest += myHandle.getValue(source_index)*
w;
256 *myDest += myHandle.getHomogeneous(source_index)*
w;
265 fpreal normalization=1)
const
267 *myDest *= normalization;
270 fpreal normalization=1)
const
272 *myDest *= normalization;
277 {
return *myDest ==
val; }
279 {
return *myDest ==
val; }
282 void zero()
const { *myDest = 0; }
285 { *myDest *=
scale; }
292 { *myDest = s0 + (s1-
s0)*t; }
302 *myDest += GA_Homogenize::homogenize(val)*
w;
306 if (myHandle.isRational())
308 for (
int i = 0; i <
size; i++)
309 GA_Homogenize::dehomogenize(data[i]);
319 template <
typename T>
331 template <
typename T>
345 template <
typename T, GA_AttributeOwner T_OWNER>
355 template <
typename T>
366 template <
typename T>
381 template <GA_AttributeOwner T_OWNER>
389 "component operations not supported on GA_Offset handles");
425 template <GA_AttributeOwner T_OWNER>
454 template <GA_AttributeOwner T_OWNER>
466 for (
int i = 0; i <
size; i++)
468 Base::setElement(data[i]);
469 Base::dehomogenize();
500 template <GA_AttributeOwner T_OWNER>
505 : myBuffer(gah.getMap().getVertexPool()) {}
510 myBuffer.appendPoints(data, size);
512 myBuffer.appendVertices(data, size);
515 { myBuffer.clear(); }
544 template <GA_AttributeOwner T_OWNER>
552 ((attr == attr->getDetail().getP() || forceisp)
553 && attr->getDetail().getPwAttribute()))
577 : myPwHandle.get(off);
581 GA_Offset ptoff = attr->getDetail().vertexPoint(off);
584 : myPwHandle.get(ptoff);
589 : myPwHandle.get(off);
610 template <GA_AttributeOwner T_OWNER>
618 using Base::myPwHandle;
622 :
Base(attr, component)
638 myPwHandle.set(off, val);
646 myPwHandle.set(ptoff, val);
653 myPwHandle.set(off, val);
GA_ROGenericHandle< UT_Vector4, T_OWNER > Base
Definition of a geometry attribute.
void finishSum(const GA_WeightedSum &sum, fpreal normalization=1) const
GA_RWGenericHandle< GA_Offset, T_OWNER > Base
GLenum GLenum GLenum GLenum GLenum scale
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.
const GA_Detail & getDetail() const
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.
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
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
void startHSum(const GA_WeightedSum &sum) const
void copyDest(T val) const
GLubyte GLubyte GLubyte GLubyte w
void lerpDest(T s0, T s1, fpreal t) const
void appendVertices(GA_Offset *data, int size)
GA_GenericTemp(const GA_ROGenericHandle< T, T_OWNER > &)
void homogenize< UT_Vector4 >(UT_Vector4 &val)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s0
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)
GA_AttributeOwner getOwner() const
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 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)
GA_GenericTempVertex(const GA_ROGenericHandleVertex< T > &h)
Specialization of GA_GenericTemp for GA_ATTRIB_POINT types.
void setValue(GA_Offset dest, const GA_Offset &src) const
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)