diff options
Diffstat (limited to 'source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c')
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c b/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c index 2694c0559d7..5f7613464c1 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_distanceMatte.c @@ -53,35 +53,35 @@ static void do_distance_matte(bNode *node, float *out, float *in) { NodeChroma *c= (NodeChroma *)node->storage; float tolerence=c->t1; - float falloff=c->t2; + float falloff=c->t2; float distance; - float alpha; - - distance=sqrt((c->key[0]-in[0])*(c->key[0]-in[0]) + + float alpha; + + distance=sqrt((c->key[0]-in[0])*(c->key[0]-in[0]) + (c->key[1]-in[1])*(c->key[1]-in[1]) + (c->key[2]-in[2])*(c->key[2]-in[2])); - VECCOPY(out, in); - - /*make 100% transparent */ - if(distance < tolerence) { - out[3]=0.0; - } - /*in the falloff region, make partially transparent */ - else if(distance < falloff+tolerence){ - distance=distance-tolerence; - alpha=distance/falloff; - /*only change if more transparent than before */ - if(alpha < in[3]) { - out[3]=alpha; - } - else { /* leave as before */ - out[3]=in[3]; - } - } - else { - out[3]=in[3]; - } + VECCOPY(out, in); + + /*make 100% transparent */ + if(distance < tolerence) { + out[3]=0.0; + } + /*in the falloff region, make partially transparent */ + else if(distance < falloff+tolerence){ + distance=distance-tolerence; + alpha=distance/falloff; + /*only change if more transparent than before */ + if(alpha < in[3]) { + out[3]=alpha; + } + else { /* leave as before */ + out[3]=in[3]; + } + } + else { + out[3]=in[3]; + } } static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out) @@ -124,10 +124,10 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac static void node_composit_init_distance_matte(bNode *node) { - NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); - node->storage= c; - c->t1= 0.1f; - c->t2= 0.1f; + NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma"); + node->storage= c; + c->t1= 0.1f; + c->t2= 0.1f; } void register_node_type_cmp_distance_matte(ListBase *lb) |