HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_PrimNURBSCurveMesh.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_PrimNURBSCurveMesh.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_PrimNURBSCurveMesh__
12 #define __GT_PrimNURBSCurveMesh__
13 
14 #include "GT_API.h"
15 #include "GT_GEOPrimitive.h"
16 
17 #include <UT/UT_ValArray.h>
18 #include <GU/GU_DetailHandle.h>
19 
20 class GEO_Curve;
21 class GT_DataArray;
22 class GT_CountArray;
23 class GT_AttributeList;
24 class GT_AttributeMerge;
25 class GT_PrimCurve;
26 class GT_GEODetailList;
27 
28 /// @brief A mesh of polygons
30 {
31 public:
33  /// Default constructor
35 
37  : GT_Primitive(src)
38  , myDetailHandle(src.myDetailHandle)
39  , myCurves(src.myCurves)
40  , myHullCounts(src.myHullCounts)
41  , myHullVertex(src.myHullVertex)
42  , myUniform(src.myUniform)
43  , myDetail(src.myDetail)
44  , myWrap(src.myWrap)
45  , myCubicBezier(src.myCubicBezier)
46  {
47  }
48 
49  /// Useful constructor
51  const PrimitiveArrayType &curves,
52  const GT_AttributeListHandle &uniform,
53  const GT_AttributeListHandle &detail,
54  bool wrap,
55  bool cubic_bezier=false)
56  : myDetailHandle(gdh)
57  , myCurves(curves)
58  , myUniform(uniform)
59  , myDetail(detail)
60  , myWrap(wrap)
61  , myCubicBezier(cubic_bezier)
62  {
63  }
64 
65  /// Useful constructor
68  const GT_AttributeListHandle &uniform,
69  const GT_AttributeListHandle &detail,
70  bool wrap,
71  bool cubic_bezier=false)
72  : myDetailHandle(gdh)
73  , myCurves()
74  , myUniform(uniform)
75  , myDetail(detail)
76  , myWrap(wrap)
77  , myCubicBezier(cubic_bezier)
78  {
79  GT_GEOPrimitive::makePairArray(myCurves, gdh, offsets);
80  }
81 
82  /// Destructor
83  ~GT_PrimNURBSCurveMesh() override;
84 
85  const char *className() const override
86  { return "GT_PrimNURBSCurveMesh"; }
87 
88  /// Initialize the mesh
89  void init(const PrimitiveArrayType &curvePrims,
90  const GT_GEODetailList &geo);
91 
92  /// Set the vertex attributes for the hull
93  void setHullVertices(const GT_DataArrayHandle &counts,
95  {
96  myHullCounts = counts;
97  myHullVertex = vertex;
98  }
99 
100  /// @{
101  /// Methods defined on GT_Primitive
102  int getPrimitiveType() const override;
103  void enlargeBounds(UT_BoundingBox boxes[],
104  int nseg) const override;
105  int getMotionSegments() const override;
106  int64 getMemoryUsage() const override;
107 
108  /// Refine into eithe a GT_PrimCurveMesh or a GT_PrimPolygonMesh depending
109  /// on @c getWrap()
110  bool refine(GT_Refine &refiner,
111  const GT_RefineParms *parms) const override;
112 
114  { return new GT_PrimNURBSCurveMesh(*this); }
115  /// @}
116 
117  /// Viewport refinement options
118  const GT_ViewportRefineOptions &viewportRefineOptions() const override;
119 
120  /// Refine to either a GT_PrimPolygonMesh or a GT_PrimCurveMesh depending
121  /// on the state of myWrap.
122  ///
123  /// May return an empty pointer when there are no curves.
125  { return refineToMesh(parms, NULL); }
126 
127  /// Refine to the hull mesh
128  GT_PrimitiveHandle refineToHull(const GT_RefineParms *parms) const;
129 
130  /// Refine to a GT_PrimCurveMesh or a GT_PrimPolygonMesh dependeing on @c
131  /// getWrap(). When refining to GT_PrimPolygonMesh, the @c outline
132  /// primitive will be set to a GT_PrimCurveMesh containing the outlines of
133  /// all the faces.
134  GT_PrimitiveHandle refineToMesh(const GT_RefineParms *parms,
135  GT_PrimitiveHandle *outlines) const;
136 
137  /// Fill the break points for all curves. You must pass in an array of the
138  /// number of vertices for each curve. For example, this could be the
139  /// vertex count array of the polygon mesh created by the refine process.
140  GT_DataArrayHandle getBreakPointIndices(const GT_RefineParms *parms,
141  GT_CountArray *curvecounts=NULL) const;
142 
143  /// @{
144  /// Accessor
145  GT_Size getCurveCount() const { return myCurves.entries(); }
146  bool getWrap() const { return myWrap; }
147  bool isOpenCubicBezier() const { return myCubicBezier;}
148  const GEO_Curve *getCurve(exint i) const;
150  { return myUniform; }
152  { return myDetail; }
153  /// @}
154 
155  /// @{
156  /// Access attributes
158  { return myHullVertex; }
160  { return myUniform; }
162  { return myDetail; }
163  /// @}
164 
165  bool refineToCurveMesh(GT_Refine &refiner,
166  const GT_RefineParms *parms) const;
167 
168  /// Update the primitive pointers
169  bool updateGeoPrim(const GU_ConstDetailHandle &dtl,
170  const GT_RefineParms &refine) override;
171 
172 private:
173  GU_ConstDetailHandle myDetailHandle;
174  PrimitiveArrayType myCurves;
175  GT_DataArrayHandle myHullCounts;
176  GT_AttributeListHandle myHullVertex;
177  GT_AttributeListHandle myUniform;
178  GT_AttributeListHandle myDetail;
179  bool myWrap;
180  bool myCubicBezier; // Cubic Bezier
181 };
182 
183 #endif
SIM_API const UT_StringHolder vertex
virtual int getMotionSegments() const =0
Keep track of merging of attribute maps.
const GT_AttributeListHandle & getConstant() const
virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl, const GT_RefineParms &parms)
update any cached data for geometry and its attributes
virtual bool refine(GT_Refine &refiner, const GT_RefineParms *parms=NULL) const
virtual const GT_ViewportRefineOptions & viewportRefineOptions() const
const GT_AttributeListHandle & getUniformAttributes() const override
virtual int getPrimitiveType() const
Keeps a list of GU_Detail pointers.
#define GT_API
Definition: GT_API.h:13
int64 exint
Definition: SYS_Types.h:125
GT_PrimNURBSCurveMesh(const GU_ConstDetailHandle &gdh, const GT_GEOOffsetList &offsets, const GT_AttributeListHandle &uniform, const GT_AttributeListHandle &detail, bool wrap, bool cubic_bezier=false)
Useful constructor.
const GT_AttributeListHandle & getVertexAttributes() const override
GT_PrimNURBSCurveMesh(const GU_ConstDetailHandle &gdh, const PrimitiveArrayType &curves, const GT_AttributeListHandle &uniform, const GT_AttributeListHandle &detail, bool wrap, bool cubic_bezier=false)
Useful constructor.
GT_PrimitiveHandle refineToMesh(const GT_RefineParms *parms) const
void setHullVertices(const GT_DataArrayHandle &counts, const GT_AttributeListHandle &vertex)
Set the vertex attributes for the hull.
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glcorearb.h:2621
GT_PrimitiveHandle doSoftCopy() const override
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:40
const GT_AttributeListHandle & getDetailAttributes() const override
long long int64
Definition: SYS_Types.h:116
The base class for all GT primitive types.
Definition: GT_Primitive.h:43
UT_Array< GT_GEOPrimitive::GEOPrimitivePair > PrimitiveArrayType
virtual int64 getMemoryUsage() const =0
Processes primitives generated by refinement process.
Definition: GT_Refine.h:20
int64 GT_Size
Definition: GT_Types.h:128
GT_Size getCurveCount() const
const char * className() const override
static void makePairArray(UT_Array< GEOPrimitivePair > &array, const GU_ConstDetailHandle &gdh, const GT_GEOOffsetList &offsets)
A mesh of polygons.
const GT_AttributeListHandle & getUniform() const
A single linear or cubic patch.
Definition: GT_PrimCurve.h:18
virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegments) const =0
GT_PrimNURBSCurveMesh(const GT_PrimNURBSCurveMesh &src)
GLenum src
Definition: glcorearb.h:1793