Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-07-17 03:29:12 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-07-17 03:29:12 +0400
commit5a581c1fd116c51df13e09c5c320feba48d069bb (patch)
tree91df14a7a43b19af4ecac736460cbbd8c1b1e291 /source/blender/freestyle/intern/application
parent9d2a957a0d440b07d1a5e9e0ee5fb613d93637d9 (diff)
Better handling of the ESC key during Freestyle rendering.
This commit is meant to improve the response of the ESC key for stopping Freestyle rendering throughout the rendering process. The rendering with Freestyle consists of several steps including: (1) mesh data loading, (2) winged edge construction, (3) silhouette edge detection, (4) view map construction, and (5) stroke drawing. All these steps have been extended to frequently check if the ESC key is pressed, so that users can abort time-consuming rendering at any point of time.
Diffstat (limited to 'source/blender/freestyle/intern/application')
-rwxr-xr-xsource/blender/freestyle/intern/application/Controller.cpp17
-rwxr-xr-xsource/blender/freestyle/intern/application/Controller.h4
2 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp
index eb27ab62340..d7f91d3d7c2 100755
--- a/source/blender/freestyle/intern/application/Controller.cpp
+++ b/source/blender/freestyle/intern/application/Controller.cpp
@@ -93,6 +93,7 @@ Controller::Controller()
_winged_edge = NULL;
_pView = NULL;
+ _pRenderMonitor = NULL;
_edgeTesselationNature = (Nature::SILHOUETTE | Nature::BORDER | Nature::CREASE);
@@ -181,6 +182,11 @@ void Controller::setView(AppView *iView)
_Canvas->setViewer(_pView);
}
+void Controller::setRenderMonitor(RenderMonitor *iRenderMonitor)
+{
+ _pRenderMonitor = iRenderMonitor;
+}
+
void Controller::setPassDiffuse(float *buf, int width, int height)
{
AppCanvas *app_canvas = dynamic_cast<AppCanvas *>(_Canvas);
@@ -206,6 +212,8 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer* srl)
{
BlenderFileLoader loader(re, srl);
+
+ loader.setRenderMonitor(_pRenderMonitor);
_Chrono.start();
@@ -242,11 +250,15 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer* srl)
_pView->setModel(_RootNode);
//_pView->FitBBox();
+ if (_pRenderMonitor->testBreak())
+ return 0;
+
_Chrono.start();
WXEdgeBuilder wx_builder;
+ wx_builder.setRenderMonitor(_pRenderMonitor);
blenderScene->accept(wx_builder);
_winged_edge = wx_builder.getWingedEdge();
@@ -465,11 +477,15 @@ void Controller::ComputeViewMap()
edgeDetector.setCreaseAngle(_creaseAngle);
edgeDetector.setSphereRadius(_sphereRadius);
edgeDetector.setSuggestiveContourKrDerivativeEpsilon(_suggestiveContourKrDerivativeEpsilon);
+ edgeDetector.setRenderMonitor(_pRenderMonitor);
edgeDetector.processShapes(*_winged_edge);
real duration = _Chrono.stop();
printf("Feature lines : %lf\n", duration);
+ if (_pRenderMonitor->testBreak())
+ return;
+
// Builds the view map structure from the flagged WSEdge structure:
//----------------------------------------------------------
ViewMapBuilder vmBuilder;
@@ -478,6 +494,7 @@ void Controller::ComputeViewMap()
vmBuilder.setTransform( mv, proj,viewport, _pView->GetFocalLength(), _pView->GetAspect(), _pView->GetFovyRadian());
vmBuilder.setFrustum(_pView->znear(), _pView->zfar());
vmBuilder.setGrid(&_Grid);
+ vmBuilder.setRenderMonitor(_pRenderMonitor);
// Builds a tesselated form of the silhouette for display purpose:
//---------------------------------------------------------------
diff --git a/source/blender/freestyle/intern/application/Controller.h b/source/blender/freestyle/intern/application/Controller.h
index 4ee79405fa9..6119e14f7b7 100755
--- a/source/blender/freestyle/intern/application/Controller.h
+++ b/source/blender/freestyle/intern/application/Controller.h
@@ -38,6 +38,7 @@
# include "../system/ProgressBar.h"
# include "../system/Precision.h"
# include "../system/Interpreter.h"
+# include "../system/RenderMonitor.h"
# include "../view_map/FEdgeXDetector.h"
class AppView;
@@ -69,6 +70,7 @@ public:
~Controller() ;
void setView(AppView *iView);
+ void setRenderMonitor(RenderMonitor *iRenderMonitor);
void setPassDiffuse(float *buf, int width, int height);
void setPassZ(float *buf, int width, int height);
void setContext(bContext *C);
@@ -177,6 +179,8 @@ private:
//Viewer2DWindow *_pView2DWindow;
//Viewer2D *_pView2D;
+ RenderMonitor *_pRenderMonitor;
+
//Model
// Drawing Structure
NodeGroup *_RootNode;