~ubuntu-branches/ubuntu/trusty/blender/trusty-proposed

« back to all changes in this revision

Viewing changes to source/blender/nodes/shader/nodes/node_shader_curves.c

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2013-08-14 10:43:49 UTC
  • mfrom: (14.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20130814104349-t1d5mtwkphp12dyj
Tags: 2.68a-3
* Upload to unstable
* debian/: python3.3 Depends simplified
  - debian/control: python3.3 Depends dropped
    for blender-data package
  - 0001-blender_thumbnailer.patch refreshed
* debian/control: libavcodec b-dep versioning dropped

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
/* **************** CURVE VEC  ******************** */
37
37
static bNodeSocketTemplate sh_node_curve_vec_in[] = {
38
 
        {       SOCK_FLOAT, 0, N_("Fac"),       1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
 
38
        {       SOCK_FLOAT, 0, N_("Fac"),       1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
39
39
        {       SOCK_VECTOR, 1, N_("Vector"),   0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
40
40
        {       -1, 0, ""       }
41
41
};
45
45
        {       -1, 0, ""       }
46
46
};
47
47
 
48
 
static void node_shader_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 
48
static void node_shader_exec_curve_vec(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
49
49
{
50
50
        float vec[3];
51
51
        
55
55
        curvemapping_evaluate3F(node->storage, out[0]->vec, vec);
56
56
}
57
57
 
58
 
static void node_shader_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 
58
static void node_shader_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node)
59
59
{
60
 
        node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
 
60
        node->storage = curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
61
61
}
62
62
 
63
 
static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
 
63
static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
64
64
{
65
65
        float *array;
66
66
        int size;
69
69
        return GPU_stack_link(mat, "curves_vec", in, out, GPU_texture(size, array));
70
70
}
71
71
 
72
 
void register_node_type_sh_curve_vec(bNodeTreeType *ttype)
 
72
void register_node_type_sh_curve_vec(void)
73
73
{
74
74
        static bNodeType ntype;
75
75
 
76
 
        node_type_base(ttype, &ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
77
 
        node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
 
76
        sh_node_type_base(&ntype, SH_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0);
 
77
        node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
78
78
        node_type_socket_templates(&ntype, sh_node_curve_vec_in, sh_node_curve_vec_out);
79
 
        node_type_size(&ntype, 200, 140, 320);
80
79
        node_type_init(&ntype, node_shader_init_curve_vec);
 
80
        node_type_size_preset(&ntype, NODE_SIZE_LARGE);
81
81
        node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
82
 
        node_type_exec(&ntype, node_shader_exec_curve_vec);
83
 
        node_type_exec_new(&ntype, node_initexec_curves, NULL, NULL);  /* only for its initexec func */
 
82
        node_type_exec(&ntype, node_initexec_curves, NULL, node_shader_exec_curve_vec);
84
83
        node_type_gpu(&ntype, gpu_shader_curve_vec);
85
84
 
86
 
        nodeRegisterType(ttype, &ntype);
 
85
        nodeRegisterType(&ntype);
87
86
}
88
87
 
89
88
 
90
89
/* **************** CURVE RGB  ******************** */
91
90
static bNodeSocketTemplate sh_node_curve_rgb_in[] = {
92
 
        {       SOCK_FLOAT, 1, N_("Fac"),       1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR},
 
91
        {       SOCK_FLOAT, 1, N_("Fac"),       1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
93
92
        {       SOCK_RGBA, 1, N_("Color"),      0.0f, 0.0f, 0.0f, 1.0f},
94
93
        {       -1, 0, ""       }
95
94
};
99
98
        {       -1, 0, ""       }
100
99
};
101
100
 
102
 
static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 
101
static void node_shader_exec_curve_rgb(void *UNUSED(data), int UNUSED(thread), bNode *node, bNodeExecData *UNUSED(execdata), bNodeStack **in, bNodeStack **out)
103
102
{
104
103
        float vec[3];
105
104
        
112
111
        }
113
112
}
114
113
 
115
 
static void node_shader_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
 
114
static void node_shader_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node)
116
115
{
117
 
        node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
 
116
        node->storage = curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
118
117
}
119
118
 
120
 
static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
 
119
static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
121
120
{
122
121
        float *array;
123
122
        int size;
127
126
        return GPU_stack_link(mat, "curves_rgb", in, out, GPU_texture(size, array));
128
127
}
129
128
 
130
 
void register_node_type_sh_curve_rgb(bNodeTreeType *ttype)
 
129
void register_node_type_sh_curve_rgb(void)
131
130
{
132
131
        static bNodeType ntype;
133
132
 
134
 
        node_type_base(ttype, &ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
135
 
        node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
 
133
        sh_node_type_base(&ntype, SH_NODE_CURVE_RGB, "RGB Curves", NODE_CLASS_OP_COLOR, 0);
 
134
        node_type_compatibility(&ntype, NODE_OLD_SHADING | NODE_NEW_SHADING);
136
135
        node_type_socket_templates(&ntype, sh_node_curve_rgb_in, sh_node_curve_rgb_out);
137
 
        node_type_size(&ntype, 200, 140, 320);
138
136
        node_type_init(&ntype, node_shader_init_curve_rgb);
 
137
        node_type_size_preset(&ntype, NODE_SIZE_LARGE);
139
138
        node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
140
 
        node_type_exec(&ntype, node_shader_exec_curve_rgb);
141
 
        node_type_exec_new(&ntype, node_initexec_curves, NULL, NULL);  /* only for its initexec func */
 
139
        node_type_exec(&ntype, node_initexec_curves, NULL, node_shader_exec_curve_rgb);
142
140
        node_type_gpu(&ntype, gpu_shader_curve_rgb);
143
141
 
144
 
        nodeRegisterType(ttype, &ntype);
 
142
        nodeRegisterType(&ntype);
145
143
}