diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_particle.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 33 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_distribute.c | 5 | ||||
-rw-r--r-- | source/blender/io/alembic/exporter/abc_writer_hair.cc | 6 |
4 files changed, 38 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index d1fabdf4265..21d60bcc5c5 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -578,7 +578,8 @@ void psys_get_texture(struct ParticleSimulationData *sim, /** * Interpolate a location on a face based on face coordinates. */ -void psys_interpolate_face(struct MVert *mvert, +void psys_interpolate_face(struct Mesh *mesh, + struct MVert *mvert, const float (*vert_normals)[3], struct MFace *mface, struct MTFace *tface, diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 56d640b8ac0..c47b22dcd34 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1657,7 +1657,8 @@ static void interpolate_pathcache(ParticleCacheKey *first, float t, ParticleCach /* Particles on a dm */ /************************************************/ -void psys_interpolate_face(MVert *mvert, +void psys_interpolate_face(Mesh *mesh, + MVert *mvert, const float (*vert_normals)[3], MFace *mface, MTFace *tface, @@ -1777,6 +1778,7 @@ void psys_interpolate_face(MVert *mvert, else { interp_v3_v3v3v3(orco, o1, o2, o3, w); } + BKE_mesh_orco_verts_transform(mesh, (float(*)[3])orco, 1, true); } else { copy_v3_v3(orco, vec); @@ -2121,6 +2123,7 @@ void psys_particle_on_dm(Mesh *mesh_final, if (orco) { if (orcodata) { copy_v3_v3(orco, orcodata[mapindex]); + BKE_mesh_orco_verts_transform(mesh_final, (float(*)[3])orco, 1, true); } else { copy_v3_v3(orco, vec); @@ -2146,8 +2149,18 @@ void psys_particle_on_dm(Mesh *mesh_final, } if (from == PART_FROM_VOLUME) { - psys_interpolate_face( - mvert, vert_normals, mface, mtface, orcodata, mapfw, vec, tmpnor, utan, vtan, orco); + psys_interpolate_face(mesh_final, + mvert, + vert_normals, + mface, + mtface, + orcodata, + mapfw, + vec, + tmpnor, + utan, + vtan, + orco); if (nor) { copy_v3_v3(nor, tmpnor); } @@ -2159,8 +2172,18 @@ void psys_particle_on_dm(Mesh *mesh_final, add_v3_v3(vec, tmpnor); } else { - psys_interpolate_face( - mvert, vert_normals, mface, mtface, orcodata, mapfw, vec, nor, utan, vtan, orco); + psys_interpolate_face(mesh_final, + mvert, + vert_normals, + mface, + mtface, + orcodata, + mapfw, + vec, + nor, + utan, + vtan, + orco); } } } diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index aa209102522..83fb52ce1ef 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -611,7 +611,7 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa, tot = mesh->totface; psys_interpolate_face( - mvert, BKE_mesh_vertex_normals_ensure(mesh), mface, 0, 0, pa->fuv, co, nor, 0, 0, 0); + mesh, mvert, BKE_mesh_vertex_normals_ensure(mesh), mface, 0, 0, pa->fuv, co, nor, 0, 0, 0); normalize_v3(nor); negate_v3(nor); @@ -942,6 +942,9 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, } } + /* After this #BKE_mesh_orco_verts_transform can be used safely from multiple threads. */ + BKE_mesh_texspace_ensure(final_mesh); + /* Create trees and original coordinates if needed */ if (from == PART_FROM_CHILD) { distr = PART_DISTR_RAND; diff --git a/source/blender/io/alembic/exporter/abc_writer_hair.cc b/source/blender/io/alembic/exporter/abc_writer_hair.cc index bdf11857580..d12eaf07e29 100644 --- a/source/blender/io/alembic/exporter/abc_writer_hair.cc +++ b/source/blender/io/alembic/exporter/abc_writer_hair.cc @@ -160,7 +160,8 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context, psys_interpolate_uvs(tface, face->v4, pa->fuv, r_uv); uv_values.emplace_back(r_uv[0], r_uv[1]); - psys_interpolate_face(mverts, + psys_interpolate_face(mesh, + mverts, vert_normals, face, tface, @@ -275,7 +276,8 @@ void ABCHairWriter::write_hair_child_sample(const HierarchyContext &context, psys_interpolate_uvs(tface, face->v4, pc->fuv, r_uv); uv_values.emplace_back(r_uv[0], r_uv[1]); - psys_interpolate_face(mverts, + psys_interpolate_face(mesh, + mverts, vert_normals, face, tface, |