diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-07-08 15:44:58 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-07-08 15:44:58 +0400 |
commit | 06d943cfd684176e10c2a31b8ea66dfb2221e870 (patch) | |
tree | f96d31e8373d4d73f7e251ee8531420d213352ed /source | |
parent | a5902fb276933278bd8db86a9b1938fe649662d8 (diff) |
Fix T40983 Particle Texture use of generated coordinates is wrong.
Particle texture eval was not taking the actual texture space for orco/
generated textures into account at all.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 50152c7d053..8161f9d8875 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3890,6 +3890,8 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti } void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTexture *ptex, int event, float cfra) { + Object *ob = sim->ob; + Mesh *me = (Mesh *)ob->data; ParticleSettings *part = sim->psys->part; MTex **mtexp = part->mtex; MTex *mtex; @@ -3929,6 +3931,14 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex /* no break, failed to get uv's, so let's try orco's */ case TEXCO_ORCO: psys_particle_on_emitter(sim->psmd, sim->psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, 0, 0, 0, texvec, 0); + + if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) { + BKE_mesh_texspace_calc(me); + } + sub_v3_v3(texvec, me->loc); + if (me->size[0] != 0.0f) texvec[0] /= me->size[0]; + if (me->size[1] != 0.0f) texvec[1] /= me->size[1]; + if (me->size[2] != 0.0f) texvec[2] /= me->size[2]; break; case TEXCO_PARTICLE: /* texture coordinates in range [-1, 1] */ |