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  virtual ~GT_PrimNURBSCurveMesh();
84 
85  virtual const char *className() const { return "GT_PrimNURBSCurveMesh"; }
86 
87  /// Initialize the mesh
88  void init(const PrimitiveArrayType &curvePrims,
89  const GT_GEODetailList &geo);
90 
91  /// Set the vertex attributes for the hull
92  void setHullVertices(const GT_DataArrayHandle &counts,
93  const GT_AttributeListHandle &vertex)
94  {
95  myHullCounts = counts;
96  myHullVertex = vertex;
97  }
98 
99  /// @{
100  /// Methods defined on GT_Primitive
101  virtual int getPrimitiveType() const;
102  virtual void enlargeBounds(UT_BoundingBox boxes[],
103  int nseg) const;
104  virtual int getMotionSegments() const;
105  virtual int64 getMemoryUsage() const;
106 
107  /// Refine into eithe a GT_PrimCurveMesh or a GT_PrimPolygonMesh depending
108  /// on @c getWrap()
109  virtual bool refine(GT_Refine &refiner,
110  const GT_RefineParms *parms) const;
111 
113  { return new GT_PrimNURBSCurveMesh(*this); }
114  /// @}
115 
116  /// Viewport refinement options
117  virtual const GT_ViewportRefineOptions &viewportRefineOptions() const;
118 
119  /// Refine to either a GT_PrimPolygonMesh or a GT_PrimCurveMesh depending
120  /// on the state of myWrap.
121  ///
122  /// May return an empty pointer when there are no curves.
124  { return refineToMesh(parms, NULL); }
125 
126  /// Refine to the hull mesh
127  GT_PrimitiveHandle refineToHull(const GT_RefineParms *parms) const;
128 
129  /// Refine to a GT_PrimCurveMesh or a GT_PrimPolygonMesh dependeing on @c
130  /// getWrap(). When refining to GT_PrimPolygonMesh, the @c outline
131  /// primitive will be set to a GT_PrimCurveMesh containing the outlines of
132  /// all the faces.
133  GT_PrimitiveHandle refineToMesh(const GT_RefineParms *parms,
134  GT_PrimitiveHandle *outlines) const;
135 
136  /// Fill the break points for all curves. You must pass in an array of the
137  /// number of vertices for each curve. For example, this could be the
138  /// vertex count array of the polygon mesh created by the refine process.
139  GT_DataArrayHandle getBreakPointIndices(const GT_RefineParms *parms,
140  GT_CountArray *curvecounts=NULL) const;
141 
142  /// @{
143  /// Accessor
144  GT_Size getCurveCount() const { return myCurves.entries(); }
145  bool getWrap() const { return myWrap; }
146  bool isOpenCubicBezier() const { return myCubicBezier;}
147  const GEO_Curve *getCurve(exint i) const;
149  { return myUniform; }
151  { return myDetail; }
152  /// @}
153 
154  /// @{
155  /// Access attributes
157  { return myHullVertex; }
159  { return myUniform; }
161  { return myDetail; }
162  /// @}
163 
164  bool refineToCurveMesh(GT_Refine &refiner,
165  const GT_RefineParms *parms) const;
166 
167  /// Update the primitive pointers
168  virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl,
169  const GT_RefineParms &refine);
170 
171 private:
172  GU_ConstDetailHandle myDetailHandle;
173  PrimitiveArrayType myCurves;
174  GT_DataArrayHandle myHullCounts;
175  GT_AttributeListHandle myHullVertex;
176  GT_AttributeListHandle myUniform;
177  GT_AttributeListHandle myDetail;
178  bool myWrap;
179  bool myCubicBezier; // Cubic Bezier
180 };
181 
182 #endif
virtual int getMotionSegments() const =0
Keep track of merging of attribute maps.
const GT_AttributeListHandle & getConstant() const
virtual const GT_AttributeListHandle & getDetailAttributes() const
virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl, const GT_RefineParms &parms)
update any cached data for geometry and its attributes
GLenum src
Definition: glew.h:2410
virtual bool refine(GT_Refine &refiner, const GT_RefineParms *parms=NULL) const
virtual const GT_ViewportRefineOptions & viewportRefineOptions() const
virtual int getPrimitiveType() const
Keeps a list of GU_Detail pointers.
GLuint GLsizei const GLuint const GLintptr * offsets
Definition: glew.h:4117
#define GT_API
Definition: GT_API.h:11
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.
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.
long long int64
Definition: SYS_Types.h:111
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:39
int64 exint
Definition: SYS_Types.h:120
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:113
virtual const char * className() const
GT_Size getCurveCount() const
static void makePairArray(UT_Array< GEOPrimitivePair > &array, const GU_ConstDetailHandle &gdh, const GT_GEOOffsetList &offsets)
A mesh of polygons.
virtual const GT_AttributeListHandle & getVertexAttributes() const
const GT_AttributeListHandle & getUniform() const
virtual const GT_AttributeListHandle & getUniformAttributes() 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)
virtual GT_PrimitiveHandle doSoftCopy() const