Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_tex_coord.cc
| /* SPDX-License-Identifier: GPL-2.0-or-later | /* SPDX-License-Identifier: GPL-2.0-or-later | ||||
| * Copyright 2005 Blender Foundation. All rights reserved. */ | * Copyright 2005 Blender Foundation. All rights reserved. */ | ||||
| #include "node_shader_util.hh" | #include "node_shader_util.hh" | ||||
| #include "NOD_geometry_exec.hh" | |||||
| #include "DNA_customdata_types.h" | #include "DNA_customdata_types.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_resources.h" | #include "UI_resources.h" | ||||
| namespace blender::nodes::node_shader_tex_coord_cc { | namespace blender::nodes::node_shader_tex_coord_cc { | ||||
| static void node_declare(NodeDeclarationBuilder &b) | static void node_declare(NodeDeclarationBuilder &b) | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | if (ELEM(i, 1, 6)) { | ||||
| &out[i].link, | &out[i].link, | ||||
| nullptr); | nullptr); | ||||
| } | } | ||||
| } | } | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| static void node_geo_exec(GeoNodeExecParams params) | |||||
| { | |||||
| if (params.output_is_required("Generated")) { | |||||
| Field<float3> field{AttributeFieldInput::Create<float3>("rest_position")}; | |||||
| params.set_output("Generated", std::move(field)); | |||||
| } | |||||
| if (params.output_is_required("Normal")) { | |||||
| Field<float3> field{std::make_shared<bke::NormalFieldInput>()}; | |||||
| params.set_output("Normal", std::move(field)); | |||||
| } | |||||
| if (params.output_is_required("UV")) { | |||||
| Field<float3> field{AttributeFieldInput::Create<float3>(".uv_active")}; | |||||
| params.set_output("UV", std::move(field)); | |||||
| } | |||||
| if (params.output_is_required("Object")) { | |||||
| Field<float3> field{AttributeFieldInput::Create<float3>("position")}; | |||||
| params.set_output("Object", std::move(field)); | |||||
| } | |||||
| /* No camera, window or view direction in texture nodes. */ | |||||
| if (params.output_is_required("Camera")) { | |||||
| params.set_output("Camera", float3(0.0f)); | |||||
| } | |||||
| if (params.output_is_required("Window")) { | |||||
| params.set_output("Window", float3(0.0f)); | |||||
| } | |||||
| if (params.output_is_required("Reflection")) { | |||||
| params.set_output("Reflection", float3(0.0f)); | |||||
| } | |||||
| } | |||||
| } // namespace blender::nodes::node_shader_tex_coord_cc | } // namespace blender::nodes::node_shader_tex_coord_cc | ||||
| /* node type definition */ | /* node type definition */ | ||||
| void register_node_type_sh_tex_coord() | void register_node_type_sh_tex_coord() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_shader_tex_coord_cc; | namespace file_ns = blender::nodes::node_shader_tex_coord_cc; | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT); | sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT); | ||||
| ntype.declare = file_ns::node_declare; | ntype.declare = file_ns::node_declare; | ||||
| ntype.draw_buttons = file_ns::node_shader_buts_tex_coord; | ntype.draw_buttons = file_ns::node_shader_buts_tex_coord; | ||||
| node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_coord); | node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_coord); | ||||
| ntype.geometry_node_execute = file_ns::node_geo_exec; | |||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||