Applied patch by Alexander Kuznetsov for bug 26373: math node 'round' mode was not working correctly for negative numbers.
This commit is contained in:
@@ -140,7 +140,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
|
||||
break;
|
||||
case 14: /* Round */
|
||||
{
|
||||
out[0]= (int)(in[0] + 0.5f);
|
||||
out[0]= (out[0]<0)?(int)(in[0] - 0.5f):(int)(in[0] + 0.5f);
|
||||
}
|
||||
break;
|
||||
case 15: /* Less Than */
|
||||
|
||||
@@ -174,9 +174,9 @@ bNodeStack **out)
|
||||
case 14: /* Round */
|
||||
{
|
||||
if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
|
||||
out[0]->vec[0]= (int)(in[0]->vec[0] + 0.5f);
|
||||
out[0]->vec[0]= (in[0]->vec[0]<0)?(int)(in[0]->vec[0] - 0.5f):(int)(in[0]->vec[0] + 0.5f);
|
||||
else
|
||||
out[0]->vec[0]= (int)(in[1]->vec[0] + 0.5f);
|
||||
out[0]->vec[0]= (in[1]->vec[0]<0)?(int)(in[1]->vec[0] - 0.5f):(int)(in[1]->vec[0] + 0.5f);
|
||||
}
|
||||
break;
|
||||
case 15: /* Less Than */
|
||||
|
||||
@@ -151,7 +151,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
|
||||
break;
|
||||
case 14: /* Round */
|
||||
{
|
||||
*out= (int)(in0 + 0.5f);
|
||||
*out= (in0<0)?(int)(in0 - 0.5f):(int)(in0 + 0.5f);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user