Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_value.c
| Show All 32 Lines | |||||
| #include "node_shader_util.h" | #include "node_shader_util.h" | ||||
| /* **************** VALUE ******************** */ | /* **************** VALUE ******************** */ | ||||
| static bNodeSocketTemplate sh_node_value_out[] = { | static bNodeSocketTemplate sh_node_value_out[] = { | ||||
| { SOCK_FLOAT, 0, N_("Value"), 0.5f, 0, 0, 0, -FLT_MAX, FLT_MAX, PROP_NONE}, | { SOCK_FLOAT, 0, N_("Value"), 0.5f, 0, 0, 0, -FLT_MAX, FLT_MAX, PROP_NONE}, | ||||
| { -1, 0, "" } | { -1, 0, "" } | ||||
| }; | }; | ||||
| static int gpu_shader_value(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | static int gpu_shader_value(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | ||||
| { | { | ||||
| GPUNodeLink *vec = GPU_uniform(out[0].vec); | GPUNodeLink *link = GPU_uniformbuffer_link_out(mat, node, out, 0); | ||||
| return GPU_stack_link(mat, "set_value", in, out, vec); | return GPU_stack_link(mat, node, "set_value", in, out, link); | ||||
| } | } | ||||
| void register_node_type_sh_value(void) | void register_node_type_sh_value(void) | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0); | sh_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0); | ||||
| node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); | node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING); | ||||
| node_type_socket_templates(&ntype, NULL, sh_node_value_out); | node_type_socket_templates(&ntype, NULL, sh_node_value_out); | ||||
| node_type_gpu(&ntype, gpu_shader_value); | node_type_gpu(&ntype, gpu_shader_value); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||