Fix for particle influence textures. These now work with "Particle/Strand" input...
authorLukas Toenne <lukas.toenne@googlemail.com>
Tue, 7 Aug 2012 10:54:50 +0000 (10:54 +0000)
committerLukas Toenne <lukas.toenne@googlemail.com>
Tue, 7 Aug 2012 10:54:50 +0000 (10:54 +0000)
source/blender/blenkernel/intern/particle.c

index c8b07e2ec1110052cfeae126a881a55aca6a2198..ac0625d1bade33b43dba34ceffded629d1c66df8 100644 (file)
@@ -3876,7 +3876,10 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
                                case TEXCO_PARTICLE:
                                        /* texture coordinates in range [-1, 1] */
                                        texvec[0] = 2.f * (cfra - pa->time) / (pa->dietime - pa->time) - 1.f;
-                                       texvec[1] = 0.f;
+                                       if (sim->psys->totpart > 0)
+                                               texvec[1] = 2.f * (float)(pa - sim->psys->particles) / (float)sim->psys->totpart - 1.f;
+                                       else
+                                               texvec[1] = 0.0f;
                                        texvec[2] = 0.f;
                                        break;
                        }