diff options
Diffstat (limited to 'source')
5 files changed, 21 insertions, 8 deletions
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 77d31a900d4..8b40379f88d 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -99,6 +99,7 @@ typedef struct { int number_of_rays; float bias; int raytrace_structure; + int octree_resolution; } MultiresBakeJob; static int multiresbake_check(bContext *C, wmOperator *op) @@ -317,6 +318,7 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op) bkr.bias = scene->r.bake_biasdist; bkr.number_of_rays = scene->r.bake_rays_number; bkr.raytrace_structure = scene->r.raytrace_structure; + bkr.octree_resolution = scene->r.ocres; /* create low-resolution DM (to bake to) and hi-resolution DM (to bake from) */ bkr.hires_dm = multiresbake_create_hiresdm(scene, ob, &bkr.tot_lvl, &bkr.simple); @@ -353,6 +355,7 @@ static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj) bkj->bias = scene->r.bake_biasdist; bkj->number_of_rays = scene->r.bake_rays_number; bkj->raytrace_structure = scene->r.raytrace_structure; + bkj->octree_resolution = scene->r.ocres; CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { @@ -418,6 +421,7 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa bkr.bias = bkj->bias; bkr.number_of_rays = bkj->number_of_rays; bkr.raytrace_structure = bkj->raytrace_structure; + bkr.octree_resolution = bkj->octree_resolution; RE_multires_bake_images(&bkr); diff --git a/source/blender/render/extern/include/RE_multires_bake.h b/source/blender/render/extern/include/RE_multires_bake.h index 31fe93981b3..5e8ebdd8a18 100644 --- a/source/blender/render/extern/include/RE_multires_bake.h +++ b/source/blender/render/extern/include/RE_multires_bake.h @@ -49,6 +49,7 @@ typedef struct MultiresBakeRender { int baked_objects, baked_faces; int raytrace_structure; + int octree_resolution; short *stop; short *do_update; diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index 921f1173039..88b639c4ba9 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -83,7 +83,7 @@ int get_sample_layers(struct RenderPart *pa, struct RenderLayer *rl, struct Rend /* -------- ray.c ------- */ -struct RayObject *RE_rayobject_create(struct Render *re, int type, int size); +struct RayObject *RE_rayobject_create(int type, int size, int octree_resolution); extern void freeraytree(Render *re); extern void makeraytree(Render *re); diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c index edc0718ccdb..0eb0c9a51c3 100644 --- a/source/blender/render/intern/source/multires_bake.c +++ b/source/blender/render/intern/source/multires_bake.c @@ -869,7 +869,7 @@ static void create_ao_raytree(MultiresBakeRender *bkr, MAOBakeData *ao_data) face_side = (grid_size << 1) - 1; num_faces = num_grids * (grid_size - 1) * (grid_size - 1); - raytree = ao_data->raytree = RE_rayobject_create(NULL, bkr->raytrace_structure, num_faces); + raytree = ao_data->raytree = RE_rayobject_create(bkr->raytrace_structure, num_faces, bkr->octree_resolution); face = ao_data->rayfaces = (RayFace *) MEM_callocN(num_faces * sizeof(RayFace), "ObjectRen faces"); for (i = 0; i < num_grids; i++) { diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 1224edd5591..fb9eb59cbbf 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -94,7 +94,7 @@ static void RE_rayobject_config_control(RayObject *r, Render *re) } } -RayObject* RE_rayobject_create(Render *re, int type, int size) +RayObject *RE_rayobject_create(int type, int size, int octree_resolution) { RayObject * res = NULL; @@ -117,7 +117,7 @@ RayObject* RE_rayobject_create(Render *re, int type, int size) if (type == R_RAYSTRUCTURE_OCTREE) //TODO dynamic ocres - res = RE_rayobject_octree_create(re ? re->r.ocres : 128, size); + res = RE_rayobject_octree_create(octree_resolution, size); else if (type == R_RAYSTRUCTURE_BLIBVH) res = RE_rayobject_blibvh_create(size); else if (type == R_RAYSTRUCTURE_VBVH) @@ -129,10 +129,18 @@ RayObject* RE_rayobject_create(Render *re, int type, int size) else res = RE_rayobject_vbvh_create(size); //Fallback + return res; +} + +static RayObject* rayobject_create(Render *re, int type, int size) +{ + RayObject * res = NULL; + + res = RE_rayobject_create(type, size, re->r.ocres); - if (res && re) + if (res) RE_rayobject_config_control(res, re); - + return res; } @@ -240,7 +248,7 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi) return NULL; //Create Ray cast accelaration structure - raytree = RE_rayobject_create( re, re->r.raytrace_structure, faces ); + raytree = rayobject_create( re, re->r.raytrace_structure, faces ); if ( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) ) vlakprimitive = obr->rayprimitives = (VlakPrimitive*)MEM_callocN(faces*sizeof(VlakPrimitive), "ObjectRen primitives"); else @@ -334,7 +342,7 @@ static void makeraytree_single(Render *re) } //Create raytree - raytree = re->raytree = RE_rayobject_create( re, re->r.raytrace_structure, faces+special ); + raytree = re->raytree = rayobject_create( re, re->r.raytrace_structure, faces+special ); if ( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) ) { vlakprimitive = re->rayprimitives = (VlakPrimitive*)MEM_callocN(faces*sizeof(VlakPrimitive), "Raytrace vlak-primitives"); |