HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_PrimSphere.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: GU_PrimSphere.h (C++)
7  *
8  * COMMENTS:
9  * Header file for GU_PrimSphere.h class...
10  *
11  */
12 
13 #ifndef __GU_PrimSphere_h__
14 #define __GU_PrimSphere_h__
15 
16 #include "GU_API.h"
17 #include "GU_Detail.h"
18 #include <GEO/GEO_SurfaceType.h>
19 #include <GEO/GEO_PrimSphere.h>
20 #include <UT/UT_Matrix4.h>
21 
22 class GU_PrimMesh;
23 class GU_PrimNURBSurf;
24 class GU_PrimRBezSurf;
25 class GEO_ConvertParms;
26 class GEO_Hull;
27 class GEO_TriMesh;
29 class UT_MemoryCounter;
30 
31 /////////////////////////////////////////////////////////////
32 // //
33 // Class: GU_PrimSphere //
34 // Descr: This class is responsible for operations //
35 // done on sphere primitives. As we need to access //
36 // the GU_Detail, the pointer is passed in the //
37 // constructor. The second constructor creates a //
38 // sphere with the given parameters. //
39 // //
40 /////////////////////////////////////////////////////////////
41 
43 {
44 public:
46 
48  GA_Offset ptoff; // use this point instead of yours
50  int freq; // For polygons/polysoup
51  int rows, cols; // For mesh
52  int uniquePole; // For mesh&others
53  int orderu; // for surfaces
54  int orderv;
55  int imperfect; // nonrational
56  GEO_SurfaceType type; // For hull types
57  bool soup; // For polygons/polysoup
58  bool polymesh; // For polygon mesh
59  bool tripoles; // Triangular poles
60 };
61 
62 
64 {
65 protected:
66  /// NOTE: Primitives should not be deleted directly. They are managed
67  /// by the GA_PrimitiveList and the stash.
68  ~GU_PrimSphere() override {}
69 
70 public:
71  /// NOTE: This constructor should only be called via GU_PrimitiveFactory.
73  : GEO_PrimSphere(gdp, offset)
74  {}
75 
76  /// Report approximate memory usage.
77  int64 getMemoryUsage() const override;
78 
79  /// Count memory usage using a UT_MemoryCounter in order to count
80  /// shared memory correctly.
81  /// NOTE: This should always include sizeof(*this).
82  void countMemory(UT_MemoryCounter &counter) const override;
83 
84  const GA_PrimitiveDefinition &getTypeDef() const override
85  {
86  UT_ASSERT(theDefinition);
87  return *theDefinition;
88  }
89 
90  // Conversion Methods
92  GA_PointGroup *usedpts = 0) override;
93  GEO_Primitive *convertNew(GEO_ConvertParms &parms) override;
94 
95  void normal(NormalComp &output) const override;
96 
97 
98  // NOTE: For static member functions please call in the following
99  // manner. <ptrvalue> = GU_PrimSphere::<functname>
100  // i.e. sphereptr = GU_PrimSphere::sphereBuild(params...);
101 
102  // Optional Build Method
103 
104  static GEO_Primitive *build(const GU_PrimSphereParms &parms,
106 
107  int intersectRay(const UT_Vector3 &o,
108  const UT_Vector3 &d,
109  float tmax = 1E17F, float tol = 1E-12F,
110  float *distance = 0,
111  UT_Vector3 *pos = 0,
112  UT_Vector3 *nml = 0,
113  int accurate = 0,
114  float *u = 0, float *v = 0,
115  int ignoretrim = 1) const override;
116 
117 private:
118  // Pass center attributes to converted geometry:
119  void passAttributesToPolys(const GA_Range &primrange,
120  const GA_Range &ptrange,
121  bool preserve_groups,
122  GA_ElementWranglerCache &) const;
123  void passAttributesToMesh(GEO_Primitive &dest,
124  bool preserve_groups,
125  GA_ElementWranglerCache &) const;
126 
127  static GA_PrimitiveDefinition *theDefinition;
128  friend class GU_PrimitiveFactory;
130 };
132 
133 #endif
GEO_SurfaceType type
Definition: GU_PrimSphere.h:56
#define SYS_DEPRECATED_PUSH_DISABLE()
#define SYS_DEPRECATED_POP_DISABLE()
const GLdouble * v
Definition: glew.h:1391
GU_PrimSphere(GU_Detail *gdp, GA_Offset offset=GA_INVALID_OFFSET)
NOTE: This constructor should only be called via GU_PrimitiveFactory.
Definition: GU_PrimSphere.h:72
virtual int64 getMemoryUsage() const
Definition: GA_Primitive.h:209
#define GA_INVALID_OFFSET
Definition: GA_Types.h:676
virtual void normal(NormalComp &output) const =0
A range of elements in an index-map.
Definition: GA_Range.h:42
GA_Size GA_Offset
Definition: GA_Types.h:639
const GA_PrimitiveDefinition & getTypeDef() const override
Definition: GU_PrimSphere.h:84
virtual void countMemory(UT_MemoryCounter &counter) const
GLsizei GLsizei GLfloat distance
Definition: glew.h:13640
long long int64
Definition: SYS_Types.h:116
#define GU_API
Definition: GU_API.h:14
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
static GEO_PrimSphere * build(GA_Detail &detail, GA_Offset existing_ptoff=GA_INVALID_OFFSET)
GLuint counter
Definition: glew.h:2740
virtual int intersectRay(const UT_Vector3 &o, const UT_Vector3 &d, float tmax=1E17F, float tol=1E-12F, float *distance=0, UT_Vector3 *pos=0, UT_Vector3 *nml=0, int accurate=0, float *u=0, float *v=0, int ignoretrim=1) const
~GU_PrimSphere() override
Definition: GU_PrimSphere.h:68
GEO_SurfaceType
virtual GEO_Primitive * convert(GEO_ConvertParms &parms, GA_PointGroup *usedpts=0)=0
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
Definition of a geometric primitive.
virtual GEO_Primitive * convertNew(GEO_ConvertParms &parms)=0
GLintptr offset
Definition: glew.h:1682