~ubuntu-branches/ubuntu/lucid/blender/lucid

« back to all changes in this revision

Viewing changes to source/blender/nodes/intern/TEX_nodes/TEX_decompose.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2009-08-06 22:32:19 UTC
  • mfrom: (1.2.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090806223219-8z4eej1u8levu4pz
Tags: 2.49a+dfsg-0ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: Build-depend on python-2.6 rather than python-2.5.
  - debian/misc/*.desktop: Add Spanish translation to .desktop 
    files.
  - debian/pyversions: 2.6.
  - debian/rules: Clean *.o of source/blender/python/api2_2x/
* New upstream release (LP: #382153).
* Refreshed patches:
  - 01_sanitize_sys.patch
  - 02_tmp_in_HOME
  - 10_use_systemwide_ftgl
  - 70_portability_platform_detection
* Removed patches merged upstream:
  - 30_fix_python_syntax_warning
  - 90_ubuntu_ffmpeg_52_changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 *
 
3
 * ***** BEGIN GPL LICENSE BLOCK *****
 
4
 *
 
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. 
 
9
 *
 
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.
 
14
 *
 
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.
 
18
 *
 
19
 * The Original Code is Copyright (C) 2005 Blender Foundation.
 
20
 * All rights reserved.
 
21
 *
 
22
 * The Original Code is: all of this file.
 
23
 *
 
24
 * Contributor(s): none yet.
 
25
 *
 
26
 * ***** END GPL LICENSE BLOCK *****
 
27
 */
 
28
 
 
29
#include "../TEX_util.h"                                                   
 
30
#include <math.h>
 
31
 
 
32
static bNodeSocketType inputs[]= {
 
33
        { SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
 
34
        { -1, 0, "" }
 
35
};
 
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 },
 
41
        { -1, 0, "" }
 
42
};
 
43
 
 
44
static void valuefn_r(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
 
45
{
 
46
        tex_input_rgba(out, in[0], coord, thread);
 
47
        *out = out[0];
 
48
}
 
49
 
 
50
static void valuefn_g(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
 
51
{
 
52
        tex_input_rgba(out, in[0], coord, thread);
 
53
        *out = out[1];
 
54
}
 
55
 
 
56
static void valuefn_b(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
 
57
{
 
58
        tex_input_rgba(out, in[0], coord, thread);
 
59
        *out = out[2];
 
60
}
 
61
 
 
62
static void valuefn_a(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
 
63
{
 
64
        tex_input_rgba(out, in[0], coord, thread);
 
65
        *out = out[3];
 
66
}
 
67
 
 
68
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 
69
{
 
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);
 
74
}
 
75
 
 
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,
 
84
        /* storage         */  "", 
 
85
        /* execfunc        */  exec,
 
86
        /* butfunc         */  NULL,
 
87
        /* initfunc        */  NULL,
 
88
        /* freestoragefunc */  NULL,
 
89
        /* copystoragefunc */  NULL,
 
90
        /* id              */  NULL   
 
91
        
 
92
};