diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-03-29 00:34:44 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-03-29 00:34:44 +0300 |
commit | 47c1112e6e09634b8e394102bacc74ca12818a62 (patch) | |
tree | c10b8da6868507a1d58a1a8a1560136a2e317cd4 /source/blender/render/intern | |
parent | 94b01931963a725b9a85a767d9bcaa25c2eb550a (diff) |
Make internal functions of point density independent from Render
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r-- | source/blender/render/intern/source/pointdensity.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 320ab07dd29..3a1f1fbb744 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) { |