Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_sepcombRGB.cc
| Show All 17 Lines | |||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup shdnodes | * \ingroup shdnodes | ||||
| */ | */ | ||||
| #include "node_shader_util.hh" | #include "node_shader_util.hh" | ||||
| namespace blender::nodes { | namespace blender::nodes::node_shader_sepcombRGB_cc { | ||||
| static void sh_node_seprgb_declare(NodeDeclarationBuilder &b) | static void sh_node_seprgb_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.is_function_node(); | b.is_function_node(); | ||||
| b.add_input<decl::Color>(N_("Image")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); | b.add_input<decl::Color>(N_("Image")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); | ||||
| b.add_output<decl::Float>(N_("R")); | b.add_output<decl::Float>(N_("R")); | ||||
| b.add_output<decl::Float>(N_("G")); | b.add_output<decl::Float>(N_("G")); | ||||
| b.add_output<decl::Float>(N_("B")); | b.add_output<decl::Float>(N_("B")); | ||||
| }; | }; | ||||
| } // namespace blender::nodes | |||||
| static void node_shader_exec_seprgb(void *UNUSED(data), | static void node_shader_exec_seprgb(void *UNUSED(data), | ||||
| int UNUSED(thread), | int UNUSED(thread), | ||||
| bNode *UNUSED(node), | bNode *UNUSED(node), | ||||
| bNodeExecData *UNUSED(execdata), | bNodeExecData *UNUSED(execdata), | ||||
| bNodeStack **in, | bNodeStack **in, | ||||
| bNodeStack **out) | bNodeStack **out) | ||||
| { | { | ||||
| float col[3]; | float col[3]; | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
| }; | }; | ||||
| static void sh_node_seprgb_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) | static void sh_node_seprgb_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) | ||||
| { | { | ||||
| static SeparateRGBFunction fn; | static SeparateRGBFunction fn; | ||||
| builder.set_matching_fn(fn); | builder.set_matching_fn(fn); | ||||
| } | } | ||||
| void register_node_type_sh_seprgb() | |||||
| { | |||||
| static bNodeType ntype; | |||||
| sh_fn_node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTER, 0); | |||||
| ntype.declare = blender::nodes::sh_node_seprgb_declare; | |||||
| node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_seprgb); | |||||
| node_type_gpu(&ntype, gpu_shader_seprgb); | |||||
| ntype.build_multi_function = sh_node_seprgb_build_multi_function; | |||||
| nodeRegisterType(&ntype); | |||||
| } | |||||
| namespace blender::nodes { | |||||
| static void sh_node_combrgb_declare(NodeDeclarationBuilder &b) | static void sh_node_combrgb_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.is_function_node(); | b.is_function_node(); | ||||
| b.add_input<decl::Float>(N_("R")).min(0.0f).max(1.0f); | b.add_input<decl::Float>(N_("R")).min(0.0f).max(1.0f); | ||||
| b.add_input<decl::Float>(N_("G")).min(0.0f).max(1.0f); | b.add_input<decl::Float>(N_("G")).min(0.0f).max(1.0f); | ||||
| b.add_input<decl::Float>(N_("B")).min(0.0f).max(1.0f); | b.add_input<decl::Float>(N_("B")).min(0.0f).max(1.0f); | ||||
| b.add_output<decl::Color>(N_("Image")); | b.add_output<decl::Color>(N_("Image")); | ||||
| }; | }; | ||||
| } // namespace blender::nodes | |||||
| static void node_shader_exec_combrgb(void *UNUSED(data), | static void node_shader_exec_combrgb(void *UNUSED(data), | ||||
| int UNUSED(thread), | int UNUSED(thread), | ||||
| bNode *UNUSED(node), | bNode *UNUSED(node), | ||||
| bNodeExecData *UNUSED(execdata), | bNodeExecData *UNUSED(execdata), | ||||
| bNodeStack **in, | bNodeStack **in, | ||||
| bNodeStack **out) | bNodeStack **out) | ||||
| { | { | ||||
| float r, g, b; | float r, g, b; | ||||
| Show All 18 Lines | |||||
| static void sh_node_combrgb_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) | static void sh_node_combrgb_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) | ||||
| { | { | ||||
| static blender::fn::CustomMF_SI_SI_SI_SO<float, float, float, blender::ColorGeometry4f> fn{ | static blender::fn::CustomMF_SI_SI_SI_SO<float, float, float, blender::ColorGeometry4f> fn{ | ||||
| "Combine RGB", | "Combine RGB", | ||||
| [](float r, float g, float b) { return blender::ColorGeometry4f(r, g, b, 1.0f); }}; | [](float r, float g, float b) { return blender::ColorGeometry4f(r, g, b, 1.0f); }}; | ||||
| builder.set_matching_fn(fn); | builder.set_matching_fn(fn); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_shader_sepcombRGB_cc | |||||
| void register_node_type_sh_seprgb() | |||||
| { | |||||
| namespace file_ns = blender::nodes::node_shader_sepcombRGB_cc; | |||||
| static bNodeType ntype; | |||||
| sh_fn_node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTER, 0); | |||||
| ntype.declare = file_ns::sh_node_seprgb_declare; | |||||
| node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_seprgb); | |||||
| node_type_gpu(&ntype, file_ns::gpu_shader_seprgb); | |||||
| ntype.build_multi_function = file_ns::sh_node_seprgb_build_multi_function; | |||||
| nodeRegisterType(&ntype); | |||||
| } | |||||
| void register_node_type_sh_combrgb() | void register_node_type_sh_combrgb() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_shader_sepcombRGB_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_fn_node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTER, 0); | sh_fn_node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTER, 0); | ||||
| ntype.declare = blender::nodes::sh_node_combrgb_declare; | ntype.declare = file_ns::sh_node_combrgb_declare; | ||||
| node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_combrgb); | node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_combrgb); | ||||
| node_type_gpu(&ntype, gpu_shader_combrgb); | node_type_gpu(&ntype, file_ns::gpu_shader_combrgb); | ||||
| ntype.build_multi_function = sh_node_combrgb_build_multi_function; | ntype.build_multi_function = file_ns::sh_node_combrgb_build_multi_function; | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||