HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_PrimCurve.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_PrimCurve.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_PrimCurve__
12 #define __GT_PrimCurve__
13 
14 #include "GT_API.h"
15 #include "GT_Primitive.h"
16 
17 /// @brief A single linear or cubic patch
19 public:
20  GT_PrimCurve();
22  const GT_AttributeListHandle &vertex,
23  const GT_AttributeListHandle &uniform,
24  bool wrap)
25  {
26  init(basis, vertex, uniform, wrap);
27  }
28  ~GT_PrimCurve() override;
29 
30  const char *className() const override { return "GT_PrimCurve"; }
31  bool save(UT_JSONWriter &w) const override;
32 
33  /// @{
34  /// Methods defined on GT_Primitive
35  void enlargeBounds(UT_BoundingBox boxes[],
36  int nsegments) const override;
38  UT_BoundingBox b[], int n) const override;
39  int getPrimitiveType() const override;
40  int getMotionSegments() const override;
41  int64 getMemoryUsage() const override;
42  /// @}
43 
44  /// Construct a simple curve.
45  /// - @c vertex @n Attribute data per vertex
46  /// - @c uniform @n Single value which is uniform over the patch
47  bool init(GT_Basis basis,
48  const GT_AttributeListHandle &vertex,
49  const GT_AttributeListHandle &uniform,
50  bool wrapped);
51 
52  /// @{
53  /// Accessor
54  GT_Basis getBasis() const { return myBasis; }
55  bool getWrap() const { return myWrap; }
56  const GT_AttributeListHandle &getVertex() const { return myVertex; }
57  const GT_AttributeListHandle &getUniform() const { return myUniform; }
58  /// @}
59 
60  /// @{
61  /// Access attributes
63  { return myVertex; }
65  { return myUniform; }
66  /// @}
67 
68  /// @{
69  /// Methods for GEO/GU support.
70  /// Compute perimeter of a curve or an indexed curve
71  fpreal computePerimeter(int seg) const override;
72  static fpreal curveLength(const GT_DataArray &P,
73  GT_Size nvtx=-1, GT_Offset start=0,
74  const UT_Matrix4D *xform = NULL);
75  /// @}
76 
77  /// Harden all attributes so there are no dangling dependencies
78  GT_PrimitiveHandle doHarden() const override;
79  GT_PrimitiveHandle doSoftCopy() const override
80  { return new GT_PrimCurve(*this); }
81 
82  /// The virtual implementation of attribute merging
84  const GT_Primitive &src,
85  const UT_StringMMPattern *vertex,
86  const UT_StringMMPattern *point,
87  const UT_StringMMPattern *uniform,
88  const UT_StringMMPattern *detail) const override;
89 
90 private:
91  GT_AttributeListHandle myVertex;
92  GT_AttributeListHandle myUniform;
94  bool myWrap;
95 };
96 
97 #endif
virtual int getMotionSegments() const =0
GLenum src
Definition: glew.h:2410
virtual int getPrimitiveType() const
virtual fpreal computePerimeter(int seg=0) const
const char * className() const override
Definition: GT_PrimCurve.h:30
GT_PrimCurve(GT_Basis basis, const GT_AttributeListHandle &vertex, const GT_AttributeListHandle &uniform, bool wrap)
Definition: GT_PrimCurve.h:21
#define GT_API
Definition: GT_API.h:11
const GT_AttributeListHandle & getVertex() const
Definition: GT_PrimCurve.h:56
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:34
const GT_AttributeListHandle & getUniform() const
Definition: GT_PrimCurve.h:57
Abstract data class for an array of float, int or string data.
Definition: GT_DataArray.h:40
bool getWrap() const
Definition: GT_PrimCurve.h:55
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
virtual void enlargeRenderBounds(UT_BoundingBox boxes[], int nsegments) const
GLsizei n
Definition: glew.h:4040
int64 GT_Offset
Definition: GT_Types.h:114
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
GLuint start
Definition: glew.h:1253
virtual int64 getMemoryUsage() const =0
GT_PrimitiveHandle doSoftCopy() const override
Definition: GT_PrimCurve.h:79
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
int64 GT_Size
Definition: GT_Types.h:113
GT_Basis myBasis
Definition: GT_CurveEval.h:262
const GT_AttributeListHandle & getVertexAttributes() const override
Definition: GT_PrimCurve.h:62
fpreal64 fpreal
Definition: SYS_Types.h:277
virtual bool save(UT_JSONWriter &w) const
const GT_AttributeListHandle & getUniformAttributes() const override
Definition: GT_PrimCurve.h:64
GT_Basis getBasis() const
Definition: GT_PrimCurve.h:54
GT_Basis
Definition: GT_Types.h:53
A single linear or cubic patch.
Definition: GT_PrimCurve.h:18
virtual GT_PrimitiveHandle doAttributeMerge(const GT_Primitive &src, const UT_StringMMPattern *vertex, const UT_StringMMPattern *point, const UT_StringMMPattern *uniform, const UT_StringMMPattern *detail) const
The virtual implementation of attribute merging.
virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegments) const =0