HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_PrimTube.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_PrimTube.h (C++)
7  *
8  * COMMENTS:
9  * Header file for GU_PrimTube.h class...
10  *
11  */
12 
13 #ifndef __GU_PrimTube_h__
14 #define __GU_PrimTube_h__
15 
16 #include "GU_API.h"
17 #include <GEO/GEO_PrimTube.h>
18 #include <GEO/GEO_SurfaceType.h>
19 #include "GU_Cap.h"
20 
21 class GEO_ConvertParms;
22 class GEO_Hull;
23 class GEO_Detail;
24 class GEO_TriMesh;
25 class GU_PrimMesh;
26 class GU_PrimNURBSurf;
27 class GU_PrimRBezSurf;
28 class GU_CapOptions;
30 class UT_MemoryCounter;
31 
32 /////////////////////////////////////////////////////////////
33 // //
34 // Class: GU_PrimTube //
35 // Descr: This class is responsible for operations //
36 // done on tube primitives. As we need to access //
37 // the GEO_Detail, the pointer is passed in the //
38 // constructor. The second constructor creates a //
39 // tube with the given parameters. //
40 // //
41 /////////////////////////////////////////////////////////////
42 
44 {
45 public:
47 
48 //
49 // Build a transform matrix for a tube given two points in space. The
50 // transform will create a tube connecting the two points.
51  void buildXform(const UT_Vector3 &p0, const UT_Vector3 &p1,
52  float radius);
53 
57  int rows, cols;
58  int orderu;
59  int orderv;
60  int imperfect;
61  float taper;
63 };
64 
66 {
67 protected:
68  /// NOTE: Primitives should not be deleted directly. They are managed
69  /// by the GA_PrimitiveList and the stash.
70  virtual ~GU_PrimTube() {}
71 
72 public:
73  /// NOTE: This constructor should only be called via GU_PrimitiveFactory.
75  : GEO_PrimTube(gdp, offset)
76  {}
77 
78  /// Report approximate memory usage.
79  virtual int64 getMemoryUsage() const;
80 
81  /// Count memory usage using a UT_MemoryCounter in order to count
82  /// shared memory correctly.
83  /// NOTE: This should always include sizeof(*this).
84  virtual void countMemory(UT_MemoryCounter &counter) const;
85 
86  virtual const GA_PrimitiveDefinition &getTypeDef() const
87  {
88  UT_ASSERT(theDefinition);
89  return *theDefinition;
90  }
91 
92  // Conversion Methods
93  virtual GEO_Primitive *convert(GEO_ConvertParms &parms,
94  GA_PointGroup *usedpts = 0);
95  virtual GEO_Primitive *convertNew(GEO_ConvertParms &parms);
96 
97  virtual void normal(NormalComp &ouput) const;
98  virtual int intersectRay(const UT_Vector3 &o, const UT_Vector3 &d,
99  float tmax = 1E17F, float tol = 1E-12F,
100  float *distance = 0, UT_Vector3 *pos = 0,
101  UT_Vector3 *nml = 0, int accurate = 0,
102  float *u = 0, float *v = 0,
103  int ignoretrim = 1) const;
104 
105  static GEO_Primitive *build(const GU_PrimTubeParms &parms,
106  const GU_CapOptions &caps,
108 
109 private:
110  // Pass base attributes to converted geometry:
111  void passAttributesToFaces(const GA_Range &primrange,
112  const GA_Range &ptrange,
113  bool preserve_groups,
114  GA_ElementWranglerCache &) const;
115 
116  void passAttributesToMesh(GEO_Primitive &dest,
117  bool preserve_groups,
118  GA_ElementWranglerCache &) const;
119 
120  static GA_PrimitiveDefinition *theDefinition;
121  friend class GU_PrimitiveFactory;
123 };
125 
126 #endif
GU_PrimTube(GEO_Detail *gdp, GA_Offset offset=GA_INVALID_OFFSET)
NOTE: This constructor should only be called via GU_PrimitiveFactory.
Definition: GU_PrimTube.h:74
GEO_Detail * gdp
Definition: GU_PrimTube.h:54
#define SYS_DEPRECATED_PUSH_DISABLE()
const GLdouble * v
Definition: glcorearb.h:836
#define SYS_DEPRECATED_POP_DISABLE()
virtual ~GU_PrimTube()
Definition: GU_PrimTube.h:70
virtual int64 getMemoryUsage() const
Definition: GA_Primitive.h:201
#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:107
GEO_SurfaceType type
Definition: GU_PrimTube.h:62
T distance(const UT_Vector4T< T > &v1, const UT_Vector4T< T > &v2)
Definition: UT_Vector4.h:698
virtual void countMemory(UT_MemoryCounter &counter) const
virtual const GA_PrimitiveDefinition & getTypeDef() const
Definition: GU_PrimTube.h:86
GLintptr offset
Definition: glcorearb.h:664
UT_Matrix4 xform
Definition: GU_PrimTube.h:56
#define GU_API
Definition: GU_API.h:12
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
GA_Offset ptoff
Definition: GU_PrimTube.h:55
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
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:126
Definition of a geometric primitive.
static GEO_Quadric * build(GA_Detail &detail, GA_PrimitiveTypeId type, GA_Offset existing_ptoff=GA_INVALID_OFFSET)
virtual GEO_Primitive * convertNew(GEO_ConvertParms &parms)=0