[Bf-blender-cvs] [849ea4b] alembic: Removed redundant particle matrix calculation when writing hair caches.

Lukas Tönne noreply at git.blender.org
Fri May 15 12:15:02 CEST 2015


Commit: 849ea4b818c3680cae19b68551d5549dbb0981e5
Author: Lukas Tönne
Date:   Fri May 15 12:13:52 2015 +0200
Branches: alembic
https://developer.blender.org/rB849ea4b818c3680cae19b68551d5549dbb0981e5

Removed redundant particle matrix calculation when writing hair caches.

This could give a significant improvement in cache baking speed. The
particle matrix is particularly costly to calculate for highly
subdivided meshes.

===================================================================

M	source/blender/pointcache/alembic/abc_particles.cpp

===================================================================

diff --git a/source/blender/pointcache/alembic/abc_particles.cpp b/source/blender/pointcache/alembic/abc_particles.cpp
index fcc08fe..e74a5ff 100644
--- a/source/blender/pointcache/alembic/abc_particles.cpp
+++ b/source/blender/pointcache/alembic/abc_particles.cpp
@@ -364,8 +364,9 @@ static void hair_children_create_sample(Object *ob, ParticleSystem *psys, Partic
 				
 				for (k = 0; k < numkeys; ++k) {
 					ParticleCacheKey *key = &keys[k];
-					float co[3];
+					
 					/* pathcache keys are in world space, transform to hair root space */
+					float co[3];
 					mul_v3_m4v3(co, imat, key->co);
 					
 					sample.positions.push_back(V3f(co[0], co[1], co[2]));
@@ -527,14 +528,12 @@ static void hair_create_sample(Object *ob, DerivedMesh *dm, ParticleSystem *psys
 		
 		for (k = 0; k < numverts; ++k) {
 			HairKey *key = &pa->hair[k];
-			float hairmat[4][4];
-			float co[3];
 			
 			/* hair keys are in "hair space" relative to the mesh,
 			 * store them in object space for compatibility and to avoid
 			 * complexities of how particles work.
 			 */
-			psys_mat_hair_to_object(ob, dm, psys->part->from, pa, hairmat);
+			float co[3];
 			mul_v3_m4v3(co, hairmat, key->co);
 			
 			sample.positions.push_back(V3f(co[0], co[1], co[2]));




More information about the Bf-blender-cvs mailing list