Fix for [#25797] Hair partcle crash when vertexgroup length enabled
authorJanne Karhu <jhkarh@gmail.com>
Wed, 26 Jan 2011 13:02:47 +0000 (13:02 +0000)
committerJanne Karhu <jhkarh@gmail.com>
Wed, 26 Jan 2011 13:02:47 +0000 (13:02 +0000)
* Rounding errors could give vgroup weights of slightly over 1.0 to particles in some cases.

source/blender/blenkernel/intern/particle.c

index 87c39abd56157a07441af728b25a08f83080f4e7..61bedb0b2309edbd802312afda612cbe2ac1ec5e 100644 (file)
@@ -1001,6 +1001,8 @@ static float interpolate_particle_value(float v1, float v2, float v3, float v4,
        value= w[0]*v1 + w[1]*v2 + w[2]*v3;
        if(four)
                value += w[3]*v4;
+
+       CLAMP(value, 0.f, 1.f);
        
        return value;
 }