Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2012-08-07 14:54:50 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2012-08-07 14:54:50 +0400
commit9388d0491131e77dd8ff6e7b2960262c3378ab14 (patch)
tree5bd140176c129f3bbce0fb4bcac06853bdda4c3c /source/blender/blenkernel/intern/particle.c
parent5bcdecd72b24d337d53dd5da37eecb942449abc1 (diff)
Fix for particle influence textures. These now work with "Particle/Strand" input coordinates, mapping the relative particle index into the [-1, 1] Y-coordinate range.
Diffstat (limited to 'source/blender/blenkernel/intern/particle.c')
-rw-r--r--source/blender/blenkernel/intern/particle.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index c8b07e2ec11..ac0625d1bad 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -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;
}