Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_displacement.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_displacement_cc { | |||||
| static bNodeSocketTemplate sh_node_displacement_in[] = { | static bNodeSocketTemplate sh_node_displacement_in[] = { | ||||
| {SOCK_FLOAT, N_("Height"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, | {SOCK_FLOAT, N_("Height"), 0.00f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, | ||||
| {SOCK_FLOAT, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, | {SOCK_FLOAT, N_("Midlevel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, | ||||
| {SOCK_FLOAT, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, | {SOCK_FLOAT, N_("Scale"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, | ||||
| {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}, | ||||
| {-1, ""}, | {-1, ""}, | ||||
| }; | }; | ||||
| Show All 31 Lines | static int gpu_shader_displacement(GPUMaterial *mat, | ||||
| if (node->custom1 == SHD_SPACE_OBJECT) { | if (node->custom1 == SHD_SPACE_OBJECT) { | ||||
| return GPU_stack_link( | return GPU_stack_link( | ||||
| mat, node, "node_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX)); | mat, node, "node_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX)); | ||||
| } | } | ||||
| return GPU_stack_link(mat, node, "node_displacement_world", in, out); | return GPU_stack_link(mat, node, "node_displacement_world", in, out); | ||||
| } | } | ||||
| } // namespace blender::nodes::node_shader_displacement_cc | |||||
| /* node type definition */ | /* node type definition */ | ||||
| void register_node_type_sh_displacement() | void register_node_type_sh_displacement() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_shader_displacement_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_DISPLACEMENT, "Displacement", NODE_CLASS_OP_VECTOR, 0); | sh_node_type_base(&ntype, SH_NODE_DISPLACEMENT, "Displacement", NODE_CLASS_OP_VECTOR, 0); | ||||
| node_type_socket_templates(&ntype, sh_node_displacement_in, sh_node_displacement_out); | node_type_socket_templates( | ||||
| &ntype, file_ns::sh_node_displacement_in, file_ns::sh_node_displacement_out); | |||||
| node_type_storage(&ntype, "", nullptr, nullptr); | node_type_storage(&ntype, "", nullptr, nullptr); | ||||
| node_type_init(&ntype, node_shader_init_displacement); | node_type_init(&ntype, file_ns::node_shader_init_displacement); | ||||
| node_type_gpu(&ntype, gpu_shader_displacement); | node_type_gpu(&ntype, file_ns::gpu_shader_displacement); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||