Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_normal_map.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. | ||||
| */ | */ | ||||
| #include "node_shader_util.hh" | #include "node_shader_util.hh" | ||||
| /* **************** OUTPUT ******************** */ | /* **************** OUTPUT ******************** */ | ||||
| namespace blender::nodes::node_shader_normal_map_cc { | |||||
| static bNodeSocketTemplate sh_node_normal_map_in[] = { | static bNodeSocketTemplate sh_node_normal_map_in[] = { | ||||
| {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f}, | {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f}, | ||||
| {SOCK_RGBA, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f}, | {SOCK_RGBA, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f}, | ||||
| {-1, ""}, | {-1, ""}, | ||||
| }; | }; | ||||
| static bNodeSocketTemplate sh_node_normal_map_out[] = { | static bNodeSocketTemplate sh_node_normal_map_out[] = { | ||||
| {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| ▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | static int gpu_shader_normal_map(GPUMaterial *mat, | ||||
| } | } | ||||
| GPUNodeLink *oldnormal = GPU_builtin(GPU_WORLD_NORMAL); | GPUNodeLink *oldnormal = GPU_builtin(GPU_WORLD_NORMAL); | ||||
| GPU_link(mat, "node_normal_map_mix", strength, newnormal, oldnormal, &out[0].link); | GPU_link(mat, "node_normal_map_mix", strength, newnormal, oldnormal, &out[0].link); | ||||
| return true; | return true; | ||||
| } | } | ||||
| } // namespace blender::nodes::node_shader_normal_map_cc | |||||
| /* node type definition */ | /* node type definition */ | ||||
| void register_node_type_sh_normal_map() | void register_node_type_sh_normal_map() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_shader_normal_map_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR, 0); | sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR, 0); | ||||
| node_type_socket_templates(&ntype, sh_node_normal_map_in, sh_node_normal_map_out); | node_type_socket_templates( | ||||
| &ntype, file_ns::sh_node_normal_map_in, file_ns::sh_node_normal_map_out); | |||||
| node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); | node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); | ||||
| node_type_init(&ntype, node_shader_init_normal_map); | node_type_init(&ntype, file_ns::node_shader_init_normal_map); | ||||
| node_type_storage( | node_type_storage( | ||||
| &ntype, "NodeShaderNormalMap", node_free_standard_storage, node_copy_standard_storage); | &ntype, "NodeShaderNormalMap", node_free_standard_storage, node_copy_standard_storage); | ||||
| node_type_gpu(&ntype, gpu_shader_normal_map); | node_type_gpu(&ntype, file_ns::gpu_shader_normal_map); | ||||
| node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_normal_map); | node_type_exec(&ntype, nullptr, nullptr, file_ns::node_shader_exec_normal_map); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||