[Bf-blender-cvs] [0868ccae138] blender2.8: Draw manager: Move UVs interpolation of child particles to a function
Sergey Sharybin
noreply at git.blender.org
Wed May 9 10:35:01 CEST 2018
Commit: 0868ccae1383b7989de44ed45d7bb64145b4bf72
Author: Sergey Sharybin
Date: Tue May 8 14:23:55 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0868ccae1383b7989de44ed45d7bb64145b4bf72
Draw manager: Move UVs interpolation of child particles to a function
===================================================================
M source/blender/draw/intern/draw_cache_impl_particles.c
===================================================================
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index 19b0949d7ea..d50a45a9b3b 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -203,6 +203,26 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys,
}
}
+/* Used by interpolated children. */
+static void particle_interpolate_children_uvs(ParticleSystem *psys,
+ ParticleSystemModifierData *psmd,
+ const int num_uv_layers,
+ const int child_index,
+ /*const*/ MTFace **mtfaces,
+ float (*r_uv)[2])
+{
+ ChildParticle *particle = &psys->child[child_index];
+ int num = particle->num;
+ if (num != DMCACHE_NOTFOUND) {
+ MFace *mface = psmd->dm_final->getTessFaceData(
+ psmd->dm_final, num, CD_MFACE);
+ for (int j = 0; j < num_uv_layers; j++) {
+ psys_interpolate_uvs(
+ mtfaces[j] + num, mface->v4, particle->fuv, r_uv[j]);
+ }
+ }
+}
+
/* Gwn_Batch cache usage. */
static void particle_batch_cache_ensure_pos_and_seg(ParticleSystem *psys, ModifierData *md, ParticleBatchCache *cache)
{
@@ -342,14 +362,8 @@ static void particle_batch_cache_ensure_pos_and_seg(ParticleSystem *psys, Modifi
uv = MEM_callocN(sizeof(*uv) * num_uv_layers, "Particle UVs");
}
if (ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
- ChildParticle *particle = &psys->child[i];
- int num = particle->num;
- if (num != DMCACHE_NOTFOUND) {
- MFace *mface = psmd->dm_final->getTessFaceData(psmd->dm_final, num, CD_MFACE);
- for (int j = 0; j < num_uv_layers; j++) {
- psys_interpolate_uvs(mtfaces[j] + num, mface->v4, particle->fuv, uv[j]);
- }
- }
+ particle_interpolate_children_uvs(
+ psys, psmd, num_uv_layers, i, mtfaces, uv);
}
}
else if (!parent_uvs[psys->child[i].parent]) {
More information about the Bf-blender-cvs
mailing list