Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-06-29 20:28:08 +0300
committerHans Goudey <h.goudey@me.com>2022-06-29 20:28:08 +0300
commit0ea282f7462070041b2599389ba61c7ef50426b5 (patch)
tree0c7468364f5c34d3bea3379f261717b3673503ac /source/blender/modifiers/intern
parent4593fb52cf809de29bffa8f18af9a9a792def30d (diff)
Geometry Nodes: Only calculate mesh to volume bounds when necessary
In "size" voxel resolution mode, calculating the bounds of the mesh to volume node's input mesh isn't necessary. For high poly this can take a few milliseconds, so this commit skips the calculation unless we need it for the "Amount" mode. Differential Revision: https://developer.blender.org/D15324
Diffstat (limited to 'source/blender/modifiers/intern')
-rw-r--r--source/blender/modifiers/intern/MOD_mesh_to_volume.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
index a0ebc9cfdcb..01c1875a760 100644
--- a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
+++ b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc
@@ -133,7 +133,6 @@ static Volume *mesh_to_volume(ModifierData *md,
const float4x4 mesh_to_own_object_space_transform = float4x4(ctx->object->imat) *
float4x4(object_to_convert->obmat);
- const BoundBox *bb = BKE_object_boundbox_get(mvmd->object);
geometry::MeshToVolumeResolution resolution;
resolution.mode = (MeshToVolumeModifierResolutionMode)mvmd->resolution_mode;
if (resolution.mode == MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT) {
@@ -149,9 +148,14 @@ static Volume *mesh_to_volume(ModifierData *md,
}
}
+ auto bounds_fn = [&](float3 &r_min, float3 &r_max) {
+ const BoundBox *bb = BKE_object_boundbox_get(mvmd->object);
+ r_min = bb->vec[0];
+ r_max = bb->vec[6];
+ };
+
const float voxel_size = geometry::volume_compute_voxel_size(ctx->depsgraph,
- bb->vec[0],
- bb->vec[6],
+ bounds_fn,
resolution,
mvmd->exterior_band_width,
mesh_to_own_object_space_transform);