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 #include "GU_Types.h"
21 
22 class GEO_ConvertParms;
23 class GEO_Hull;
24 class GEO_Detail;
25 class GEO_TriMesh;
26 class GU_PrimMesh;
27 class GU_PrimNURBSurf;
28 class GU_PrimRBezSurf;
29 class GU_CapOptions;
31 class UT_MemoryCounter;
32 
33 /////////////////////////////////////////////////////////////
34 // //
35 // Class: GU_PrimTube //
36 // Descr: This class is responsible for operations //
37 // done on tube primitives. As we need to access //
38 // the GEO_Detail, the pointer is passed in the //
39 // constructor. The second constructor creates a //
40 // tube with the given parameters. //
41 // //
42 /////////////////////////////////////////////////////////////
43 
45 {
46 public:
48 
49 //
50 // Build a transform matrix for a tube given two points in space. The
51 // transform will create a tube connecting the two points.
52  void buildXform(const UT_Vector3 &p0, const UT_Vector3 &p1,
53  float radius);
54 
58  int rows, cols;
59  int orderu;
60  int orderv;
61  int imperfect;
62  float taper;
64  float botrad;
65  float height;
66  bool poly;
67 };
68 
70 {
71 protected:
72  /// NOTE: Primitives should not be deleted directly. They are managed
73  /// by the GA_PrimitiveList and the stash.
74  ~GU_PrimTube() override {}
75 
76 public:
77  /// NOTE: This constructor should only be called via GU_PrimitiveFactory.
79  : GEO_PrimTube(gdp, offset)
80  {}
81 
82  /// Report approximate memory usage.
83  int64 getMemoryUsage() const override;
84 
85  /// Count memory usage using a UT_MemoryCounter in order to count
86  /// shared memory correctly.
87  /// NOTE: This should always include sizeof(*this).
88  void countMemory(UT_MemoryCounter &counter) const override;
89 
90  const GA_PrimitiveDefinition &getTypeDef() const override
91  {
92  UT_ASSERT(theDefinition);
93  return *theDefinition;
94  }
95 
96  // Conversion Methods
98  GA_PointGroup *usedpts = 0) override;
99  GEO_Primitive *convertNew(GEO_ConvertParms &parms) override;
100 
101  void normal(NormalComp &ouput) const override {}
102  void normal(NormalCompD &ouput) const override {}
103 
104  int intersectRay(const UT_Vector3 &o, const UT_Vector3 &d,
105  float tmax = 1E17F, float tol = 1E-12F,
106  float *distance = 0, UT_Vector3 *pos = 0,
107  UT_Vector3 *nml = 0, int accurate = 0,
108  float *u = 0, float *v = 0,
109  int ignoretrim = 1) const override;
110 
111  static GEO_Primitive *build(const GU_PrimTubeParms &parms,
112  const GU_CapOptions &caps,
114 
115 private:
116  // Pass base attributes to converted geometry:
117  void passAttributesToFaces(const GA_Range &primrange,
118  const GA_Range &ptrange,
119  bool preserve_groups,
120  GA_ElementWranglerCache &) const;
121 
122  void passAttributesToMesh(GEO_Primitive &dest,
123  bool preserve_groups,
124  GA_ElementWranglerCache &) const;
125 
126  static GA_PrimitiveDefinition *theDefinition;
127  friend class GU_PrimitiveFactory;
129 };
131 
132 #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:78
GEO_Detail * gdp
Definition: GU_PrimTube.h:55
const GLdouble * v
Definition: glcorearb.h:837
#define SYS_DEPRECATED_PUSH_DISABLE()
#define SYS_DEPRECATED_POP_DISABLE()
virtual int64 getMemoryUsage() const
Definition: GA_Primitive.h:209
void normal(NormalComp &ouput) const override
Definition: GU_PrimTube.h:101
void normal(NormalCompD &ouput) const override
Definition: GU_PrimTube.h:102
#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
GEO_SurfaceType type
Definition: GU_PrimTube.h:63
virtual void countMemory(UT_MemoryCounter &counter) const
const GA_PrimitiveDefinition & getTypeDef() const override
Definition: GU_PrimTube.h:90
long long int64
Definition: SYS_Types.h:116
UT_Matrix4 xform
Definition: GU_PrimTube.h:57
#define GU_API
Definition: GU_API.h:14
~GU_PrimTube() override
Definition: GU_PrimTube.h:74
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:56
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
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