HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_AttributeHandle.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GEO_AttributeHandle.h ( GEO Library, C++)
7  *
8  * COMMENTS: A handle class to perform operations on an attribute
9  */
10 
11 #ifndef __GEO_AttributeHandle__
12 #define __GEO_AttributeHandle__
13 
14 #include "GEO_API.h"
15 #include "GEO_Primitive.h"
16 #include "GEO_Vertex.h"
17 
18 #include <GA/GA_Types.h>
19 
20 #include <UT/UT_Matrix3.h>
21 #include <UT/UT_Matrix4.h>
22 #include <UT/UT_Quaternion.h>
23 #include <UT/UT_Vector2.h>
24 #include <UT/UT_Vector3.h>
25 #include <UT/UT_Vector4.h>
26 
27 #include <SYS/SYS_Types.h>
28 
29 
30 class UT_StringArray;
31 class GEO_Detail;
32 class GEO_Primitive;
33 class GEO_Vertex;
34 class GA_GBElement;
35 class GEO_Point;
36 
38 
40 {
41 public:
42  SYS_DEPRECATED_HDK(13.0)
43  GEO_AttributeHandle();
44  SYS_DEPRECATED_HDK(13.0)
45  GEO_AttributeHandle(const GEO_AttributeHandle &gah);
46  SYS_DEPRECATED_HDK(13.0)
47  GEO_AttributeHandle(const GA_Attribute *attrib);
48  SYS_DEPRECATED_HDK(13.0)
49  GEO_AttributeHandle(GA_Attribute *attrib);
50  SYS_DEPRECATED_HDK(13.0)
51  GEO_AttributeHandle(const GA_ROAttributeRef &ref);
52  SYS_DEPRECATED_HDK(13.0)
53  GEO_AttributeHandle(const GA_RWAttributeRef &ref);
54 
55  SYS_DEPRECATED_HDK(13.0)
56  GEO_AttributeHandle *clone() const;
57  SYS_DEPRECATED_HDK(13.0)
58  const char *getName() const;
59 
60  SYS_DEPRECATED_HDK(13.0)
61  ~GEO_AttributeHandle();
62 
63  SYS_DEPRECATED_HDK(13.0)
64  const GA_Attribute *getAttribute() const;
65  SYS_DEPRECATED_HDK(13.0)
66  const GA_Attribute *getSourceAttribute() const;
67 
68  SYS_DEPRECATED_HDK(13.0)
69  GEO_AttributeHandle &operator=(const GEO_AttributeHandle &gah);
70 
71  SYS_DEPRECATED_HDK(13.0)
72  void invalidate();
73 
74  SYS_DEPRECATED_HDK(13.0)
75  bool isAttributeValid() const;
76  SYS_DEPRECATED_HDK(13.0)
77  bool isSourceAttributeValid() const;
78  SYS_DEPRECATED_HDK(13.0)
79  void clearElement() { setRawElement(GA_INVALID_OFFSET); }
80 
81  // Upgrade a read-only handle to a read-write handle, returning true on
82  // success.
83  SYS_DEPRECATED_HDK(13.0)
84  bool upgradeToReadWrite(GA_AttributeSet &set);
85  // Downgrade a read-write handle to a read-only handle, returning true on
86  // success.
87  SYS_DEPRECATED_HDK(13.0)
88  bool downgradeToReadOnly();
89 
90  /// @{
91  /// Test to see whether the attribute is a string attribute. This tests to
92  /// see whether the attribute has an shared string tuple interface (@see
93  /// GA_AIFSharedStringTuple).
94  /// Please use isSharedStringAttribute() rather than isIndexAttribute()
95  SYS_DEPRECATED(12.0) bool isIndexAttribute() const
96  { return isSharedStringAttribute(); }
97  SYS_DEPRECATED_HDK(13.0)
98  bool isSharedStringAttribute() const;
99  /// @}
100 
101  /// Returns true if our attribute handle is bound to a valid attribute of
102  /// a floating point tuple type.
103  SYS_DEPRECATED_HDK(13.0)
104  bool isFloatOrVectorAttribute() const;
105 
106  /// Returns true if the attribute handle has strings defined.
107  /// It's possible that the array contains 0 strings.
108  SYS_DEPRECATED_HDK(13.0)
109  bool getDefinedStrings(UT_StringArray &list,
110  bool harden=true) const;
111 
112  /// Return the string assocated with the given index. This is only valid
113  /// for shared string attributes.
114  SYS_DEPRECATED(12.0) const char *getDefinedString(int idx) const
115  { return getSharedString(idx); }
116  SYS_DEPRECATED_HDK(13.0)
117  const char *getSharedString(int index) const;
118 
119  /// The myOffset refers to elements which are bound to the handle (i.e
120  /// through setElementRaw(). When copying data from other details, the
121  /// attribute data doesn't always come from the same location (or even the
122  /// same element). The source offset is used to define the offset from the
123  /// source detail (i.e. the detail *not* bound to this handle).
124  /// By default, myOffset == mySourceOffset
125  SYS_DEPRECATED_HDK(13.0)
126  void clearSourceMap()
127  {
128  GA_ROAttributeRef invalid;
129  setSourceMap(invalid);
130  }
131  SYS_DEPRECATED_HDK(13.0)
132  void setSourceMap(GA_AttributeOwner owner,
134  SYS_DEPRECATED_HDK(13.0)
135  void setSourceMap(const GA_AttributeDict &dict,
136  GA_AttributeOwner owner);
137  SYS_DEPRECATED_HDK(13.0)
138  void setSourceMap(const GEO_AttributeHandle &h);
139 
140  /// Attribute data is now stored externally to the element, so we can no
141  /// longer use the constness of the element argument to determine whether
142  /// we can write to the attribute.
143  SYS_DEPRECATED_HDK(13.0)
144  void setElement(GEO_Vertex *v)
145  { setElement(const_cast<const GEO_Vertex *>(v)); }
146  SYS_DEPRECATED_HDK(13.0)
147  void setElement(GEO_Primitive *prim)
148  { setElement(const_cast<const GEO_Primitive *> (prim)); }
149  SYS_DEPRECATED_HDK(13.0)
150  void setElement(GEO_Detail *gdp)
151  { setElement(const_cast<const GEO_Detail *>(gdp)); }
152 
153  SYS_DEPRECATED_HDK(13.0)
154  void setElement(const GEO_Vertex *v)
155  {
156  setVertex(v ? v->getMapOffset():GA_INVALID_OFFSET);
157  }
158  SYS_DEPRECATED_HDK(13.0)
159  void setElement(const GEO_Primitive *prim)
160  {
161  if (myDictType == GA_ATTRIB_GLOBAL)
162  setElement(prim ? prim->getParent() : 0);
163  else
164  setPrimitive(prim ? prim->getMapOffset()
166  }
167  SYS_DEPRECATED_HDK(13.0)
168  void setElement(const GEO_Detail *gdp)
169  {
170  if (gdp)
171  setGlobal();
172  else
173  setRawElement(GA_INVALID_OFFSET);
174  }
175 
176  SYS_DEPRECATED_HDK(13.0)
177  void setElement(GEO_Primitive *p, GEO_Vertex *v)
178  { setElement(const_cast<const GEO_Primitive *>(p),
179  const_cast<const GEO_Vertex *>(v)); }
180  SYS_DEPRECATED_HDK(13.0)
181  void setElement(const GEO_Primitive *p, const GEO_Vertex *v);
182  SYS_DEPRECATED_HDK(13.0)
183  void setElement(GEO_Primitive *p, const GEO_Vertex &v)
184  { setElement(const_cast<const GEO_Primitive *>(p), v); }
185  SYS_DEPRECATED_HDK(13.0)
186  void setElement(const GEO_Primitive *p, const GEO_Vertex &v);
187 
188  SYS_DEPRECATED_HDK(13.0)
189  void setElement(GA_AttributeOwner owner, GA_Offset offset);
190 
191  SYS_DEPRECATED_HDK(13.0)
192  void setPoint(GA_Offset offset);
193  SYS_DEPRECATED_HDK(13.0)
194  void setVertex(GA_Offset offset);
195  SYS_DEPRECATED_HDK(13.0)
196  void setPrimitive(GA_Offset offset);
197  SYS_DEPRECATED_HDK(13.0)
198  void setGlobal();
199 
200  SYS_DEPRECATED_HDK(13.0)
201  GA_AttributeOwner getDictionary() const { return myDictType; }
202  SYS_DEPRECATED_HDK(13.0)
203  bool isP() const { return myIsPointP; }
204  SYS_DEPRECATED_HDK(13.0)
205  GA_AttributeOwner getSourceDictionary() const
206  { return mySourceDictType; }
207 
208  SYS_DEPRECATED(12.5) int entries() const // Return the tuple size
209  { return tupleSize(); }
210  SYS_DEPRECATED_HDK(13.0)
211  int tupleSize() const;
212  SYS_DEPRECATED_HDK(13.0)
213  int getFloatCount(bool includePw) const
214  {
215  if (myIsPointP)
216  return 3;
217  return isFloatOrVectorAttribute() ? tupleSize() : 0;
218  }
219 
220  /// Generic Data Accessors
221  SYS_DEPRECATED_HDK(13.0)
222  void setF(fpreal val, int index=0);
223  SYS_DEPRECATED_HDK(13.0)
224  fpreal getF(int index=0) const;
225 
226  SYS_DEPRECATED_HDK(13.0)
227  void setI(int val, int index=0);
228  SYS_DEPRECATED_HDK(13.0)
229  int getI(int index=0) const;
230 
231  SYS_DEPRECATED_HDK(13.0)
232  void setV2(const UT_Vector2 &val, int index=0);
233  SYS_DEPRECATED_HDK(13.0)
234  UT_Vector2 getV2(int index=0) const;
235 
236  SYS_DEPRECATED_HDK(13.0)
237  void setV3(const UT_Vector3 &val, int index=0);
238  SYS_DEPRECATED_HDK(13.0)
239  UT_Vector3 getV3(int index=0) const;
240 
241  SYS_DEPRECATED_HDK(13.0)
242  void setV4(const UT_Vector4 &val, int index=0);
243  SYS_DEPRECATED_HDK(13.0)
244  UT_Vector4 getV4(int index=0) const;
245 
246  SYS_DEPRECATED_HDK(13.0)
247  void setM2(const UT_Matrix2 &val, int index=0);
248  SYS_DEPRECATED_HDK(13.0)
249  UT_Matrix2 getM2(int index=0) const;
250 
251  SYS_DEPRECATED_HDK(13.0)
252  void setM3(const UT_Matrix3 &val, int index=0);
253  SYS_DEPRECATED_HDK(13.0)
254  UT_Matrix3 getM3(int index=0) const;
255 
256  SYS_DEPRECATED_HDK(13.0)
257  void setM4(const UT_Matrix4 &val, int index=0);
258  SYS_DEPRECATED_HDK(13.0)
259  UT_Matrix4 getM4(int index=0) const;
260 
261  SYS_DEPRECATED_HDK(13.0)
262  void setQ(const UT_Quaternion &val, int index=0);
263  SYS_DEPRECATED_HDK(13.0)
264  UT_Quaternion getQ(int index=0) const;
265 
266  SYS_DEPRECATED_HDK(13.0)
267  bool importVector(fpreal32 *val, int size) const;
268  SYS_DEPRECATED_HDK(13.0)
269  bool importVector(fpreal64 *val, int size) const;
270  SYS_DEPRECATED_HDK(13.0)
271  bool importVector(int32 *val, int size) const;
272  SYS_DEPRECATED_HDK(13.0)
273  bool importVector(int64 *val, int size) const;
274 
275  SYS_DEPRECATED_HDK(13.0)
276  bool import(fpreal32 &val) const
277  { return importVector(&val, 1); }
278  SYS_DEPRECATED_HDK(13.0)
279  bool import(fpreal64 &val) const
280  { return importVector(&val, 1); }
281  SYS_DEPRECATED_HDK(13.0)
282  bool import(int32 &val) const
283  { return importVector(&val, 1); }
284  SYS_DEPRECATED_HDK(13.0)
285  bool import(int64 &val) const
286  { return importVector(&val, 1); }
287  SYS_DEPRECATED_HDK(13.0)
288  bool import(UT_Vector2 &v)
289  { return importVector(v.data(), 2); }
290  SYS_DEPRECATED_HDK(13.0)
291  bool import(UT_Vector3 &v)
292  { return importVector(v.data(), 3); }
293  SYS_DEPRECATED_HDK(13.0)
294  bool import(UT_Vector4 &v)
295  { return importVector(v.data(), 4); }
296  SYS_DEPRECATED_HDK(13.0)
297  bool import(UT_Matrix2 &v)
298  { return importVector(v.data(), 4); }
299  SYS_DEPRECATED_HDK(13.0)
300  bool import(UT_Matrix3 &v)
301  { return importVector(v.data(), 9); }
302  SYS_DEPRECATED_HDK(13.0)
303  bool import(UT_Matrix4 &v)
304  { return importVector(v.data(), 16); }
305 
306  /// p4 will return a 4th component of 1 if it does not exist
307  SYS_DEPRECATED_HDK(13.0)
308  void setP4(const UT_Vector4 &val, int index=0);
309  SYS_DEPRECATED_HDK(13.0)
310  UT_Vector4 getP4(int index=0) const;
311 
312  // The {get,set}String methods return true if the attribute is a valid
313  // string attribute and false otherwise.
314  SYS_DEPRECATED_HDK(13.0)
315  bool setString(const UT_String &str, int index=0);
316  SYS_DEPRECATED_HDK(13.0)
317  bool getString(UT_String &str, int index=0,
318  bool harden=true) const;
319 
320  // Operations on data
321  SYS_DEPRECATED_HDK(13.0)
322  void multiply(fpreal w);
323 
324  SYS_DEPRECATED_HDK(13.0)
325  void setValue(fpreal val);
326 
327  /// Performs: this = this + gah * w
328  SYS_DEPRECATED_HDK(13.0)
329  void addScale(const GEO_AttributeHandle &gah, fpreal w);
330 
331  /// Performs: this = this * gah
332  SYS_DEPRECATED_HDK(13.0)
333  void multiply(const GEO_AttributeHandle &gah);
334  /// Performs the operation this = this*(1-w) + gah*w
335  SYS_DEPRECATED_HDK(13.0)
336  void lerp(const GEO_AttributeHandle &gah, fpreal w);
337 
338  /// Copies the data from the src attribute to this attribute
339  SYS_DEPRECATED_HDK(13.0)
340  void copyDataFrom(const GEO_AttributeHandle &src);
341 
342 
343  // Operations combining other attributes. The provided objects (points,
344  // vertices, primitives) must be from the same detail as the source map
345  // attribute. This also applies to the detail versions, and so it makes
346  // no sense to have a lerp(const GEO_Detail *, const GEO_Detail *, fpreal).
347  SYS_DEPRECATED_HDK(13.0)
348  void addScale(const GEO_Primitive *p, const GEO_Vertex *v, fpreal s);
349  SYS_DEPRECATED_HDK(13.0)
350  void lerp(const GEO_Primitive *p, const GEO_Vertex *v, fpreal w);
351  SYS_DEPRECATED_HDK(13.0)
352  void lerp(const GEO_Primitive *p0, const GEO_Vertex *v0,
353  const GEO_Primitive *p1, const GEO_Vertex *v1,
354  fpreal w);
355  SYS_DEPRECATED_HDK(13.0)
356  void multiply(const GEO_Primitive *p, const GEO_Vertex *v);
357  SYS_DEPRECATED_HDK(13.0)
358  void copyDataFrom(const GEO_Primitive *p, const GEO_Vertex *v);
359 
360  SYS_DEPRECATED_HDK(13.0)
361  void addScale(const GEO_Point *elem, fpreal w)
362  { addScale((const GA_GBElement*)elem, GA_ATTRIB_POINT, w); }
363  SYS_DEPRECATED_HDK(13.0)
365  { lerp((const GA_GBElement*)elem, GA_ATTRIB_POINT, w); }
366  SYS_DEPRECATED_HDK(13.0)
368  { lerp((const GA_GBElement*)p0, (const GA_GBElement*)p1, GA_ATTRIB_POINT, w); }
369  SYS_DEPRECATED_HDK(13.0)
371  { multiply((const GA_GBElement*)elem, GA_ATTRIB_POINT); }
372  SYS_DEPRECATED_HDK(13.0)
373  void copyDataFrom(const GEO_Point *elem)
374  { copyDataFrom((const GA_GBElement*)elem, GA_ATTRIB_POINT); }
375 
376  SYS_DEPRECATED_HDK(13.0)
377  void addScale(const GEO_Primitive *p, const GEO_Vertex &v, fpreal s);
378  SYS_DEPRECATED_HDK(13.0)
380  SYS_DEPRECATED_HDK(13.0)
383  fpreal w);
384  SYS_DEPRECATED_HDK(13.0)
386  SYS_DEPRECATED_HDK(13.0)
387  void copyDataFrom(const GEO_Primitive *p, const GEO_Vertex &v);
388 
389  SYS_DEPRECATED_HDK(13.0)
390  void addScale(const GEO_Vertex *elem, fpreal w)
391  { addScale(elem, GA_ATTRIB_VERTEX, w); }
392  SYS_DEPRECATED_HDK(13.0)
394  { lerp(elem, GA_ATTRIB_VERTEX, w); }
395  SYS_DEPRECATED_HDK(13.0)
397  { lerp(p0, p1, GA_ATTRIB_VERTEX, w); }
398  SYS_DEPRECATED_HDK(13.0)
400  { multiply(elem, GA_ATTRIB_VERTEX); }
401  SYS_DEPRECATED_HDK(13.0)
402  void copyDataFrom(const GEO_Vertex *elem)
403  { copyDataFrom(elem, GA_ATTRIB_VERTEX); }
404 
405  SYS_DEPRECATED_HDK(13.0)
406  void addScale(const GEO_Vertex &elem, fpreal w)
407  { addScale(&elem, w); }
408  SYS_DEPRECATED_HDK(13.0)
410  { lerp(&elem, w); }
411  SYS_DEPRECATED_HDK(13.0)
413  { lerp(&p0, &p1, w); }
414  SYS_DEPRECATED_HDK(13.0)
416  { multiply(&elem); }
417  SYS_DEPRECATED_HDK(13.0)
418  void copyDataFrom(const GEO_Vertex &elem)
419  { copyDataFrom(&elem); }
420 
421  SYS_DEPRECATED_HDK(13.0)
422  void addScale(const GEO_Primitive *elem, fpreal w)
423  { addScaleRaw(elem ? elem->getMapOffset() : GA_INVALID_OFFSET, GA_ATTRIB_PRIMITIVE, w); }
424  SYS_DEPRECATED_HDK(13.0)
426  { lerpRaw(elem ? elem->getMapOffset() : GA_INVALID_OFFSET, GA_ATTRIB_PRIMITIVE, w); }
427  SYS_DEPRECATED_HDK(13.0)
429  {
430  lerpRaw(p0 ? p0->getMapOffset() : GA_INVALID_OFFSET,
431  p1 ? p1->getMapOffset() : GA_INVALID_OFFSET,
433  }
434  SYS_DEPRECATED_HDK(13.0)
436  { multiplyRaw(elem ? elem->getMapOffset() : GA_INVALID_OFFSET, GA_ATTRIB_PRIMITIVE); }
437  SYS_DEPRECATED_HDK(13.0)
438  void copyDataFrom(const GEO_Primitive *elem)
439  { copyDataFromRaw(elem ? elem->getMapOffset() : GA_INVALID_OFFSET, GA_ATTRIB_PRIMITIVE); }
440 
441  SYS_DEPRECATED_HDK(13.0)
442  void addScale(const GEO_Detail *elem, fpreal w)
443  {
444  addScaleRaw(elem ? GA_Offset(0) : GA_INVALID_OFFSET,
445  GA_ATTRIB_GLOBAL, w);
446  }
447  SYS_DEPRECATED_HDK(13.0)
449  {
450  lerpRaw(elem ? GA_Offset(0) : GA_INVALID_OFFSET,
451  GA_ATTRIB_GLOBAL, w);
452  }
453  //void lerp(const GEO_Detail *gdp0, const GEO_Detail *gdp1, fpreal w);
454  SYS_DEPRECATED_HDK(13.0)
456  {
457  multiplyRaw(elem ? GA_Offset(0) : GA_INVALID_OFFSET,
459  }
460  SYS_DEPRECATED_HDK(13.0)
461  void copyDataFrom(const GEO_Detail *elem)
462  {
463  copyDataFromRaw(elem ? GA_Offset(0) : GA_INVALID_OFFSET,
465  }
466 
467  // Operations combining attribute values from other elements. The provided
468  // objects (points, vertices, primitives) must be from the same detail as
469  // the bound attribute. This also applies to the detail versions, and so
470  // it makes no sense to have
471  // lepDest(const GEO_Detail *, fpreal)
472  // lerpDest(const GEO_Detail *, const GEO_Detail *, fpreal)
473  // copyDestData(const GEO_Detail *)
474  //
475  // These operations read from and write to the destination attribute, and
476  // so do not require a source map.
477  // @{
478  SYS_DEPRECATED_HDK(13.0)
479  void addScaleDest(const GEO_Primitive *p, const GEO_Vertex *v,
480  fpreal s);
481  SYS_DEPRECATED_HDK(13.0)
482  void addScaleDest(const GEO_Primitive *p, const GEO_Vertex &v,
483  fpreal s);
484  SYS_DEPRECATED_HDK(13.0)
485  void addScaleDest(const GEO_Point *elem, fpreal w)
486  { addScaleDest((const GA_GBElement*)elem, GA_ATTRIB_POINT, w); }
487  SYS_DEPRECATED_HDK(13.0)
488  void addScaleDest(const GEO_Vertex *elem, fpreal w)
489  { addScaleDest(elem, GA_ATTRIB_VERTEX, w); }
490  SYS_DEPRECATED_HDK(13.0)
491  void addScaleDest(const GEO_Vertex &elem, fpreal w)
492  { addScaleDest(&elem, w); }
493  SYS_DEPRECATED_HDK(13.0)
494  void addScaleDest(const GEO_Primitive *elem, fpreal w)
495  { addScaleDestRaw(elem ? elem->getMapOffset() : GA_INVALID_OFFSET, GA_ATTRIB_PRIMITIVE, w); }
496  SYS_DEPRECATED_HDK(13.0)
497  void addScaleDest(const GEO_Detail *elem, fpreal w)
498  { addScaleDestRaw(elem ? GA_Offset(0) : GA_INVALID_OFFSET,
499  GA_ATTRIB_GLOBAL, w); }
500 
501  SYS_DEPRECATED_HDK(13.0)
502  void lerpDest(const GEO_Primitive *p, const GEO_Vertex *v, fpreal w);
503  SYS_DEPRECATED_HDK(13.0)
504  void lerpDest(const GEO_Primitive *p, const GEO_Vertex &v, fpreal w);
505  SYS_DEPRECATED_HDK(13.0)
506  void lerpDest(const GEO_Point *elem, fpreal w)
507  { lerpDest((const GA_GBElement*)elem, GA_ATTRIB_POINT, w); }
508  SYS_DEPRECATED_HDK(13.0)
509  void lerpDest(const GEO_Vertex *elem, fpreal w)
510  { lerpDest(elem, GA_ATTRIB_VERTEX, w); }
511  SYS_DEPRECATED_HDK(13.0)
512  void lerpDest(const GEO_Vertex &elem, fpreal w)
513  { lerpDest(&elem, w); }
514  SYS_DEPRECATED_HDK(13.0)
515  void lerpDest(const GEO_Primitive *elem, fpreal w)
516  { lerpDestRaw(elem ? elem->getMapOffset() : GA_INVALID_OFFSET, GA_ATTRIB_PRIMITIVE, w); }
517 
518  SYS_DEPRECATED_HDK(13.0)
519  void lerpDest(const GEO_Primitive *p0, const GEO_Vertex *v0,
521  fpreal w);
522  SYS_DEPRECATED_HDK(13.0)
523  void lerpDest(const GEO_Primitive *p0, const GEO_Vertex &v0,
525  fpreal w);
526  SYS_DEPRECATED_HDK(13.0)
527  void lerpDest(const GEO_Point *p0, const GEO_Point *p1, fpreal w)
528  { lerpDest((const GA_GBElement*)p0, (const GA_GBElement*)p1, GA_ATTRIB_POINT, w); }
529  SYS_DEPRECATED_HDK(13.0)
531  { lerpDest(p0, p1, GA_ATTRIB_VERTEX, w); }
532  SYS_DEPRECATED_HDK(13.0)
534  { lerpDest(&p0, &p1, w); }
535  SYS_DEPRECATED_HDK(13.0)
537  fpreal w)
538  { lerpDestRaw(p0 ? p0->getMapOffset() : GA_INVALID_OFFSET, p1 ? p1->getMapOffset() : GA_INVALID_OFFSET, GA_ATTRIB_PRIMITIVE, w); }
539 
540  SYS_DEPRECATED_HDK(13.0)
541  void multiplyDest(const GEO_Primitive *p, const GEO_Vertex *v);
542  SYS_DEPRECATED_HDK(13.0)
543  void multiplyDest(const GEO_Primitive *p, const GEO_Vertex &v);
544  SYS_DEPRECATED_HDK(13.0)
545  void multiplyDest(const GEO_Point *elem)
546  { multiplyDest((const GA_GBElement*)elem, GA_ATTRIB_POINT); }
547  SYS_DEPRECATED_HDK(13.0)
548  void multiplyDest(const GEO_Vertex *elem)
549  { multiplyDest(elem, GA_ATTRIB_VERTEX); }
550  SYS_DEPRECATED_HDK(13.0)
551  void multiplyDest(const GEO_Vertex &elem)
552  { multiplyDest(&elem); }
553  SYS_DEPRECATED_HDK(13.0)
554  void multiplyDest(const GEO_Primitive *elem)
555  { multiplyDestRaw(elem ? elem->getMapOffset() : GA_INVALID_OFFSET, GA_ATTRIB_PRIMITIVE); }
556  SYS_DEPRECATED_HDK(13.0)
557  void multiplyDest(const GEO_Detail *elem)
558  { multiplyDestRaw(elem ? GA_Offset(0) : GA_INVALID_OFFSET,
559  GA_ATTRIB_GLOBAL); }
560 
561  SYS_DEPRECATED_HDK(13.0)
562  void copyDestData(const GEO_Primitive *p, const GEO_Vertex *v);
563  SYS_DEPRECATED_HDK(13.0)
564  void copyDestData(const GEO_Primitive *p, const GEO_Vertex &v);
565  SYS_DEPRECATED_HDK(13.0)
566  void copyDestData(const GEO_Point *elem)
567  { copyDestData((const GA_GBElement*)elem, GA_ATTRIB_POINT); }
568  SYS_DEPRECATED_HDK(13.0)
569  void copyDestData(const GEO_Vertex *elem)
570  { copyDestData(elem, GA_ATTRIB_VERTEX); }
571  SYS_DEPRECATED_HDK(13.0)
572  void copyDestData(const GEO_Vertex &elem)
573  { copyDestData(&elem); }
574  SYS_DEPRECATED_HDK(13.0)
575  void copyDestData(const GEO_Primitive *elem)
576  { copyDestDataRaw(elem ? elem->getMapOffset() : GA_INVALID_OFFSET, GA_ATTRIB_PRIMITIVE); }
577  // @}
578 
579 
580  SYS_DEPRECATED_HDK(13.0)
581  bool match(const GA_AttributeFilter &filter) const;
582 
583  SYS_DEPRECATED_HDK(13.0)
584  void dump(const char *msg="") const; // For debugging
585 
586 protected:
587  bool isValid() const
588  { return isAttributeValid() && GAisValid(myBoundElement); }
589  bool isSourceValid() const
590  { return isSourceAttributeValid() && GAisValid(myBoundElement); }
591  void setRawElement(GA_Offset offset);
592 
593  // Intermediaries between the GEO_Point, GEO_Vertex, GEO_Primitive versions
594  // and the GA_Offset "Raw" methods.
595  void addScale(const GA_GBElement *elem, GA_AttributeOwner owner,
596  fpreal w);
597  void lerp(const GA_GBElement *elem, GA_AttributeOwner owner,
598  fpreal w);
599  void lerpH(const GA_GBElement *elem, GA_AttributeOwner owner,
600  fpreal w);
601  void lerp(const GA_GBElement *e0, const GA_GBElement *e1,
602  GA_AttributeOwner owner, fpreal w);
603  void multiply(const GA_GBElement *elem, GA_AttributeOwner owner);
604  void copyDataFrom(const GA_GBElement *elem, GA_AttributeOwner owner);
605 
606  // The "Raw" methods that work directly with the GA_Offset of the source
607  // element.
608  void addScaleRaw(GA_Offset elem, GA_AttributeOwner owner, fpreal w);
609  void lerpRaw(GA_Offset elem, GA_AttributeOwner owner, fpreal w);
610  void lerpHRaw(GA_Offset elem, GA_AttributeOwner owner, fpreal w);
611  void lerpRaw(GA_Offset e0, GA_Offset e1, GA_AttributeOwner owner,
612  fpreal w);
613  void multiplyRaw(GA_Offset elem, GA_AttributeOwner owner);
614  void copyDataFromRaw(GA_Offset elem, GA_AttributeOwner owner);
615 
616  // Intermediaries between the GEO_Point, GEO_Vertex, GEO_Primitive versions
617  // and the GA_Offset "Raw" methods.
618  void addScaleDest(const GA_GBElement *elem, GA_AttributeOwner owner,
619  fpreal w);
620  void lerpDest(const GA_GBElement *elem, GA_AttributeOwner owner,
621  fpreal w);
622  void lerpDest(const GA_GBElement *e0, const GA_GBElement *e1,
623  GA_AttributeOwner owner, fpreal w);
624  void multiplyDest(const GA_GBElement *elem, GA_AttributeOwner owner);
625  void copyDestData(const GA_GBElement *elem, GA_AttributeOwner owner);
626 
627  // The "Raw" methods that work directly with the GA_Offset of the dest
628  // element.
629  void addScaleDestRaw(GA_Offset elem, GA_AttributeOwner owner,
630  fpreal w);
631  void lerpDestRaw(GA_Offset elem, GA_AttributeOwner owner, fpreal w);
632  void lerpDestRaw(GA_Offset e0, GA_Offset e1, GA_AttributeOwner owner,
633  fpreal w);
634  void multiplyDestRaw(GA_Offset elem, GA_AttributeOwner owner);
635  void copyDestDataRaw(GA_Offset elem, GA_AttributeOwner owner);
636 
637 private:
638  // These initializer methods assume that myAttributeProxy, myReadOnly, and
639  // myBoundElement are set externally.
640  void initCommon(const GA_Attribute &attrib);
641  void initCommon();
642 
643  const GA_Attribute *getConstAttribute() const;
644  GA_Attribute *getNonConstAttribute();
645 
646  const GA_Detail *getDetail() const;
647 
648  template <typename T> inline bool
649  importVectorT(T *val, int size) const;
650 
651  GA_AttributeOwner myDictType;
652  GA_AttributeOwner mySourceDictType;
653 
654 #if 0
655  union {
656  const GA_AttributeProxy *myConst;
657  GA_AttributeProxy *myNonConst;
658  } myAttributeProxy;
659 #endif
660  GA_AttributeProxyHandle myDestProxy;
661  GA_TypeInfo myDestTypeInfo;
662  GA_ConstAttributeProxyHandle mySourceProxy;
663 
664  // Cached AIFs to avoid virtual query for every element.
665  const GA_AIFMath *myMath;
666  const GA_AIFInterp *myInterp;
667  const GA_AIFTuple *myTuple;
668  const GA_AIFCopyData *myCopyData;
669 
670  GA_Offset myBoundElement;
671 
672  // This flag marks whether this is a read-only or read-write attribute
673  // handle, and thus, which member of the myAttributeProxy union to access.
674  bool myReadOnly;
675 
676  // Special flag for "P" attrib on points.
677  bool myIsPointP;
678 };
679 
681 
682 #endif
GA_GBPoint & operator=(const GA_GBPoint &src)
Definition: GEO_Point.h:41
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
Definition of a geometry attribute.
Definition: GA_Attribute.h:198
int int32
Definition: SYS_Types.h:39
#define SYS_DEPRECATED(__V__)
*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
Definition: thread.h:623
void
Definition: png.h:1083
Attribute Interface class to perform numeric operations on attributes.
Definition: GA_AIFMath.h:88
const GLdouble * v
Definition: glcorearb.h:837
#define SYS_DEPRECATED_PUSH_DISABLE()
#define SYS_DEPRECATED_POP_DISABLE()
bool GAisValid(GA_Size v)
Definition: GA_Types.h:649
virtual bool lerp(GA_AttributeOperand &d, GA_AttributeOperand &a, GA_AttributeOperand &b, GA_AttributeOperand &t) const
d = SYSlerp(a, b, t);
GLdouble s
Definition: glad.h:3009
float fpreal32
Definition: SYS_Types.h:200
#define GA_INVALID_OFFSET
Definition: GA_Types.h:678
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
double fpreal64
Definition: SYS_Types.h:201
GA_Size GA_Offset
Definition: GA_Types.h:641
const char * getString(const GA_ROAttributeRef &h, int index=0) const
Definition: GA_GBElement.h:372
This class provides a way to manage a reference to an attribute permitting Read-Write access...
GLintptr offset
Definition: glcorearb.h:665
GLint ref
Definition: glcorearb.h:124
This class provides a way to manage a reference to an attribute permitting Read-Only access...
PXL_API const char * getName(const ColorSpace *space)
Return the name of the color space.
This class holds a reference to an attribute. Such an indirection level allows an easy way to invalid...
#define GEO_API
Definition: GEO_API.h:14
long long int64
Definition: SYS_Types.h:116
GA_Detail & getDetail() const
Provide access to the GA_Detail containing this element.
Definition: GA_GBElement.h:97
#define SYS_DEPRECATED_HDK(__V__)
void setString(const GA_WOAttributeRef &h, const char *str, int index=0)
Definition: GA_GBElement.h:384
GA_TypeInfo
Definition: GA_Types.h:100
GLfloat v0
Definition: glcorearb.h:816
void set(const GA_WOAttributeRef &h, const T *val, int count)
Definition: GA_GBElement.h:435
GLsizeiptr size
Definition: glcorearb.h:664
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
GA_AttributeOwner
Definition: GA_Types.h:34
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint index
Definition: glcorearb.h:786
GLfloat GLfloat v1
Definition: glcorearb.h:817
GLuint GLfloat * val
Definition: glcorearb.h:1608
Container class for all geometry.
Definition: GA_Detail.h:96
Attribute Interface class to copy attribute data.
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
#define const
Definition: zconf.h:214
Generic Attribute Interface class to access an attribute as a tuple.
Definition: GA_AIFTuple.h:32
uint64_t multiply(uint64_t lhs, uint64_t rhs)
Definition: format-inl.h:258
void setValue(const GA_WOAttributeRef &h, const T &val, int index=0)
Definition: GA_GBElement.h:407
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1297
GLenum src
Definition: glcorearb.h:1793