Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_bump.cc
| Show All 18 Lines | |||||
| /** \file | /** \file | ||||
| * \ingroup shdnodes | * \ingroup shdnodes | ||||
| */ | */ | ||||
| #include "node_shader_util.hh" | #include "node_shader_util.hh" | ||||
| /* **************** BUMP ******************** */ | /* **************** BUMP ******************** */ | ||||
| namespace blender::nodes::node_shader_bump_cc { | |||||
| /* clang-format off */ | /* clang-format off */ | ||||
| static bNodeSocketTemplate sh_node_bump_in[] = { | static bNodeSocketTemplate sh_node_bump_in[] = { | ||||
| {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, | {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, | ||||
| {SOCK_FLOAT, N_("Distance"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, | {SOCK_FLOAT, N_("Distance"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, | ||||
| {SOCK_FLOAT, N_("Height"), 1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE}, | {SOCK_FLOAT, N_("Height"), 1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_HIDE_VALUE}, | ||||
| {SOCK_FLOAT, N_("Height_dx"), 1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_UNAVAIL}, | {SOCK_FLOAT, N_("Height_dx"), 1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_UNAVAIL}, | ||||
| {SOCK_FLOAT, N_("Height_dy"), 1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_UNAVAIL}, | {SOCK_FLOAT, N_("Height_dy"), 1.0f, 1.0f, 1.0f, 1.0f, -1000.0f, 1000.0f, PROP_NONE, SOCK_UNAVAIL}, | ||||
| {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, | {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, | ||||
| Show All 14 Lines | static int gpu_shader_bump(GPUMaterial *mat, | ||||
| } | } | ||||
| float invert = (node->custom1) ? -1.0 : 1.0; | float invert = (node->custom1) ? -1.0 : 1.0; | ||||
| return GPU_stack_link( | return GPU_stack_link( | ||||
| mat, node, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_constant(&invert)); | mat, node, "node_bump", in, out, GPU_builtin(GPU_VIEW_POSITION), GPU_constant(&invert)); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_shader_bump_cc | |||||
| /* node type definition */ | /* node type definition */ | ||||
| void register_node_type_sh_bump() | void register_node_type_sh_bump() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_shader_bump_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR, 0); | sh_node_type_base(&ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR, 0); | ||||
| node_type_socket_templates(&ntype, sh_node_bump_in, sh_node_bump_out); | node_type_socket_templates(&ntype, file_ns::sh_node_bump_in, file_ns::sh_node_bump_out); | ||||
| node_type_storage(&ntype, "", nullptr, nullptr); | node_type_storage(&ntype, "", nullptr, nullptr); | ||||
| node_type_gpu(&ntype, gpu_shader_bump); | node_type_gpu(&ntype, file_ns::gpu_shader_bump); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||