diff options
author | Hans Goudey <h.goudey@me.com> | 2021-04-08 21:28:35 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-04-08 21:28:35 +0300 |
commit | 0e2a1ef13223925a874d6dbb139e0ce9f4eecab5 (patch) | |
tree | abfe1aa3ae40c424e9b5ee6291adf1c81dde39f2 /source/blender/blenkernel/BKE_volume.h | |
parent | 223093ed17e23948399070689b3d5ad9ce964746 (diff) |
BKE: Add a utility to transform a shallow copy of a volume grid
Often you need to apply a transformation to a grid without changing the
original, and it's necessary to avoid a deep copy of the actual data.
OpenVDB has a function to do this, this commit simply adds a wrapper
to transform and use that function with blender's `float4x4` data type.
Split from D10906
Diffstat (limited to 'source/blender/blenkernel/BKE_volume.h')
-rw-r--r-- | source/blender/blenkernel/BKE_volume.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_volume.h b/source/blender/blenkernel/BKE_volume.h index 2b17cf26e0e..5d32dd3e91e 100644 --- a/source/blender/blenkernel/BKE_volume.h +++ b/source/blender/blenkernel/BKE_volume.h @@ -160,9 +160,15 @@ bool BKE_volume_save(const struct Volume *volume, * Access to OpenVDB grid for C++. These will automatically load grids from * file or copy shared grids to make them writeable. */ -#if defined(__cplusplus) && defined(WITH_OPENVDB) -# include <openvdb/openvdb.h> -# include <openvdb/points/PointDataGrid.h> +#ifdef __cplusplus +# include "BLI_float4x4.hh" + +# ifdef WITH_OPENVDB +# include <openvdb/openvdb.h> +# include <openvdb/points/PointDataGrid.h> + +openvdb::GridBase::ConstPtr BKE_volume_grid_shallow_transform(openvdb::GridBase::ConstPtr grid, + const blender::float4x4 &transform); openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_metadata(const struct VolumeGrid *grid); openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_read(const struct Volume *volume, @@ -213,4 +219,5 @@ openvdb::GridBase::Ptr BKE_volume_grid_create_with_changed_resolution( const openvdb::GridBase &old_grid, const float resolution_factor); +# endif #endif |