HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GEO_PrimNull.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: GEO_PrimNull.h (GEO Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GEO_PrimNull__
12 #define __GEO_PrimNull__
13 
14 #include "GEO_API.h"
15 #include "GEO_Primitive.h"
16 #include <GA/GA_Types.h>
17 #include <UT/UT_Assert.h>
18 #include <UT/UT_Vector3.h>
19 
20 class GA_Detail;
21 class GEO_ConvertParms;
22 
23 /// Null primitive is a stand-in primitive to handle loading of unknown
24 /// primitives
26 {
27 protected:
28  /// NOTE: The destructor should only be called from subclass
29  /// destructors.
30  virtual ~GEO_PrimNull() {}
31 
32 public:
33  /// NOTE: The constructor should only be called from subclass
34  /// constructors.
36  : GEO_Primitive(d, offset)
37  {}
38 
39  /// @{
40  /// Required interface for GEO
41  virtual bool isDegenerate() const { return true; }
42  virtual int getBBox(UT_BoundingBox *bbox) const;
43  virtual void reverse() {}
44  virtual UT_Vector3 computeNormal() const;
45  virtual void copyPrimitive(const GEO_Primitive *s);
46 #if !GA_PRIMITIVE_VERTEXLIST
47  virtual void copyUnwiredForMerge(
48  const GA_Primitive *src, const GA_MergeMap &map) {}
49  virtual GA_Size getVertexCount() const { return 0; }
51  {
52  UT_ASSERT(0);
53  return GA_INVALID_OFFSET;
54  }
55 #endif
56  virtual int detachPoints(GA_PointGroup &g);
57  virtual GA_DereferenceStatus dereferencePoint(GA_Offset, bool);
58  virtual GA_DereferenceStatus dereferencePoints(
59  const GA_RangeMemberQuery &, bool);
60  virtual const GA_PrimitiveJSON *getJSON() const;
61 #if !GA_PRIMITIVE_VERTEXLIST
62  virtual void swapVertexOffsets(const GA_Defragment &) {}
63 #endif
64  virtual bool evaluatePointRefMap(GA_Offset,
66  fpreal, fpreal, uint, uint) const;
67  /// @}
68 
69  /// @{
70  /// Special for factory primitives
72  { return GA_FAMILY_NONE; }
73  /// @}
74 
75  /// Report approximate memory usage.
76  virtual int64 getMemoryUsage() const
77  {
78  return sizeof(*this);
79  }
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  /// @{
87  /// Minimal interface required by GU
88  virtual const GA_PrimitiveDefinition &getTypeDef() const
89  {
90  UT_ASSERT(theDefinition);
91  return *theDefinition;
92  }
93 
95  { return NULL; }
97  { return NULL; }
98  virtual void normal(NormalComp &) const {}
99  virtual int intersectRay(const UT_Vector3 &,
100  const UT_Vector3 &,
101  float, float,
102  float *, UT_Vector3 *,
103  UT_Vector3 *, int,
104  float *, float *,
105  int) const
106  { return 0; }
107  /// @}
108 
109 private:
110  static GA_PrimitiveDefinition *theDefinition;
111  friend class GU_PrimitiveFactory;
112 };
113 
114 #endif
115 
virtual const GA_PrimitiveDefinition & getTypeDef() const
Definition: GEO_PrimNull.h:88
virtual void copyPrimitive(const GEO_Primitive *src)=0
GLboolean GLboolean g
Definition: glcorearb.h:1221
The merge map keeps track of information when merging details.
Definition: GA_MergeMap.h:53
virtual void normal(NormalComp &) const
Definition: GEO_PrimNull.h:98
virtual GA_DereferenceStatus dereferencePoint(GA_Offset point, bool dry_run=false)=0
Abstract base class for a range membership query object.
3D Vector class.
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:211
virtual GA_Size getVertexCount() const
Definition: GEO_PrimNull.h:49
GA_PrimitiveFamilyMask
virtual UT_Vector3 computeNormal() const =0
Return a normal vector for the primitive.
#define GA_INVALID_OFFSET
Definition: GA_Types.h:654
GA_Size GA_Offset
Definition: GA_Types.h:617
virtual GEO_Primitive * convert(GEO_ConvertParms &, GA_PointGroup *)
Definition: GEO_PrimNull.h:94
long long int64
Definition: SYS_Types.h:106
virtual bool isDegenerate() const
Definition: GEO_PrimNull.h:41
virtual void swapVertexOffsets(const GA_Defragment &)
Definition: GEO_PrimNull.h:62
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:102
virtual GA_Offset getVertexOffset(GA_Size) const
Definition: GEO_PrimNull.h:50
virtual void countMemory(UT_MemoryCounter &counter) const
virtual const GA_PrimitiveJSON * getJSON() const =0
GLintptr offset
Definition: glcorearb.h:664
Provide a JSON interface to a primitive.
#define GEO_API
Definition: GEO_API.h:10
virtual int64 getMemoryUsage() const
Report approximate memory usage.
Definition: GEO_PrimNull.h:76
static GA_PrimitiveFamilyMask buildFamilyMask()
Definition: GEO_PrimNull.h:71
A handle to simplify manipulation of multiple attributes.
virtual int getBBox(UT_BoundingBox *bbox) const =0
GEO_PrimNull(GA_Detail *d, GA_Offset offset=GA_INVALID_OFFSET)
Definition: GEO_PrimNull.h:35
virtual ~GEO_PrimNull()
Definition: GEO_PrimNull.h:30
Defragmentation of IndexMaps.
Definition: GA_Defragment.h:45
virtual GA_DereferenceStatus dereferencePoints(const GA_RangeMemberQuery &pt_q, bool dry_run=false)=0
unsigned int uint
Definition: SYS_Types.h:39
double fpreal
Definition: SYS_Types.h:269
virtual int detachPoints(GA_PointGroup &grp)=0
virtual int intersectRay(const UT_Vector3 &, const UT_Vector3 &, float, float, float *, UT_Vector3 *, UT_Vector3 *, int, float *, float *, int) const
Definition: GEO_PrimNull.h:99
virtual bool evaluatePointRefMap(GA_Offset result_vtx, GA_AttributeRefMap &map, fpreal u, fpreal v=0, uint du=0, uint dv=0) const =0
Container class for all geometry.
Definition: GA_Detail.h:96
virtual void copyUnwiredForMerge(const GA_Primitive *src, const GA_MergeMap &map)
Definition: GEO_PrimNull.h:47
Definition of a geometric primitive.
virtual void reverse()
Definition: GEO_PrimNull.h:43
GLenum src
Definition: glcorearb.h:1792
virtual GEO_Primitive * convertNew(GEO_ConvertParms &)
Definition: GEO_PrimNull.h:96