diff options
author | Hans Goudey <h.goudey@me.com> | 2022-04-28 00:40:30 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-04-28 00:40:30 +0300 |
commit | b60f3fe6ada2904c93383d8f5160b750423725ea (patch) | |
tree | 3c8b75a516e22d9b28f3eed7c92357cc18119d98 /source/blender/nodes/geometry | |
parent | bfb4dcaa1a7ec5bfd2b25cf7aa5b6173d6c53358 (diff) |
Cleanup: Remove disabled optimization code
Addressing the TODO from the comment isn't a priority at the moment,
and should be solved a bit more generally anyway.
Diffstat (limited to 'source/blender/nodes/geometry')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc index 877dc05211d..09d0f13c50d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_convex_hull.cc @@ -209,69 +209,6 @@ static Mesh *compute_hull(const GeometrySet &geometry_set) return hull_from_bullet(geometry_set.get_mesh_for_read(), positions); } -/* Since only positions are read from the instances, this can be used as an internal optimization - * to avoid the cost of realizing instances before the node. But disable this for now, since - * re-enabling that optimization will be a separate step. */ -# if 0 -static void read_positions(const GeometryComponent &component, - Span<float4x4> transforms, - Vector<float3> *r_coords) -{ - VArray<float3> positions = component.attribute_get_for_read<float3>( - "position", ATTR_DOMAIN_POINT, {0, 0, 0}); - - /* NOTE: could use convex hull operation here to - * cut out some vertices, before accumulating, - * but can also be done by the user beforehand. */ - - r_coords->reserve(r_coords->size() + positions->size() * transforms.size()); - for (const float4x4 &transform : transforms) { - for (const int i : positions->index_range()) { - const float3 position = positions[i]; - const float3 transformed_position = transform * position; - r_coords->append(transformed_position); - } - } -} - -static void read_curve_positions(const Curves &curves_id, - Span<float4x4> transforms, - Vector<float3> *r_coords) -{ - const bke::CurvesGeometry &curves = bke::CurvesGeometry::wrap(curves_id.geometry); - const int total_size = curves.evaluated_points_num(); - r_coords->reserve(r_coords->size() + total_size * transforms.size()); - r_coords->as_mutable_span().take_back(total_size).copy_from(curves.evaluated_positions()); - for (const float3 &position : curves.evaluated_positions()) { - r_coords->append(transform * position); - } -} - -static Mesh *convex_hull_from_instances(const GeometrySet &geometry_set) -{ - Vector<GeometryInstanceGroup> set_groups; - bke::geometry_set_gather_instances(geometry_set, set_groups); - - Vector<float3> coords; - - for (const GeometryInstanceGroup &set_group : set_groups) { - const GeometrySet &set = set_group.geometry_set; - Span<float4x4> transforms = set_group.transforms; - - if (set.has_pointcloud()) { - read_positions(*set.get_component_for_read<PointCloudComponent>(), transforms, &coords); - } - if (set.has_mesh()) { - read_positions(*set.get_component_for_read<MeshComponent>(), transforms, &coords); - } - if (set.has_curves()) { - read_curve_positions(*set.get_curves_for_read(), transforms, &coords); - } - } - return hull_from_bullet(nullptr, coords); -} -# endif - #endif /* WITH_BULLET */ static void node_geo_exec(GeoNodeExecParams params) |