HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GDT_PrimitiveList.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: GDT Library. (Geo Delta)
7  *
8  * COMMENTS: GDT_PrimitiveList contains tokens for primitive attributes.
9  * All these tokens are not sparse.
10  *
11  */
12 #ifndef __GDT_PrimitiveList_h__
13 #define __GDT_PrimitiveList_h__
14 
15 #include "GDT_API.h"
16 #include "GDT_TokenList.h"
17 
18 #include <GEO/GEO_Detail.h>
19 #include "GDT_Transform.h"
20 
21 class GA_PrimitiveGroup;
22 
23 
25 {
26 public:
27  GDT_PrimitiveList() : myTransform(0) {}
29  ~GDT_PrimitiveList() override;
30 
31  // Implement the pure virtual applyDeltas() from GDT_TokenList.
32  void applyDeltas(GEO_Detail &gdp,
33  bool inverse = false) const override;
34 
35  // Merge the primitive deltas from another GDT_PrimitiveList
36  void mergePrimitiveDeltas(const GDT_PrimitiveList &other,
37  bool inverse = false);
38 
39  // Reset elements with deltas to the values from the source detail.
40  void resetElementsFromSource(GEO_Detail &gdp,
41  const GEO_Detail &src_gdp) const;
42 
43  // Apply stored deltas for elements also recordered in other to the
44  // given gdp.
45  void applyIntersectionDeltas(GEO_Detail &gdp,
46  const GDT_PrimitiveList &other) const;
47 
48  // Overload hiding base class method which requires a GA_AIFEditDeltaMap.
49  void endAttributeChange(const GEO_Detail &gdp);
50 
51  // Begin and end a transform change to the primitive specified by index.
52  // The delta matrix is computed and stored.
53  void beginPrimitiveTransformChange(const UT_Matrix3 &mat);
54  void endPrimitiveTransformChange(const UT_Matrix3 &mat,
55  unsigned int index);
56 
58  const GEO_Detail &gdp) const override
59  { return gdp.primitiveAttribs(); }
60 
61  bool hasChange() const override;
62  virtual bool haveAttributesChanged() const
63  { return GDT_TokenList::hasChange(); }
64  bool hasTransformChanged() const
65  {
66  return (myTransform &&
67  myTransform->changed() > 0);
68  }
69 
70  virtual bool legacyLoadTrans(UT_IStream &is, uint numtotal);
71 
72  bool saveTrans(UT_JSONWriter &w,
73  const GDT_JSON &json) const;
74  bool loadTrans(UT_JSONParser &p,
75  const GDT_JSON &json);
76 
77  // Zero the primitive deltas
78  void zeroDeltas() override;
79  // Destroy the primitive deltas, but not the attribute lists
80  void clearDeltas() override;
81  // Destroy the primitive deltas
82  void destroy() override;
83 
84 private:
85  // As with the position token, the transform token for primitives
86  // is kept apart from the token list.
87  GDT_Transform *myTransform;
88 };
89 #endif
virtual bool haveAttributesChanged() const
#define GDT_API
Definition: GDT_API.h:10
virtual void zeroDeltas()
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:87
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
virtual void applyDeltas(GEO_Detail &gdp, bool inverse=0) const =0
const GA_AttributeDict & getAttributeDict(const GEO_Detail &gdp) const override
SYS_FORCE_INLINE const GA_AttributeDict & primitiveAttribs() const
Definition: GEO_Detail.h:1943
GLuint index
Definition: glcorearb.h:786
bool hasTransformChanged() const
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
void endAttributeChange(const GA_AIFEditDeltaMap &map)
virtual bool hasChange() const
unsigned int uint
Definition: SYS_Types.h:45
virtual void clearDeltas()
virtual void destroy()