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 
66  /// Destructor
67  virtual ~GT_PrimNURBSCurveMesh();
68 
69  virtual const char *className() const { return "GT_PrimNURBSCurveMesh"; }
70 
71  /// Initialize the mesh
72  void init(const PrimitiveArrayType &curvePrims,
73  const GT_GEODetailList &geo);
74 
75  /// Set the vertex attributes for the hull
76  void setHullVertices(const GT_DataArrayHandle &counts,
77  const GT_AttributeListHandle &vertex)
78  {
79  myHullCounts = counts;
80  myHullVertex = vertex;
81  }
82 
83  /// @{
84  /// Methods defined on GT_Primitive
85  virtual int getPrimitiveType() const;
86  virtual void enlargeBounds(UT_BoundingBox boxes[],
87  int nseg) const;
88  virtual int getMotionSegments() const;
89  virtual int64 getMemoryUsage() const;
90 
91  /// Refine into eithe a GT_PrimCurveMesh or a GT_PrimPolygonMesh depending
92  /// on @c getWrap()
93  virtual bool refine(GT_Refine &refiner,
94  const GT_RefineParms *parms) const;
95 
97  { return new GT_PrimNURBSCurveMesh(*this); }
98  /// @}
99 
100  /// Viewport refinement options
101  virtual const GT_ViewportRefineOptions &viewportRefineOptions() const;
102 
103  /// Refine to either a GT_PrimPolygonMesh or a GT_PrimCurveMesh depending
104  /// on the state of myWrap.
105  ///
106  /// May return an empty pointer when there are no curves.
108  { return refineToMesh(parms, NULL); }
109 
110  /// Refine to the hull mesh
111  GT_PrimitiveHandle refineToHull(const GT_RefineParms *parms) const;
112 
113  /// Refine to a GT_PrimCurveMesh or a GT_PrimPolygonMesh dependeing on @c
114  /// getWrap(). When refining to GT_PrimPolygonMesh, the @c outline
115  /// primitive will be set to a GT_PrimCurveMesh containing the outlines of
116  /// all the faces.
117  GT_PrimitiveHandle refineToMesh(const GT_RefineParms *parms,
118  GT_PrimitiveHandle *outlines) const;
119 
120  /// Fill the break points for all curves. You must pass in an array of the
121  /// number of vertices for each curve. For example, this could be the
122  /// vertex count array of the polygon mesh created by the refine process.
123  GT_DataArrayHandle getBreakPointIndices(const GT_RefineParms *parms,
124  GT_CountArray *curvecounts=NULL) const;
125 
126  /// @{
127  /// Accessor
128  GT_Size getCurveCount() const { return myCurves.entries(); }
129  bool getWrap() const { return myWrap; }
130  bool isOpenCubicBezier() const { return myCubicBezier;}
131  const GEO_Curve *getCurve(exint i) const;
133  { return myUniform; }
135  { return myDetail; }
136  /// @}
137 
138  /// @{
139  /// Access attributes
141  { return myHullVertex; }
143  { return myUniform; }
145  { return myDetail; }
146  /// @}
147 
148  bool refineToCurveMesh(GT_Refine &refiner,
149  const GT_RefineParms *parms) const;
150 
151  /// Update the primitive pointers
152  virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl,
153  const GT_RefineParms &refine);
154 
155 private:
156  GU_ConstDetailHandle myDetailHandle;
157  PrimitiveArrayType myCurves;
158  GT_DataArrayHandle myHullCounts;
159  GT_AttributeListHandle myHullVertex;
160  GT_AttributeListHandle myUniform;
161  GT_AttributeListHandle myDetail;
162  bool myWrap;
163  bool myCubicBezier; // Cubic Bezier
164 };
165 
166 #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
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.
#define GT_API
Definition: GT_API.h:11
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.
png_uint_32 i
Definition: png.h:2877
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:107
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:38
int64 exint
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
virtual const char * className() const
GT_Size getCurveCount() const
A mesh of polygons.
virtual const GT_AttributeListHandle & getVertexAttributes() const
const GT_AttributeListHandle & getUniform() const
virtual const GT_AttributeListHandle & getUniformAttributes() const
int64 GT_Size
Definition: GT_Types.h:112
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:1792
virtual GT_PrimitiveHandle doSoftCopy() const