HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_PrimVDB.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: GT_PrimVDB.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef GT_PrimVDB_h
12 #define GT_PrimVDB_h
13 
14 #include "GT_API.h"
15 #include "GT_DataArray.h"
16 #include "GT_Primitive.h"
17 #include "GT_GEOPrimCollect.h"
18 #include <GEO/GEO_PrimVDB.h>
19 #include <UT/UT_VectorTypes.h>
20 #include <SYS/SYS_Inline.h>
21 
22 #include <openvdb/Grid.h>
23 
24 
26 {
27 public:
28  GT_PrimVDB(const GU_ConstDetailHandle &gdh, const GEO_Primitive *prim);
29  virtual ~GT_PrimVDB();
30 
31  virtual int getPrimitiveType() const { return GT_PRIM_VDB_VOLUME; }
32 
33  virtual const char *className() const { return "GT_PrimVDB"; }
34 
35  bool isLevelSet() const { return myLevelSetFlag; }
36  bool isVolume() const { return myVolumeFlag; }
37  bool isInvisible() const { return myIsInvisible; }
38 
39  // Compute list of voxel coords with corresponding leaf node edge masks.
40  // Returns coords.entries().
41  exint getLeafCoords(
43  UT_Int16Array &masks) const;
44 
45  /// Returns a GT_PrimPointMesh with 1 point containing the VDB's 1 point.
46  /// Contains all of the VDBs attributes as point or uniform attributes.
47  GT_PrimitiveHandle getPointPrimitive() const;
48 
49  GEO_PrimVolumeXform getVolumeTransform() const;
50  GEO_PrimVolumeXform getVolumeIndexTransform() const;
51 
52  UT_Vector3I getRes() const;
53 
54  /// Viewport refinement options -- changes on LOD
55  virtual const GT_ViewportRefineOptions &viewportRefineOptions() const;
56 
57  virtual bool refine(GT_Refine &refiner,
58  const GT_RefineParms *parms=NULL) const;
59 
60  virtual void enlargeBounds(UT_BoundingBox boxes[],
61  int nsegments) const;
62  virtual int getMotionSegments() const { return 1; }
63  virtual int64 getMemoryUsage() const { return sizeof(GEO_Primitive *);}
65  { return new GT_PrimVDB(*this); }
66 
67  virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl,
68  const GT_RefineParms &refine);
69 
70  GA_Offset getPrimitiveOffset() const { return myPrimID; }
71  GA_Offset getPointOffset() const { return myPointID; }
72  UT_Vector3F getPrimColor() const { return myPrimColor; }
73 
74  GT_TransformHandle getGridTransform();
75 
76  /// Set the list of uniform attributes.
78  {
79  myUniformList = uniform;
80  }
81 
83  { return myUniformList; }
84 
86  const openvdb::GridBase * getGrid() { return &myVDB->getGrid(); }
87 
88  const GEO_PrimVDB *getGeoPrimitive() const { return myVDB; }
89 
90 private:
91  const GEO_PrimVDB * myVDB;
92 
93  GU_ConstDetailHandle myDetail;
94  GT_AttributeListHandle myUniformList;
95  GA_Offset myPrimID;
96  GA_Offset myPointID;
97  UT_Vector3F myPrimColor;
98  bool myVolumeFlag;
99  bool myLevelSetFlag;
100  bool myIsInvisible;
101 };
102 
103 /// Trivial collector class for VDBs - 1 GT_PrimVDB per VDB primitive
105 {
106 public:
109 
111  const GEO_Primitive *const* prim_list,
112  int,
113  GT_GEOPrimCollectData *) const
114  {
115  GT_PrimitiveHandle vdbh;
116  vdbh = new GT_PrimVDB(g->getGeometry(0), prim_list[0]);
117  return vdbh;
118  }
119 };
120 
121 #endif
virtual bool updateGeoPrim(const GU_ConstDetailHandle &dtl, const GT_RefineParms &parms)
update any cached data for geometry and its attributes
virtual bool refine(GT_Refine &refiner, const GT_RefineParms *parms=NULL) const
virtual const GT_ViewportRefineOptions & viewportRefineOptions() const
GLenum GLuint coords
Definition: glew.h:7906
#define GT_API
Definition: GT_API.h:11
virtual const char * className() const
Definition: GT_PrimVDB.h:33
Collection data container.
GA_Size GA_Offset
Definition: GA_Types.h:637
long long int64
Definition: SYS_Types.h:111
Trivial collector class for VDBs - 1 GT_PrimVDB per VDB primitive.
Definition: GT_PrimVDB.h:104
int64 exint
Definition: SYS_Types.h:120
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
SYS_FORCE_INLINE const openvdb::GridBase * getGrid()
Definition: GT_PrimVDB.h:86
UT_Vector3F getPrimColor() const
Definition: GT_PrimVDB.h:72
The base class for all GT primitive types.
Definition: GT_Primitive.h:43
bool isInvisible() const
Definition: GT_PrimVDB.h:37
virtual int64 getMemoryUsage() const
Definition: GT_PrimVDB.h:63
const GEO_PrimVDB * getGeoPrimitive() const
Definition: GT_PrimVDB.h:88
virtual GT_PrimitiveHandle collect(const GT_GEODetailListHandle &g, const GEO_Primitive *const *prim_list, int, GT_GEOPrimCollectData *) const
Definition: GT_PrimVDB.h:110
Processes primitives generated by refinement process.
Definition: GT_Refine.h:20
virtual const GT_AttributeListHandle & getUniformAttributes() const
Definition: GT_PrimVDB.h:82
void setUniformAttributes(const GT_AttributeListHandle &uniform)
Set the list of uniform attributes.
Definition: GT_PrimVDB.h:77
bool isVolume() const
Definition: GT_PrimVDB.h:36
GA_Offset getPointOffset() const
Definition: GT_PrimVDB.h:71
virtual int getPrimitiveType() const
Definition: GT_PrimVDB.h:31
UT_SharedPtr< GT_GEODetailList > GT_GEODetailListHandle
GA_Offset getPrimitiveOffset() const
Definition: GT_PrimVDB.h:70
virtual ~GT_GEOPrimCollectVDB()
Definition: GT_PrimVDB.h:108
bool isLevelSet() const
Definition: GT_PrimVDB.h:35
virtual void enlargeBounds(UT_BoundingBox boxes[], int nsegments) const =0
virtual GT_PrimitiveHandle doSoftCopy() const
Definition: GT_PrimVDB.h:64
virtual int getMotionSegments() const
Definition: GT_PrimVDB.h:62
GLboolean GLboolean g
Definition: glew.h:9477