Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_attribute.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_attribute_cc { | |||||
| static bNodeSocketTemplate sh_node_attribute_out[] = { | static bNodeSocketTemplate sh_node_attribute_out[] = { | ||||
| {SOCK_RGBA, N_("Color")}, | {SOCK_RGBA, N_("Color")}, | ||||
| {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {SOCK_FLOAT, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, | {SOCK_FLOAT, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, | ||||
| {SOCK_FLOAT, N_("Alpha"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, | {SOCK_FLOAT, N_("Alpha"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, | ||||
| {-1, ""}, | {-1, ""}, | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | static int node_shader_gpu_attribute(GPUMaterial *mat, | ||||
| /* for each output. */ | /* for each output. */ | ||||
| for (int i = 0; sh_node_attribute_out[i].type != -1; i++) { | for (int i = 0; sh_node_attribute_out[i].type != -1; i++) { | ||||
| node_shader_gpu_bump_tex_coord(mat, node, &out[i].link); | node_shader_gpu_bump_tex_coord(mat, node, &out[i].link); | ||||
| } | } | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| } // namespace blender::nodes::node_shader_attribute_cc | |||||
| /* node type definition */ | /* node type definition */ | ||||
| void register_node_type_sh_attribute() | void register_node_type_sh_attribute() | ||||
| { | { | ||||
| namespace file_ns = blender::nodes::node_shader_attribute_cc; | |||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT, 0); | sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT, 0); | ||||
| node_type_socket_templates(&ntype, nullptr, sh_node_attribute_out); | node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_attribute_out); | ||||
| node_type_init(&ntype, node_shader_init_attribute); | node_type_init(&ntype, file_ns::node_shader_init_attribute); | ||||
| node_type_storage( | node_type_storage( | ||||
| &ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage); | &ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage); | ||||
| node_type_gpu(&ntype, node_shader_gpu_attribute); | node_type_gpu(&ntype, file_ns::node_shader_gpu_attribute); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||