2
* ***** BEGIN GPL LICENSE BLOCK *****
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
* The Original Code is Copyright (C) 2006 Blender Foundation.
19
* All rights reserved.
21
* The Original Code is: all of this file.
23
* Contributor(s): Juho Vepsäläinen
25
* ***** END GPL LICENSE BLOCK *****
28
/** \file blender/nodes/shader/nodes/node_shader_sepcombRGB.c
33
#include "node_shader_util.h"
35
/* **************** SEPARATE RGBA ******************** */
36
static bNodeSocketTemplate sh_node_seprgb_in[]= {
37
{ SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f},
40
static bNodeSocketTemplate sh_node_seprgb_out[]= {
41
{ SOCK_FLOAT, 0, "R"},
42
{ SOCK_FLOAT, 0, "G"},
43
{ SOCK_FLOAT, 0, "B"},
47
static void node_shader_exec_seprgb(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
49
out[0]->vec[0] = in[0]->vec[0];
50
out[1]->vec[0] = in[0]->vec[1];
51
out[2]->vec[0] = in[0]->vec[2];
54
static int gpu_shader_seprgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
56
return GPU_stack_link(mat, "separate_rgb", in, out);
59
void register_node_type_sh_seprgb(bNodeTreeType *ttype)
61
static bNodeType ntype;
63
node_type_base(ttype, &ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTOR, 0);
64
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
65
node_type_socket_templates(&ntype, sh_node_seprgb_in, sh_node_seprgb_out);
66
node_type_size(&ntype, 80, 40, 140);
67
node_type_exec(&ntype, node_shader_exec_seprgb);
68
node_type_gpu(&ntype, gpu_shader_seprgb);
70
nodeRegisterType(ttype, &ntype);
75
/* **************** COMBINE RGB ******************** */
76
static bNodeSocketTemplate sh_node_combrgb_in[]= {
77
{ SOCK_FLOAT, 1, "R", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
78
{ SOCK_FLOAT, 1, "G", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
79
{ SOCK_FLOAT, 1, "B", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
82
static bNodeSocketTemplate sh_node_combrgb_out[]= {
83
{ SOCK_RGBA, 0, "Image"},
87
static void node_shader_exec_combrgb(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
89
out[0]->vec[0] = in[0]->vec[0];
90
out[0]->vec[1] = in[1]->vec[0];
91
out[0]->vec[2] = in[2]->vec[0];
94
static int gpu_shader_combrgb(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
96
return GPU_stack_link(mat, "combine_rgb", in, out);
99
void register_node_type_sh_combrgb(bNodeTreeType *ttype)
101
static bNodeType ntype;
103
node_type_base(ttype, &ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
104
node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
105
node_type_socket_templates(&ntype, sh_node_combrgb_in, sh_node_combrgb_out);
106
node_type_size(&ntype, 80, 40, 140);
107
node_type_exec(&ntype, node_shader_exec_combrgb);
108
node_type_gpu(&ntype, gpu_shader_combrgb);
110
nodeRegisterType(ttype, &ntype);