HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 };
59 
60 
62 {
63 protected:
64  /// NOTE: Primitives should not be deleted directly. They are managed
65  /// by the GA_PrimitiveList and the stash.
66  virtual ~GU_PrimSphere() {}
67 
68 public:
69  /// NOTE: This constructor should only be called via GU_PrimitiveFactory.
71  : GEO_PrimSphere(gdp, offset)
72  {}
73 
74  /// Report approximate memory usage.
75  virtual int64 getMemoryUsage() const;
76 
77  /// Count memory usage using a UT_MemoryCounter in order to count
78  /// shared memory correctly.
79  /// NOTE: This should always include sizeof(*this).
80  virtual void countMemory(UT_MemoryCounter &counter) const;
81 
82  virtual const GA_PrimitiveDefinition &getTypeDef() const
83  {
84  UT_ASSERT(theDefinition);
85  return *theDefinition;
86  }
87 
88  // Conversion Methods
89  virtual GEO_Primitive *convert(GEO_ConvertParms &parms,
90  GA_PointGroup *usedpts = 0);
91  virtual GEO_Primitive *convertNew(GEO_ConvertParms &parms);
92 
93  virtual void normal(NormalComp &output) const;
94 
95 
96  // NOTE: For static member functions please call in the following
97  // manner. <ptrvalue> = GU_PrimSphere::<functname>
98  // i.e. sphereptr = GU_PrimSphere::sphereBuild(params...);
99 
100  // Optional Build Method
101 
102  static GEO_Primitive *build(const GU_PrimSphereParms &parms,
104 
105  virtual int intersectRay(const UT_Vector3 &o,
106  const UT_Vector3 &d,
107  float tmax = 1E17F, float tol = 1E-12F,
108  float *distance = 0,
109  UT_Vector3 *pos = 0,
110  UT_Vector3 *nml = 0,
111  int accurate = 0,
112  float *u = 0, float *v = 0,
113  int ignoretrim = 1) const;
114 
115 private:
116  // Pass center attributes to converted geometry:
117  void passAttributesToPolys(const GA_Range &primrange,
118  const GA_Range &ptrange,
119  bool preserve_groups,
120  GA_ElementWranglerCache &) const;
121  void passAttributesToMesh(GEO_Primitive &dest,
122  bool preserve_groups,
123  GA_ElementWranglerCache &) const;
124 
125  static GA_PrimitiveDefinition *theDefinition;
126  friend class GU_PrimitiveFactory;
128 };
130 
131 #endif
GEO_SurfaceType type
Definition: GU_PrimSphere.h:56
#define SYS_DEPRECATED_PUSH_DISABLE()
const GLdouble * v
Definition: glcorearb.h:836
#define SYS_DEPRECATED_POP_DISABLE()
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:70
3D Vector class.
virtual int64 getMemoryUsage() const
Definition: GA_Primitive.h:204
virtual const GA_PrimitiveDefinition & getTypeDef() const
Definition: GU_PrimSphere.h:82
#define GA_INVALID_OFFSET
Definition: GA_Types.h:654
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:617
long long int64
Definition: SYS_Types.h:100
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:102
T distance(const UT_Vector4T< T > &v1, const UT_Vector4T< T > &v2)
Definition: UT_Vector4.h:634
virtual void countMemory(UT_MemoryCounter &counter) const
GLintptr offset
Definition: glcorearb.h:664
#define GU_API
Definition: GU_API.h:11
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
virtual ~GU_PrimSphere()
Definition: GU_PrimSphere.h:66
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
GEO_SurfaceType
virtual GEO_Primitive * convert(GEO_ConvertParms &parms, GA_PointGroup *usedpts=0)=0
Definition of a geometric primitive.
virtual GEO_Primitive * convertNew(GEO_ConvertParms &parms)=0