diff options
Diffstat (limited to 'source/blender/nodes/intern/TEX_nodes/TEX_math.c')
-rw-r--r-- | source/blender/nodes/intern/TEX_nodes/TEX_math.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/nodes/intern/TEX_nodes/TEX_math.c b/source/blender/nodes/intern/TEX_nodes/TEX_math.c index 7e1c54b6e47..3043cd756d0 100644 --- a/source/blender/nodes/intern/TEX_nodes/TEX_math.c +++ b/source/blender/nodes/intern/TEX_nodes/TEX_math.c @@ -106,11 +106,17 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor break; case 10: /* Power */ { - /* Don't want any imaginary numbers... */ - if( in0 >= 0 ) - *out= pow(in0, in1); - else - *out= 0.0; + /* Only raise negative numbers by full integers */ + if( in0 >= 0 ) { + out[0]= pow(in0, in1); + } else { + float y_mod_1 = fmod(in1, 1); + if (y_mod_1 > 0.999 || y_mod_1 < 0.001) { + *out = pow(in0, round(in1)); + } else { + *out = 0.0; + } + } } break; case 11: /* Logarithm */ |