HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_GEODetail.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_GEODetail.h ( GEO Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_GEODetail__
12 #define __GT_GEODetail__
13 
14 #include "GT_API.h"
15 #include "GT_Primitive.h"
16 #include "GT_GEODetailList.h"
17 #include <GA/GA_Names.h>
18 #include <GA/GA_Range.h>
19 
21 class GU_Detail;
22 class UT_StringRef;
23 
24 /// @brief Primitive representing entire detail. Refine this primitive.
25 ///
26 /// Refining this primitive will iterate over the primitives in the detail.
28 {
29 public:
31  const GA_Range *prim_range);
33  const GA_Range *prim_range);
35  ~GT_GEODetail() override;
36 
37  const char *className() const override { return "GT_GEODetail"; }
38 
39  /// Compute the bounding box
40  void enlargeBounds(UT_BoundingBox boxes[],
41  int nsegments) const override;
42  void getVelocityRange(
44  const UT_StringRef &attribute_name = GA_Names::v
45  ) const override;
46 
47  /// Return the primitive type
48  int getPrimitiveType() const override;
49 
50  /// Harden the detail.
51  GT_PrimitiveHandle doHarden() const override;
52 
53  /// Do a soft-copy
54  GT_PrimitiveHandle doSoftCopy() const override
55  { return new GT_GEODetail(*this); }
56 
57  /// Parameters
58  /// - bool renderpoints (false) @n Generate GT_PrimPointsMesh primitive
59  /// - string rendergroup ("") @n Name of primitive group to refine
60  /// - bool polygonmesh (true) @n Generate GT_PrimPolygonMesh primitive
61  bool refine(GT_Refine &refine,
62  const GT_RefineParms *parms) const override;
63 
64  int64 getMemoryUsage() const override
65  { return sizeof(*this); }
66 
67  /// Query number of motion segments
68  int getMotionSegments() const override
69  { return myList->getMotionSegments(); }
70  /// Get geometry for a given segment
71  const GU_ConstDetailHandle &getGeometry(int segment=0) const
72  { return myList->getGeometry(segment); }
74  { return myRange; }
75 
76  /// @{
77  /// Make a primitive for an entire detail
78  static GT_PrimitiveHandle makeDetail(const GU_ConstDetailHandle &gdh,
79  const GA_Range *prim_range = NULL);
80 
81  static GT_PrimitiveHandle makeDetail(
82  const GT_GEODetailListHandle &geo,
83  const GA_Range *prim_range
84  );
85  /// @}
86 
87  /// @{
88  /// Make a polygon mesh primitive for all the polygons in the detail
89  static GT_PrimitiveHandle makePolygonMesh(
90  const GU_ConstDetailHandle &gdp,
91  const GA_Range *prim_range = NULL,
92  const GT_RefineParms *rparms = NULL
93  );
94  static GT_PrimitiveHandle makePolygonMesh(
95  const GT_GEODetailListHandle &geo,
96  const GA_Range &prim_range,
97  const GT_RefineParms *rparms = NULL
98  );
99  /// @}
100 
101  /// @{
102  /// Make a point mesh containing just the points from a detail. Note that
103  /// the attributes can be picked up from detail attributes as well.
104  /// Vertex & primitive attributes are ignored.
105  static GT_PrimitiveHandle makePointMesh(
106  const GU_ConstDetailHandle &gdp,
107  const GA_Range *point_range = NULL
108  );
109  static GT_PrimitiveHandle makePointMesh(
110  const GT_GEODetailListHandle &geo,
111  const GA_Range *point_range = NULL
112  );
113  /// @}
114  bool save(UT_JSONWriter &w) const override;
115 
116 private:
117  GT_GEODetailListHandle myList;
119 };
120 
121 #endif
vint4 max(const vint4 &a, const vint4 &b)
Definition: simd.h:4703
GLenum src
Definition: glew.h:2410
virtual bool refine(GT_Refine &refiner, const GT_RefineParms *parms=NULL) const
virtual int getPrimitiveType() const
const GU_ConstDetailHandle & getGeometry(int segment=0) const
Get geometry for a given segment.
Definition: GT_GEODetail.h:71
#define GT_API
Definition: GT_API.h:11
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:34
GA_API const UT_StringHolder v
GT_PrimitiveHandle doSoftCopy() const override
Do a soft-copy.
Definition: GT_GEODetail.h:54
A range of elements in an index-map.
Definition: GA_Range.h:42
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
Definition: UT_SharedPtr.h:28
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
const char * className() const override
Definition: GT_GEODetail.h:37
long long int64
Definition: SYS_Types.h:116
The base class for all GT primitive types.
Definition: GT_Primitive.h:43
virtual GT_PrimitiveHandle doHarden() const
int getMotionSegments() const override
Query number of motion segments.
Definition: GT_GEODetail.h:68
Processes primitives generated by refinement process.
Definition: GT_Refine.h:20
int64 getMemoryUsage() const override
Definition: GT_GEODetail.h:64
virtual bool save(UT_JSONWriter &w) const
const UT_SharedPtr< const GA_Range > & getRange() const
Definition: GT_GEODetail.h:73
Primitive representing entire detail. Refine this primitive.
Definition: GT_GEODetail.h:27
UT_SharedPtr< GT_GEODetailList > GT_GEODetailListHandle
vint4 min(const vint4 &a, const vint4 &b)
Definition: simd.h:4694
virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegments) const =0