Files
test2/intern/cycles/scene/image_vdb.h
Brecht Van Lommel d0c2e68e5f Refactor: Cycles: Automated clang-tidy fixups in Cycles
* Use .empty() and .data()
* Use nullptr instead of 0
* No else after return
* Simple class member initialization
* Add override for virtual methods
* Include C++ instead of C headers
* Remove some unused includes
* Use default constructors
* Always use braces
* Consistent names in definition and declaration
* Change typedef to using

Pull Request: https://projects.blender.org/blender/blender/pulls/132361
2025-01-03 10:22:55 +01:00

64 lines
1.4 KiB
C++

/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
*
* SPDX-License-Identifier: Apache-2.0 */
#pragma once
#ifdef WITH_OPENVDB
# include <openvdb/openvdb.h>
#endif
#ifdef WITH_NANOVDB
# include <nanovdb/NanoVDB.h>
# if NANOVDB_MAJOR_VERSION_NUMBER > 32 || \
(NANOVDB_MAJOR_VERSION_NUMBER == 32 && NANOVDB_MINOR_VERSION_NUMBER >= 7)
# include <nanovdb/GridHandle.h>
# else
# include <nanovdb/util/GridHandle.h>
# endif
#endif
#include "scene/image.h"
CCL_NAMESPACE_BEGIN
class VDBImageLoader : public ImageLoader {
public:
#ifdef WITH_OPENVDB
VDBImageLoader(openvdb::GridBase::ConstPtr grid_, const string &grid_name);
#endif
VDBImageLoader(const string &grid_name);
~VDBImageLoader() override;
bool load_metadata(const ImageDeviceFeatures &features, ImageMetaData &metadata) override;
bool load_pixels(const ImageMetaData &metadata,
void *pixels,
const size_t pixels_size,
const bool associate_alpha) override;
string name() const override;
bool equals(const ImageLoader &other) const override;
void cleanup() override;
bool is_vdb_loader() const override;
#ifdef WITH_OPENVDB
openvdb::GridBase::ConstPtr get_grid();
#endif
protected:
string grid_name;
#ifdef WITH_OPENVDB
openvdb::GridBase::ConstPtr grid;
openvdb::CoordBBox bbox;
#endif
#ifdef WITH_NANOVDB
nanovdb::GridHandle<> nanogrid;
int precision = 0;
#endif
};
CCL_NAMESPACE_END