HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 class UT_StringRef;
19 
20 
21 /// A class which contains a collection of primitives. The primitives may be
22 /// heterogeneous (i.e. different types).
24 {
25 public:
26  typedef UT_ConcurrentVector<GT_PrimitiveHandle> ListType;
29  virtual ~GT_PrimCollect();
30 
31  virtual const char *className() const { return "GT_PrimCollect"; }
32  virtual bool save(UT_JSONWriter &w) const;
33 
34  /// Clear the list
35  void clear();
36 
37  /// @{
38  /// Interface from GT_Primitive
39  virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegs) const;
40  virtual void enlargeRenderBounds(UT_BoundingBox b[], int n) const;
41  virtual void getVelocityRange(UT_Vector3 &vmin, UT_Vector3 &vmax,
42  const UT_StringRef &attribute_name) const;
43  virtual bool refine(GT_Refine &refiner,
44  const GT_RefineParms *parms) const;
45  virtual int getMotionSegments() const;
46  virtual int64 getMemoryUsage() const;
47  virtual int getPrimitiveType() const;
48  virtual GT_PrimitiveHandle doHarden() const;
50  { return new GT_PrimCollect(*this); }
51  /// @}
52 
53  /// Reserve space for a total of N primitives
54  void reserve(exint size) { myList.reserve(size); }
55 
56  /// Add a primitive to the list. This method is thread-safe
58  { myList.push_back(pr); }
59 
60  /// Return the number of primitives in the collection
61  exint entries() const { return myList.size(); }
62  /// Return the given primitive
63  GT_PrimitiveHandle getPrim(exint i) const;
64 
65  /// Sort the list
66  template <typename Compare>
67  void sortList(Compare &cmp)
68  {
69  std::sort(myList.begin(), myList.end(), cmp);
70  }
71 
72 protected:
73  void hardenContents();
74 
76 };
77 
78 #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
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:107
GLdouble n
Definition: glcorearb.h:2007
int64 exint
Definition: SYS_Types.h:116
void appendPrimitive(const GT_PrimitiveHandle &pr)
Add a primitive to the list. This method is thread-safe.
virtual void getVelocityRange(UT_Vector3 &min, UT_Vector3 &max, const UT_StringRef &attribute_name=GA_Names::v) const
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:43
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