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:
authorLukas Tönne <lukas.toenne@gmail.com>2021-06-15 20:01:15 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2021-06-15 20:01:15 +0300
commit3f55f3c20720e67ed691a8e13e50cfb18b6ca261 (patch)
tree3efe520066ae43ea93061ea1da2b8e969ed895ee
parent65ebb5ce84f256bf1e82724696853ddad2cb5021 (diff)
Support mesh, point cloud, and curve geometry.
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_raycast.cc38
1 files changed, 15 insertions, 23 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc
index 72b5725b71f..5e2513068a1 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc
@@ -328,29 +328,21 @@ static void geo_node_raycast_exec(GeoNodeExecParams params)
geometry_set = bke::geometry_set_realize_instances(geometry_set);
cast_geometry_set = bke::geometry_set_realize_instances(cast_geometry_set);
- if (geometry_set.has<MeshComponent>()) {
- raycast_from_points(params,
- cast_geometry_set,
- geometry_set.get_component_for_write<MeshComponent>(),
- hit_name,
- hit_index_name,
- hit_position_name,
- hit_normal_name,
- hit_distance_name,
- hit_attribute_names,
- hit_attribute_output_names);
- }
- if (geometry_set.has<PointCloudComponent>()) {
- raycast_from_points(params,
- cast_geometry_set,
- geometry_set.get_component_for_write<MeshComponent>(),
- hit_name,
- hit_index_name,
- hit_position_name,
- hit_normal_name,
- hit_distance_name,
- hit_attribute_names,
- hit_attribute_output_names);
+ static const Array<GeometryComponentType> SupportedTypes = {
+ GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_POINT_CLOUD, GEO_COMPONENT_TYPE_CURVE};
+ for (GeometryComponentType geo_type : SupportedTypes) {
+ if (geometry_set.has(geo_type)) {
+ raycast_from_points(params,
+ cast_geometry_set,
+ geometry_set.get_component_for_write(geo_type),
+ hit_name,
+ hit_index_name,
+ hit_position_name,
+ hit_normal_name,
+ hit_distance_name,
+ hit_attribute_names,
+ hit_attribute_output_names);
+ }
}
params.set_output("Geometry", geometry_set);