diff options
author | Jacques Lucke <jacques@blender.org> | 2020-10-20 12:00:16 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-10-20 12:00:16 +0300 |
commit | 63a9f24b55d0b5d84d625bdbb44d498fb1f2ae01 (patch) | |
tree | 217fa45ec9b0c66f856dd8b32d8ab3d5cbc18d3d /source/blender/blenkernel/BKE_volume.h | |
parent | f3ecb4c91e159caff2e6d335adb1ccf06423c90f (diff) |
Volumes: simplify volumes in modifiers or on load
This changes how the simplify volumes setting works. Before, it only
affeted viewport rendering. This was an issue, because all internal
computations would still have to happen on the high resolution volumes.
With this patch, the simplify setting already affects file loading and
procedural generation of volumes.
Rendering does not have to care about the simplify option anymore,
it just gets the correct simplified version from the depsgraph.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D9176
Diffstat (limited to 'source/blender/blenkernel/BKE_volume.h')
-rw-r--r-- | source/blender/blenkernel/BKE_volume.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_volume.h b/source/blender/blenkernel/BKE_volume.h index 2a272d06986..12c37ec56e0 100644 --- a/source/blender/blenkernel/BKE_volume.h +++ b/source/blender/blenkernel/BKE_volume.h @@ -140,6 +140,10 @@ struct VolumeGrid *BKE_volume_grid_add(struct Volume *volume, VolumeGridType type); void BKE_volume_grid_remove(struct Volume *volume, struct VolumeGrid *grid); +/* Simplify */ +int BKE_volume_simplify_level(const struct Depsgraph *depsgraph); +float BKE_volume_simplify_factor(const struct Depsgraph *depsgraph); + /* File Save */ bool BKE_volume_save(struct Volume *volume, struct Main *bmain, @@ -166,16 +170,7 @@ openvdb::GridBase::Ptr BKE_volume_grid_openvdb_for_write(const struct Volume *vo struct VolumeGrid *grid, const bool clear); -template<typename GridType> -typename GridType::Ptr BKE_volume_grid_openvdb_for_write(const struct Volume *volume, - struct VolumeGrid *grid, - const bool clear) -{ - openvdb::GridBase::Ptr openvdb_grid = BKE_volume_grid_openvdb_for_write(volume, grid, clear); - BLI_assert(openvdb_grid->isType<GridType>()); - typename GridType::Ptr typed_openvdb_grid = openvdb::gridPtrCast<GridType>(openvdb_grid); - return typed_openvdb_grid; -} +VolumeGridType BKE_volume_grid_type_openvdb(const openvdb::GridBase::Ptr &grid); template<typename OpType> auto BKE_volume_grid_type_operation(const VolumeGridType grid_type, OpType &&op) @@ -212,4 +207,9 @@ auto BKE_volume_grid_type_operation(const VolumeGridType grid_type, OpType &&op) return op.template operator()<openvdb::FloatGrid>(); } +openvdb::GridBase::Ptr BKE_volume_grid_create_with_changed_resolution( + const VolumeGridType grid_type, + const openvdb::GridBase &old_grid, + const float resolution_factor); + #endif |