Changeset View
Changeset View
Standalone View
Standalone View
source/blender/render/intern/source/convertblender.c
| Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_colortools.h" | #include "BKE_colortools.h" | ||||
| #include "BKE_displist.h" | #include "BKE_displist.h" | ||||
| #include "BKE_depsgraph.h" | #include "BKE_depsgraph.h" | ||||
| #include "BKE_DerivedMesh.h" | #include "BKE_DerivedMesh.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_key.h" | #include "BKE_key.h" | ||||
| #include "BKE_image.h" | #include "BKE_image.h" | ||||
| #include "BKE_lattice.h" | #include "BKE_lattice.h" | ||||
| #include "BKE_localview.h" | |||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_mball.h" | #include "BKE_mball.h" | ||||
| #include "BKE_mesh.h" | #include "BKE_mesh.h" | ||||
| #include "BKE_modifier.h" | #include "BKE_modifier.h" | ||||
| #include "BKE_node.h" | #include "BKE_node.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_particle.h" | #include "BKE_particle.h" | ||||
| ▲ Show 20 Lines • Show All 3,900 Lines • ▼ Show 20 Lines | static void add_lightgroup(Render *re, Group *group, int exclusive) | ||||
| /* it's a bit too many loops in loops... but will survive */ | /* it's a bit too many loops in loops... but will survive */ | ||||
| /* note that 'exclusive' will remove it from the global list */ | /* note that 'exclusive' will remove it from the global list */ | ||||
| for (go= group->gobject.first; go; go= go->next) { | for (go= group->gobject.first; go; go= go->next) { | ||||
| go->lampren= NULL; | go->lampren= NULL; | ||||
| if (is_object_hidden(re, go->ob)) | if (is_object_hidden(re, go->ob)) | ||||
| continue; | continue; | ||||
| /* Lamps ignore local view visibility, only check layers */ | |||||
| if (go->ob->lay & re->lay) { | if (go->ob->lay & re->lay) { | ||||
| if (go->ob && go->ob->type==OB_LAMP) { | if (go->ob && go->ob->type==OB_LAMP) { | ||||
| for (gol= re->lights.first; gol; gol= gol->next) { | for (gol= re->lights.first; gol; gol= gol->next) { | ||||
| if (gol->ob==go->ob) { | if (gol->ob==go->ob) { | ||||
| go->lampren= gol->lampren; | go->lampren= gol->lampren; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 970 Lines • ▼ Show 20 Lines | if (ob->flag & OB_DONE) { | ||||
| if (ob->dup_group) | if (ob->dup_group) | ||||
| add_group_render_dupli_obs(re, ob->dup_group, nolamps, onlyselected, actob, timeoffset, level+1); | add_group_render_dupli_obs(re, ob->dup_group, nolamps, onlyselected, actob, timeoffset, level+1); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void database_init_objects(Render *re, unsigned int renderlay, int nolamps, int onlyselected, Object *actob, int timeoffset) | static void database_init_objects(Render *re, int nolamps, int onlyselected, Object *actob, int timeoffset) | ||||
| { | { | ||||
| Base *base; | Base *base; | ||||
| Object *ob; | Object *ob; | ||||
| Group *group; | Group *group; | ||||
| ObjectInstanceRen *obi; | ObjectInstanceRen *obi; | ||||
| Scene *sce_iter; | Scene *sce_iter; | ||||
| int lay, vectorlay; | int lay, vectorlay; | ||||
| Show All 16 Lines | for (ob= re->main->object.first; ob; ob= ob->id.next) { | ||||
| invert_m4_m4(ob->imat_ren, mat); | invert_m4_m4(ob->imat_ren, mat); | ||||
| copy_m4_m4(ob->imat, ob->imat_ren); | copy_m4_m4(ob->imat, ob->imat_ren); | ||||
| /* each object should only be rendered once */ | /* each object should only be rendered once */ | ||||
| ob->flag &= ~OB_DONE; | ob->flag &= ~OB_DONE; | ||||
| ob->transflag &= ~OB_RENDER_DUPLI; | ob->transflag &= ~OB_RENDER_DUPLI; | ||||
| } | } | ||||
| for (SETLOOPER(re->scene, sce_iter, base)) { | for (SETLOOPER(re->scene, sce_iter, base)) { | ||||
| const bool localview_check = !re->localview || BKE_localview_info_cmp(base->object->localview, *re->localview); | |||||
| ob= base->object; | ob= base->object; | ||||
| /* in the prev/next pass for making speed vectors, avoid creating | /* in the prev/next pass for making speed vectors, avoid creating | ||||
| * objects that are not on a renderlayer with a vector pass, can | * objects that are not on a renderlayer with a vector pass, can | ||||
| * save a lot of time in complex scenes */ | * save a lot of time in complex scenes */ | ||||
| vectorlay= get_vector_renderlayers(re->scene); | vectorlay = get_vector_renderlayers(re->scene); | ||||
| lay= (timeoffset)? renderlay & vectorlay: renderlay; | lay = (timeoffset)? re->lay & vectorlay: re->lay; | ||||
| /* if the object has been restricted from rendering in the outliner, ignore it */ | /* if the object has been restricted from rendering in the outliner, ignore it */ | ||||
| if (is_object_restricted(re, ob)) continue; | if (is_object_restricted(re, ob)) continue; | ||||
| /* OB_DONE means the object itself got duplicated, so was already converted */ | /* OB_DONE means the object itself got duplicated, so was already converted */ | ||||
| if (ob->flag & OB_DONE) { | if (ob->flag & OB_DONE) { | ||||
| /* OB_RENDER_DUPLI means instances for it were already created, now | /* OB_RENDER_DUPLI means instances for it were already created, now | ||||
| * it still needs to create the ObjectRen containing the data */ | * it still needs to create the ObjectRen containing the data */ | ||||
| if (ob->transflag & OB_RENDER_DUPLI) { | if (ob->transflag & OB_RENDER_DUPLI) { | ||||
| if (allow_render_object(re, ob, nolamps, onlyselected, actob)) { | if (allow_render_object(re, ob, nolamps, onlyselected, actob)) { | ||||
| init_render_object(re, ob, NULL, NULL, NULL, timeoffset); | init_render_object(re, ob, NULL, NULL, NULL, timeoffset); | ||||
| ob->transflag &= ~OB_RENDER_DUPLI; | ob->transflag &= ~OB_RENDER_DUPLI; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if ((base->lay & lay) || (ob->type==OB_LAMP && (base->lay & re->lay)) ) { | /* while objects use usual visibility check (layer and localview), lamps only | ||||
| * check layer and render even if they're not included in localview */ | |||||
| else if (((base->lay & lay) && localview_check) || | |||||
| (ob->type == OB_LAMP && (base->lay & re->lay))) | |||||
| { | |||||
| if ((ob->transflag & OB_DUPLI) && (ob->type!=OB_MBALL)) { | if ((ob->transflag & OB_DUPLI) && (ob->type!=OB_MBALL)) { | ||||
| DupliObject *dob; | DupliObject *dob; | ||||
| ListBase *duplilist; | ListBase *duplilist; | ||||
| DupliApplyData *duplilist_apply_data = NULL; | DupliApplyData *duplilist_apply_data = NULL; | ||||
| int i; | int i; | ||||
| /* create list of duplis generated by this object, particle | /* create list of duplis generated by this object, particle | ||||
| * system need to have render settings set for dupli particles */ | * system need to have render settings set for dupli particles */ | ||||
| ▲ Show 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int lay, int use_camera_view) | ||||
| /* XXX add test if dbase was filled already? */ | /* XXX add test if dbase was filled already? */ | ||||
| re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "render db arena"); | re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "render db arena"); | ||||
| re->totvlak=re->totvert=re->totstrand=re->totlamp=re->tothalo= 0; | re->totvlak=re->totvert=re->totstrand=re->totlamp=re->tothalo= 0; | ||||
| re->lights.first= re->lights.last= NULL; | re->lights.first= re->lights.last= NULL; | ||||
| re->lampren.first= re->lampren.last= NULL; | re->lampren.first= re->lampren.last= NULL; | ||||
| re->i.partsdone = false; /* signal now in use for previewrender */ | re->i.partsdone = false; /* signal now in use for previewrender */ | ||||
| /* in localview, lamps are using normal layers, objects only local bits */ | |||||
| if (re->lay & 0xFF000000) | |||||
| lay &= 0xFF000000; | |||||
| /* applies changes fully */ | /* applies changes fully */ | ||||
| if ((re->r.scemode & (R_NO_FRAME_UPDATE|R_BUTS_PREVIEW|R_VIEWPORT_PREVIEW))==0) { | if ((re->r.scemode & (R_NO_FRAME_UPDATE|R_BUTS_PREVIEW|R_VIEWPORT_PREVIEW))==0) { | ||||
| BKE_scene_update_for_newframe(re->eval_ctx, re->main, re->scene, lay); | BKE_scene_update_for_newframe(re->eval_ctx, re->main, re->scene, re->lay); | ||||
| render_update_anim_renderdata(re, &re->scene->r); | render_update_anim_renderdata(re, &re->scene->r); | ||||
| } | } | ||||
| /* if no camera, viewmat should have been set! */ | /* if no camera, viewmat should have been set! */ | ||||
| if (use_camera_view && camera) { | if (use_camera_view && camera) { | ||||
| /* called before but need to call again in case of lens animation from the | /* called before but need to call again in case of lens animation from the | ||||
| * above call to BKE_scene_update_for_newframe, fixes bug. [#22702]. | * above call to BKE_scene_update_for_newframe, fixes bug. [#22702]. | ||||
| * following calls don't depend on 'RE_SetCamera' */ | * following calls don't depend on 'RE_SetCamera' */ | ||||
| Show All 20 Lines | void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int lay, int use_camera_view) | ||||
| /* still bad... doing all */ | /* still bad... doing all */ | ||||
| init_render_textures(re); | init_render_textures(re); | ||||
| copy_v3_v3(amb, &re->wrld.ambr); | copy_v3_v3(amb, &re->wrld.ambr); | ||||
| init_render_materials(re->main, re->r.mode, amb, (re->r.scemode & R_BUTS_PREVIEW) == 0); | init_render_materials(re->main, re->r.mode, amb, (re->r.scemode & R_BUTS_PREVIEW) == 0); | ||||
| set_node_shader_lamp_loop(shade_material_loop); | set_node_shader_lamp_loop(shade_material_loop); | ||||
| /* MAKE RENDER DATA */ | /* MAKE RENDER DATA */ | ||||
| database_init_objects(re, lay, 0, 0, NULL, 0); | database_init_objects(re, 0, 0, NULL, 0); | ||||
| if (!re->test_break(re->tbh)) { | if (!re->test_break(re->tbh)) { | ||||
| set_material_lightgroups(re); | set_material_lightgroups(re); | ||||
| for (sce= re->scene; sce; sce= sce->set) | for (sce= re->scene; sce; sce= sce->set) | ||||
| set_renderlayer_lightgroups(re, sce); | set_renderlayer_lightgroups(re, sce); | ||||
| /* for now some clumsy copying still */ | /* for now some clumsy copying still */ | ||||
| re->i.totvert= re->totvert; | re->i.totvert= re->totvert; | ||||
| re->i.totface= re->totvlak; | re->i.totface= re->totvlak; | ||||
| ▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| copy_m4_m4(mat, re->viewmat); | copy_m4_m4(mat, re->viewmat); | ||||
| } | } | ||||
| /* ------------------------------------------------------------------------- */ | /* ------------------------------------------------------------------------- */ | ||||
| /* Speed Vectors */ | /* Speed Vectors */ | ||||
| /* ------------------------------------------------------------------------- */ | /* ------------------------------------------------------------------------- */ | ||||
| static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int lay, int timeoffset) | static void database_fromscene_vectors(Render *re, Scene *scene, int timeoffset) | ||||
| { | { | ||||
| Object *camera= RE_GetCamera(re); | Object *camera= RE_GetCamera(re); | ||||
| float mat[4][4]; | float mat[4][4]; | ||||
| re->scene= scene; | re->scene= scene; | ||||
| re->lay= lay; | |||||
| /* XXX add test if dbase was filled already? */ | /* XXX add test if dbase was filled already? */ | ||||
| re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "vector render db arena"); | re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "vector render db arena"); | ||||
| re->totvlak=re->totvert=re->totstrand=re->totlamp=re->tothalo= 0; | re->totvlak=re->totvert=re->totstrand=re->totlamp=re->tothalo= 0; | ||||
| re->i.totface=re->i.totvert=re->i.totstrand=re->i.totlamp=re->i.tothalo= 0; | re->i.totface=re->i.totvert=re->i.totstrand=re->i.totlamp=re->i.tothalo= 0; | ||||
| re->lights.first= re->lights.last= NULL; | re->lights.first= re->lights.last= NULL; | ||||
| /* in localview, lamps are using normal layers, objects only local bits */ | |||||
| if (re->lay & 0xFF000000) | |||||
| lay &= 0xFF000000; | |||||
| /* applies changes fully */ | /* applies changes fully */ | ||||
| scene->r.cfra += timeoffset; | scene->r.cfra += timeoffset; | ||||
| BKE_scene_update_for_newframe(re->eval_ctx, re->main, re->scene, lay); | BKE_scene_update_for_newframe(re->eval_ctx, re->main, re->scene, re->lay); | ||||
| /* if no camera, viewmat should have been set! */ | /* if no camera, viewmat should have been set! */ | ||||
| if (camera) { | if (camera) { | ||||
| RE_GetCameraModelMatrix(re, camera, mat); | RE_GetCameraModelMatrix(re, camera, mat); | ||||
| normalize_m4(mat); | normalize_m4(mat); | ||||
| invert_m4(mat); | invert_m4(mat); | ||||
| RE_SetView(re, mat); | RE_SetView(re, mat); | ||||
| } | } | ||||
| /* MAKE RENDER DATA */ | /* MAKE RENDER DATA */ | ||||
| database_init_objects(re, lay, 0, 0, NULL, timeoffset); | database_init_objects(re, 0, 0, NULL, timeoffset); | ||||
| if (!re->test_break(re->tbh)) | if (!re->test_break(re->tbh)) | ||||
| project_renderdata(re, projectverto, (re->r.mode & R_PANORAMA) != 0, 0, 1); | project_renderdata(re, projectverto, (re->r.mode & R_PANORAMA) != 0, 0, 1); | ||||
| /* do this in end, particles for example need cfra */ | /* do this in end, particles for example need cfra */ | ||||
| scene->r.cfra -= timeoffset; | scene->r.cfra -= timeoffset; | ||||
| } | } | ||||
| /* choose to use static, to prevent giving too many args to this call */ | /* choose to use static, to prevent giving too many args to this call */ | ||||
| ▲ Show 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | static void free_dbase_object_vectors(ListBase *lb) | ||||
| ObjectInstanceRen *obi; | ObjectInstanceRen *obi; | ||||
| for (obi= lb->first; obi; obi= obi->next) | for (obi= lb->first; obi; obi= obi->next) | ||||
| if (obi->vectors) | if (obi->vectors) | ||||
| MEM_freeN(obi->vectors); | MEM_freeN(obi->vectors); | ||||
| BLI_freelistN(lb); | BLI_freelistN(lb); | ||||
| } | } | ||||
| void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned int lay) | void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce) | ||||
| { | { | ||||
| ObjectInstanceRen *obi, *oldobi; | ObjectInstanceRen *obi, *oldobi; | ||||
| StrandSurface *mesh; | StrandSurface *mesh; | ||||
| ListBase *table; | ListBase *table; | ||||
| ListBase oldtable= {NULL, NULL}, newtable= {NULL, NULL}; | ListBase oldtable= {NULL, NULL}, newtable= {NULL, NULL}; | ||||
| ListBase strandsurface; | ListBase strandsurface; | ||||
| int step; | int step; | ||||
| re->i.infostr = IFACE_("Calculating previous frame vectors"); | re->i.infostr = IFACE_("Calculating previous frame vectors"); | ||||
| re->r.mode |= R_SPEED; | re->r.mode |= R_SPEED; | ||||
| speedvector_project(re, NULL, NULL, NULL); /* initializes projection code */ | speedvector_project(re, NULL, NULL, NULL); /* initializes projection code */ | ||||
| /* creates entire dbase */ | /* creates entire dbase */ | ||||
| database_fromscene_vectors(re, sce, lay, -1); | database_fromscene_vectors(re, sce, -1); | ||||
| /* copy away vertex info */ | /* copy away vertex info */ | ||||
| copy_dbase_object_vectors(re, &oldtable); | copy_dbase_object_vectors(re, &oldtable); | ||||
| /* free dbase and make the future one */ | /* free dbase and make the future one */ | ||||
| strandsurface= re->strandsurface; | strandsurface= re->strandsurface; | ||||
| memset(&re->strandsurface, 0, sizeof(ListBase)); | memset(&re->strandsurface, 0, sizeof(ListBase)); | ||||
| re->i.convertdone = true; | re->i.convertdone = true; | ||||
| RE_Database_Free(re); | RE_Database_Free(re); | ||||
| re->strandsurface= strandsurface; | re->strandsurface= strandsurface; | ||||
| if (!re->test_break(re->tbh)) { | if (!re->test_break(re->tbh)) { | ||||
| /* creates entire dbase */ | /* creates entire dbase */ | ||||
| re->i.infostr = IFACE_("Calculating next frame vectors"); | re->i.infostr = IFACE_("Calculating next frame vectors"); | ||||
| database_fromscene_vectors(re, sce, lay, +1); | database_fromscene_vectors(re, sce, +1); | ||||
| } | } | ||||
| /* copy away vertex info */ | /* copy away vertex info */ | ||||
| copy_dbase_object_vectors(re, &newtable); | copy_dbase_object_vectors(re, &newtable); | ||||
| /* free dbase and make the real one */ | /* free dbase and make the real one */ | ||||
| strandsurface= re->strandsurface; | strandsurface= re->strandsurface; | ||||
| memset(&re->strandsurface, 0, sizeof(ListBase)); | memset(&re->strandsurface, 0, sizeof(ListBase)); | ||||
| re->i.convertdone = true; | re->i.convertdone = true; | ||||
| RE_Database_Free(re); | RE_Database_Free(re); | ||||
| re->strandsurface= strandsurface; | re->strandsurface= strandsurface; | ||||
| if (!re->test_break(re->tbh)) { | if (!re->test_break(re->tbh)) { | ||||
| RE_Database_FromScene(re, bmain, sce, lay, 1); | RE_Database_FromScene(re, bmain, sce, re->lay, 1); | ||||
| RE_Database_Preprocess(re); | RE_Database_Preprocess(re); | ||||
| } | } | ||||
| if (!re->test_break(re->tbh)) { | if (!re->test_break(re->tbh)) { | ||||
| int vectorlay= get_vector_renderlayers(re->scene); | int vectorlay= get_vector_renderlayers(re->scene); | ||||
| for (step= 0; step<2; step++) { | for (step= 0; step<2; step++) { | ||||
| ▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
| * RE_BAKE_NORMALS:for baking, no lamps and only selected objects | * RE_BAKE_NORMALS:for baking, no lamps and only selected objects | ||||
| * RE_BAKE_AO: for baking, no lamps, but all objects | * RE_BAKE_AO: for baking, no lamps, but all objects | ||||
| * RE_BAKE_TEXTURE:for baking, no lamps, only selected objects | * RE_BAKE_TEXTURE:for baking, no lamps, only selected objects | ||||
| * RE_BAKE_VERTEX_COLORS:for baking, no lamps, only selected objects | * RE_BAKE_VERTEX_COLORS:for baking, no lamps, only selected objects | ||||
| * RE_BAKE_DISPLACEMENT:for baking, no lamps, only selected objects | * RE_BAKE_DISPLACEMENT:for baking, no lamps, only selected objects | ||||
| * RE_BAKE_DERIVATIVE:for baking, no lamps, only selected objects | * RE_BAKE_DERIVATIVE:for baking, no lamps, only selected objects | ||||
| * RE_BAKE_SHADOW: for baking, only shadows, but all objects | * RE_BAKE_SHADOW: for baking, only shadows, but all objects | ||||
| */ | */ | ||||
| void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, const int type, Object *actob) | void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, const int type, Object *actob) | ||||
| { | { | ||||
| Object *camera; | Object *camera; | ||||
| float mat[4][4]; | float mat[4][4]; | ||||
| float amb[3]; | float amb[3]; | ||||
| const short onlyselected= !ELEM(type, RE_BAKE_LIGHT, RE_BAKE_ALL, RE_BAKE_SHADOW, RE_BAKE_AO, RE_BAKE_VERTEX_COLORS); | const short onlyselected= !ELEM(type, RE_BAKE_LIGHT, RE_BAKE_ALL, RE_BAKE_SHADOW, RE_BAKE_AO, RE_BAKE_VERTEX_COLORS); | ||||
| const short nolamps= ELEM(type, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_DISPLACEMENT, RE_BAKE_DERIVATIVE, RE_BAKE_VERTEX_COLORS); | const short nolamps= ELEM(type, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_DISPLACEMENT, RE_BAKE_DERIVATIVE, RE_BAKE_VERTEX_COLORS); | ||||
| re->main= bmain; | re->main = bmain; | ||||
| re->scene= scene; | re->scene = scene; | ||||
| re->lay= lay; | re->lay = scene->lay; | ||||
| /* renderdata setup and exceptions */ | /* renderdata setup and exceptions */ | ||||
| render_copy_renderdata(&re->r, &scene->r); | render_copy_renderdata(&re->r, &scene->r); | ||||
| RE_init_threadcount(re); | RE_init_threadcount(re); | ||||
| re->flag |= R_BAKING; | re->flag |= R_BAKING; | ||||
| re->excludeob= actob; | re->excludeob= actob; | ||||
| Show All 17 Lines | void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, const int type, Object *actob) | ||||
| /* setup render stuff */ | /* setup render stuff */ | ||||
| re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "bake db arena"); | re->memArena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "bake db arena"); | ||||
| re->totvlak=re->totvert=re->totstrand=re->totlamp=re->tothalo= 0; | re->totvlak=re->totvert=re->totstrand=re->totlamp=re->tothalo= 0; | ||||
| re->lights.first= re->lights.last= NULL; | re->lights.first= re->lights.last= NULL; | ||||
| re->lampren.first= re->lampren.last= NULL; | re->lampren.first= re->lampren.last= NULL; | ||||
| /* in localview, lamps are using normal layers, objects only local bits */ | |||||
| if (re->lay & 0xFF000000) | |||||
| lay &= 0xFF000000; | |||||
| camera= RE_GetCamera(re); | camera= RE_GetCamera(re); | ||||
| /* if no camera, set unit */ | /* if no camera, set unit */ | ||||
| if (camera) { | if (camera) { | ||||
| normalize_m4_m4(mat, camera->obmat); | normalize_m4_m4(mat, camera->obmat); | ||||
| invert_m4(mat); | invert_m4(mat); | ||||
| RE_SetView(re, mat); | RE_SetView(re, mat); | ||||
| } | } | ||||
| Show All 21 Lines | void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, const int type, Object *actob) | ||||
| /* still bad... doing all */ | /* still bad... doing all */ | ||||
| init_render_textures(re); | init_render_textures(re); | ||||
| copy_v3_v3(amb, &re->wrld.ambr); | copy_v3_v3(amb, &re->wrld.ambr); | ||||
| init_render_materials(re->main, re->r.mode, amb, true); | init_render_materials(re->main, re->r.mode, amb, true); | ||||
| set_node_shader_lamp_loop(shade_material_loop); | set_node_shader_lamp_loop(shade_material_loop); | ||||
| /* MAKE RENDER DATA */ | /* MAKE RENDER DATA */ | ||||
| database_init_objects(re, lay, nolamps, onlyselected, actob, 0); | database_init_objects(re, nolamps, onlyselected, actob, 0); | ||||
| set_material_lightgroups(re); | set_material_lightgroups(re); | ||||
| /* SHADOW BUFFER */ | /* SHADOW BUFFER */ | ||||
| if (type!=RE_BAKE_LIGHT) | if (type!=RE_BAKE_LIGHT) | ||||
| if (re->r.mode & R_SHADOW) | if (re->r.mode & R_SHADOW) | ||||
| threaded_makeshadowbufs(re); | threaded_makeshadowbufs(re); | ||||
| Show All 21 Lines | |||||