[Bf-blender-cvs] [47c1112] master: Make internal functions of point density independent from Render

Sergey Sharybin noreply at git.blender.org
Sat Mar 28 22:35:04 CET 2015


Commit: 47c1112e6e09634b8e394102bacc74ca12818a62
Author: Sergey Sharybin
Date:   Sun Mar 29 02:34:44 2015 +0500
Branches: master
https://developer.blender.org/rB47c1112e6e09634b8e394102bacc74ca12818a62

Make internal functions of point density independent from Render

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

M	source/blender/render/intern/source/pointdensity.c

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

diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index 320ab07..3a1f1fb 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -111,14 +111,20 @@ static void alloc_point_data(PointDensity *pd, int total_particles, int point_da
 	}
 }
 
-static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, ParticleSystem *psys)
+static void pointdensity_cache_psys(Scene *scene,
+                                    PointDensity *pd,
+                                    Object *ob,
+                                    ParticleSystem *psys,
+                                    float viewmat[4][4],
+                                    float winmat[4][4],
+                                    int winx, int winy)
 {
 	DerivedMesh *dm;
 	ParticleKey state;
 	ParticleCacheKey *cache;
 	ParticleSimulationData sim = {NULL};
 	ParticleData *pa = NULL;
-	float cfra = BKE_scene_frame_get(re->scene);
+	float cfra = BKE_scene_frame_get(scene);
 	int i /*, childexists*/ /* UNUSED */;
 	int total_particles, offset = 0;
 	int data_used = point_data_used(pd);
@@ -130,16 +136,16 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
 	}
 
 	/* Just to create a valid rendering context for particles */
-	psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy, 0);
+	psys_render_set(ob, psys, viewmat, winmat, winx, winy, 0);
 
-	dm = mesh_create_derived_render(re->scene, ob, CD_MASK_BAREMESH | CD_MASK_MTFACE | CD_MASK_MCOL);
+	dm = mesh_create_derived_render(scene, ob, CD_MASK_BAREMESH | CD_MASK_MTFACE | CD_MASK_MCOL);
 
 	if ( !psys_check_enabled(ob, psys)) {
 		psys_render_restore(ob, psys);
 		return;
 	}
 
-	sim.scene = re->scene;
+	sim.scene = scene;
 	sim.ob = ob;
 	sim.psys = psys;
 
@@ -275,7 +281,11 @@ static void pointdensity_cache_object(Scene *scene, PointDensity *pd, Object *ob
 
 }
 
-void cache_pointdensity(Render *re, PointDensity *pd)
+static void cache_pointdensity_ex(Scene *scene,
+                                  PointDensity *pd,
+                                  float viewmat[4][4],
+                                  float winmat[4][4],
+                                  int winx, int winy)
 {
 	if (pd == NULL) {
 		return;
@@ -299,15 +309,20 @@ void cache_pointdensity(Render *re, PointDensity *pd)
 			return;
 		}
 
-		pointdensity_cache_psys(re, pd, ob, psys);
+		pointdensity_cache_psys(scene, pd, ob, psys, viewmat, winmat, winx, winy);
 	}
 	else if (pd->source == TEX_PD_OBJECT) {
 		Object *ob = pd->object;
 		if (ob && ob->type == OB_MESH)
-			pointdensity_cache_object(re->scene, pd, ob);
+			pointdensity_cache_object(scene, pd, ob);
 	}
 }
 
+void cache_pointdensity(Render *re, PointDensity *pd)
+{
+	cache_pointdensity_ex(re->scene, pd, re->viewmat, re->winmat, re->winx, re->winy);
+}
+
 void free_pointdensity(PointDensity *pd)
 {
 	if (pd == NULL) {




More information about the Bf-blender-cvs mailing list