Merge branch 'blender-v3.1-release'

This commit is contained in:
Jacques Lucke 2022-03-02 17:13:57 +01:00
commit 037e1ad140
4 changed files with 38 additions and 9 deletions

View File

@ -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,

View File

@ -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);
}
}
}

View File

@ -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;

View File

@ -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,