Blender  V2.93
image_vdb.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2020 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __IMAGE_VDB__
18 #define __IMAGE_VDB__
19 
20 #ifdef WITH_OPENVDB
21 # include <openvdb/openvdb.h>
22 #endif
23 #ifdef WITH_NANOVDB
24 # include <nanovdb/util/GridHandle.h>
25 #endif
26 
27 #include "render/image.h"
28 
30 
31 class VDBImageLoader : public ImageLoader {
32  public:
33  VDBImageLoader(const string &grid_name);
35 
36  virtual bool load_metadata(const ImageDeviceFeatures &features,
37  ImageMetaData &metadata) override;
38 
39  virtual bool load_pixels(const ImageMetaData &metadata,
40  void *pixels,
41  const size_t pixels_size,
42  const bool associate_alpha) override;
43 
44  virtual string name() const override;
45 
46  virtual bool equals(const ImageLoader &other) const override;
47 
48  virtual void cleanup() override;
49 
50  virtual bool is_vdb_loader() const override;
51 
52 #ifdef WITH_OPENVDB
53  openvdb::GridBase::ConstPtr get_grid();
54 #endif
55 
56  protected:
57  string grid_name;
58 #ifdef WITH_OPENVDB
59  openvdb::GridBase::ConstPtr grid;
60  openvdb::CoordBBox bbox;
61 #endif
62 #ifdef WITH_NANOVDB
63  nanovdb::GridHandle<> nanogrid;
64 #endif
65 };
66 
68 
69 #endif /* __IMAGE_VDB__ */
VDBImageLoader(const string &grid_name)
Definition: image_vdb.cpp:29
virtual bool equals(const ImageLoader &other) const override
Definition: image_vdb.cpp:255
string grid_name
Definition: image_vdb.h:57
virtual bool load_metadata(const ImageDeviceFeatures &features, ImageMetaData &metadata) override
Definition: image_vdb.cpp:37
virtual void cleanup() override
Definition: image_vdb.cpp:266
virtual bool is_vdb_loader() const override
Definition: image_vdb.cpp:277
virtual string name() const override
Definition: image_vdb.cpp:250
virtual bool load_pixels(const ImageMetaData &metadata, void *pixels, const size_t pixels_size, const bool associate_alpha) override
Definition: image_vdb.cpp:193
#define CCL_NAMESPACE_END