Revision: 15238
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15238
Author:   mxcurioni
Date:     2008-06-16 02:51:19 +0200 (Mon, 16 Jun 2008)

Log Message:
-----------
soc-2008-mxcurioni: Freestyle now supports camera information (the image is 
still a bit larger than Blender's internal renderer, probably a field of view 
problem). 3d scene is now no longer rendered, only 2d scene (strokes from view 
map information) is. Style module is still static (contour.py), will soon be 
handled via independent UI panel.

Phase 1 is considered finished. Phase 2 starts now: the objective is 
integrating Freestyle as an independent render layer.

Modified 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/Controller.cpp
    
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
    branches/soc-2008-mxcurioni/source/blender/render/intern/source/pipeline.c

Modified: 
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-06-15 21:02:42 UTC (rev 15237)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.cpp
     2008-06-16 00:51:19 UTC (rev 15238)
@@ -130,7 +130,7 @@
   _debug = false;
   _selection_mode = false;
   _Draw2DScene = true;
-  _Draw3DScene = true;
+  _Draw3DScene = false;
   _drawEnvMap = false;
   _currentEnvMap = 1;
   _maxId = 0;

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h
       2008-06-15 21:02:42 UTC (rev 15237)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppGLWidget.h
       2008-06-16 00:51:19 UTC (rev 15238)
@@ -401,9 +401,9 @@
 
   inline bool getRecordFlag() const {return _record;}
 
-  void setCameraState(const float* position, const float* orientation) {
-    _camera->setPosition(Vec(position[0], position[1], position[2]));
-    _camera->setOrientation(Quaternion(orientation[0], orientation[1], 
orientation[2], orientation[3]));
+  void setCameraState(const Vec& position, const Quaternion& orientation) {
+    _camera->setPosition(position);
+    _camera->setOrientation(orientation);
   }
 
   void getCameraState(float* position, float* orientation) const {

Modified: 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp
===================================================================
--- 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp
      2008-06-15 21:02:42 UTC (rev 15237)
+++ 
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp
      2008-06-16 00:51:19 UTC (rev 15238)
@@ -209,7 +209,7 @@
   _RootNode->UpdateBBox(); // FIXME: Correct that by making a Renderer to 
compute the bbox
 
   _pView->SetModel(_RootNode);
-  _pView->FitBBox();
+  //_pView->FitBBox();
 
 
   _Chrono.start();
@@ -399,150 +399,150 @@
   cout << "ViewMap saving   : " << d << endl;
 }
 
-void Controller::LoadViewMapFile(const char *iFileName, bool only_camera)
-{
-  ifstream ifs(iFileName, ios::binary);
-  if (!ifs.is_open()) {
-    cerr << "Error: Cannot load this file" << endl;
-    return;
-  }
-//    char buffer[buffer_size];
-//  #if defined(__GNUC__) && (__GNUC__ < 3)
-//    ifs.rdbuf()->setbuf(buffer, buffer_size);
-//  # else
-//    ifs.rdbuf()->pubsetbuf(buffer, buffer_size);
-//  #endif
+// void Controller::LoadViewMapFile(const char *iFileName, bool only_camera)
+// {
+//   ifstream ifs(iFileName, ios::binary);
+//   if (!ifs.is_open()) {
+//     cerr << "Error: Cannot load this file" << endl;
+//     return;
+//   }
+// //    char buffer[buffer_size];
+// //  #if defined(__GNUC__) && (__GNUC__ < 3)
+// //    ifs.rdbuf()->setbuf(buffer, buffer_size);
+// //  # else
+// //    ifs.rdbuf()->pubsetbuf(buffer, buffer_size);
+// //  #endif
+// 
+//   // Test File Magic and version
+//   char tmp_buffer[256];
+//   string test;
+//   
+//   ifs.getline(tmp_buffer, 255);
+//   test = tmp_buffer;
+//   if (test != Config::VIEWMAP_MAGIC) {
+//     cerr << "Error: This is not a valid ." << Config::VIEWMAP_EXTENSION << 
" file" << endl;
+//     return;
+//   }
+//   ifs.getline(tmp_buffer, 255);
+//   test = tmp_buffer;
+//   if (test != Config::VIEWMAP_VERSION && !only_camera) {
+//     cerr << "Error: This version of the ." << Config::VIEWMAP_EXTENSION << 
" file format is no longer supported" << endl;
+//     return;
+//   }
+// 
+//   // Read the models filenames and open them (if not already done)
+//   string tmp;
+//   vector<string> tmp_vec;
+//   unsigned models_nb, i;
+// 
+//   ifs.getline(tmp_buffer, 255);
+//   models_nb = atoi(tmp_buffer);
+//   for (i = 0; i < models_nb; i++) {
+//     ifs.getline(tmp_buffer, 255);
+//     tmp = tmp_buffer;
+//     tmp_vec.push_back(tmp);
+//   }
+//   if (_ListOfModels != tmp_vec && !only_camera) {
+//     CloseFile();
+//     vector<string> pathnames;
+//     int err = 0;
+//     for (vector<string>::const_iterator i = tmp_vec.begin(); i != 
tmp_vec.end(); i++)
+//       {
+//     pathnames.clear();
+//     StringUtils::getPathName(ViewMapIO::Options::getModelsPath(), *i, 
pathnames);
+//     for (vector<string>::const_iterator j = pathnames.begin(); j != 
pathnames.end(); j++)
+//       if (!(err = Load3DSFile(j->c_str())))
+//         break;
+//     if (err) {
+//       cerr << "Error: cannot find model \"" << *i << "\" - check the path 
in the Options" << endl;
+//       return;
+//     }
+//       }
+//   }
+// 
+//   // Set the camera position
+//   float position[3];
+//   float orientation[4];
+//   ifs.read((char*)position, 3 * sizeof(*position));
+//   ifs.read((char*)orientation, 4 * sizeof(*orientation));
+//   _pView->setCameraState(position, orientation);
+//   _pView->saveCameraState();
+// 
+//   if (only_camera) {
+//     return;
+//   }
+// 
+//   // Reset ViewMap
+//   if(NULL != _ViewMap)
+//     {
+//       delete _ViewMap;
+//       _ViewMap = 0;
+//     }
+//   _pView->DetachSilhouette();
+//   if (NULL != _SilhouetteNode)
+//     {
+//       int ref = _SilhouetteNode->destroy();
+//       if(0 == ref)
+//     delete _SilhouetteNode;
+//     }
+//   //  if(NULL != _ProjectedSilhouette)
+//   //    {
+//   //      int ref = _ProjectedSilhouette->destroy();
+//   //      if(0 == ref)
+//   //        delete _ProjectedSilhouette;
+//   //    }
+//   //  if(NULL != _VisibleProjectedSilhouette)
+//   //    {
+//   //      int ref = _VisibleProjectedSilhouette->destroy();
+//   //      if(0 == ref)
+//   //        {
+//   //          delete _VisibleProjectedSilhouette;
+//   //          _VisibleProjectedSilhouette = 0;
+//   //        }
+//    // }
+//   _ViewMap = new ViewMap();
+// 
+//   // Read ViewMap
+//   _Chrono.start();
+//   if (ViewMapIO::load(ifs, _ViewMap, 0)) {
+//     _Chrono.stop();
+// 
+//     cerr << "Error: This is not a valid ." << Config::VIEWMAP_EXTENSION << 
" file" << endl;
+//     return;
+//   }
+// 
+//   // Update display
+//   ViewMapTesselator3D sTesselator3d;
+//   //ViewMapTesselator2D sTesselator2d;
+//   //sTesselator2d.SetNature(_edgeTesselationNature);
+//   sTesselator3d.SetNature(_edgeTesselationNature);
+//   
+//   // Tesselate the 3D edges:
+//   _SilhouetteNode = sTesselator3d.Tesselate(_ViewMap);
+//   _SilhouetteNode->addRef();
+//   
+//   // Tesselate 2D edges
+//   //  _ProjectedSilhouette = sTesselator2d.Tesselate(_ViewMap);
+//   //  _ProjectedSilhouette->addRef();
+//   //  
+//   _pView->AddSilhouette(_SilhouetteNode);
+//   //_pView->Add2DSilhouette(_ProjectedSilhouette);
+// 
+//   // Update options window
+//   //_pOptionsWindow->updateViewMapFormat();
+// 
+//   real d = _Chrono.stop();
+//   cout << "ViewMap loading  : " << d << endl;
+// 
+//   // Compute the Directional ViewMap:
+//   if(_ComputeSteerableViewMap){
+//     ComputeSteerableViewMap();
+//   }
+// 
+//   // Reset Style modules modification flags
+//   resetModified(true);
+// }
 
-  // Test File Magic and version
-  char tmp_buffer[256];
-  string test;
-  
-  ifs.getline(tmp_buffer, 255);
-  test = tmp_buffer;
-  if (test != Config::VIEWMAP_MAGIC) {
-    cerr << "Error: This is not a valid ." << Config::VIEWMAP_EXTENSION << " 
file" << endl;
-    return;
-  }
-  ifs.getline(tmp_buffer, 255);
-  test = tmp_buffer;
-  if (test != Config::VIEWMAP_VERSION && !only_camera) {
-    cerr << "Error: This version of the ." << Config::VIEWMAP_EXTENSION << " 
file format is no longer supported" << endl;
-    return;
-  }
-
-  // Read the models filenames and open them (if not already done)
-  string tmp;
-  vector<string> tmp_vec;
-  unsigned models_nb, i;
-
-  ifs.getline(tmp_buffer, 255);
-  models_nb = atoi(tmp_buffer);
-  for (i = 0; i < models_nb; i++) {
-    ifs.getline(tmp_buffer, 255);
-    tmp = tmp_buffer;
-    tmp_vec.push_back(tmp);
-  }
-  if (_ListOfModels != tmp_vec && !only_camera) {
-    CloseFile();
-    vector<string> pathnames;
-    int err = 0;
-    for (vector<string>::const_iterator i = tmp_vec.begin(); i != 
tmp_vec.end(); i++)
-      {
-       pathnames.clear();
-       StringUtils::getPathName(ViewMapIO::Options::getModelsPath(), *i, 
pathnames);
-       for (vector<string>::const_iterator j = pathnames.begin(); j != 
pathnames.end(); j++)
-         if (!(err = Load3DSFile(j->c_str())))
-           break;
-       if (err) {
-         cerr << "Error: cannot find model \"" << *i << "\" - check the path 
in the Options" << endl;
-         return;
-       }
-      }
-  }
-
-  // Set the camera position
-  float position[3];
-  float orientation[4];
-  ifs.read((char*)position, 3 * sizeof(*position));
-  ifs.read((char*)orientation, 4 * sizeof(*orientation));
-  _pView->setCameraState(position, orientation);
-  _pView->saveCameraState();
-
-  if (only_camera) {
-    return;
-  }
-
-  // Reset ViewMap
-  if(NULL != _ViewMap)
-    {
-      delete _ViewMap;
-      _ViewMap = 0;
-    }
-  _pView->DetachSilhouette();
-  if (NULL != _SilhouetteNode)
-    {
-      int ref = _SilhouetteNode->destroy();
-      if(0 == ref)
-       delete _SilhouetteNode;
-    }
-  //  if(NULL != _ProjectedSilhouette)
-  //    {
-  //      int ref = _ProjectedSilhouette->destroy();
-  //      if(0 == ref)
-  //   delete _ProjectedSilhouette;
-  //    }
-  //  if(NULL != _VisibleProjectedSilhouette)
-  //    {
-  //      int ref = _VisibleProjectedSilhouette->destroy();
-  //      if(0 == ref)
-  //   {
-  //     delete _VisibleProjectedSilhouette;
-  //     _VisibleProjectedSilhouette = 0;
-  //   }
-   // }
-  _ViewMap = new ViewMap();
-
-  // Read ViewMap
-  _Chrono.start();
-  if (ViewMapIO::load(ifs, _ViewMap, 0)) {
-    _Chrono.stop();
-
-    cerr << "Error: This is not a valid ." << Config::VIEWMAP_EXTENSION << " 
file" << endl;
-    return;
-  }
-
-  // Update display
-  ViewMapTesselator3D sTesselator3d;
-  //ViewMapTesselator2D sTesselator2d;
-  //sTesselator2d.SetNature(_edgeTesselationNature);
-  sTesselator3d.SetNature(_edgeTesselationNature);
-  
-  // Tesselate the 3D edges:
-  _SilhouetteNode = sTesselator3d.Tesselate(_ViewMap);
-  _SilhouetteNode->addRef();
-  
-  // Tesselate 2D edges
-  //  _ProjectedSilhouette = sTesselator2d.Tesselate(_ViewMap);
-  //  _ProjectedSilhouette->addRef();
-  //  
-  _pView->AddSilhouette(_SilhouetteNode);
-  //_pView->Add2DSilhouette(_ProjectedSilhouette);
-
-  // Update options window

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to