HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GT_PrimCollect.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_Primitive.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_PrimCollect__
12 #define __GT_PrimCollect__
13 
14 #include "GT_API.h"
15 #include "GT_Primitive.h"
16 #include <UT/UT_ConcurrentVector.h>
17 
18 /// A class which contains a collection of primitives. The primitives may be
19 /// heterogeneous (i.e. different types).
21 {
22 public:
23  typedef UT_ConcurrentVector<GT_PrimitiveHandle> ListType;
26  virtual ~GT_PrimCollect();
27 
28  virtual const char *className() const { return "GT_PrimCollect"; }
29  virtual bool save(UT_JSONWriter &w) const;
30 
31  /// Clear the list
32  void clear();
33 
34  /// @{
35  /// Interface from GT_Primitive
36  virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegs) const;
37  virtual void enlargeRenderBounds(UT_BoundingBox b[], int n) const;
38  virtual void getVelocityRange(UT_Vector3 &vmin, UT_Vector3 &vmax,
39  const char *attribute_name) const;
40  virtual bool refine(GT_Refine &refiner,
41  const GT_RefineParms *parms) const;
42  virtual int getMotionSegments() const;
43  virtual int64 getMemoryUsage() const;
44  virtual int getPrimitiveType() const;
45  virtual GT_PrimitiveHandle doHarden() const;
47  { return new GT_PrimCollect(*this); }
48  /// @}
49 
50  /// Reserve space for a total of N primitives
51  void reserve(exint size) { myList.reserve(size); }
52 
53  /// Add a primitive to the list. This method is thread-safe
55  { myList.push_back(pr); }
56 
57  /// Return the number of primitives in the collection
58  exint entries() const { return myList.size(); }
59  /// Return the given primitive
60  GT_PrimitiveHandle getPrim(exint i) const;
61 
62  /// Sort the list
63  template <typename Compare>
64  void sortList(Compare &cmp)
65  {
66  std::sort(myList.begin(), myList.end(), cmp);
67  }
68 
69 protected:
70  void hardenContents();
71 
73 };
74 
75 #endif
virtual int getMotionSegments() const =0
virtual bool refine(GT_Refine &refiner, const GT_RefineParms *parms=NULL) const
virtual int getPrimitiveType() const
UT_ConcurrentVector< GT_PrimitiveHandle > ListType
#define GT_API
Definition: GT_API.h:11
virtual void getVelocityRange(UT_Vector3 &min, UT_Vector3 &max, const char *attribute_name="v") const
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
3D Vector class.
png_uint_32 i
Definition: png.h:2877
GLsizeiptr size
Definition: glcorearb.h:663
long long int64
Definition: SYS_Types.h:106
GLdouble n
Definition: glcorearb.h:2007
int64 exint
Definition: SYS_Types.h:115
void appendPrimitive(const GT_PrimitiveHandle &pr)
Add a primitive to the list. This method is thread-safe.
virtual void enlargeRenderBounds(UT_BoundingBox boxes[], int nsegments) const
virtual GT_PrimitiveHandle doSoftCopy() const
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
The base class for all GT primitive types.
Definition: GT_Primitive.h:41
void reserve(exint size)
Reserve space for a total of N primitives.
virtual GT_PrimitiveHandle doHarden() const
virtual int64 getMemoryUsage() const =0
int cmp(T a, T b)
Definition: ImathFun.h:119
Processes primitives generated by refinement process.
Definition: GT_Refine.h:20
void sortList(Compare &cmp)
Sort the list.
virtual bool save(UT_JSONWriter &w) const
exint entries() const
Return the number of primitives in the collection.
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
virtual const char * className() const
virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegments) const =0
GLenum src
Definition: glcorearb.h:1792