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  ~GT_PrimCollect() override;
30 
31  const char *className() const override { return "GT_PrimCollect"; }
32  bool save(UT_JSONWriter &w) const override;
33 
34  /// Clear the list
35  void clear();
36 
37  /// @{
38  /// Interface from GT_Primitive
39  void enlargeBounds(
40  UT_BoundingBox boxes[],
41  int nsegs) const override;
43  UT_BoundingBox b[], int n) const override;
44  void getVelocityRange(
45  UT_Vector3 &vmin, UT_Vector3 &vmax,
46  const UT_StringRef &attribute_name
47  ) const override;
48  bool refine(GT_Refine &refiner,
49  const GT_RefineParms *parms) const override;
50  int getMotionSegments() const override;
51  int64 getMemoryUsage() const override;
52  int getPrimitiveType() const override;
53  GT_PrimitiveHandle doHarden() const override;
54  GT_PrimitiveHandle doSoftCopy() const override
55  { return new GT_PrimCollect(*this); }
56  bool updateGeoPrim(const GU_ConstDetailHandle &dtl,
57  const GT_RefineParms &parms) override;
58  /// @}
59 
60  /// Reserve space for a total of N primitives
61  void reserve(exint size) { myList.reserve(size); }
62 
63  /// Add a primitive to the list. This method is thread-safe
65  { myList.push_back(pr); }
66 
67  /// Return the number of primitives in the collection
68  exint entries() const { return myList.size(); }
69  /// Return the given primitive
70  GT_PrimitiveHandle getPrim(exint i) const;
71 
72  /// Sort the list
73  template <typename Compare>
74  void sortList(Compare &cmp)
75  {
76  std::sort(myList.begin(), myList.end(), cmp);
77  }
78 
79 protected:
80  void hardenContents();
81 
83 };
84 
85 #endif
virtual int getMotionSegments() const =0
virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl, const GT_RefineParms &parms)
update any cached data for geometry and its attributes
GLsizeiptr size
Definition: glew.h:1681
GLenum src
Definition: glew.h:2410
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
int64 exint
Definition: SYS_Types.h:125
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:34
const char * className() const override
GT_PrimitiveHandle doSoftCopy() const override
void appendPrimitive(const GT_PrimitiveHandle &pr)
Add a primitive to the list. This method is thread-safe.
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
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
GLsizei n
Definition: glew.h:4040
long long int64
Definition: SYS_Types.h:116
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
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
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.
virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegments) const =0
void sort(I begin, I end, const Pred &pred)
Definition: pugixml.cpp:7334