diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-08 15:23:55 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-09 11:34:45 +0300 |
commit | 0868ccae1383b7989de44ed45d7bb64145b4bf72 (patch) | |
tree | 0cad66de7841698bf5ca6ea57327b2990f3939b1 /source/blender/draw/intern/draw_cache_impl_particles.c | |
parent | e3eaca976a334c34f811d2f14227f82d4b6d4342 (diff) |
Draw manager: Move UVs interpolation of child particles to a function
Diffstat (limited to 'source/blender/draw/intern/draw_cache_impl_particles.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_particles.c | 30 |
1 files changed, 22 insertions, 8 deletions
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]) { |