Freestyle: Fix for view map caching not flashed properly in view port rendering.

This commit is contained in:
2014-10-05 00:29:09 +09:00
parent 8fa55d95e4
commit 3fea13ed6c
4 changed files with 72 additions and 11 deletions

View File

@@ -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();