From 3fea13ed6c0c1488b6f8a2853d76ca0872aabffd Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Sun, 5 Oct 2014 00:29:09 +0900 Subject: Freestyle: Fix for view map caching not flashed properly in view port rendering. --- .../freestyle/intern/application/Controller.cpp | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'source/blender/freestyle/intern/application') diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index 86322bcd350..237176df5e3 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -220,11 +220,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; } @@ -281,10 +280,26 @@ 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); + 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(); -- cgit v1.2.3