diff options
author | Matt Ebb <matt@mke3.net> | 2008-06-17 08:18:34 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2008-06-17 08:18:34 +0400 |
commit | 4c391a0c30018917f6173d1200efcb93c02211f5 (patch) | |
tree | 9435ae13a8353ad8ff3891639bbc983c612e536d /source | |
parent | 6be46f9ee3c29da2022e14bf812a5dac172453cb (diff) |
* Simple addition to math node (comp and shading): Greater Than and Less Than modes.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_math.c | 18 | ||||
-rw-r--r-- | source/blender/nodes/intern/SHD_nodes/SHD_math.c | 18 | ||||
-rw-r--r-- | source/blender/src/drawnode.c | 2 |
3 files changed, 35 insertions, 3 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_math.c b/source/blender/nodes/intern/CMP_nodes/CMP_math.c index e317998b5fc..d00ce18a44f 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_math.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_math.c @@ -131,7 +131,23 @@ static void do_math(bNode *node, float *out, float *in, float *in2) { out[0]= (int)(in[0] + 0.5f); } - break; + break; + case 15: /* Less Than */ + { + if( in[0] < in2[0] ) + out[0]= 1.0f; + else + out[0]= 0.0f; + } + break; + case 16: /* Greater Than */ + { + if( in[0] > in2[0] ) + out[0]= 1.0f; + else + out[0]= 0.0f; + } + break; } } diff --git a/source/blender/nodes/intern/SHD_nodes/SHD_math.c b/source/blender/nodes/intern/SHD_nodes/SHD_math.c index 95162e508d5..2e156cf12bf 100644 --- a/source/blender/nodes/intern/SHD_nodes/SHD_math.c +++ b/source/blender/nodes/intern/SHD_nodes/SHD_math.c @@ -174,7 +174,23 @@ bNodeStack **out) else out[0]->vec[0]= (int)(in[1]->vec[0] + 0.5f); } - break; + break; + case 15: /* Less Than */ + { + if( in[0]->vec[0] < in[1]->vec[0] ) + out[0]->vec[0]= 1.0f; + else + out[0]->vec[0]= 0.0f; + } + break; + case 16: /* Greater Than */ + { + if( in[0]->vec[0] > in[1]->vec[0] ) + out[0]->vec[0]= 1.0f; + else + out[0]->vec[0]= 0.0f; + } + break; } } diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c index cea33685744..1169062fdd0 100644 --- a/source/blender/src/drawnode.c +++ b/source/blender/src/drawnode.c @@ -517,7 +517,7 @@ static int node_buts_math(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *b if(block) { uiBut *bt; - bt=uiDefButS(block, MENU, B_NODE_EXEC, "Add %x0|Subtract %x1|Multiply %x2|Divide %x3|Sine %x4|Cosine %x5|Tangent %x6|Arcsine %x7|Arccosine %x8|Arctangent %x9|Power %x10|Logarithm %x11|Minimum %x12|Maximum %x13|Round %x14", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, ""); + bt=uiDefButS(block, MENU, B_NODE_EXEC, "Add %x0|Subtract %x1|Multiply %x2|Divide %x3|Sine %x4|Cosine %x5|Tangent %x6|Arcsine %x7|Arccosine %x8|Arctangent %x9|Power %x10|Logarithm %x11|Minimum %x12|Maximum %x13|Round %x14|Less Than %x15|Greater Than %x16", butr->xmin, butr->ymin, butr->xmax-butr->xmin, 20, &node->custom1, 0, 0, 0, 0, ""); uiButSetFunc(bt, node_but_title_cb, node, bt); } return 20; |