HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CE_VDBGrid.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: CE_VDBGrid.h ( CE Library, C++)
7  *
8  * COMMENTS: Compute Engine Grid.
9  */
10 
11 #ifndef __CE_VDBGrid__
12 #define __CE_VDBGrid__
13 
14 #include "CE_API.h"
15 
16 #include <UT/UT_Array.h>
17 #include <UT/UT_NonCopyable.h>
18 #include <UT/UT_VectorTypes.h>
19 
20 #include <SYS/SYS_Types.h>
21 
22 #include <openvdb/Platform.h>
23 #include <openvdb/openvdb.h>
24 
26 {
27 public:
30  {
31  releaseBuffer();
32  releaseTileStarts();
33  };
34 
36 
37  /// Return the underlying OpenCL buffer that can be used in kernel
38  /// invocations.
39  const cl::Buffer &buffer() const { return myBuffer; }
40  exint bufferSize() const { return myBufSize; }
41 
42  const cl::Buffer &tileStarts() const { return myTileStartsBuffer; }
43  exint numTiles() const { return myTileStarts.entries(); }
44 
45  /// If the current OpenCL buffer is valid.
46  bool hasBuffer() const { return (myBuffer() != 0);}
47  bool hasTileStarts() const { return (myTileStartsBuffer() != 0); }
48 
49  /// Initialize the CE_VDBGrid from the supplied VDB grid.
50  void initFromVDB(const openvdb::GridBase &grid);
51 
52  /// Build the tile start buffer from the provided grid, this will
53  /// be one tile per dense leaf node
54  void buildTileStarts(const openvdb::GridBase &grid);
55 
56  /// Create a VDB grid from the CE VDB grid
57  openvdb::GridBase::Ptr createVDB() const;
58 
59 protected:
60 
61  void releaseBuffer();
62  void releaseTileStarts();
63 
65  exint myBufSize = -1;
66 
69 };
70 
71 #endif
72 
#define CE_API
Definition: CE_API.h:10
const cl::Buffer & tileStarts() const
Definition: CE_VDBGrid.h:42
UT_Array< UT_Vector3i > myTileStarts
Definition: CE_VDBGrid.h:67
int64 exint
Definition: SYS_Types.h:125
bool hasTileStarts() const
Definition: CE_VDBGrid.h:47
exint bufferSize() const
Definition: CE_VDBGrid.h:40
Definition: core.h:760
cl::Buffer myTileStartsBuffer
Definition: CE_VDBGrid.h:68
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
exint numTiles() const
Definition: CE_VDBGrid.h:43
cl::Buffer myBuffer
Definition: CE_VDBGrid.h:64
Memory buffer interface.
Definition: cl.hpp:1867
bool hasBuffer() const
If the current OpenCL buffer is valid.
Definition: CE_VDBGrid.h:46
#define const
Definition: zconf.h:214