HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GDT_Transform.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: A GDT_Transform contains a list of matrices that describe
9  * the changes to the gdp's primitive transforms.
10  *
11  */
12 #ifndef __GDT_Transform_h__
13 #define __GDT_Transform_h__
14 
15 #include "GDT_API.h"
16 #include <UT/UT_BitArray.h>
17 #include <UT/UT_ValArray.h>
18 #include <UT/UT_Matrix3.h>
19 
20 #include "GDT_Token.h"
21 
22 class GA_PrimitiveGroup;
23 class GDT_TokenList;
24 
26 {
27 public:
28  GDT_Transform(unsigned int size) : myUsedEntries(size) {}
29  GDT_Transform(const GDT_Transform &other);
30 
31  ~GDT_Transform() override;
32 
34  bool inclusive = false) const override;
35 
36  void applyDeltas(const GDT_TokenList &list,
37  GEO_Detail &gdp,
38  const GA_AIFEditDeltaMap &map,
39  bool inverse=false) const override;
40 
41  void mergeTransformDeltas(
42  const GDT_Transform &other,
43  bool inverse = false);
44 
45  // Reset elements with deltas to the values from the source detail.
46  void resetElementsFromSource(GEO_Detail &gdp,
47  const GA_AIFEditDeltaMap &map,
48  const GEO_Detail &src_gdp,
49  const GA_AIFEditDeltaMap &src_map) const;
50 
51  // Apply stored deltas for elements also recordered in other to the
52  // given gdp.
53  void applyIntersectionDeltas(
54  const GDT_TokenList &token_list,
55  GEO_Detail &gdp,
56  const GA_AIFEditDeltaMap &map,
57  const GDT_Transform &other) const;
58 
59  // Zero all the deltas non-destructively
60  virtual void zeroDeltas();
61 
62  // Begin/end a change to a point position
63  void beginPrimitiveTransformChange(
64  const UT_Matrix3 &mat);
65  void endPrimitiveTransformChange(
66  const UT_Matrix3 &endmat,
67  unsigned int index);
68 
69  virtual void resize(unsigned int size);
70 
71  virtual unsigned int changed() const
72  { return myUsedEntries.numBitsSet(); }
73  virtual unsigned int entries() const
74  { return myUsedEntries.size(); }
75 
76  // I/O Methods
77  bool legacyLoad(UT_IStream &is,
78  unsigned int numtotal) override;
79 
80  bool save(UT_JSONWriter &w,
81  const GDT_JSON &json) const override;
82  bool load(UT_JSONParser &p,
83  const GDT_JSON &json) override;
84 
85 private:
86  UT_Matrix3 mySavedMat;
87 
89  UT_BitArray myUsedEntries;
90 };
91 
92 #endif
#define GDT_API
Definition: GDT_API.h:10
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:87
virtual unsigned int entries() const
Definition: GDT_Transform.h:73
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
virtual bool legacyLoad(UT_IStream &is, unsigned int numtotal)=0
long long int64
Definition: SYS_Types.h:116
GLsizeiptr size
Definition: glcorearb.h:664
ImageBuf OIIO_API resize(const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)
virtual void applyDeltas(const GDT_TokenList &list, GEO_Detail &gdp, const GA_AIFEditDeltaMap &map, bool inverse=false) const =0
GLuint index
Definition: glcorearb.h:786
GDT_Transform(unsigned int size)
Definition: GDT_Transform.h:28
virtual bool load(UT_JSONParser &p, const GDT_JSON &json)=0
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
virtual bool save(UT_JSONWriter &w, const GDT_JSON &json) const =0
virtual unsigned int changed() const
Definition: GDT_Transform.h:71
virtual int64 getMemoryUsage(bool inclusive=false) const =0
Class for mapping between an index and an attribute data offset.
Definition: GA_AIFEdit.h:48