From 06d943cfd684176e10c2a31b8ea66dfb2221e870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Tue, 8 Jul 2014 13:44:58 +0200 Subject: 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. --- source/blender/blenkernel/intern/particle.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source') 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] */ -- cgit v1.2.3