HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_DisplayCache.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: Geometry library (C++)
7  *
8  * COMMENTS: Base class for display caches. 3 classes are defined here:
9  * GU_CacheFlags: (dirty) flags for the cache class
10  * GU_DisplayCache:the mother of all display caches
11  * GU_CacheParms: parms to update the cache with
12  *
13  */
14 
15 #ifndef __GU_DisplayCache_H__
16 #define __GU_DisplayCache_H__
17 
18 #include "GU_API.h"
19 #include <UT/UT_Vector3.h>
20 #include <UT/UT_Matrix4.h>
21 
22 class GU_DisplayAttribs;
23 
24 
25 // These defines are used as unsigned short commands, thus we can only deal
26 // with polygons of less than 65529 vertices
27 #define GU_GIVEUP 65535 // Something we can't deal with, so
28  // let the GU tessellator handle it.
29 #define GU_BEGINPOLY 65534 // Begin polygon
30 #define GU_BEGINTRI 65533 // Begin triangle
31 #define GU_BEGINQUAD 65532 // Begin quad
32 #define GU_ENDPOLY 65531 // End polygon
33 #define GU_ENDCOMMAND 65530 // End of all polygons
34 
36 
38 
40 {
41 public:
42  SYS_DEPRECATED_HDK(13.0)
43  GU_CacheFlags() {
44  allDirty = 1; // YES, completely dirty by default
45  xformDirty = 0;
46  xlateDirty = 0;
47  uvDirty = 0;
48  pushXform = 0;
49  }
50 
51  SYS_DEPRECATED_HDK(13.0)
52  int isDirty() const
53  { return allDirty|xformDirty|xlateDirty|uvDirty; }
54  SYS_DEPRECATED_HDK(13.0)
55  int howDirty() const
56  { return allDirty+xformDirty+xlateDirty+uvDirty; }
57  SYS_DEPRECATED_HDK(13.0)
58  void clear()
59  { allDirty = xformDirty = xlateDirty = uvDirty = 0; }
60 
61 
62  unsigned allDirty:1, // it's a mess. Must refresh it all
63  xformDirty:1, // the entire cache can be transformed
64  xlateDirty:1, // the entire cache can be translated
65  uvDirty:1, // parts of the domain are dirty
66  pushXform:1; // push xform when render rather than apply
67 };
68 
70 {
71 public:
72  SYS_DEPRECATED_HDK(13.0)
73  GU_DisplayCache() { theLOD = -1.0f; }
74  SYS_DEPRECATED_HDK(13.0)
75  virtual ~GU_DisplayCache();
76 
77  // Find out if anything is dirty or if we're so messy we should refresh all
78  SYS_DEPRECATED_HDK(13.0)
79  int isDirty() const { return theFlags.isDirty(); }
80  SYS_DEPRECATED_HDK(13.0)
81  int isMessy() const { return theFlags.allDirty; }
82  SYS_DEPRECATED_HDK(13.0)
83  int howDirty()const { return theFlags.howDirty(); }
84  SYS_DEPRECATED_HDK(13.0)
85  void clear() { theFlags.clear(); }
86  SYS_DEPRECATED_HDK(13.0)
87  void dirty()
88  {
89  theFlags.clear();
90  theFlags.pushXform = 0; // forget it, we're too dirty
91  theFlags.allDirty = 1;
92  }
93 
94  // Query or set the xform flag:
95  SYS_DEPRECATED_HDK(13.0)
96  int transformed() const { return theFlags.xformDirty; }
97  SYS_DEPRECATED_HDK(13.0)
98  void transform(const UT_Matrix4 &xform, int pushxform = 0);
99 
100  // Query or set the translate flag:
101  SYS_DEPRECATED_HDK(13.0)
102  int translated() const { return theFlags.xlateDirty; }
103  SYS_DEPRECATED_HDK(13.0)
104  void translate(const UT_Vector3 &d);
105 
106  // Query or set the uvdirty flag:
107  SYS_DEPRECATED_HDK(13.0)
108  int uvChanged() const { return theFlags.uvDirty; }
109  SYS_DEPRECATED_HDK(13.0)
110  void uvChange();
111 
112  // If we're about to be "smeared" with a transformation, decide now
113  // whether to apply the xform to the cache or push the matrix before
114  // rendering and using the current cache. This flag gets turned off
115  // if other things will cause us to be dirty.
116  SYS_DEPRECATED_HDK(13.0)
117  int pushXform() const { return theFlags.pushXform; }
118  SYS_DEPRECATED_HDK(13.0)
119  void pushXform(int yesno) { theFlags.pushXform = yesno; }
120 
121  SYS_DEPRECATED_HDK(13.0)
122  float lod() const { return theLOD; }
123  SYS_DEPRECATED_HDK(13.0)
124  const UT_Matrix4 &transformation() const { return theXform; }
125 
126 protected:
127  // Clear the cache data and other related info:
128  SYS_DEPRECATED_HDK(13.0)
129  virtual void initializeData();
130 
131  // If pushXform is set, the cache data has not been updated with the
132  // latest xform matrix. This method makes sure the data _is_ updated,
133  // and turns off the flag.
134  SYS_DEPRECATED_HDK(13.0)
135  virtual void assimilateXform();
136 
137  SYS_DEPRECATED_HDK(13.0)
138  UT_Vector3 &delta() { return theDelta; }
139  SYS_DEPRECATED_HDK(13.0)
140  const UT_Vector3 &delta() const { return theDelta; }
141  SYS_DEPRECATED_HDK(13.0)
142  UT_Matrix4 &transformation() { return theXform; }
143  SYS_DEPRECATED_HDK(13.0)
144  void lod(float l) { theLOD = l; }
145 
146 
147 private:
148  GU_CacheFlags theFlags;
149  UT_Matrix4 theXform;
150  UT_Vector3 theDelta;
151  float theLOD;
152 };
153 
154 
156 {
157 public:
158  SYS_DEPRECATED_HDK(13.0)
160  SYS_DEPRECATED_HDK(13.0)
161  virtual ~GU_CacheParms();
162 
163  SYS_DEPRECATED_HDK(13.0)
164  void lod(float l) { theLOD = l; }
165  SYS_DEPRECATED_HDK(13.0)
166  float lod() const { return theLOD; }
167  SYS_DEPRECATED_HDK(13.0)
168  void mode(GU_CacheMode m) { theMode = m; }
169  SYS_DEPRECATED_HDK(13.0)
170  GU_CacheMode mode() const { return theMode; }
171  SYS_DEPRECATED_HDK(13.0)
172  void attributes(const GU_DisplayAttribs *a) { theAttribs=a;}
173  SYS_DEPRECATED_HDK(13.0)
174  const GU_DisplayAttribs *attributes() const { return theAttribs; }
175 
176 private:
177  float theLOD; // level of detail
178  GU_CacheMode theMode; // display mode: wire, shaded
179  const GU_DisplayAttribs *theAttribs; // attribute offsets
180 };
181 
183 
184 #endif
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
*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
#define SYS_DEPRECATED_PUSH_DISABLE()
#define SYS_DEPRECATED_POP_DISABLE()
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
IMATH_NAMESPACE::V2f float
#define GU_API
Definition: GU_API.h:14
#define SYS_DEPRECATED_HDK(__V__)
GA_API const UT_StringHolder transform
GU_CacheMode
GLenum mode
Definition: glcorearb.h:99
PUGI__FN char_t * translate(char_t *buffer, const char_t *from, const char_t *to, size_t to_length)
Definition: pugixml.cpp:8352
GLint lod
Definition: glcorearb.h:2765