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  void normal(NormalCompD &output) const override {}
97 
98 
99  // NOTE: For static member functions please call in the following
100  // manner. <ptrvalue> = GU_PrimSphere::<functname>
101  // i.e. sphereptr = GU_PrimSphere::sphereBuild(params...);
102 
103  // Optional Build Method
104 
105  static GEO_Primitive *build(const GU_PrimSphereParms &parms,
107 
108  int intersectRay(const UT_Vector3 &o,
109  const UT_Vector3 &d,
110  float tmax = 1E17F, float tol = 1E-12F,
111  float *distance = 0,
112  UT_Vector3 *pos = 0,
113  UT_Vector3 *nml = 0,
114  int accurate = 0,
115  float *u = 0, float *v = 0,
116  int ignoretrim = 1) const override;
117 
118 private:
119  // Pass center attributes to converted geometry:
120  void passAttributesToPolys(const GA_Range &primrange,
121  const GA_Range &ptrange,
122  bool preserve_groups,
123  GA_ElementWranglerCache &) const;
124  void passAttributesToMesh(GEO_Primitive &dest,
125  bool preserve_groups,
126  GA_ElementWranglerCache &) const;
127 
128  static GA_PrimitiveDefinition *theDefinition;
129  friend class GU_PrimitiveFactory;
131 };
133 
134 #endif
GEO_SurfaceType type
Definition: GU_PrimSphere.h:56
const GLdouble * v
Definition: glcorearb.h:837
#define SYS_DEPRECATED_PUSH_DISABLE()
#define SYS_DEPRECATED_POP_DISABLE()
void normal(NormalComp &output) const override
Definition: GU_PrimSphere.h:95
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:687
A range of elements in an index-map.
Definition: GA_Range.h:42
GA_Size GA_Offset
Definition: GA_Types.h:646
GLintptr offset
Definition: glcorearb.h:665
const GA_PrimitiveDefinition & getTypeDef() const override
Definition: GU_PrimSphere.h:84
virtual void countMemory(UT_MemoryCounter &counter) const
long long int64
Definition: SYS_Types.h:116
#define GU_API
Definition: GU_API.h:14
static GEO_PrimSphere * build(GA_Detail &detail, GA_Offset existing_ptoff=GA_INVALID_OFFSET)
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
void normal(NormalCompD &output) const override
Definition: GU_PrimSphere.h:96
GEO_SurfaceType
virtual GEO_Primitive * convert(GEO_ConvertParms &parms, GA_PointGroup *usedpts=0)=0
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
Definition of a geometric primitive.
SIM_API const UT_StringHolder distance
type
Definition: core.h:1059
virtual GEO_Primitive * convertNew(GEO_ConvertParms &parms)=0