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  virtual const char *className() const { 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  virtual void enlargeBounds(UT_BoundingBox boxes[],
58  int nsegments) const;
59  virtual int getMotionSegments() const;
60  virtual int64 getMemoryUsage() const;
61  virtual bool refine(GT_Refine &refiner,
62  const GT_RefineParms *parms) const;
63 
64  virtual int getPrimitiveType() const = 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  virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl,
94  const GT_RefineParms &refine);
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
virtual int getMotionSegments() const =0
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
virtual const char * className() const
#define GT_API
Definition: GT_API.h:11
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:32
png_uint_32 i
Definition: png.h:2877
GT_AttributeListHandle myVertex
virtual const GT_AttributeListHandle & getVertexAttributes() const
long long int64
Definition: SYS_Types.h:107
GLuint const GLchar * name
Definition: glcorearb.h:785
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
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
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2001
GLuint index
Definition: glcorearb.h:785
bool saveAttributeLists(UT_JSONWriter &w) const
GLint GLenum GLint x
Definition: glcorearb.h:408
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
GT_PrimQuadricMesh()
Default c-tor.
int64 GT_Size
Definition: GT_Types.h:112
virtual const GT_AttributeListHandle & getDetailAttributes() const
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:1792
GT_AttributeListHandle myDetail