diff options
Diffstat (limited to 'source/blender/freestyle/intern/application/Controller.cpp')
-rw-r--r-- | source/blender/freestyle/intern/application/Controller.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index 7ecb4164caf..f8931d32f56 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -40,6 +40,7 @@ extern "C" { #include "../scene_graph/NodeDrawingStyle.h" #include "../scene_graph/NodeShape.h" #include "../scene_graph/NodeTransform.h" +#include "../scene_graph/NodeSceneRenderLayer.h" #include "../scene_graph/ScenePrettyPrinter.h" #include "../scene_graph/VertexRep.h" @@ -67,6 +68,7 @@ extern "C" { #include "BKE_global.h" #include "BLI_utildefines.h" +#include "BLI_path_util.h" #include "DNA_freestyle_types.h" @@ -219,11 +221,10 @@ bool Controller::hitViewMapCache() if (!_EnableViewMapCache) { return false; } - real hashCode = sceneHashFunc.getValue(); - if (prevSceneHash == hashCode) { + if (sceneHashFunc.match()) { return (NULL != _ViewMap); } - prevSceneHash = hashCode; + sceneHashFunc.store(); return false; } @@ -280,10 +281,27 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer *srl) return 0; if (_EnableViewMapCache) { + + NodeCamera *cam; + if (freestyle_proj[3][3] != 0.0) + cam = new NodeOrthographicCamera; + else + cam = new NodePerspectiveCamera; + double proj[16]; + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + proj[i * 4 + j] = freestyle_proj[i][j]; + } + } + cam->setProjectionMatrix(proj); + _RootNode->AddChild(cam); + _RootNode->AddChild(new NodeSceneRenderLayer(*srl)); + sceneHashFunc.reset(); - blenderScene->accept(sceneHashFunc); + //blenderScene->accept(sceneHashFunc); + _RootNode->accept(sceneHashFunc); if (G.debug & G_DEBUG_FREESTYLE) { - printf("Scene hash : %.16e\n", sceneHashFunc.getValue()); + cout << "Scene hash : " << sceneHashFunc.toString() << endl; } if (hitViewMapCache()) { ClearRootNode(); @@ -864,10 +882,13 @@ void Controller::ResetRenderCount() Render *Controller::RenderStrokes(Render *re, bool render) { + int totmesh = 0; _Chrono.start(); BlenderStrokeRenderer *blenderRenderer = new BlenderStrokeRenderer(re, ++_render_count); - if (render) + if (render) { _Canvas->Render(blenderRenderer); + totmesh = blenderRenderer->GenerateScene(); + } real d = _Chrono.stop(); if (G.debug & G_DEBUG_FREESTYLE) { cout << "Temporary scene generation: " << d << endl; @@ -886,8 +907,8 @@ Render *Controller::RenderStrokes(Render *re, bool render) float mmap_used_memory = (mmap_in_use) / (1024.0 * 1024.0); float megs_peak_memory = (peak_memory) / (1024.0 * 1024.0); - printf("%d verts, %d faces, mem %.2fM (%.2fM, peak %.2fM)\n", - freestyle_render->i.totvert, freestyle_render->i.totface, + printf("%d objs, %d verts, %d faces, mem %.2fM (%.2fM, peak %.2fM)\n", + totmesh, freestyle_render->i.totvert, freestyle_render->i.totface, megs_used_memory, mmap_used_memory, megs_peak_memory); } delete blenderRenderer; |