Fix GLSL compatible_pow to give 1.0 for 0 ^ 0

This commit is contained in:
Sv. Lockal 2014-01-14 22:58:07 +04:00
parent 1c49eb0072
commit 6e8321f2c0
1 changed files with 3 additions and 0 deletions

View File

@ -6,6 +6,9 @@ float exp_blender(float f)
float compatible_pow(float x, float y)
{
if(y == 0.0) /* x^0 -> 1, including 0^0 */
return 1.0;
/* glsl pow doesn't accept negative x */
if(x < 0.0) {
if(mod(-y, 2.0) == 0.0)