HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GT_TransformArray.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: GT_TransformArray.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_TransformArray__
12 #define __GT_TransformArray__
13 
14 #include "GT_API.h"
15 #include "GT_Handles.h"
16 #include "GT_Types.h"
17 #include <UT/UT_IntrusivePtr.h>
18 #include <UT/UT_Array.h>
19 
20 class UT_JSONWriter;
21 
23  : public UT_IntrusiveRefCounter<GT_TransformArray>
24 {
25 public:
27  {}
28  ~GT_TransformArray() { setEntries(0); }
29 
30  /// Return the number of entries
31  GT_Size entries() const { return myTransforms.entries(); }
32 
33  /// Return approximate memory usage
34  int64 getMemoryUsage() const;
35 
36  /// Return the number of motion segments. We assume that all transforms
37  /// have the same number of segments.
38  int getMotionSegments() const;
39 
40  /// Set the number of entries
41  void setEntries(GT_Size n);
42 
43  /// Return a transform handle
44  const GT_TransformHandle &get(GT_Size i) const
45  { return myTransforms(i); }
46  /// Set a transform handle
48  { myTransforms(i) = h; }
49 
50  /// Append a transform handle
51  void append(const GT_TransformHandle &h);
52 
53  /// Multiply all the transforms by a single transform
54  GT_TransformArrayHandle multiply(const GT_TransformHandle &h) const;
55 
56  /// Pre-multiply all the transforms by a single transform
57  GT_TransformArrayHandle preMultiply(const GT_TransformHandle &h) const;
58 
59  /// @{
60  /// For memory tracking, we override the new/delete operators
61  static void *operator new(size_t size);
62  static void *operator new(size_t size, void *p);
63  static void operator delete(void *p, size_t size);
64  /// @}
65 
66  /// Save to JSON
67  bool save(UT_JSONWriter &w) const;
68 
69  void setTransforms(const UT_Matrix4FArray &transforms);
70  void setTransforms(const UT_Matrix4DArray &transforms);
71 
72  void getTransforms(UT_Matrix4FArray &transforms);
73  void getTransforms(UT_Matrix4DArray &transforms);
74 
75  /// Dump array
76  void dump(const char *msg="") const;
77 
78 private:
79  UT_Array<GT_TransformHandle> myTransforms;
80 };
81 
82 #endif
png_infop int transforms
Definition: png.h:2591
#define GT_API
Definition: GT_API.h:11
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
A reference counter base class for use with UT_IntrusivePtr.
png_uint_32 i
Definition: png.h:2877
GLsizeiptr size
Definition: glcorearb.h:663
long long int64
Definition: SYS_Types.h:100
GLdouble n
Definition: glcorearb.h:2007
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2001
void set(GT_Size i, const GT_TransformHandle &h)
Set a transform handle.
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
int64 GT_Size
Definition: GT_Types.h:109
GT_Size entries() const
Return the number of entries.