Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_mixRgb.c
| Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | static const char *names[] = { | ||||
| "mix_hue", | "mix_hue", | ||||
| "mix_sat", | "mix_sat", | ||||
| "mix_val", | "mix_val", | ||||
| "mix_color", | "mix_color", | ||||
| "mix_soft", | "mix_soft", | ||||
| "mix_linear", | "mix_linear", | ||||
| }; | }; | ||||
| if (node->custom1 < ARRAY_SIZE(names) && names[node->custom1]) { | |||||
| int ret = GPU_stack_link(mat, node, names[node->custom1], in, out); | int ret = GPU_stack_link(mat, node, names[node->custom1], in, out); | ||||
| if (ret && node->custom2 & SHD_MIXRGB_CLAMP) { | if (ret && node->custom2 & SHD_MIXRGB_CLAMP) { | ||||
| float min[3] = {0.0f, 0.0f, 0.0f}; | float min[3] = {0.0f, 0.0f, 0.0f}; | ||||
| float max[3] = {1.0f, 1.0f, 1.0f}; | float max[3] = {1.0f, 1.0f, 1.0f}; | ||||
| GPU_link(mat, "clamp_color", out[0].link, GPU_constant(min), GPU_constant(max), &out[0].link); | GPU_link(mat, "clamp_color", out[0].link, GPU_constant(min), GPU_constant(max), &out[0].link); | ||||
| } | } | ||||
| return ret; | return ret; | ||||
| } | } | ||||
| else { | |||||
| return 0; | |||||
| } | |||||
| } | |||||
| void register_node_type_sh_mix_rgb(void) | void register_node_type_sh_mix_rgb(void) | ||||
| { | { | ||||
| static bNodeType ntype; | static bNodeType ntype; | ||||
| sh_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0); | sh_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0); | ||||
| node_type_socket_templates(&ntype, sh_node_mix_rgb_in, sh_node_mix_rgb_out); | node_type_socket_templates(&ntype, sh_node_mix_rgb_in, sh_node_mix_rgb_out); | ||||
| node_type_label(&ntype, node_blend_label); | node_type_label(&ntype, node_blend_label); | ||||
| node_type_exec(&ntype, NULL, NULL, node_shader_exec_mix_rgb); | node_type_exec(&ntype, NULL, NULL, node_shader_exec_mix_rgb); | ||||
| node_type_gpu(&ntype, gpu_shader_mix_rgb); | node_type_gpu(&ntype, gpu_shader_mix_rgb); | ||||
| nodeRegisterType(&ntype); | nodeRegisterType(&ntype); | ||||
| } | } | ||||