Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-08-21 18:43:51 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-21 18:43:51 +0400
commit8bd7c3fba2749fdf2b16c4f32abf1a35692bc5bb (patch)
treeec5506895139ed6a09921c60eaf61bd8eb7f2226 /source/blender/nodes
parent809fce9d00ecf8eea2c3d2ea52c3de2ec2ede1ee (diff)
change curve evaluation functions never to modify curve data (ensures thread safety), now initializations has to be done outside evaluation.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_curves.c13
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_huecorrect.c6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_curves.c3
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_curves.c1
4 files changed, 19 insertions, 4 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c
index 85830e8ca14..ddc93e94061 100644
--- a/source/blender/nodes/composite/nodes/node_composite_curves.c
+++ b/source/blender/nodes/composite/nodes/node_composite_curves.c
@@ -52,7 +52,9 @@ static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack *
if (node->custom1 < node->custom2)
fac= (rd->cfra - node->custom1)/(float)(node->custom2-node->custom1);
- fac= curvemapping_evaluateF(node->storage, 0, fac);
+ curvemapping_initialize(node->storage);
+ fac = curvemapping_evaluateF(node->storage, 0, fac);
+
out[0]->vec[0]= CLAMPIS(fac, 0.0f, 1.0f);
}
@@ -100,7 +102,8 @@ static void node_composit_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeS
{
/* stack order input: vec */
/* stack order output: vec */
-
+
+ curvemapping_initialize(node->storage);
curvemapping_evaluate_premulRGBF(node->storage, out[0]->vec, in[0]->vec);
}
@@ -146,13 +149,15 @@ static bNodeSocketTemplate cmp_node_curve_rgb_out[]= {
static void do_curves(bNode *node, float *out, float *in)
{
+ curvemapping_initialize(node->storage);
curvemapping_evaluate_premulRGBF(node->storage, out, in);
out[3]= in[3];
}
static void do_curves_fac(bNode *node, float *out, float *in, float *fac)
{
-
+ curvemapping_initialize(node->storage);
+
if (*fac >= 1.0f)
curvemapping_evaluate_premulRGBF(node->storage, out, in);
else if (*fac <= 0.0f) {
@@ -176,6 +181,8 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS
if (out[0]->hasoutput==0)
return;
+ curvemapping_initialize(node->storage);
+
/* input no image? then only color operation */
if (in[1]->data==NULL) {
curvemapping_evaluateRGBF(node->storage, out[0]->vec, in[1]->vec);
diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
index 1f343c648c3..7e3f6a5fb3a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
+++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
@@ -51,6 +51,8 @@ static void do_huecorrect(bNode *node, float *out, float *in)
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
+ curvemapping_initialize(node->storage);
+
/* adjust hue, scaling returned default 0.5 up to 1 */
f = curvemapping_evaluateF(node->storage, 0, hsv[0]);
hsv[0] += f-0.5f;
@@ -79,6 +81,8 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac)
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
+ curvemapping_initialize(node->storage);
+
/* adjust hue, scaling returned default 0.5 up to 1 */
f = curvemapping_evaluateF(node->storage, 0, hsv[0]);
hsv[0] += f-0.5f;
@@ -118,7 +122,7 @@ static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNode
out[0]->data = pass_on_compbuf(cbuf);
return;
}
-
+
/* input no image? then only color operation */
if (in[1]->data==NULL) {
do_huecorrect_fac(node, out[0]->vec, in[1]->vec, in[0]->vec);
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c
index be7f3c1c614..512182ebe12 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.c
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.c
@@ -65,6 +65,7 @@ static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
float *array;
int size;
+ curvemapping_initialize(node->storage);
curvemapping_table_RGBA(node->storage, &array, &size);
return GPU_stack_link(mat, "curves_vec", in, out, GPU_texture(size, array));
}
@@ -120,6 +121,8 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
{
float *array;
int size;
+
+ curvemapping_initialize(node->storage);
curvemapping_table_RGBA(node->storage, &array, &size);
return GPU_stack_link(mat, "curves_rgb", in, out, GPU_texture(size, array));
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c
index a56d69a6657..35e14c592a7 100644
--- a/source/blender/nodes/texture/nodes/node_texture_curves.c
+++ b/source/blender/nodes/texture/nodes/node_texture_curves.c
@@ -49,6 +49,7 @@ static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNU
if (node->custom1 < node->custom2)
fac = (p->cfra - node->custom1)/(float)(node->custom2-node->custom1);
+ curvemapping_initialize(node->storage);
fac = curvemapping_evaluateF(node->storage, 0, fac);
out[0] = CLAMPIS(fac, 0.0f, 1.0f);
}