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:
authorMitchell Stokes <mogurijin@gmail.com>2011-07-29 10:32:30 +0400
committerMitchell Stokes <mogurijin@gmail.com>2011-07-29 10:32:30 +0400
commitb46d8955509e805f06b76a6fd800ecb4edee113b (patch)
tree7ed0b1a3b5d04ab48d3e9062ff02ce54961ecb06 /source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
parent6960127d2609620d52620539388ada5cb466bab2 (diff)
parent26589497529ca3c8da85391d4976d286a371e258 (diff)
Merging r36529-38806bge_components
Diffstat (limited to 'source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
index 151850105b7..55d77a902b9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorMatte.c
@@ -49,16 +49,24 @@ static bNodeSocketType cmp_node_color_out[]={
static void do_color_key(bNode *node, float *out, float *in)
{
+ float h_wrap;
NodeChroma *c;
c=node->storage;
VECCOPY(out, in);
- if(fabs(in[0]-c->key[0]) < c->t1 &&
- fabs(in[1]-c->key[1]) < c->t2 &&
- fabs(in[2]-c->key[2]) < c->t3)
- {
+ if(
+ /* do hue last because it needs to wrap, and does some more checks */
+
+ /* sat */ (fabs(in[1]-c->key[1]) < c->t2) &&
+ /* val */ (fabs(in[2]-c->key[2]) < c->t3) &&
+
+ /* multiply by 2 because it wraps on both sides of the hue,
+ * otherwise 0.5 would key all hue's */
+
+ /* hue */ ((h_wrap= 2.0f * fabs(in[0]-c->key[0])) < c->t1 || (2.0f - h_wrap) < c->t1)
+ ) {
out[3]=0.0; /*make transparent*/
}