diff options
author | Ton Roosendaal <ton@blender.org> | 2006-11-19 17:12:56 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-11-19 17:12:56 +0300 |
commit | c47fa4d0ecefea3f32448cb89610a4cc28aac2bb (patch) | |
tree | ba3f59c3bfd5415de4480138fd383d651a56f13f /source/blender/src/meshtools.c | |
parent | 204f6066a9c9355aea28bd3092a74d12a52c7869 (diff) |
Long waited feature: Render Baking
Here's the full release log with example file.
http://www.blender3d.org/cms/Render_Baking.827.0.html
For people who don't read docs; just press ALT+CTRL+B on a Mesh
with texture faces!
Todos:
- maybe some filter options extra?
- Make normal maps in Tangent space
Diffstat (limited to 'source/blender/src/meshtools.c')
-rw-r--r-- | source/blender/src/meshtools.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/source/blender/src/meshtools.c b/source/blender/src/meshtools.c index 677ae69d4ad..2182e5ccc37 100644 --- a/source/blender/src/meshtools.c +++ b/source/blender/src/meshtools.c @@ -60,6 +60,7 @@ void sort_faces(void); #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_view3d_types.h" +#include "DNA_world_types.h" #include "BLI_blenlib.h" #include "BLI_arithb.h" @@ -75,6 +76,7 @@ void sort_faces(void); #include "BIF_editmesh.h" #include "BIF_graphics.h" +#include "BIF_interface.h" #include "BIF_mywindow.h" #include "BIF_screen.h" #include "BIF_space.h" @@ -91,6 +93,9 @@ void sort_faces(void); #include "BIF_meshtools.h" /* include ourself for prototypes */ +#include "RE_pipeline.h" +#include "RE_shader_ext.h" + /* * ********************** no editmode!!! *********** */ @@ -852,3 +857,45 @@ EditVert *editmesh_get_x_mirror_vert(Object *ob, float *co) return NULL; } + +/* ****************** render BAKING ********************** */ + +/* all selected meshes with UV maps are rendered for current scene visibility */ +void objects_bake_render(void) +{ + short event; + + event= pupmenu("Bake Selected Meshes %t|Full Render %x1|Ambient Occlusion %x2|Normals %x3"); + if(event>0) { + Render *re= RE_NewRender("_Bake View_"); + + if(event==1) event= RE_BAKE_ALL; + else if(event==2) event= RE_BAKE_AO; + else event= RE_BAKE_NORMALS; + + if(event==RE_BAKE_AO) { + if((G.scene->r.mode & R_RAYTRACE)==0 || G.scene->world==NULL + || (G.scene->world->mode & WO_AMB_OCC)==0) { + error("No AO set up"); + return; + } + } + + waitcursor(1); + RE_timecursor_cb(re, set_timecursor); + RE_test_break_cb(re, blender_test_break); + G.afbreek= 0; /* blender_test_break uses this global */ + + RE_Database_Baking(re, G.scene, event); + + RE_bake_shade_all_selected(re, event); + + RE_Database_Free(re); + waitcursor(0); + + allqueue(REDRAWIMAGE, 0); + allqueue(REDRAWVIEW3D, 0); + } +} + + |