HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_PrimQuadricMesh.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_PrimQuadricMesh.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_PrimQuadricMesh__
12 #define __GT_PrimQuadricMesh__
13 
14 #include "GT_API.h"
15 #include "GT_Primitive.h"
16 #include "GT_TransformArray.h"
17 
18 class GT_PrimQuadric;
19 
20 /// A virtual container used by sphere, circle and tube meshes
22 {
23 public:
24  /// Default c-tor
26  { }
27 
29  : GT_Primitive(src)
30  , myVertex(src.myVertex)
31  , myDetail(src.myDetail)
32  , myTransforms(src.myTransforms)
33  {
34  }
35 
36  /// Construct a full list of quadrics
38  const GT_AttributeListHandle &detail,
39  const GT_TransformArrayHandle &xforms)
40  {
41  init(vertex, detail, xforms);
42  }
43 
44  /// Construct a mesh from a single quadric
46 
47  const char *className() const override { return "GT_PrimQuadricMesh"; }
48  bool saveQuadricMesh(UT_JSONWriter &w, const char *name) const
49  {
50  jsonWriter j(w, name);
51  return myTransforms->save(*j) &&
53  }
54 
55  /// @{
56  /// Methods defined on GT_Primitive
57  void enlargeBounds(UT_BoundingBox boxes[],
58  int nsegments) const override;
59  int getMotionSegments() const override;
60  int64 getMemoryUsage() const override;
61  bool refine(GT_Refine &refiner,
62  const GT_RefineParms *parms) const override;
63 
64  int getPrimitiveType() const override = 0;
65  /// @}
66 
67  /// Initialize the quadric mesh
68  bool init(const GT_AttributeListHandle &vertex,
69  const GT_AttributeListHandle &detail,
70  const GT_TransformArrayHandle &xforms);
71 
72  /// @{
73  /// Accessors
74  GT_Size getQuadricCount() const;
76  { return myVertex; }
78  { return myDetail; }
80  { return myTransforms; }
82  { return myTransforms->get(i); }
83  /// @}
84 
85  /// @{
86  /// Access attributes
88  { return myVertex; }
90  { return myDetail; }
91  /// @}
92 
93  bool updateGeoPrim(const GU_ConstDetailHandle &dtl,
94  const GT_RefineParms &refine) override;
95 
96  virtual bool getBaseTransform(UT_Matrix4D &) const
97  { return false; }
98 
99 protected:
100  /// Sub-class method to compute a bounding box for a single non-transformed
101  /// element.
102  virtual void getQBounds(UT_BoundingBox &box) const = 0;
103 
104  /// Method to harden attributes
105  void hardenAttributes();
106 
107  /// Sub-class method to make an individual primitive
108  virtual GT_PrimitiveHandle makeQuadric(GT_Size index,
109  const GT_AttributeListHandle &h,
110  const GT_TransformHandle &x,
111  const GT_RefineParms *parms) const = 0;
112 
116 };
117 
118 #endif
SIM_API const UT_StringHolder vertex
virtual int getMotionSegments() const =0
const GT_AttributeListHandle & getDetailAttributes() const override
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 int getPrimitiveType() const
#define GT_API
Definition: GT_API.h:13
const GT_AttributeListHandle & getDetail() const
const GT_TransformHandle & getTransform(GT_Size i) const
GT_TransformArrayHandle myTransforms
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
GLdouble GLdouble GLdouble q
Definition: glad.h:2445
GT_AttributeListHandle myVertex
const GT_AttributeListHandle & getVertexAttributes() const override
long long int64
Definition: SYS_Types.h:116
GLuint const GLchar * name
Definition: glcorearb.h:786
A virtual container used by sphere, circle and tube meshes.
const GT_AttributeListHandle & getVertex() const
bool saveQuadricMesh(UT_JSONWriter &w, const char *name) const
The base class for all GT primitive types.
Definition: GT_Primitive.h:43
GLint GLenum GLint x
Definition: glcorearb.h:409
virtual bool getBaseTransform(UT_Matrix4D &) const
const GT_TransformArrayHandle & getTransforms() const
virtual int64 getMemoryUsage() const =0
Processes primitives generated by refinement process.
Definition: GT_Refine.h:20
GLint j
Definition: glad.h:2733
const char * className() const override
int64 GT_Size
Definition: GT_Types.h:128
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
GLuint index
Definition: glcorearb.h:786
bool saveAttributeLists(UT_JSONWriter &w) const
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
GT_PrimQuadricMesh()
Default c-tor.
virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegments) const =0
GT_PrimQuadricMesh(const GT_AttributeListHandle &vertex, const GT_AttributeListHandle &detail, const GT_TransformArrayHandle &xforms)
Construct a full list of quadrics.
GT_PrimQuadricMesh(const GT_PrimQuadricMesh &src)
GLenum src
Definition: glcorearb.h:1793
GT_AttributeListHandle myDetail