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

« back to all changes in this revision

Viewing changes to source/blender/nodes/intern/TEX_nodes/TEX_invert.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
 
 
31
/* **************** INVERT ******************** */ 
 
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
 
 
37
static bNodeSocketType outputs[]= { 
 
38
        { SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, 
 
39
        { -1, 0, "" } 
 
40
};
 
41
 
 
42
static void colorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
 
43
{
 
44
        float col[4];
 
45
        
 
46
        tex_input_rgba(col, in[0], coord, thread);
 
47
 
 
48
        col[0] = 1.0f - col[0];
 
49
        col[1] = 1.0f - col[1];
 
50
        col[2] = 1.0f - col[2];
 
51
        
 
52
        VECCOPY(out, col);
 
53
        out[3] = col[3];
 
54
}
 
55
 
 
56
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 
57
{
 
58
        tex_output(node, in, out[0], &colorfn);
 
59
        
 
60
        tex_do_preview(node, out[0], data);
 
61
}
 
62
 
 
63
bNodeType tex_node_invert= {
 
64
        /* *next,*prev */       NULL, NULL,
 
65
        /* type code   */       TEX_NODE_INVERT, 
 
66
        /* name        */       "Invert", 
 
67
        /* width+range */       90, 80, 100, 
 
68
        /* class+opts  */       NODE_CLASS_OP_COLOR, NODE_OPTIONS, 
 
69
        /* input sock  */       inputs, 
 
70
        /* output sock */       outputs, 
 
71
        /* storage     */       "", 
 
72
        /* execfunc    */       exec,
 
73
        /* butfunc     */       NULL,
 
74
        /* initfunc    */       NULL,
 
75
        /* freestoragefunc    */        NULL,
 
76
        /* copystoragefunc    */        NULL,
 
77
        /* id          */       NULL
 
78
};
 
79