Fix T65844: wrong eevee hair when vertex colors are used as input
authorPhilipp Oeser <info@graphics-engineer.com>
Sat, 15 Jun 2019 21:37:55 +0000 (23:37 +0200)
committerPhilipp Oeser <info@graphics-engineer.com>
Sun, 16 Jun 2019 06:34:19 +0000 (08:34 +0200)
- was using wrong offset [index instead of index * 4]
- also minor correction to variable naming

Reviewers: fclem

Differential Revision: https://developer.blender.org/D5082

source/blender/draw/intern/draw_cache_impl_particles.c

index 2c66215..467626b 100644 (file)
@@ -318,7 +318,7 @@ static void particle_calculate_parent_uvs(ParticleSystem *psys,
 
 static void particle_calculate_parent_mcol(ParticleSystem *psys,
                                            ParticleSystemModifierData *psmd,
-                                           const int num_uv_layers,
+                                           const int num_col_layers,
                                            const int parent_index,
                                            /*const*/ MCol **mcols,
                                            MCol *r_mcol)
@@ -340,8 +340,8 @@ static void particle_calculate_parent_mcol(ParticleSystem *psys,
   }
   if (num != DMCACHE_NOTFOUND && num != DMCACHE_ISCHILD) {
     MFace *mface = &mesh_final->mface[num];
-    for (int j = 0; j < num_uv_layers; j++) {
-      psys_interpolate_mcol(mcols[j] + num, mface->v4, particle->fuv, &r_mcol[j]);
+    for (int j = 0; j < num_col_layers; j++) {
+      psys_interpolate_mcol(mcols[j] + num * 4, mface->v4, particle->fuv, &r_mcol[j]);
     }
   }
 }
@@ -392,7 +392,7 @@ static void particle_interpolate_children_mcol(ParticleSystem *psys,
   if (num != DMCACHE_NOTFOUND) {
     MFace *mface = &mesh_final->mface[num];
     for (int j = 0; j < num_col_layers; j++) {
-      psys_interpolate_mcol(mcols[j] + num, mface->v4, particle->fuv, &r_mcol[j]);
+      psys_interpolate_mcol(mcols[j] + num * 4, mface->v4, particle->fuv, &r_mcol[j]);
     }
   }
 }