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  virtual ~GDT_Transform();
32 
33  virtual int64 getMemoryUsage(bool inclusive=false) const;
34 
35  virtual void applyDeltas(const GDT_TokenList &list,
36  GEO_Detail &gdp,
37  const GA_AIFEditDeltaMap &map,
38  bool inverse=false) const;
39 
40  void mergeTransformDeltas(
41  const GDT_Transform &other,
42  bool inverse = false);
43 
44  // Reset elements with deltas to the values from the source detail.
45  void resetElementsFromSource(GEO_Detail &gdp,
46  const GA_AIFEditDeltaMap &map,
47  const GEO_Detail &src_gdp,
48  const GA_AIFEditDeltaMap &src_map) const;
49 
50  // Apply stored deltas for elements also recordered in other to the
51  // given gdp.
52  void applyIntersectionDeltas(
53  const GDT_TokenList &token_list,
54  GEO_Detail &gdp,
55  const GA_AIFEditDeltaMap &map,
56  const GDT_Transform &other) const;
57 
58  // Zero all the deltas non-destructively
59  virtual void zeroDeltas();
60 
61  // Begin/end a change to a point position
62  void beginPrimitiveTransformChange(
63  const UT_Matrix3 &mat);
64  void endPrimitiveTransformChange(
65  const UT_Matrix3 &endmat,
66  unsigned int index);
67 
68  virtual void resize(unsigned int size);
69 
70  virtual unsigned int changed() const
71  { return myUsedEntries.numBitsSet(); }
72  virtual unsigned int entries() const
73  { return myUsedEntries.size(); }
74 
75  // I/O Methods
76  virtual bool legacyLoad(UT_IStream &is,
77  unsigned int numtotal);
78 
79  virtual bool save(UT_JSONWriter &w,
80  const GDT_JSON &json) const;
81  virtual bool load(UT_JSONParser &p,
82  const GDT_JSON &json);
83 
84 private:
85  UT_Matrix3 mySavedMat;
86 
88  UT_BitArray myUsedEntries;
89 };
90 
91 #endif
#define GDT_API
Definition: GDT_API.h:10
GLsizeiptr size
Definition: glew.h:1681
GLuint index
Definition: glew.h:1814
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:75
virtual unsigned int entries() const
Definition: GDT_Transform.h:72
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
virtual bool legacyLoad(UT_IStream &is, unsigned int numtotal)=0
long long int64
Definition: SYS_Types.h:111
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
ImageBuf OIIO_API resize(const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)
GLfloat GLfloat p
Definition: glew.h:16321
virtual void applyDeltas(const GDT_TokenList &list, GEO_Detail &gdp, const GA_AIFEditDeltaMap &map, bool inverse=false) const =0
GDT_Transform(unsigned int size)
Definition: GDT_Transform.h:28
virtual bool load(UT_JSONParser &p, const GDT_JSON &json)=0
virtual bool save(UT_JSONWriter &w, const GDT_JSON &json) const =0
virtual unsigned int changed() const
Definition: GDT_Transform.h:70
virtual int64 getMemoryUsage(bool inclusive=false) const =0
Class for mapping between an index and an attribute data offset.
Definition: GA_AIFEdit.h:48