HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GEO_WorkVertexBuffer.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: GEOWorkVertexBuffer.h ( GEO Library, C++)
7  *
8  * COMMENTS: A work-buffer of temporary vertices. These are allocated on
9  * demand and free'd when the class is destructed. They are
10  * intended to be used as temporary stack storage, and shouldn't
11  * be persistent.
12  *
13  * Each vertex is indexed by a unique integer (like an array).
14  * Accessing a vertex which hasn't been accessed already will
15  * cause the vertex to be created.
16  *
17  * Each vertex will also have a point allocated for it, and the
18  * point associated with the vertex should NOT be changed.
19  */
20 
21 #ifndef __GEO_WorkVertexBuffer__
22 #define __GEO_WorkVertexBuffer__
23 
24 #include "GEO_API.h"
25 #include <UT/UT_Array.h>
26 #include <GA/GA_WorkVertexBuffer.h>
27 #include "GEO_Vertex.h"
28 #include "GEO_Detail.h"
29 
30 class GEO_Detail;
31 class GEO_Vertex;
32 
33 #define GEO_WORK_VERTEX_ARRAY_SIZE 128
34 
36 
38 {
39 public:
40  SYS_DEPRECATED_HDK(13.0)
41  GEO_WorkVertexBuffer(
43  GA_Size initial_size = 0,
44  GA_Size matrix_size = GA_MAXORDER);
45  SYS_DEPRECATED_HDK(13.0)
46  virtual ~GEO_WorkVertexBuffer();
47 
48  /// Clear all vertices out of the work vertex buffer.
49  SYS_DEPRECATED_HDK(13.0)
50  void clear();
51 
52  /// @{
53  /// If the vertex isn't already allocated at the index passed in, it will be
54  /// created. The const method may return a NULL pointer if the vertex
55  /// hasn't been allocated.
56  SYS_DEPRECATED_HDK(13.0)
57  GEO_Vertex *getVertexElement(GA_Size idx);
58  SYS_DEPRECATED_HDK(13.0)
59  const GEO_Vertex *getVertexElement(GA_Size idx) const;
60  SYS_DEPRECATED_HDK(13.0)
61  GEO_Vertex *appendVertexElement();
62  /// @}
63 
64  /// Return the number of vertices allocated in the buffer
65  SYS_DEPRECATED_HDK(13.0)
66  GA_Size getVertexEntries() const { return myVertices.entries(); }
67 
68  /// Swap two entries in the vertex array. This changes the vertex numbers
69  /// associated with given entries in the vertex buffer.
70  SYS_DEPRECATED_HDK(13.0)
71  void swapVertices(GA_Size i1, GA_Size i2);
72 
73 private:
74  GA_WorkVertexBuffer myGAVertices;
75  UT_Array<GEO_Vertex *> myVertices;
76 };
77 
79 {
80 public:
81  // Many of the curve/surface methods require an array of vertices. Rather
82  // than worrying about allocating/deleting dynamic arrays, the
83  // work-vertex-array can be used.
84  //
85  // Vertices are allocated using the work-vertex-buffer, so it must remain
86  // in scope as long as the array.
87  //
88  SYS_DEPRECATED_HDK(13.0)
89  GEO_WorkVertexArray(GEO_WorkVertexBuffer &buffer, GA_Size size);
90  SYS_DEPRECATED_HDK(13.0)
91  virtual ~GEO_WorkVertexArray();
92 
93  // Get a pointer to the array of GEO_Vertex objects
94  SYS_DEPRECATED_HDK(13.0)
95  GEO_Vertex **getVertexElements() const { return myVertices; }
96 
97  /// Query size
98  SYS_DEPRECATED_HDK(13.0)
99  GA_Size entries() const { return mySize; }
100 
101 private:
102  GEO_Vertex **myVertices;
104  GA_Size mySize;
105 };
106 
108 
109 #endif
*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()
GLint GLint i2
Definition: glad.h:2724
Manages allocation/deletion of temporary vertex/points for a detail.
Definition: GA_VertexPool.h:35
#define GA_MAXORDER
Definition: GA_Defines.h:17
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:236
Definition: core.h:760
#define GEO_API
Definition: GEO_API.h:14
GLint i1
Definition: glad.h:2724
#define SYS_DEPRECATED_HDK(__V__)
#define GEO_WORK_VERTEX_ARRAY_SIZE
GLsizeiptr size
Definition: glcorearb.h:664
**Note that the tasks the is the thread number *for the pool
Definition: thread.h:637