Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_rgb.c
| Show All 32 Lines | |||||
| #include "node_shader_util.h" | #include "node_shader_util.h" | ||||
| /* **************** RGB ******************** */ | /* **************** RGB ******************** */ | ||||
| static bNodeSocketTemplate sh_node_rgb_out[] = { | static bNodeSocketTemplate sh_node_rgb_out[] = { | ||||
| { SOCK_RGBA, 0, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f}, | { SOCK_RGBA, 0, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f}, | ||||
| { -1, 0, "" } | { -1, 0, "" } | ||||
| }; | }; | ||||
| static int gpu_shader_rgb(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | static int gpu_shader_rgb(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->outputs, out, 0); | ||||
| return GPU_stack_link(mat, "set_rgba", in, out, vec); | return GPU_stack_link(mat, "set_rgba", in, out, link); | ||||
| } | } | ||||
| void register_node_type_sh_rgb(void) | void register_node_type_sh_rgb(void) | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", NODE_CLASS_INPUT, 0); | sh_node_type_base(&ntype, SH_NODE_RGB, "RGB", 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_rgb_out); | node_type_socket_templates(&ntype, NULL, sh_node_rgb_out); | ||||
| node_type_gpu(&ntype, gpu_shader_rgb); | node_type_gpu(&ntype, gpu_shader_rgb); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||