Revision: 17782 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17782 Author: mxcurioni Date: 2008-12-10 22:51:58 +0100 (Wed, 10 Dec 2008)
Log Message: ----------- removed AppGLWidget and all related classes added an AppView class to transfer camera information from Blender to Freestyle removed unused functions Modified Paths: -------------- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp Added Paths: ----------- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppView.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppView.h Removed Paths: ------------- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_camera.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_camera.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_config.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_constraint.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_frame.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_frame.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedCameraFrame.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedCameraFrame.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedFrame.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_manipulatedFrame.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_point.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_quaternion.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_quaternion.h branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_vec.cpp branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget_vec.h Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp =================================================================== --- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp 2008-12-10 19:22:10 UTC (rev 17781) +++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.cpp 2008-12-10 21:51:58 UTC (rev 17782) @@ -21,7 +21,7 @@ #include "../rendering/GLBlendEquation.h" -#include "AppGLWidget.h" +#include "AppView.h" #include "../image/Image.h" #include "../system/TimeStamp.h" #include "Controller.h" @@ -40,7 +40,7 @@ _MapsPath = StringUtils::toAscii( Config::Path::getInstance()->getMapsDir() ).c_str(); } -AppCanvas::AppCanvas(AppGLWidget* iViewer) +AppCanvas::AppCanvas(AppView* iViewer) :Canvas() { _pViewer = iViewer; @@ -57,7 +57,7 @@ _pViewer = 0; } -void AppCanvas::setViewer(AppGLWidget *iViewer) +void AppCanvas::setViewer(AppView *iViewer) { _pViewer = iViewer; } @@ -69,7 +69,7 @@ int AppCanvas::height() const { - return _pViewer->height(); + return _pViewer->height();; } BBox<Vec3r> AppCanvas::scene3DBBox() const Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.h =================================================================== --- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.h 2008-12-10 19:22:10 UTC (rev 17781) +++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppCanvas.h 2008-12-10 21:51:58 UTC (rev 17782) @@ -2,15 +2,14 @@ #define ARTCANVAS_H #include "../stroke/Canvas.h" +#include "AppView.h" -//class AppGLWidget; class AppCanvas : public Canvas { -private: - mutable AppGLWidget *_pViewer; + public: AppCanvas(); - AppCanvas(AppGLWidget *iViewer); + AppCanvas(AppView *iViewer); AppCanvas(const AppCanvas& iBrother); virtual ~AppCanvas(); @@ -41,10 +40,12 @@ /*! accessors */ virtual int width() const ; virtual int height() const ; - inline const AppGLWidget * viewer() const {return _pViewer;} + AppView *_pViewer; + inline const AppView * viewer() const {return _pViewer;} + /*! modifiers */ - void setViewer(AppGLWidget *iViewer) ; + void setViewer(AppView *iViewer) ; }; Deleted: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.cpp =================================================================== --- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.cpp 2008-12-10 19:22:10 UTC (rev 17781) +++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.cpp 2008-12-10 21:51:58 UTC (rev 17782) @@ -1,589 +0,0 @@ - -// -// Copyright (C) : Please refer to the COPYRIGHT file distributed -// with this source distribution. -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -/////////////////////////////////////////////////////////////////////////////// - -#include <iostream> -#include "../stroke/Canvas.h" -#include "AppGLWidget.h" -#include "../scene_graph/NodeLight.h" -#include "../rendering/GLRenderer.h" -#include "../rendering/GLSelectRenderer.h" -#include "../rendering/GLBBoxRenderer.h" -#include "../rendering/GLMonoColorRenderer.h" -#include "Controller.h" -#include "../view_map/Silhouette.h" -#include "../view_map/ViewMap.h" -#include "../scene_graph/LineRep.h" -#include "../scene_graph/NodeShape.h" -#include "../scene_graph/VertexRep.h" -#include "AppConfig.h" -#include "AppCanvas.h" - -#include "../system/StringUtils.h" - -extern "C" { -#include "BLI_blenlib.h" -#include "IMB_imbuf.h" -#include "IMB_imbuf_types.h" -} - -// glut.h must be included last to avoid a conflict with stdlib.h on vc .net 2003 and 2005 -#ifdef __MACH__ -# include <GLUT/glut.h> -#else -# ifdef _WIN32 -# include <GL/glu.h> -# else -# include <GL/glut.h> -# endif -#endif - -GLuint texture = 0; - -bool AppGLWidget::_frontBufferFlag = false; -bool AppGLWidget::_backBufferFlag = true; - -AppGLWidget::AppGLWidget(const char *iName) -{ - //soc - _camera = new AppGLWidget_Camera; - - _Fovy = 30.f; - //_SceneDepth = 2.f; - _RenderStyle = LINE; - //_ModelRootNode->setBBox(BBox<Vec3f>(Vec3f(-10.f, -10.f, -10.f), Vec3f(10.f, 10.f, 10.f))); - _ModelRootNode = new NodeDrawingStyle; - _SilhouetteRootNode = new NodeDrawingStyle; - _DebugRootNode = new NodeDrawingStyle; - - _RootNode.AddChild(_ModelRootNode); - _SilhouetteRootNode->setStyle(DrawingStyle::LINES); - _SilhouetteRootNode->setLightingEnabled(false); - _SilhouetteRootNode->setLineWidth(2.f); - _SilhouetteRootNode->setPointSize(3.f); - - _RootNode.AddChild(_SilhouetteRootNode); - - _DebugRootNode->setStyle(DrawingStyle::LINES); - _DebugRootNode->setLightingEnabled(false); - _DebugRootNode->setLineWidth(1.f); - - _RootNode.AddChild(_DebugRootNode); - - _minBBox = __min(__min(_ModelRootNode->bbox().getMin()[0], - _ModelRootNode->bbox().getMin()[1]), - _ModelRootNode->bbox().getMin()[2]); - _maxBBox = __max(__max(_ModelRootNode->bbox().getMax()[0], - _ModelRootNode->bbox().getMax()[1]), - _ModelRootNode->bbox().getMax()[2]); - - _maxAbs = __max(rabs(_minBBox), rabs(_maxBBox)); - _minAbs = __min(rabs(_minBBox), rabs(_maxBBox)); - - _camera->setZNearCoefficient(0.1); - - // 2D Scene - // _pFENode = new NodeDrawingStyle; - // _pFENode->setStyle(DrawingStyle::LINES); - // _pFENode->setLightingEnabled(false); - // _pFENode->setLineWidth(1.f); - // - // _p2DNode.AddChild(_pFENode); - // - // _pVisibleSilhouetteNode = new NodeDrawingStyle; - // _pVisibleSilhouetteNode->setStyle(DrawingStyle::LINES); - // _pVisibleSilhouetteNode->setLightingEnabled(false); - // _pVisibleSilhouetteNode->setLineWidth(3.f); - // - // _p2DNode.AddChild(_pVisibleSilhouetteNode); - // - _p2DSelectionNode = new NodeDrawingStyle; - _p2DSelectionNode->setLightingEnabled(false); - _p2DSelectionNode->setStyle(DrawingStyle::LINES); - _p2DSelectionNode->setLineWidth(5.f); - - _p2DNode.AddChild(_p2DSelectionNode); - - _pGLRenderer = new GLRenderer; - _pSelectRenderer = new GLSelectRenderer; - _pBBoxRenderer = new GLBBoxRenderer; - _pMonoColorRenderer = new GLMonoColorRenderer; - _pDebugRenderer = new GLDebugRenderer; - - _pMainWindow = NULL; - _cameraStateSaved = false; - _drawBBox = false; - _silhouette = false; - _fedges = false; - _debug = false; - _selection_mode = false; - _Draw2DScene = true; - _Draw3DScene = false; - _drawEnvMap = false; - _currentEnvMap = 1; - _maxId = 0; - _blendFunc = 0; - - const string sep(Config::DIR_SEP); - const string filename = Config::Path::getInstance()->getHomeDir() + sep + - Config::OPTIONS_DIR + sep + Config::OPTIONS_QGLVIEWER_FILE; - setStateFileName(filename); - - //get camera frame: - //qglviewer::Camera * cam = camera(); - //qglviewer::ManipulatedFrame * fr = cam->frame() ; - - //soc _enableupdateSilhouettes = false; - - _captureMovie = false; - // _frontBufferFlag = false; - // _backBufferFlag = true; - _record = false; - - - workingBuffer = GL_BACK; //soc - -} - -AppGLWidget::~AppGLWidget() -{ - int ref = _RootNode.destroy(); - - _Light.destroy(); - ref = _p2DNode.destroy(); - - if(NULL != _pGLRenderer) - { - delete _pGLRenderer; - _pGLRenderer = NULL; - } - - if(NULL != _pSelectRenderer) - { - delete _pSelectRenderer; - _pSelectRenderer = NULL; - } - - if(NULL != _pBBoxRenderer) - { - delete _pBBoxRenderer; - _pBBoxRenderer = NULL; - } - - if(NULL != _pMonoColorRenderer) - { - delete _pMonoColorRenderer; - _pMonoColorRenderer = NULL; - } - - if(NULL != _pDebugRenderer) - { - delete _pDebugRenderer; - _pDebugRenderer = NULL; - } - - //saveToFile(filename); -} - - - -void AppGLWidget::LoadEnvMap(const char *filename) -{ - GLuint textureId; - //sgiImage img; - //cout << filename << endl; - ImBuf *image = IMB_loadiffname(filename, 0); - - //data = img.read(filename); // tres beau bleu gris mauve!! - // allocate a texture name - glGenTextures( 1, &textureId ); - if(textureId > (GLuint) _maxId) - _maxId = textureId; - - // select our current texture - glBindTexture( GL_TEXTURE_2D, textureId ); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_NEAREST); - - glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA, image->x, image->y, 0, - GL_RGBA, GL_UNSIGNED_BYTE, image->rect ); -} - -void AppGLWidget::init() -{ - //setShortcut(QGLViewer::EXIT_VIEWER, 0); -// setShortcut(QGLViewer::DISPLAY_Z_BUFFER, 0); - //setShortcut(QGLViewer::STEREO, 0); - //setShortcut(QGLViewer::ANIMATION, 0); - //setShortcut(QGLViewer::EDIT_CAMERA, 0); - - //restoreStateFromFile(); - - //trackball().fitBBox(_ModelRootNode->bbox().getMin(), _ModelRootNode->bbox().getMax(), _Fovy); - - glClearColor(1,1,1,0); - glShadeModel(GL_SMOOTH); - - glCullFace(GL_BACK); - glEnable(GL_CULL_FACE); - glEnable(GL_DEPTH_TEST); - - // open and read texture data - Config::Path * cpath = Config::Path::getInstance(); - string envmapDir = cpath->getEnvMapDir(); - LoadEnvMap( StringUtils::toAscii(envmapDir + string("gray00.png")).c_str() ); - //LoadEnvMap(Config::ENV_MAP_DIR + "gray01.bmp"); - LoadEnvMap( StringUtils::toAscii(envmapDir + string("gray02.png")).c_str() ); - LoadEnvMap( StringUtils::toAscii(envmapDir + string("gray03.png")).c_str() ); - LoadEnvMap( StringUtils::toAscii(envmapDir + string("brown00.png")).c_str() ); @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs