Fix for part of bug #12075: gamma node generated nan's on negative input.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 22 May 2008 14:56:32 +0000 (14:56 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 22 May 2008 14:56:32 +0000 (14:56 +0000)
source/blender/nodes/intern/CMP_nodes/CMP_gamma.c

index 6cd1c5981a6300346ff4643b22db9746af98a8a9..ff9e2b716ce902be6ad317c7a02e9326ab16522e 100644 (file)
@@ -46,7 +46,8 @@ static void do_gamma(bNode *node, float *out, float *in, float *fac)
 {
        int i=0;
        for(i=0; i<3; i++) {
-               out[i] = pow(in[i],fac[0]);
+               /* check for negative to avoid nan's */
+               out[i] = (in[0] > 0.0f)? pow(in[i],fac[0]): in[0];
        }
        out[3] = in[3];
 }