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.
This commit is contained in:
Lukas Tönne 2014-07-08 13:44:58 +02:00
parent a5902fb276
commit 06d943cfd6
3 changed files with 12 additions and 2 deletions

@ -1 +1 @@
Subproject commit 9948cd6025f29fad12eaf6d3b0e738dfb2b50d4a
Subproject commit 59ff66fa7aca6a56dfa516ee4a456428516d2c6f

@ -1 +1 @@
Subproject commit 0bd307ae8cc7746b433c0baf9be13dc662b47f08
Subproject commit 9c1b7252bb510cc527c4ef2fd5aa3b586d095e98

View File

@ -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] */