Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_vector_math.cc
| Show All 15 Lines | |||||
| * The Original Code is Copyright (C) 2005 Blender Foundation. | * The Original Code is Copyright (C) 2005 Blender Foundation. | ||||
| * All rights reserved. | * All rights reserved. | ||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup shdnodes | * \ingroup shdnodes | ||||
| */ | */ | ||||
| #include "node_shader_util.hh" | #include "node_shader_util.h" | ||||
| #include "NOD_math_functions.hh" | #include "NOD_math_functions.hh" | ||||
| namespace blender::nodes::node_vector_math_shader_cc { | namespace blender::nodes { | ||||
| static void sh_node_vector_math_declare(NodeDeclarationBuilder &b) | static void sh_node_vector_math_declare(NodeDeclarationBuilder &b) | ||||
| { | { | ||||
| b.is_function_node(); | b.is_function_node(); | ||||
| b.add_input<decl::Vector>(N_("Vector")).min(-10000.0f).max(10000.0f); | b.add_input<decl::Vector>(N_("Vector")).min(-10000.0f).max(10000.0f); | ||||
| b.add_input<decl::Vector>(N_("Vector"), "Vector_001").min(-10000.0f).max(10000.0f); | b.add_input<decl::Vector>(N_("Vector"), "Vector_001").min(-10000.0f).max(10000.0f); | ||||
| b.add_input<decl::Vector>(N_("Vector"), "Vector_002").min(-10000.0f).max(10000.0f); | b.add_input<decl::Vector>(N_("Vector"), "Vector_002").min(-10000.0f).max(10000.0f); | ||||
| b.add_input<decl::Float>(N_("Scale")).default_value(1.0f).min(-10000.0f).max(10000.0f); | b.add_input<decl::Float>(N_("Scale")).default_value(1.0f).min(-10000.0f).max(10000.0f); | ||||
| b.add_output<decl::Vector>(N_("Vector")); | b.add_output<decl::Vector>(N_("Vector")); | ||||
| b.add_output<decl::Float>(N_("Value")); | b.add_output<decl::Float>(N_("Value")); | ||||
| }; | }; | ||||
| } // namespace blender::nodes | |||||
| static const char *gpu_shader_get_name(int mode) | static const char *gpu_shader_get_name(int mode) | ||||
| { | { | ||||
| switch (mode) { | switch (mode) { | ||||
| case NODE_VECTOR_MATH_ADD: | case NODE_VECTOR_MATH_ADD: | ||||
| return "vector_math_add"; | return "vector_math_add"; | ||||
| case NODE_VECTOR_MATH_SUBTRACT: | case NODE_VECTOR_MATH_SUBTRACT: | ||||
| return "vector_math_subtract"; | return "vector_math_subtract"; | ||||
| case NODE_VECTOR_MATH_MULTIPLY: | case NODE_VECTOR_MATH_MULTIPLY: | ||||
| ▲ Show 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | |||||
| static void sh_node_vector_math_build_multi_function( | static void sh_node_vector_math_build_multi_function( | ||||
| blender::nodes::NodeMultiFunctionBuilder &builder) | blender::nodes::NodeMultiFunctionBuilder &builder) | ||||
| { | { | ||||
| const blender::fn::MultiFunction *fn = get_multi_function(builder.node()); | const blender::fn::MultiFunction *fn = get_multi_function(builder.node()); | ||||
| builder.set_matching_fn(fn); | builder.set_matching_fn(fn); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_vector_math_shader_cc | void register_node_type_sh_vect_math(void) | ||||
| void register_node_type_sh_vect_math() | |||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_vector_math_shader_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, "Vector Math", NODE_CLASS_OP_VECTOR, 0); | sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, "Vector Math", NODE_CLASS_OP_VECTOR, 0); | ||||
| ntype.declare = file_ns::sh_node_vector_math_declare; | ntype.declare = blender::nodes::sh_node_vector_math_declare; | ||||
| node_type_label(&ntype, node_vector_math_label); | node_type_label(&ntype, node_vector_math_label); | ||||
| node_type_gpu(&ntype, file_ns::gpu_shader_vector_math); | node_type_gpu(&ntype, gpu_shader_vector_math); | ||||
| node_type_update(&ntype, file_ns::node_shader_update_vector_math); | node_type_update(&ntype, node_shader_update_vector_math); | ||||
| ntype.build_multi_function = file_ns::sh_node_vector_math_build_multi_function; | ntype.build_multi_function = sh_node_vector_math_build_multi_function; | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||