2
* $Id: SHD_curves.c,v 1.4 2007/04/04 13:58:12 jesterking Exp $
4
* ***** BEGIN GPL LICENSE BLOCK *****
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software Foundation,
18
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
* The Original Code is Copyright (C) 2005 Blender Foundation.
21
* All rights reserved.
23
* The Original Code is: all of this file.
25
* Contributor(s): none yet.
27
* ***** END GPL LICENSE BLOCK *****
30
#include "../SHD_util.h"
33
/* **************** CURVE VEC ******************** */
34
static bNodeSocketType sh_node_curve_vec_in[]= {
35
{ SOCK_VECTOR, 1, "Vector", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
39
static bNodeSocketType sh_node_curve_vec_out[]= {
40
{ SOCK_VECTOR, 0, "Vector", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
44
static void node_shader_exec_curve_vec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
48
/* stack order input: vec */
49
/* stack order output: vec */
50
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
51
curvemapping_evaluate3F(node->storage, out[0]->vec, vec);
54
static void node_shader_init_curve_vec(bNode* node)
56
node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
59
bNodeType sh_node_curve_vec= {
60
/* *next,*prev */ NULL, NULL,
61
/* type code */ SH_NODE_CURVE_VEC,
62
/* name */ "Vector Curves",
63
/* width+range */ 200, 140, 320,
64
/* class+opts */ NODE_CLASS_OP_VECTOR, NODE_OPTIONS,
65
/* input sock */ sh_node_curve_vec_in,
66
/* output sock */ sh_node_curve_vec_out,
67
/* storage */ "CurveMapping",
68
/* execfunc */ node_shader_exec_curve_vec,
70
/* initfunc */ node_shader_init_curve_vec,
71
/* freestoragefunc */ node_free_curves,
72
/* copystoragefunc */ node_copy_curves,
77
/* **************** CURVE RGB ******************** */
78
static bNodeSocketType sh_node_curve_rgb_in[]= {
79
{ SOCK_RGBA, 1, "Color", 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f},
83
static bNodeSocketType sh_node_curve_rgb_out[]= {
84
{ SOCK_RGBA, 0, "Color", 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f},
88
static void node_shader_exec_curve_rgb(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
92
/* stack order input: vec */
93
/* stack order output: vec */
94
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
95
curvemapping_evaluateRGBF(node->storage, out[0]->vec, vec);
98
static void node_shader_init_curve_rgb(bNode *node)
100
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
103
bNodeType sh_node_curve_rgb= {
104
/* *next,*prev */ NULL, NULL,
105
/* type code */ SH_NODE_CURVE_RGB,
106
/* name */ "RGB Curves",
107
/* width+range */ 200, 140, 320,
108
/* class+opts */ NODE_CLASS_OP_COLOR, NODE_OPTIONS,
109
/* input sock */ sh_node_curve_rgb_in,
110
/* output sock */ sh_node_curve_rgb_out,
111
/* storage */ "CurveMapping",
112
/* execfunc */ node_shader_exec_curve_rgb,
114
/* initfunc */ node_shader_init_curve_rgb,
115
/* freestoragefunc */ node_free_curves,
116
/* copystoragefunc */ node_copy_curves,