Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_raycast.cc
| Show All 19 Lines | |||||
| #include "BKE_bvhutils.h" | #include "BKE_bvhutils.h" | ||||
| #include "BKE_mesh_sample.hh" | #include "BKE_mesh_sample.hh" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| #include "node_geometry_util.hh" | #include "node_geometry_util.hh" | ||||
| using namespace blender::bke::mesh_surface_sample; | namespace blender::nodes::node_geo_raycast_cc { | ||||
| namespace blender::nodes { | using namespace blender::bke::mesh_surface_sample; | ||||
| static void geo_node_raycast_declare(NodeDeclarationBuilder &b) | static void geo_node_raycast_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.add_input<decl::Geometry>(N_("Target Geometry")) | b.add_input<decl::Geometry>(N_("Target Geometry")) | ||||
| .only_realized_data() | .only_realized_data() | ||||
| .supported_type(GEO_COMPONENT_TYPE_MESH); | .supported_type(GEO_COMPONENT_TYPE_MESH); | ||||
| b.add_input<decl::Vector>(N_("Attribute")).hide_value().supports_field(); | b.add_input<decl::Vector>(N_("Attribute")).hide_value().supports_field(); | ||||
| ▲ Show 20 Lines • Show All 382 Lines • ▼ Show 20 Lines | static void geo_node_raycast_exec(GeoNodeExecParams params) | ||||
| params.set_output("Hit Position", Field<float3>(op, 1)); | params.set_output("Hit Position", Field<float3>(op, 1)); | ||||
| params.set_output("Hit Normal", Field<float3>(op, 2)); | params.set_output("Hit Normal", Field<float3>(op, 2)); | ||||
| params.set_output("Hit Distance", Field<float>(op, 3)); | params.set_output("Hit Distance", Field<float>(op, 3)); | ||||
| if (do_attribute_transfer) { | if (do_attribute_transfer) { | ||||
| output_attribute_field(params, GField(op, 4)); | output_attribute_field(params, GField(op, 4)); | ||||
| } | } | ||||
| } | } | ||||
| } // namespace blender::nodes | } // namespace blender::nodes::node_geo_raycast_cc | ||||
| void register_node_type_geo_raycast() | void register_node_type_geo_raycast() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_geo_raycast_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| geo_node_type_base(&ntype, GEO_NODE_RAYCAST, "Raycast", NODE_CLASS_GEOMETRY, 0); | geo_node_type_base(&ntype, GEO_NODE_RAYCAST, "Raycast", NODE_CLASS_GEOMETRY, 0); | ||||
| node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); | node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); | ||||
| node_type_init(&ntype, blender::nodes::geo_node_raycast_init); | node_type_init(&ntype, file_ns::geo_node_raycast_init); | ||||
| node_type_update(&ntype, blender::nodes::geo_node_raycast_update); | node_type_update(&ntype, file_ns::geo_node_raycast_update); | ||||
| node_type_storage( | node_type_storage( | ||||
| &ntype, "NodeGeometryRaycast", node_free_standard_storage, node_copy_standard_storage); | &ntype, "NodeGeometryRaycast", node_free_standard_storage, node_copy_standard_storage); | ||||
| ntype.declare = blender::nodes::geo_node_raycast_declare; | ntype.declare = file_ns::geo_node_raycast_declare; | ||||
| ntype.geometry_node_execute = blender::nodes::geo_node_raycast_exec; | ntype.geometry_node_execute = file_ns::geo_node_raycast_exec; | ||||
| ntype.draw_buttons = blender::nodes::geo_node_raycast_layout; | ntype.draw_buttons = file_ns::geo_node_raycast_layout; | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||