3
* ***** BEGIN GPL LICENSE BLOCK *****
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software Foundation,
17
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
* The Original Code is Copyright (C) 2005 Blender Foundation.
20
* All rights reserved.
22
* The Original Code is: all of this file.
24
* Contributor(s): none yet.
26
* ***** END GPL LICENSE BLOCK *****
29
#include "../TEX_util.h"
32
static bNodeSocketType inputs[]= {
33
{ SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
36
static bNodeSocketType outputs[]= {
37
{ SOCK_VALUE, 0, "Red", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
38
{ SOCK_VALUE, 0, "Green", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
39
{ SOCK_VALUE, 0, "Blue", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
40
{ SOCK_VALUE, 0, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f },
44
static void valuefn_r(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
46
tex_input_rgba(out, in[0], coord, thread);
50
static void valuefn_g(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
52
tex_input_rgba(out, in[0], coord, thread);
56
static void valuefn_b(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
58
tex_input_rgba(out, in[0], coord, thread);
62
static void valuefn_a(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
64
tex_input_rgba(out, in[0], coord, thread);
68
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
70
tex_output(node, in, out[0], &valuefn_r);
71
tex_output(node, in, out[1], &valuefn_g);
72
tex_output(node, in, out[2], &valuefn_b);
73
tex_output(node, in, out[3], &valuefn_a);
76
bNodeType tex_node_decompose= {
77
/* *next,*prev */ NULL, NULL,
78
/* type code */ TEX_NODE_DECOMPOSE,
79
/* name */ "Decompose RGBA",
80
/* width+range */ 100, 60, 150,
81
/* class+opts */ NODE_CLASS_OP_COLOR, 0,
82
/* input sock */ inputs,
83
/* output sock */ outputs,
88
/* freestoragefunc */ NULL,
89
/* copystoragefunc */ NULL,