diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-08 03:17:23 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-08 03:17:23 +0400 |
commit | 4a92d82626980d6d1690113b9d27aae282fd48eb (patch) | |
tree | d690f59c72441272ed462fe59d416a9a255d087e /source/blender/freestyle/intern/application | |
parent | b4b22699850a859d601bb4851d0af18f568b3061 (diff) |
A big code clean-up patch from Bastien Montagne, many thanks!
Diffstat (limited to 'source/blender/freestyle/intern/application')
6 files changed, 37 insertions, 39 deletions
diff --git a/source/blender/freestyle/intern/application/AppCanvas.cpp b/source/blender/freestyle/intern/application/AppCanvas.cpp index 06391717bb9..d2dc14b1c19 100644 --- a/source/blender/freestyle/intern/application/AppCanvas.cpp +++ b/source/blender/freestyle/intern/application/AppCanvas.cpp @@ -47,7 +47,7 @@ AppCanvas::AppCanvas() _MapsPath = StringUtils::toAscii(Config::Path::getInstance()->getMapsDir()).c_str(); } -AppCanvas::AppCanvas(AppView* iViewer) +AppCanvas::AppCanvas(AppView *iViewer) :Canvas() { _pViewer = iViewer; @@ -116,7 +116,7 @@ void AppCanvas::init() void AppCanvas::postDraw() { for (unsigned int i = 0; i < _StyleModules.size(); i++) { - if(!_StyleModules[i]->getDisplayed() || !_Layers[i]) + if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) continue; _Layers[i]->ScaleThickness(thickness()); } @@ -130,9 +130,9 @@ void AppCanvas::Erase() // Abstract -void AppCanvas::readColorPixels(int x,int y,int w, int h, RGBImage& oImage) const +void AppCanvas::readColorPixels(int x, int y, int w, int h, RGBImage& oImage) const { - float *rgb = new float[3*w*h]; + float *rgb = new float[3 * w * h]; memset(rgb, 0, sizeof(float) * 3 * w * h); int xsch = width(); int ysch = height(); @@ -147,8 +147,8 @@ void AppCanvas::readColorPixels(int x,int y,int w, int h, RGBImage& oImage) cons float yfac = ((float)recty) / ((float)(ymax - ymin)); #if 0 if (G.debug & G_DEBUG_FREESTYLE) { - printf("readColorPixels %d x %d @ (%d, %d) in %d x %d [%d x %d] -- %d x %d @ %d%%\n", w, h, x, y, xsch, ysch, - xmax - xmin, ymax - ymin, rectx, recty, (int)(xfac * 100.0f)); + printf("readColorPixels %d x %d @ (%d, %d) in %d x %d [%d x %d] -- %d x %d @ %d%%\n", w, h, x, y, + xsch, ysch, xmax - xmin, ymax - ymin, rectx, recty, (int)(xfac * 100.0f)); } #endif int ii, jj; @@ -167,9 +167,9 @@ void AppCanvas::readColorPixels(int x,int y,int w, int h, RGBImage& oImage) cons oImage.setArray(rgb, xsch, ysch, w, h, x, y, false); } -void AppCanvas::readDepthPixels(int x,int y,int w, int h, GrayImage& oImage) const +void AppCanvas::readDepthPixels(int x, int y, int w, int h, GrayImage& oImage) const { - float *z = new float[w*h]; + float *z = new float[w * h]; memset(z, 0, sizeof(float) * w * h); int xsch = width(); int ysch = height(); @@ -184,8 +184,8 @@ void AppCanvas::readDepthPixels(int x,int y,int w, int h, GrayImage& oImage) con float yfac = ((float)recty) / ((float)(ymax - ymin)); #if 0 if (G.debug & G_DEBUG_FREESTYLE) { - printf("readDepthPixels %d x %d @ (%d, %d) in %d x %d [%d x %d] -- %d x %d @ %d%%\n", w, h, x, y, xsch, ysch, - xmax - xmin, ymax - ymin, rectx, recty, (int)(xfac * 100.0f)); + printf("readDepthPixels %d x %d @ (%d, %d) in %d x %d [%d x %d] -- %d x %d @ %d%%\n", w, h, x, y, + xsch, ysch, xmax - xmin, ymax - ymin, rectx, recty, (int)(xfac * 100.0f)); } #endif int ii, jj; @@ -206,7 +206,7 @@ void AppCanvas::readDepthPixels(int x,int y,int w, int h, GrayImage& oImage) con void AppCanvas::RenderStroke(Stroke *iStroke) { - if(_basic) + if (_basic) iStroke->RenderBasic(_Renderer); else iStroke->Render(_Renderer); diff --git a/source/blender/freestyle/intern/application/AppCanvas.h b/source/blender/freestyle/intern/application/AppCanvas.h index 3a65020463c..a839c1efe0d 100644 --- a/source/blender/freestyle/intern/application/AppCanvas.h +++ b/source/blender/freestyle/intern/application/AppCanvas.h @@ -56,14 +56,14 @@ public: virtual void init(); /*! Reads a pixel area from the canvas */ - virtual void readColorPixels(int x,int y,int w, int h, RGBImage& oImage) const; + virtual void readColorPixels(int x, int y, int w, int h, RGBImage& oImage) const; /*! Reads a depth pixel area from the canvas */ - virtual void readDepthPixels(int x,int y,int w, int h, GrayImage& oImage) const; + virtual void readDepthPixels(int x, int y, int w, int h, GrayImage& oImage) const; virtual BBox<Vec3r> scene3DBBox() const; /* abstract */ - virtual void RenderStroke(Stroke*); + virtual void RenderStroke(Stroke *); virtual void update(); diff --git a/source/blender/freestyle/intern/application/AppConfig.cpp b/source/blender/freestyle/intern/application/AppConfig.cpp index c8ebc45d7eb..2500c9c68ee 100644 --- a/source/blender/freestyle/intern/application/AppConfig.cpp +++ b/source/blender/freestyle/intern/application/AppConfig.cpp @@ -42,7 +42,7 @@ extern "C" { namespace Config { -Path* Path::_pInstance = 0; +Path *Path::_pInstance = 0; Path::Path() { // get the root directory @@ -80,7 +80,7 @@ Path::~Path() _pInstance = 0; } -Path* Path::getInstance() +Path *Path::getInstance() { return _pInstance; } @@ -89,11 +89,10 @@ string Path::getEnvVar(const string& iEnvVarName) { string value; if (!getenv(StringUtils::toAscii(iEnvVarName).c_str())) { - cerr << "Warning: You may want to set the $" - << StringUtils::toAscii(iEnvVarName) - << " environment variable to use Freestyle." << endl - << " Otherwise, the current directory will be used instead." - << endl; + cerr << "Warning: You may want to set the $" << + StringUtils::toAscii(iEnvVarName) << + " environment variable to use Freestyle." << endl << + " Otherwise, the current directory will be used instead." << endl; value = "."; } else { diff --git a/source/blender/freestyle/intern/application/AppConfig.h b/source/blender/freestyle/intern/application/AppConfig.h index 9bd5506d94c..54dde44df7c 100644 --- a/source/blender/freestyle/intern/application/AppConfig.h +++ b/source/blender/freestyle/intern/application/AppConfig.h @@ -43,7 +43,7 @@ using namespace std; namespace Config { -class Path{ +class Path { protected: static Path * _pInstance; string _ProjectDir; @@ -58,7 +58,7 @@ protected: public: Path(); virtual ~Path(); - static Path* getInstance(); + static Path *getInstance(); void setRootDir(const string& iRootDir); void setHomeDir(const string& iHomeDir); diff --git a/source/blender/freestyle/intern/application/AppView.h b/source/blender/freestyle/intern/application/AppView.h index 7b8a892858e..0aa3f8a4005 100644 --- a/source/blender/freestyle/intern/application/AppView.h +++ b/source/blender/freestyle/intern/application/AppView.h @@ -94,7 +94,7 @@ public: _minAbs = std::min(rabs(_minBBox), rabs(_maxBBox)); } - inline void AddSilhouette(NodeGroup* iSilhouette) + inline void AddSilhouette(NodeGroup *iSilhouette) { _SilhouetteRootNode->AddChild(iSilhouette); } @@ -109,7 +109,7 @@ public: //_pVisibleSilhouetteNode->AddChild(iVSilhouette); } - inline void setDebug(NodeGroup* iDebug) + inline void setDebug(NodeGroup *iDebug) { if (0 != _DebugRootNode->numberOfChildren()) { _DebugRootNode->DetachChildren(); @@ -119,7 +119,7 @@ public: AddDebug(iDebug); } - inline void AddDebug(NodeGroup* iDebug) + inline void AddDebug(NodeGroup *iDebug) { _DebugRootNode->AddChild(iDebug); } diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index b71f716459c..bc847bb6114 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -185,7 +185,7 @@ Controller::~Controller() void Controller::setView(AppView *iView) { - if(NULL == iView) + if (NULL == iView) return; _pView = iView; @@ -213,12 +213,12 @@ void Controller::setPassZ(float *buf, int width, int height) void Controller::setContext(bContext *C) { - PythonInterpreter* py_inter = dynamic_cast<PythonInterpreter*>(_inter); + PythonInterpreter *py_inter = dynamic_cast<PythonInterpreter*>(_inter); assert(py_inter != 0); py_inter->setContext(C); } -int Controller::LoadMesh(Render *re, SceneRenderLayer* srl) +int Controller::LoadMesh(Render *re, SceneRenderLayer *srl) { BlenderFileLoader loader(re, srl); @@ -300,7 +300,7 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer* srl) _ListOfModels.push_back("Blender_models"); - _bboxDiag = (_RootNode->bbox().getMax()-_RootNode->bbox().getMin()).norm(); + _bboxDiag = (_RootNode->bbox().getMax() - _RootNode->bbox().getMin()).norm(); if (G.debug & G_DEBUG_FREESTYLE) { cout << "Triangles nb : " << _SceneNumFaces << endl; cout << "Bounding Box : " << _bboxDiag << endl; @@ -531,7 +531,7 @@ void Controller::ComputeViewMap() ViewMapBuilder vmBuilder; vmBuilder.setEnableQI(_EnableQI); vmBuilder.setViewpoint(Vec3r(vp)); - vmBuilder.setTransform( mv, proj,viewport, _pView->GetFocalLength(), _pView->GetAspect(), _pView->GetFovyRadian()); + vmBuilder.setTransform(mv, proj, viewport, _pView->GetFocalLength(), _pView->GetAspect(), _pView->GetFovyRadian()); vmBuilder.setFrustum(_pView->znear(), _pView->zfar()); vmBuilder.setGrid(&_Grid); vmBuilder.setRenderMonitor(_pRenderMonitor); @@ -843,17 +843,17 @@ void Controller::ResetRenderCount() _render_count = 0; } -Render* Controller::RenderStrokes(Render *re) +Render *Controller::RenderStrokes(Render *re) { _Chrono.start(); - BlenderStrokeRenderer* blenderRenderer = new BlenderStrokeRenderer(re, ++_render_count); + BlenderStrokeRenderer *blenderRenderer = new BlenderStrokeRenderer(re, ++_render_count); _Canvas->Render(blenderRenderer); real d = _Chrono.stop(); if (G.debug & G_DEBUG_FREESTYLE) { cout << "Temporary scene generation: " << d << endl; } _Chrono.start(); - Render* freestyle_render = blenderRenderer->RenderScene(re); + Render *freestyle_render = blenderRenderer->RenderScene(re); d = _Chrono.stop(); if (G.debug & G_DEBUG_FREESTYLE) { cout << "Stroke rendering : " << d << endl; @@ -866,18 +866,17 @@ Render* Controller::RenderStrokes(Render *re) void Controller::InsertStyleModule(unsigned index, const char *iFileName) { if (!BLI_testextensie(iFileName, ".py")) { - cerr << "Error: Cannot load \"" << StringUtils::toAscii(string(iFileName)) - << "\", unknown extension" << endl; + cerr << "Error: Cannot load \"" << StringUtils::toAscii(string(iFileName)) << "\", unknown extension" << endl; return; } - StyleModule* sm = new StyleModule(iFileName, _inter); + StyleModule *sm = new StyleModule(iFileName, _inter); _Canvas->InsertStyleModule(index, sm); } void Controller::InsertStyleModule(unsigned index, const char *iName, struct Text *iText) { - StyleModule* sm = new BlenderStyleModule(iText, iName, _inter); + StyleModule *sm = new BlenderStyleModule(iText, iName, _inter); _Canvas->InsertStyleModule(index, sm); } @@ -898,7 +897,7 @@ void Controller::Clear() void Controller::ReloadStyleModule(unsigned index, const char * iFileName) { - StyleModule* sm = new StyleModule(iFileName, _inter); + StyleModule *sm = new StyleModule(iFileName, _inter); _Canvas->ReplaceStyleModule(index, sm); } |