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},
55
55
curvemapping_evaluate3F(node->storage, out[0]->vec, vec);
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)
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);
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)
69
69
return GPU_stack_link(mat, "curves_vec", in, out, GPU_texture(size, array));
72
void register_node_type_sh_curve_vec(bNodeTreeType *ttype)
72
void register_node_type_sh_curve_vec(void)
74
74
static bNodeType ntype;
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);
86
nodeRegisterType(ttype, &ntype);
85
nodeRegisterType(&ntype);
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},
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)
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);
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)
127
126
return GPU_stack_link(mat, "curves_rgb", in, out, GPU_texture(size, array));
130
void register_node_type_sh_curve_rgb(bNodeTreeType *ttype)
129
void register_node_type_sh_curve_rgb(void)
132
131
static bNodeType ntype;
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);
144
nodeRegisterType(ttype, &ntype);
142
nodeRegisterType(&ntype);