soc-2008-mxcurioni: towards Freestyle compilation, removing Qt's QString and QImage...
authorMaxime Curioni <maxime.curioni@gmail.com>
Fri, 9 May 2008 23:06:28 +0000 (23:06 +0000)
committerMaxime Curioni <maxime.curioni@gmail.com>
Fri, 9 May 2008 23:06:28 +0000 (23:06 +0000)
Modified code is commented by //soc and unused variables by //soc unused

37 files changed:
config/darwin-config.py
config/linux2-config.py
config/linuxcross-config.py
config/openbsd3-config.py
config/sunos5-config.py
config/win32-mingw-config.py
config/win32-vc-config.py
source/blender/freestyle/SConscript
source/blender/freestyle/intern/geometry/Grid.cpp
source/blender/freestyle/intern/geometry/Grid.h
source/blender/freestyle/intern/image/GaussianFilter.h
source/blender/freestyle/intern/image/ImagePyramid.cpp
source/blender/freestyle/intern/scene_graph/MaxFileLoader.h
source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
source/blender/freestyle/intern/stroke/Canvas.cpp
source/blender/freestyle/intern/stroke/ChainingIterators.cpp
source/blender/freestyle/intern/stroke/Operators.cpp
source/blender/freestyle/intern/stroke/Stroke.cpp
source/blender/freestyle/intern/stroke/StrokeRep.cpp
source/blender/freestyle/intern/system/Interpreter.h
source/blender/freestyle/intern/system/PseudoNoise.cpp
source/blender/freestyle/intern/system/StringUtils.cpp
source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
source/blender/freestyle/intern/view_map/FEdgeXDetector.h
source/blender/freestyle/intern/view_map/Interface0D.h
source/blender/freestyle/intern/view_map/Interface1D.h
source/blender/freestyle/intern/view_map/Silhouette.h
source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h
source/blender/freestyle/intern/view_map/ViewMapIO.cpp
source/blender/freestyle/intern/winged_edge/WEdge.h
source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp
source/blender/freestyle/intern/winged_edge/WSFillGrid.h
source/blender/freestyle/intern/winged_edge/WXEdge.h
source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp

index 9ceb1d1644b044c18b5c2d60c12bda2a5b0f0d12..115123f998442b1863f3c426b51b36aae72349ba 100644 (file)
@@ -168,7 +168,7 @@ BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
 BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
-BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 # WITH_BF_OPENEXR = 'true'
 # BF_OPENEXR = '${LCGDIR}/openexr'
index 3c8a48d12bc58ccd7e3955461f46dff1ac109220..f59dcf266ee3f986958d23aeed066dd27c530edb 100644 (file)
@@ -94,7 +94,7 @@ BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
 BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
-BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 #WITH_BF_NSPR = 'true'
 #BF_NSPR = $(LIBDIR)/nspr
index 886b9f93f3fdf85e38d9aa14a5b2db50bb47b061..603f6a1a8802e158252f79f58f80c4e2db75e699 100644 (file)
@@ -14,7 +14,7 @@ BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
 BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
-BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 ###########################
 
index ad4891a0098a279c483aa7cec394cde4589cef51..9a4c0d6f34e8ce378e92ee891ba058b30dd4f948 100644 (file)
@@ -88,7 +88,7 @@ BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
 BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
-BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 #WITH_BF_NSPR = 'true'
 #BF_NSPR = $(LIBDIR)/nspr
index 6581ad2b692b5b0c1694d90dd4bdef393867e0b9..cccc380f60cf293d6d0b1923b5fbe136ff028ba4 100644 (file)
@@ -90,7 +90,7 @@ BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
 BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
-BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 #WITH_BF_NSPR = 'true'
 #BF_NSPR = $(LIBDIR)/nspr
index b0a3c3ae18d28a357bf75b486e65eaecf9b48695..9757c0264b5597b067de6aca24a2fb606e204362 100644 (file)
@@ -105,7 +105,7 @@ BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
 BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
-BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 #WITH_BF_NSPR = 'true'
 #BF_NSPR = $(LIBDIR)/nspr
index 849b153378f6568566792bf98621b520fadac19a..8e7d6c56c13928460ac418140159cd8286001a62 100644 (file)
@@ -116,7 +116,7 @@ BF_SWIG_LIB = 'extern_swig'
 BF_LIB3DS = '${BF_FREESTYLE}/lib3ds'
 BF_LIB3DS_LIB = 'extern_lib3ds'
 BF_LIB3DS_LIBPATH = '${BF_LIB3DS}/lib3ds/.libs'
-BF_LIB3DS_INC = '${BF_LIB3DS}/lib3ds'
+BF_LIB3DS_INC = '${BF_LIB3DS}'
 
 #WITH_BF_NSPR = 'true'
 #BF_NSPR = $(LIBDIR)/nspr
index 7e859e58c589ffa0ca34e45df9819c9549175a5d..2bc08822a6ed98e8a0ba491e4f929155e214d5cb 100644 (file)
@@ -4,13 +4,61 @@ Import ('env')
 
 sources = []
 defs = []
+incs = ''
 
-incs = '#/extern/freestyle/lib3ds #/extern/freestyle/swig'
+incs += '../blenkernel ../blenlib ../imbuf ../makesdna'
+# incs += ' #/extern/freestyle/lib3ds #/extern/freestyle/swig'
+incs += ' ' + env['BF_PYTHON_INC']
 incs += ' ' + env['BF_LIB3DS_INC']
+incs += ' ' + env['BF_PNG_INC']
 
-# env.BlenderLib (libname="bf_freestyle",
-#                              sources=sources,
-#                 includes=Split(incs),
-#                 defines=defs,
-#                 libtype=['blender'],
-#                 priority = [15] )
\ No newline at end of file
+########################################################
+#      folders sources 
+########################################################
+
+#      system
+prefix = 'intern/system'
+system_sources = env.Glob(prefix + '/*.cpp')
+
+#      image
+prefix = 'intern/image'
+image_sources = env.Glob(prefix + '/*.cpp')
+
+#      geometry
+prefix = 'intern/geometry'
+geometry_sources = env.Glob(prefix + '/*.cpp')
+
+#      scene_graph
+prefix = 'intern/scene_graph'
+scene_graph_sources = env.Glob(prefix + '/*.cpp')
+
+#      winged_edge
+prefix = 'intern/winged_edge'
+winged_edge_sources = env.Glob(prefix + '/*.cpp')
+
+#      view_map
+prefix = 'intern/view_map'
+view_map_sources = env.Glob(prefix + '/*.cpp')
+
+#      stroke
+prefix = 'intern/stroke'
+stroke_sources = env.Glob(prefix + '/*.cpp')
+
+#      rendering
+#      app
+
+sources =      system_sources + image_sources + geometry_sources + scene_graph_sources + \
+                       winged_edge_sources + view_map_sources + stroke_sources
+#print sources
+
+env.BlenderLib (libname="bf_freestyle",
+                               sources=sources,
+                includes=Split(incs),
+                defines=defs,
+                libtype=['blender'],
+                priority = [15] )
+
+########################################################
+# SWIG
+########################################################
+#      swig
\ No newline at end of file
index 59b730358bc6980879c325122d6407ba32e56646..2477227c4108242d269d3c521c2dc2cbe2214c89 100755 (executable)
@@ -46,7 +46,7 @@ void firstIntersectionGridVisitor::examineOccluder(Polygon3r *occ){
     //first let us compute the plane equation.
     Vec3r v1(((occ)->getVertices())[0]);           
     Vec3d normal((occ)->getNormal());
-    double d = -(v1 * normal);
+    //soc unused - double d = -(v1 * normal);
 
     double tmp_u, tmp_v, tmp_t;
     if((occ)->rayIntersect(ray_org_, ray_dir_, tmp_t, tmp_u, tmp_v)){
@@ -106,7 +106,7 @@ void Grid::configure(const Vec3r& orig,
 
   if(grid_vol == 0){
     double min=DBL_MAX;
-    int index;
+    int index=0;
     int nzeros=0;
     for(int i=0;i<3;++i){
         if(size[i] == 0){
@@ -336,7 +336,7 @@ void Grid::initRay (const Vec3r &orig,
 
   for(unsigned i = 0; i < 3; i++) {
     _current_cell[i] = (unsigned)floor((orig[i] - _orig[i]) / _cell_size[i]);
-    unsigned u = _current_cell[i];
+    //soc unused - unsigned u = _current_cell[i];
     _pt[i] = orig[i] - _orig[i] - _current_cell[i] * _cell_size[i];
   }
   //_ray_occluders.clear();
@@ -359,7 +359,7 @@ bool Grid::initInfiniteRay (const Vec3r &orig,
   if(box.inside(orig)){
       for(unsigned i = 0; i < 3; i++) {
           _current_cell[i] = (unsigned)floor((orig[i] - _orig[i]) / _cell_size[i]);
-          unsigned u = _current_cell[i];
+          //soc unused - unsigned u = _current_cell[i];
           _pt[i] = orig[i] - _orig[i] - _current_cell[i] * _cell_size[i];
       }
   }else{
@@ -372,7 +372,7 @@ bool Grid::initInfiniteRay (const Vec3r &orig,
             _current_cell[i] = (unsigned)floor((newOrig[i] - _orig[i]) / _cell_size[i]);
             if(_current_cell[i] == _cells_nb[i])
                 _current_cell[i] = _cells_nb[i] - 1;
-            unsigned u = _current_cell[i];
+            //soc unused - unsigned u = _current_cell[i];
             _pt[i] = newOrig[i] - _orig[i] - _current_cell[i] * _cell_size[i];
         }
 
index 6197721bb4521177c5a47fce3daa661d104e007c..fdca13d4ca4ee13e5af0931e7b732332831e7ad6 100755 (executable)
@@ -81,6 +81,7 @@ class LIB_GEOMETRY_EXPORT Cell
 
 class GridVisitor{
 public:
+       virtual ~GridVisitor() {}; //soc
     virtual void discoverCell(Cell *cell) {}
     virtual void examineOccluder(Polygon3r *occ) {}
     virtual void finishCell(Cell *cell) {}
@@ -106,10 +107,21 @@ private:
  * the intersection information are stored and accessible.
  */
 class firstIntersectionGridVisitor : public GridVisitor {
+
+//soc - changed order to remove warnings
+public:
+    double u_, v_, t_;
+private:
+    Polygon3r *occluder_;
+       Vec3r ray_org_, ray_dir_, cell_size_;
+    Cell * current_cell_;
+
 public:
       firstIntersectionGridVisitor(const Vec3r& ray_org, const Vec3r& ray_dir, const Vec3r& cell_size) : 
-      GridVisitor(), ray_org_(ray_org), cell_size_(cell_size),ray_dir_(ray_dir),occluder_(0),
-            u_(0),v_(0),t_(DBL_MAX),current_cell_(0){}
+                GridVisitor(), u_(0),v_(0),t_(DBL_MAX),
+                occluder_(0),
+                ray_org_(ray_org), ray_dir_(ray_dir), cell_size_(cell_size),
+        current_cell_(0) {}
       virtual ~firstIntersectionGridVisitor() {}
 
     virtual void discoverCell(Cell *cell) {current_cell_=cell;}
@@ -117,14 +129,6 @@ public:
     virtual bool stop();
 
     Polygon3r * occluder() {return occluder_;}
-    
-public:
-    double u_, v_, t_;
-private:
-    Polygon3r *occluder_;
-    Vec3r ray_org_, ray_dir_;
-    Vec3r cell_size_;
-    Cell * current_cell_;
 };
 
 //
index c75177541d36ae4bd687b2a165bf0892cc56e6bf..c9ad04d4b80c20ce7f297a5855ec43ee9f9d7cfd 100755 (executable)
@@ -116,8 +116,8 @@ float GaussianFilter::getSmoothedPixel(Map * map, int x, int y)
 {
   float sum = 0.f;  
   float L=0.f;
-  unsigned w=map->width();
-  unsigned h=map->height();
+  int w = (int)map->width(); //soc
+  int h = (int)map->height(); //soc
 
   // Current pixel is x,y
   // Sum surrounding pixels L value:
index 45c02004d1cecfaff75cda29fb5198eb16d1fbdf..e3f84983055c2c0518c36a60d9831a460973367b 100755 (executable)
@@ -58,9 +58,9 @@ float ImagePyramid::pixel(int x, int y, int level){
   if(0 == level){
     return img->pixel(x,y);
   }
-  int i  = 1<<level;
-  int sx = x>>level;
-  int sy = y>>level;
+  uint i  = 1<<level;
+  uint sx = x>>level;
+  uint sy = y>>level;
   if(sx >= img->width())
     sx = img->width()-1;
   if(sy >= img->height())
@@ -135,7 +135,7 @@ void GaussianPyramid::BuildPyramid(GrayImage* level0, unsigned nbLevels){
   unsigned h = pLevel->height();
   if(nbLevels!=0)
   {
-    for(unsigned i=0; i<nbLevels; ++i){
+    for(unsigned i=0; i<nbLevels; ++i){ //soc
       w = pLevel->width()>>1;
       h = pLevel->height()>>1;
       GrayImage *img = new GrayImage(w,h);
index ab31e656d46d3143fbb64b23413874e7369b3b1d..179f9a016df12dbccee39f9d62f85b61acf91d8b 100755 (executable)
@@ -32,6 +32,9 @@
 
 # include <string.h>              
 # include <float.h>
+
+//soc - modified to adapt Blender's in
+// lib3ds includes
 # include <lib3ds/file.h>
 # include <lib3ds/node.h>
 # include <lib3ds/camera.h>
@@ -40,6 +43,7 @@
 # include <lib3ds/matrix.h>
 # include <lib3ds/vector.h>
 # include <lib3ds/file.h>
+
 # include "../system/FreestyleConfig.h"
 # include "NodeGroup.h"
 # include "NodeTransform.h"
index cf2982606e0b048e356101119f3aa080758bd3fc..ca0e97e68c198d9a8c47ac7d5e6822ce6576b3d1 100755 (executable)
@@ -89,13 +89,13 @@ namespace Functions1D {
   }  
 
   double GetDirectionalViewMapDensityF1D::operator()(Interface1D& inter) {
-    unsigned size;
+    //soc unsigned size;
     double res =  integrate(_fun, inter.pointsBegin(_sampling), inter.pointsEnd(_sampling), _integration);
     return res;
   } 
   
   double GetCompleteViewMapDensityF1D::operator()(Interface1D& inter) {
-    unsigned size;
+    //soc unsigned size;
     Id id = inter.getId();
     double res =  integrate(_fun, inter.pointsBegin(_sampling), inter.pointsEnd(_sampling), _integration);
     return res;
index c3827ae3e36f07cadebee748904f11c5a16e8b33..40a0bbbc738bd3c132f6893e724956769156e5ed 100755 (executable)
@@ -20,7 +20,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #include <fstream>
-#include <qimage.h>
 #include "BasicStrokeShaders.h"
 #include "../system/PseudoNoise.h"
 #include "../system/RandGen.h"
 #include "../system/StringUtils.h"
 #include "StrokeRenderer.h"
 #include "StrokeIO.h"
-#include <QString>
+
+//soc #include <qimage.h>
+//soc #include <QString>
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
 
 // Internal function
-void convert(const QImage& iImage, float **oArray, unsigned &oSize) {
-  oSize = iImage.width();
-  *oArray = new float[oSize];
-  for(unsigned i=0; i<oSize; ++i) {
-    QRgb rgb = iImage.pixel(i,0);
-    (*oArray)[i] = ((float)qBlue(rgb))/255.f;
-  }
+
+// soc
+// void convert(const QImage& iImage, float **oArray, unsigned &oSize) {
+//   oSize = iImage.width();
+//   *oArray = new float[oSize];
+//   for(unsigned i=0; i<oSize; ++i) {
+//     QRgb rgb = iImage.pixel(i,0);
+//     (*oArray)[i] = ((float)qBlue(rgb))/255.f;
+//   }
+// }
+void convert(ImBuf *imBuf, float **oArray, unsigned &oSize) {
+       oSize = imBuf->x;
+       *oArray = new float[oSize];
+
+       char *pix;
+       for(unsigned i=0; i < oSize; ++i) {
+               pix = (char*) imBuf->rect + i*4;
+       (*oArray)[i] = ((float) pix[2] )/255.f;
+       }
 }
 
 namespace StrokeShaders {
@@ -137,7 +152,7 @@ namespace StrokeShaders {
   {
     float step = (_maxThickness-_minThickness)/3.f;
     float l = stroke.getLength2D();
-    float thickness;
+    float thickness = 0.0;
     if(l>300.f)
       thickness = _minThickness+3.f*step;
     else if((l< 300.f) && (l>100.f))
@@ -172,7 +187,7 @@ namespace StrokeShaders {
     _stretch = stretch;
     _minThickness = iMinThickness;
     _maxThickness = iMaxThickness;
-    QImage image;
+    ImBuf *image = 0; //soc
     vector<string> pathnames;
     StringUtils::getPathName(TextureManager::Options::getPatternsPath(),
                             pattern_name,
@@ -180,11 +195,12 @@ namespace StrokeShaders {
     for (vector<string>::const_iterator j = pathnames.begin(); j != pathnames.end(); j++) {
       ifstream ifs(j->c_str());
       if (ifs.is_open()) {
-       image.load(j->c_str());
-       break;
+               //soc image.load(j->c_str());
+               image = IMB_loadiffname(j->c_str(), 0);
+               break;
       }
     }
-    if (image.isNull())
+    if (image == 0) //soc
       cerr << "Error: cannot find pattern \"" << pattern_name
           << "\" - check the path in the Options" << endl;
     else
@@ -315,7 +331,7 @@ namespace StrokeShaders {
                                                           bool stretch)
     : StrokeShader() {
     _stretch = stretch;
-    QImage image;
+    ImBuf *image = 0; //soc
     vector<string> pathnames;
     StringUtils::getPathName(TextureManager::Options::getPatternsPath(),
                             pattern_name,
@@ -323,11 +339,11 @@ namespace StrokeShaders {
     for (vector<string>::const_iterator j = pathnames.begin(); j != pathnames.end(); j++) {
       ifstream ifs(j->c_str());
       if (ifs.is_open()) {
-       image.load(j->c_str());
-       break;
+               image = IMB_loadiffname(j->c_str(), 0); //soc
+               break;
       }
     }
-    if (image.isNull())
+    if (image == 0) //soc
       cerr << "Error: cannot find pattern \"" << pattern_name
           << "\" - check the path in the Options" << endl;
     else
@@ -558,7 +574,7 @@ namespace StrokeShaders {
 
   void ExternalContourStretcherShader::shade(Stroke& stroke) const
   { 
-    float l=stroke.getLength2D();
+    //float l=stroke.getLength2D();
     Interface0DIterator it=stroke.verticesBegin();
     Functions0D::Normal2DF0D fun;
     StrokeVertex* sv;
@@ -1074,7 +1090,7 @@ namespace StrokeShaders {
     // number of vertices than before
     stroke.Resample(originalSize);
   
-    if(stroke.strokeVerticesSize() != originalSize)
+    if((int)stroke.strokeVerticesSize() != originalSize) //soc
       cerr << "Warning: resampling problem" << endl;
 
     // assign old attributes to new stroke vertices:
index ecb76c4a015b77724c09d6ca6e3f6cf046e5c782..7e63d964cb5da5e559c43120a9e028c3b70b2c5a 100755 (executable)
 #include "../system/TimeStamp.h"
 #include "../system/PseudoNoise.h"
 #include "Canvas.h"
-#include <qimage.h>
-#include <QString>
 #include "../image/Image.h"
 #include "../image/GaussianFilter.h"
 #include "../image/ImagePyramid.h"
 #include "../view_map/SteerableViewMap.h"
 #include "StyleModule.h"
 
+//soc #include <qimage.h>
+//soc #include <QString>
+#include <sstream>     
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+#include "intern/IMB_bmp.h"
+
 using namespace std;
 
 LIB_STROKE_EXPORT
@@ -326,21 +331,35 @@ void Canvas::loadMap(const char *iFileName, const char *iMapName, unsigned int i
   }else{
     filePath = iFileName;
   }
-  QImage * qimg;
-  QImage newMap(filePath.c_str()); 
-  if(newMap.isNull()){
-    cout << "Could not load image file " << filePath << endl;
-    return;
-  }
-  qimg = &newMap;
-  
+
+  //soc
+  // QImage *qimg;
+  // QImage newMap(filePath.c_str()); 
+  // if(newMap.isNull()){
+  //   cout << "Could not load image file " << filePath << endl;
+  //   return;
+  // }
+  // qimg = &newMap;
+       ImBuf *qimg = IMB_loadiffname(filePath.c_str(), 0);;
+       if( qimg == 0 ){
+               cout << "Could not load image file " << filePath << endl;
+       return; 
+       }
+
+  // soc
   //resize
-  QImage scaledImg;
-  if((newMap.width()!=width()) || (newMap.height()!=height())){
-         scaledImg = newMap.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-    qimg = &scaledImg;
+  // QImage scaledImg;
+  // if((newMap.width()!=width()) || (newMap.height()!=height())){
+  //     scaledImg = newMap.scaled(width(), height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+  //   qimg = &scaledImg;
+  // }
+       ImBuf *scaledImg;
+  if( ( qimg->x != width() ) || ( qimg->y != height() ) ){
+       scaledImg = IMB_dupImBuf(qimg);
+       IMB_scaleImBuf(scaledImg, width(), height());
   }
 
+
   // deal with color image 
   //  if(newMap->depth() != 8){
   //    int w = newMap->width();
@@ -356,13 +375,17 @@ void Canvas::loadMap(const char *iFileName, const char *iMapName, unsigned int i
   //    newMap = tmp;
   //  }
 
-  unsigned x,y;
-  int w = qimg->width();
-  int h = qimg->height();
+  int x,y;
+  int w = qimg->x;
+  int h = qimg->y;
+int rowbytes = w*4;
   GrayImage tmp(w,h);
+  char *pix;
+  
   for(y=0; y<h;++y){
     for(x=0;x<w;++x){
-      float c = qGray(qimg->pixel(x,y));// /255.f;
+               pix = (char*)qimg->rect + y*rowbytes + x*4;
+         float c = (pix[0]*11 + pix[1]*16 + pix[2]*5)/32;
       tmp.setPixel(x,y,c);
     }
   }
@@ -380,20 +403,30 @@ void Canvas::loadMap(const char *iFileName, const char *iMapName, unsigned int i
   GaussianPyramid *pyramid = new GaussianPyramid(tmp, iNbLevels, iSigma);
   int ow = pyramid->width(0);
   int oh = pyramid->height(0);
-  QString base(iMapName);
-  for(unsigned i=0; i<pyramid->getNumberOfLevels(); ++i){
+  string base(iMapName); //soc
+  for(int i=0; i<pyramid->getNumberOfLevels(); ++i){
     // save each image:
     //    w = pyramid.width(i);
     //    h = pyramid.height(i);
-         QImage qtmp(ow, oh, QImage::Format_RGB32);
-    //int k = (1<<i);
+       
+       //soc  QImage qtmp(ow, oh, QImage::Format_RGB32);
+    ImBuf *qtmp = IMB_allocImBuf(ow, oh, 32, IB_rect, 0);
+
+//int k = (1<<i);
     for(y=0;y<oh;++y){
       for(x=0;x<ow;++x){
         int c = pyramid->pixel(x,y,i);//255*pyramid->pixel(x,y,i);
-        qtmp.setPixel(x,y,qRgb(c,c,c));
+        //soc qtmp.setPixel(x,y,qRgb(c,c,c));
+               pix = (char*)qtmp->rect + y*rowbytes + x*4;
+               pix[0] = pix [1] = pix[2] = c;
       }
     }
-    qtmp.save(base+QString::number(i)+".bmp", "BMP");
+    //soc qtmp.save(base+QString::number(i)+".bmp", "BMP");
+       stringstream filename;
+       filename << base;
+       filename << i << ".bmp";        
+       imb_savebmp(qtmp, const_cast<char *>(filename.str().c_str()), 0);
+       
   }
   //  QImage *qtmp = new QImage(w, h, 32);
   //  for(y=0;y<h;++y){
index 206b6eb7364a0fe5e862fd6622a8db7125734184..ede3488c546e5d5a082b732d2babce52cabda380 100755 (executable)
@@ -106,7 +106,7 @@ ViewEdge * ChainSilhouetteIterator::traverse(const AdjacencyIterator& ait){
     return 0;
   }
   if(nextVertex->getNature() & Nature::NON_T_VERTEX){
-    NonTVertex * nontvertex = (NonTVertex*)nextVertex;
+    //soc NonTVertex * nontvertex = (NonTVertex*)nextVertex;
     ViewEdge * newEdge(0);
     // we'll try to chain the edges by keeping the same nature...
     // the preseance order is : SILHOUETTE, BORDER, CREASE, SUGGESTIVE, VALLEY, RIDGE
index 121dee3ba264cc34dd4b3c808a23f71c1a594f7b..8e34d9c519733a549d59e44bf590fa9e140f15a7 100755 (executable)
@@ -71,7 +71,7 @@ void Operators::chain(ViewEdgeInternal::ViewEdgeIterator& it,
 
   unsigned id = 0;
   ViewEdge* edge;
-  Chain* new_chain;
+  //soc unused - Chain* new_chain;
 
   for (I1DContainer::iterator it_edge = _current_view_edges_set.begin();
        it_edge != _current_view_edges_set.end();
@@ -108,7 +108,7 @@ void Operators::chain(ViewEdgeInternal::ViewEdgeIterator& it,
   Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp()+1);
 
   ViewEdge* edge;
-  Chain* new_chain;
+  //soc Chain* new_chain;
 
   for (I1DContainer::iterator it_edge = _current_view_edges_set.begin();
        it_edge != _current_view_edges_set.end();
@@ -232,7 +232,7 @@ void Operators::bidirectionalChain(ChainingIterator& it, UnaryPredicate1D& pred)
   Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp()+1);
   
   ViewEdge* edge;
-  Chain* new_chain;
+  //soc unused - Chain* new_chain;
   
   for (I1DContainer::iterator it_edge = _current_view_edges_set.begin();
   it_edge != _current_view_edges_set.end();
@@ -279,7 +279,7 @@ void Operators::bidirectionalChain(ChainingIterator& it) {
   Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp()+1);
   
   ViewEdge* edge;
-  Chain* new_chain;
+  //soc unused - Chain* new_chain;
   
   for (I1DContainer::iterator it_edge = _current_view_edges_set.begin();
   it_edge != _current_view_edges_set.end();
@@ -604,7 +604,7 @@ void __recursiveSplit(Chain *_curve, UnaryFunction0D<double>& func, UnaryPredica
   //real _min                                           = func(it0d);++it;
   real _min                                           = FLT_MAX;++it;
   real mean                                           = 0.f;
-  real variance                                       = 0.f;
+  //soc unused - real variance                                       = 0.f;
   unsigned count                                      = 0;
   CurveInternal::CurvePointIterator next              = it;++next;
   real tmp;
@@ -767,7 +767,7 @@ Stroke* createStroke(Interface1D& inter) {
   Vec3r previous = current;
   SVertex* sv;
   CurvePoint* cp;
-  StrokeVertex* stroke_vertex;  
+  StrokeVertex* stroke_vertex = NULL;  
 
   do {
     cp = dynamic_cast<CurvePoint*>(&(*it));
index d6ff4d255c4aa8071cbb154160c0da1b4fd19c36..7e7eb5ff3f0265a399aa15c1c51c792e6c5373a2 100755 (executable)
@@ -463,7 +463,7 @@ void Stroke::SetLength(float iLength)
 
 float Stroke::ComputeSampling(int iNVertices)
 {
-  if(iNVertices <= _Vertices.size())
+  if(iNVertices <= (int)_Vertices.size()) //soc
     return _sampling;
 
   float sampling = _Length/(float)(iNVertices-_Vertices.size()+1);
index 055e1fb1be414fd7efb05d6be35f292f9dff7c3a..51a1c8cfd4dba33dd4fa870d305bc9b2ab3db0ac 100755 (executable)
@@ -303,7 +303,7 @@ Strip::createStrip (const vector<StrokeVertex*>& iStrokeVertices)
     real dp1 = userDir*orthDir;
     real dp2 = userDir*t;
     real h = (thicknessLast[1]+thicknessLast[0])/dp1;
-    real x = fabs(h*dp2/2.0);
+    //soc unused - real x = fabs(h*dp2/2.0);
     if(dp1>0){
       //i'm in the upper part of the unit circle
       if(dp2>0){
@@ -367,7 +367,7 @@ Strip::createStrip (const vector<StrokeVertex*>& iStrokeVertices)
   if (iStrokeVertices.size()<3)
     _averageThickness=0.5*(thicknessLast[1]+thicknessLast[0]+thickness[0]+thickness[1]);
 
-  if (i!=2*iStrokeVertices.size())
+  if (i != 2*(int)iStrokeVertices.size())
     cerr << "Warning: problem with stripe size\n";
 
   cleanUpSingularities (iStrokeVertices);
@@ -380,7 +380,7 @@ void
 Strip::cleanUpSingularities (const vector<StrokeVertex*>& iStrokeVertices)
 {
   int k;
-  unsigned sizeStrip = _vertices.size();
+  int sizeStrip = _vertices.size();
 
   for (k=0; k<sizeStrip; k++)
     if (notValid(_vertices[k]->point2d()))
@@ -393,7 +393,7 @@ Strip::cleanUpSingularities (const vector<StrokeVertex*>& iStrokeVertices)
   if (iStrokeVertices.size()<2) return;
   int i=0, j;
   vector<StrokeVertex*>::const_iterator v ,vend, v2, vPrev;
-  StrokeVertex *sv, *sv2, *svPrev;
+StrokeVertex *sv, *sv2; //soc unused -  *svPrev;
        
   bool singu1=false, singu2=false;
   int timeSinceSingu1=0, timeSinceSingu2=0;
@@ -469,7 +469,7 @@ Strip::cleanUpSingularities (const vector<StrokeVertex*>& iStrokeVertices)
     {
       //traverse all the vertices of the singularity and average them
       Vec2r avP(0.0,0.0);
-      for (int j=i-timeSinceSingu1; j<i; j++)
+      for (j=i-timeSinceSingu1; j<i; j++)
        avP=Vec2r(avP+_vertices[2*j]->point2d());
       avP=Vec2r(1.0/float(timeSinceSingu1)*avP);
       for (j=i-timeSinceSingu1; j<i; j++)
@@ -525,18 +525,18 @@ Strip::computeTexCoord (const vector<StrokeVertex*>& iStrokeVertices)
 void
 Strip::computeTexCoordWithTips (const vector<StrokeVertex*>& iStrokeVertices, bool tipBegin, bool tipEnd)
 {
-  unsigned int sizeStrip = _vertices.size()+8; //for the transition between the tip and the body
+  //soc unused - unsigned int sizeStrip = _vertices.size()+8; //for the transition between the tip and the body
   vector<StrokeVertex*>::const_iterator v ,vend;
-  StrokeVertex *sv;
+  StrokeVertex *sv = 0;
 
   v=iStrokeVertices.begin();
   vend=iStrokeVertices.end();
   float l=(*v)->strokeLength()/_averageThickness;
   int tiles=int(l);
   float fact=(float(tiles)+0.5)/l;
-  float uTip2=float(tiles)+0.25;
+  //soc unused - float uTip2=float(tiles)+0.25;
   float u=0; 
-  float uPrev;
+  float uPrev=0;
   int i=0;
   float t;
   StrokeVertexRep *tvRep1, *tvRep2;
@@ -757,7 +757,7 @@ StrokeRep::StrokeRep(Stroke *iStroke)
 
 StrokeRep::StrokeRep(const StrokeRep& iBrother)
 {
-  int i=0;
+  //soc unused - int i=0;
   _stroke = iBrother._stroke;
   _strokeType=iBrother._strokeType;
   _textureId = iBrother._textureId;
index ce603b17238b753932561cc62eb0eea610549c3f..45cb7793cfd93340308b78e7998b9014b4115d41 100755 (executable)
@@ -40,6 +40,8 @@ class LIB_SYSTEM_EXPORT Interpreter
 
   Interpreter() { _language = "Unknown"; }
 
+  virtual ~Interpreter() {}; //soc
+
   virtual int interpretCmd(const string& cmd) = 0;
 
   virtual int interpretFile(const string& filename) = 0;
index 59332229ae272de0def92d66f304129458f8f4fe..4d62f967cde4e24dabe0d370fd49c3614025a7e4 100755 (executable)
@@ -36,7 +36,7 @@ PseudoNoise::init (long seed)
 {
   _values = new real[NB_VALUE_NOISE];
   RandGen::srand48(seed);
-  for (int i=0; i<NB_VALUE_NOISE; i++)
+  for (uint i=0; i<NB_VALUE_NOISE; i++)
     _values[i] = -1.0 + 2.0 * RandGen::drand48();
 }
 
index 2af76feeb378650f34f67a3b3f59a343d666b50e..1afee94d962c1a4ee893fc53985722a7eb6e72cd 100755 (executable)
 //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include <qfileinfo.h>
+//soc #include <qfileinfo.h>
 #include "FreestyleConfig.h"
 #include "StringUtils.h"
 
+//soc
+#include "BKE_utildefines.h"
+#include "BLI_blenlib.h"
+
 namespace StringUtils {
 
   void getPathName(const string& path, const string& base, vector<string>& pathnames) {
@@ -33,12 +37,18 @@ namespace StringUtils {
         pos < size;
         pos = sep + 1, sep = path.find(Config::PATH_SEP, pos)) {
       if (sep == (unsigned)string::npos)
-       sep = size;
+               sep = size;
       dir = path.substr(pos, sep - pos);
-      QFileInfo fi(dir.c_str());
-      string res = (const char*)fi.absoluteFilePath().toAscii();
+
+//soc      QFileInfo fi(dir.c_str());
+//soc      string res = (const char*)fi.absoluteFilePath().toAscii();
+       char cleaned[FILE_MAX];
+       BLI_strncpy(cleaned, dir.c_str(), FILE_MAX);
+       BLI_cleanup_file(NULL, cleaned);
+       string res(cleaned);
+       
       if (!base.empty())
-       res += Config::DIR_SEP + base;
+               res += Config::DIR_SEP + base;
       pathnames.push_back(res);
     }
   }
index 628b3ad77aa67bbeaf8a5bac303db4e41aa5cfde..d9caee85e188e1052c4732a91bd4f38f0a98a24d 100755 (executable)
@@ -143,7 +143,8 @@ void FEdgeXDetector::computeCurvatures(WXVertex *vertex){
    // CURVATURE LAYER
   // store all the curvature datas for each vertex
 
-  real K1, K2, cos2theta, sin2theta;
+  //soc unused - real K1, K2
+  real cos2theta, sin2theta;
   Vec3r e1, n, v;
   // one vertex curvature info :
   CurvatureInfo *C;
index 38d0f34e21fefa9b84aabac45a38ce86e9b7859e..a6235dd53b551b5fc70335ef32614c0cd72d2960 100755 (executable)
@@ -126,7 +126,7 @@ protected:
 
   Vec3r _Viewpoint;
   real _bbox_diagonal; // diagonal of the current processed shape bbox
-  //tmp values
+  //oldtmp values
   bool _computeViewIndependant;
   real _meanK1;
   real _meanKr;
index eec39d2f7bc3b229ccb765ed7f2370cea79c9c6a..fd2e882e9b63513d931662aac8c783e048dcd904 100755 (executable)
@@ -52,6 +52,8 @@ class TVertex;
 class Interface0D
 {
 public:
+       virtual ~Interface0D() {}; //soc
 
   /*! Returns the string "Interface0D".*/
   virtual string getExactTypeName() const {
index 812187e5ec172629eae9d4f682aa14ab0b11ec61..96dd94c36f9c6c4ef559238e4ed4d7bd51b7fa86 100755 (executable)
@@ -127,6 +127,7 @@ public:
 
   /*! Default constructor */
   Interface1D() {_timeStamp=0;}
+   virtual ~Interface1D() {}; //soc
 
   /*! Returns the string "Interface1D" .*/
   virtual string getExactTypeName() const {
index e88bf23b210b9046828a1045d5b653dad9e97713..958c0545d6d91f04a281b910564fe7dad621ca9f 100755 (executable)
@@ -1248,7 +1248,7 @@ public:
    */
   inline FEdge* SplitEdgeIn2(FEdge* ioEdge, SVertex * ioNewVertex)
     {
-      SVertex *A = ioEdge->vertexA();
+      //soc unused - SVertex *A = ioEdge->vertexA();
       SVertex *B = ioEdge->vertexB();
 
       
index b2604606aa739d630edbfd497f115425a666658b..3870edc2b7527f7cd3021b4c012fc03a5340a9f2 100755 (executable)
 #include "../geometry/Geom.h"
 using namespace Geometry;
 
-#include <qstring.h>
-#include <qimage.h>
+//soc #include <qstring.h>
+//soc #include <qimage.h>
+#include <sstream>
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+#include "intern/IMB_png.h"
 
 SteerableViewMap::SteerableViewMap(unsigned int nbOrientations){
   _nbOrientations = nbOrientations;
@@ -121,7 +125,7 @@ double * SteerableViewMap::AddFEdge(FEdge *iFEdge){
 
 unsigned SteerableViewMap::getSVMNumber(const Vec2f& orient){
   Vec2f dir(orient);
-  unsigned res = 0;
+  //soc unsigned res = 0;
   real norm = dir.norm();
   if(norm < 1e-6){
     return _nbOrientations+1;
@@ -205,20 +209,37 @@ void SteerableViewMap::saveSteerableViewMap() const {
     }
     int ow = _imagesPyramids[i]->width(0);
     int oh = _imagesPyramids[i]->height(0);
-    QString base("SteerableViewMap");
-    for(unsigned j=0; j<_imagesPyramids[i]->getNumberOfLevels(); ++j){
+
+    //soc QString base("SteerableViewMap");
+       string base("SteerableViewMap");
+       stringstream filename;
+       
+    for(int j=0; j<_imagesPyramids[i]->getNumberOfLevels(); ++j){ //soc
       float coeff = 1;//1/255.f; //100*255;//*pow(2,j);
-         QImage qtmp(ow, oh, QImage::Format_RGB32);
-      for(unsigned y=0;y<oh;++y){
-        for(unsigned x=0;x<ow;++x){
+         //soc QImage qtmp(ow, oh, QImage::Format_RGB32);
+         ImBuf *ibuf = IMB_allocImBuf(ow, oh, 32, IB_rect, 0);
+         int rowbytes = ow*4;
+         char *pix;
+      
+       for(int y=0;y<oh;++y){ //soc
+               for(int x=0;x<ow;++x){ //soc
           int c = (int)(coeff*_imagesPyramids[i]->pixel(x,y,j));
           if(c>255)
             c=255;
           //int c = (int)(_imagesPyramids[i]->pixel(x,y,j));
-          qtmp.setPixel(x,y,qRgb(c,c,c));
+          
+               //soc qtmp.setPixel(x,y,qRgb(c,c,c));
+                 pix = (char*)ibuf->rect + y*rowbytes + x*4;
+               pix[0] = pix [1] = pix[2] = c;
         }
       }
-      qtmp.save(base+QString::number(i)+"-"+QString::number(j)+".png", "PNG");
+
+      //soc qtmp.save(base+QString::number(i)+"-"+QString::number(j)+".png", "PNG");
+       filename << base;
+       filename << i << "-" << j << ".png";
+       
+       imb_savepng(ibuf, const_cast<char *>(filename.str().c_str()), 0);
+       
     }
     //    QString base("SteerableViewMap");
     //    for(unsigned j=0; j<_imagesPyramids[i]->getNumberOfLevels(); ++j){
index 20b3aeb144dfeaea8d94c5e21c131d147d4c7897..bf4369bcf4139183cec0001a8fea0b8c20a55d0f 100755 (executable)
@@ -169,7 +169,7 @@ ViewEdge * ViewEdgeXBuilder::BuildSmoothViewEdge(const OWXFaceLayer& iFaceLayer)
   // build FEdges
   FEdge * feprevious = 0;
   FEdge * fefirst = 0;
-  FEdge * fe;
+  FEdge * fe = 0;
   for(list<OWXFaceLayer>::iterator fl = facesChain.begin(), flend=facesChain.end();
   fl!=flend;
   ++fl){
@@ -243,7 +243,7 @@ ViewEdge * ViewEdgeXBuilder::BuildSharpViewEdge(const OWXEdge& iWEdge) {
   // build FEdges
   FEdge * feprevious = 0;
   FEdge * fefirst = 0;
-  FEdge * fe;
+  FEdge * fe = 0;
   for(list<OWXEdge>::iterator we = edgesChain.begin(), weend=edgesChain.end();
   we!=weend;
   ++we){
index 9e2837b49a77756b58c1933f215112d423ae1769..da63fa2f515e07d6e392f62875b50bcbb1560ffc 100755 (executable)
 # include <utility>
 # include <vector>
 
-# if defined(__GNUC__) && (__GNUC__ >= 3)
-//hash_map is not part of the C++ standard anymore; hash_map.h has been kept though for backward compatibility
-#  include <hash_map.h>
-# else
-#  include <hash_map>
-# endif
+// soc
+// # if defined(__GNUC__) && (__GNUC__ >= 3)
+// //hash_map is not part of the C++ standard anymore; hash_map.h has been kept though for backward compatibility
+// #  include <hash_map.h>
+// # else
+// #  include <hash_map>
+// # endif
 
 # include "../system/FreestyleConfig.h"
 # include "../geometry/Geom.h"
@@ -202,7 +203,7 @@ protected:
   /*! instanciate a ViewVertex from a SVertex, if it doesn't exist yet */
   ViewVertex * MakeViewVertex(SVertex *iSVertex);
 
-  //tmp values
+  //oldtmp values
   //  IdHashTable _hashtable;
   //  VVIdHashTable _multivertexHashTable;
   SVertexMap _SVertexMap;
index d68164973a1276417d5c05783cddff80a9da07c3..4e2796113c88419c3d93e070c943aa69e20719a4 100755 (executable)
@@ -937,7 +937,7 @@ namespace ViewMapIO {
     if (!vm)
       return 1;
 
-    unsigned tmp;
+    //soc unused - unsigned tmp;
 
     int err = 0;
 
index 2369caf45661ae02c25f24880d5db48bb067b775..1ab37246469c935c621a24de4f238573a98de5ea 100755 (executable)
@@ -117,6 +117,7 @@ public:
 # else
     inline incoming_edge_iterator() : iterator<input_iterator_tag, WOEdge*,ptrdiff_t>() {}
 # endif
+       virtual ~incoming_edge_iterator() {}; //soc
 
   protected:
     friend class WVertex;
@@ -197,6 +198,7 @@ public:
 # else
     inline face_iterator() : iterator<input_iterator_tag, WFace*,ptrdiff_t>() {}
 # endif
+       virtual ~face_iterator() {}; //soc
 
   protected:
     friend class WVertex;
@@ -308,6 +310,7 @@ public:
     _pOwner = NULL;
     userdata = NULL;
   }
+  virtual ~WOEdge() {}; //soc
 
   /*! copy constructor */
   WOEdge(WOEdge& iBrother);
index cf3734b488e07d10f80ed8cdda1255c53a329f5f..55fa418d4f5530d56e92adc1a7e3ba3a4e9c0660 100755 (executable)
@@ -19,7 +19,7 @@
 //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "WSEdge.h"
+#include "WEdge.h"
 #include "WSFillGrid.h"
 
 void WSFillGrid::fillGrid() {
index 976fdca8e462ccb11652816d48f9a924adce98ac..2ea5bc6c621d5509db2e45b8d1147202eeaa31ce 100755 (executable)
@@ -31,8 +31,8 @@
 #ifndef  WS_FILL_GRID_H
 # define WS_FILL_GRID_H
 
-# include "Grid.h" 
-# include "Polygon.h"
+# include "../geometry/Grid.h" 
+# include "../geometry/Polygon.h"
 # include "WEdge.h"
 
 class LIB_WINGED_EDGE_EXPORT WSFillGrid
index beacb1a9ca9249a9f0030cee328cc9ff67278862..66204ba5e9955fed69a70c5f7f8e197be0c2e723 100755 (executable)
@@ -208,7 +208,7 @@ public:
   WXSmoothEdge * _pSmoothEdge;
   WXNature _Nature;
 
-  //tmp values
+  //oldtmp values
   unsigned _nPosDotP; // count the number of positive dot products for vertices.
                       // if this number is != 0 and !=_DotP.size() -> it is a silhouette fac
 
index 98e7c269248b036a7a29809f4f0c74a812e69ce8..e611c1106f2b19abcf2826ecffdd537e68719cc2 100755 (executable)
@@ -64,7 +64,7 @@ void WingedEdgeBuilder::visitNodeTransformAfter(NodeTransform&) {
 void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) {
   unsigned     vsize = ifs.vsize();
   unsigned     nsize = ifs.nsize();
-  unsigned     tsize = ifs.tsize();
+  //soc unused - unsigned      tsize = ifs.tsize();
 
   const real*  vertices = ifs.vertices();
   const real*  normals = ifs.normals();