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 <openvdb/Platform.h>
17 #include <openvdb/openvdb.h>
18 
20 {
21 public:
23  ~CE_VDBGrid() { releaseBuffer(); };
24 
25  /// Return the underlying OpenCL buffer that can be used in kernel
26  /// invocations.
27  const cl::Buffer &buffer() const { return myBuffer; }
28 
29  /// If the current OpenCL buffer is valid.
30  bool hasBuffer() const {return (myBuffer() != 0);}
31 
32  /// Initialize the CE_Grid from the supplied UT_VoxelArray. Note that
33  /// in the case that UT_VoxelArray::isConstant(), this will be very fast
34  /// and avoid allocating any actual GPU memory.
35  void initFromVDB(const openvdb::GridBase &grid);
36 
37 protected:
38 
39  void releaseBuffer();
40 
42 };
43 
44 #endif
45 
#define CE_API
Definition: CE_API.h:10
const cl::Buffer & buffer() const
Definition: CE_VDBGrid.h:27
cl::Buffer myBuffer
Definition: CE_VDBGrid.h:41
Memory buffer interface.
Definition: cl.hpp:1865
bool hasBuffer() const
If the current OpenCL buffer is valid.
Definition: CE_VDBGrid.h:30