Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_mixRgb.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_mixRgb_cc { | ||||
| static void sh_node_mix_rgb_declare(NodeDeclarationBuilder &b) | static void sh_node_mix_rgb_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.is_function_node(); | b.is_function_node(); | ||||
| b.add_input<decl::Float>(N_("Fac")).default_value(0.5f).min(0.0f).max(1.0f).subtype(PROP_FACTOR); | b.add_input<decl::Float>(N_("Fac")).default_value(0.5f).min(0.0f).max(1.0f).subtype(PROP_FACTOR); | ||||
| b.add_input<decl::Color>(N_("Color1")).default_value({0.5f, 0.5f, 0.5f, 1.0f}); | b.add_input<decl::Color>(N_("Color1")).default_value({0.5f, 0.5f, 0.5f, 1.0f}); | ||||
| b.add_input<decl::Color>(N_("Color2")).default_value({0.5f, 0.5f, 0.5f, 1.0f}); | b.add_input<decl::Color>(N_("Color2")).default_value({0.5f, 0.5f, 0.5f, 1.0f}); | ||||
| b.add_output<decl::Color>(N_("Color")); | b.add_output<decl::Color>(N_("Color")); | ||||
| }; | }; | ||||
| } // namespace blender::nodes | |||||
| static void node_shader_exec_mix_rgb(void *UNUSED(data), | static void node_shader_exec_mix_rgb(void *UNUSED(data), | ||||
| int UNUSED(thread), | int UNUSED(thread), | ||||
| bNode *node, | bNode *node, | ||||
| bNodeExecData *UNUSED(execdata), | bNodeExecData *UNUSED(execdata), | ||||
| bNodeStack **in, | bNodeStack **in, | ||||
| bNodeStack **out) | bNodeStack **out) | ||||
| { | { | ||||
| /* stack order in: fac, col1, col2 */ | /* stack order in: fac, col1, col2 */ | ||||
| ▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | |||||
| static void sh_node_mix_rgb_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) | static void sh_node_mix_rgb_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder) | ||||
| { | { | ||||
| bNode &node = builder.node(); | bNode &node = builder.node(); | ||||
| bool clamp = node.custom2 & SHD_MIXRGB_CLAMP; | bool clamp = node.custom2 & SHD_MIXRGB_CLAMP; | ||||
| int mix_type = node.custom1; | int mix_type = node.custom1; | ||||
| builder.construct_and_set_matching_fn<MixRGBFunction>(clamp, mix_type); | builder.construct_and_set_matching_fn<MixRGBFunction>(clamp, mix_type); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_shader_mixRgb_cc | |||||
| void register_node_type_sh_mix_rgb() | void register_node_type_sh_mix_rgb() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_shader_mixRgb_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0); | sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0); | ||||
| ntype.declare = blender::nodes::sh_node_mix_rgb_declare; | ntype.declare = file_ns::sh_node_mix_rgb_declare; | ||||
| node_type_label(&ntype, node_blend_label); | node_type_label(&ntype, node_blend_label); | ||||
| node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_mix_rgb); | node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_mix_rgb); | ||||
| node_type_gpu(&ntype, gpu_shader_mix_rgb); | node_type_gpu(&ntype, file_ns::gpu_shader_mix_rgb); | ||||
| ntype.build_multi_function = sh_node_mix_rgb_build_multi_function; | ntype.build_multi_function = file_ns::sh_node_mix_rgb_build_multi_function; | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||