From fd9ad582983939741a4c4fa5f2707f29365d6c09 Mon Sep 17 00:00:00 2001 From: Maxime Curioni Date: Fri, 9 May 2008 23:06:28 +0000 Subject: soc-2008-mxcurioni: towards Freestyle compilation, removing Qt's QString and QImage dependencies. Up to this commit, the following directories compile well (and without any warning): system, image, geometry, graph, winged_edge, view_map, stroke. Modified code is commented by //soc and unused variables by //soc unused --- source/blender/freestyle/SConscript | 62 +++++++++++++++-- source/blender/freestyle/intern/geometry/Grid.cpp | 10 +-- source/blender/freestyle/intern/geometry/Grid.h | 24 ++++--- .../freestyle/intern/image/GaussianFilter.h | 4 +- .../freestyle/intern/image/ImagePyramid.cpp | 8 +-- .../freestyle/intern/scene_graph/MaxFileLoader.h | 4 ++ .../intern/stroke/AdvancedFunctions1D.cpp | 4 +- .../freestyle/intern/stroke/BasicStrokeShaders.cpp | 56 +++++++++------ source/blender/freestyle/intern/stroke/Canvas.cpp | 81 +++++++++++++++------- .../freestyle/intern/stroke/ChainingIterators.cpp | 2 +- .../blender/freestyle/intern/stroke/Operators.cpp | 12 ++-- source/blender/freestyle/intern/stroke/Stroke.cpp | 2 +- .../blender/freestyle/intern/stroke/StrokeRep.cpp | 20 +++--- .../blender/freestyle/intern/system/Interpreter.h | 2 + .../freestyle/intern/system/PseudoNoise.cpp | 2 +- .../freestyle/intern/system/StringUtils.cpp | 20 ++++-- .../freestyle/intern/view_map/FEdgeXDetector.cpp | 3 +- .../freestyle/intern/view_map/FEdgeXDetector.h | 2 +- .../freestyle/intern/view_map/Interface0D.h | 2 + .../freestyle/intern/view_map/Interface1D.h | 1 + .../blender/freestyle/intern/view_map/Silhouette.h | 2 +- .../freestyle/intern/view_map/SteerableViewMap.cpp | 41 ++++++++--- .../freestyle/intern/view_map/ViewEdgeXBuilder.cpp | 4 +- .../freestyle/intern/view_map/ViewEdgeXBuilder.h | 15 ++-- .../freestyle/intern/view_map/ViewMapIO.cpp | 2 +- .../blender/freestyle/intern/winged_edge/WEdge.h | 3 + .../freestyle/intern/winged_edge/WSFillGrid.cpp | 2 +- .../freestyle/intern/winged_edge/WSFillGrid.h | 4 +- .../blender/freestyle/intern/winged_edge/WXEdge.h | 2 +- .../intern/winged_edge/WingedEdgeBuilder.cpp | 2 +- 30 files changed, 272 insertions(+), 126 deletions(-) (limited to 'source/blender') diff --git a/source/blender/freestyle/SConscript b/source/blender/freestyle/SConscript index 7e859e58c58..2bc08822a6e 100644 --- a/source/blender/freestyle/SConscript +++ b/source/blender/freestyle/SConscript @@ -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 diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp index 59b730358bc..2477227c410 100755 --- a/source/blender/freestyle/intern/geometry/Grid.cpp +++ b/source/blender/freestyle/intern/geometry/Grid.cpp @@ -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]; } diff --git a/source/blender/freestyle/intern/geometry/Grid.h b/source/blender/freestyle/intern/geometry/Grid.h index 6197721bb45..fdca13d4ca4 100755 --- a/source/blender/freestyle/intern/geometry/Grid.h +++ b/source/blender/freestyle/intern/geometry/Grid.h @@ -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_; }; // diff --git a/source/blender/freestyle/intern/image/GaussianFilter.h b/source/blender/freestyle/intern/image/GaussianFilter.h index c75177541d3..c9ad04d4b80 100755 --- a/source/blender/freestyle/intern/image/GaussianFilter.h +++ b/source/blender/freestyle/intern/image/GaussianFilter.h @@ -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: diff --git a/source/blender/freestyle/intern/image/ImagePyramid.cpp b/source/blender/freestyle/intern/image/ImagePyramid.cpp index 45c02004d1c..e3f84983055 100755 --- a/source/blender/freestyle/intern/image/ImagePyramid.cpp +++ b/source/blender/freestyle/intern/image/ImagePyramid.cpp @@ -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 sy = y>>level; + uint i = 1<>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; iwidth()>>1; h = pLevel->height()>>1; GrayImage *img = new GrayImage(w,h); diff --git a/source/blender/freestyle/intern/scene_graph/MaxFileLoader.h b/source/blender/freestyle/intern/scene_graph/MaxFileLoader.h index ab31e656d46..179f9a016df 100755 --- a/source/blender/freestyle/intern/scene_graph/MaxFileLoader.h +++ b/source/blender/freestyle/intern/scene_graph/MaxFileLoader.h @@ -32,6 +32,9 @@ # include # include + +//soc - modified to adapt Blender's in +// lib3ds includes # include # include # include @@ -40,6 +43,7 @@ # include # include # include + # include "../system/FreestyleConfig.h" # include "NodeGroup.h" # include "NodeTransform.h" diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp index cf2982606e0..ca0e97e68c1 100755 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp @@ -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; diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index c3827ae3e36..40a0bbbc738 100755 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -20,7 +20,6 @@ /////////////////////////////////////////////////////////////////////////////// #include -#include #include "BasicStrokeShaders.h" #include "../system/PseudoNoise.h" #include "../system/RandGen.h" @@ -32,16 +31,32 @@ #include "../system/StringUtils.h" #include "StrokeRenderer.h" #include "StrokeIO.h" -#include + +//soc #include +//soc #include +#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; ix; + *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 pathnames; StringUtils::getPathName(TextureManager::Options::getPatternsPath(), pattern_name, @@ -180,11 +195,12 @@ namespace StrokeShaders { for (vector::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 pathnames; StringUtils::getPathName(TextureManager::Options::getPatternsPath(), pattern_name, @@ -323,11 +339,11 @@ namespace StrokeShaders { for (vector::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: diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index ecb76c4a015..7e63d964cb5 100755 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -25,14 +25,19 @@ #include "../system/TimeStamp.h" #include "../system/PseudoNoise.h" #include "Canvas.h" -#include -#include #include "../image/Image.h" #include "../image/GaussianFilter.h" #include "../image/ImagePyramid.h" #include "../view_map/SteerableViewMap.h" #include "StyleModule.h" +//soc #include +//soc #include +#include +#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; ypixel(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; igetNumberOfLevels(); ++i){ + string base(iMapName); //soc + for(int i=0; igetNumberOfLevels(); ++i){ // save each image: // w = pyramid.width(i); // h = pyramid.height(i); - QImage qtmp(ow, oh, QImage::Format_RGB32); - //int k = (1<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(filename.str().c_str()), 0); + } // QImage *qtmp = new QImage(w, h, 32); // for(y=0;ygetNature() & 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 diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp index 121dee3ba26..8e34d9c5197 100755 --- a/source/blender/freestyle/intern/stroke/Operators.cpp +++ b/source/blender/freestyle/intern/stroke/Operators.cpp @@ -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& 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(&(*it)); diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp index d6ff4d255c4..7e7eb5ff3f0 100755 --- a/source/blender/freestyle/intern/stroke/Stroke.cpp +++ b/source/blender/freestyle/intern/stroke/Stroke.cpp @@ -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); diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp index 055e1fb1be4..51a1c8cfd4d 100755 --- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp @@ -303,7 +303,7 @@ Strip::createStrip (const vector& 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& 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& iStrokeVertices) { int k; - unsigned sizeStrip = _vertices.size(); + int sizeStrip = _vertices.size(); for (k=0; kpoint2d())) @@ -393,7 +393,7 @@ Strip::cleanUpSingularities (const vector& iStrokeVertices) if (iStrokeVertices.size()<2) return; int i=0, j; vector::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& iStrokeVertices) { //traverse all the vertices of the singularity and average them Vec2r avP(0.0,0.0); - for (int j=i-timeSinceSingu1; jpoint2d()); avP=Vec2r(1.0/float(timeSinceSingu1)*avP); for (j=i-timeSinceSingu1; j& iStrokeVertices) void Strip::computeTexCoordWithTips (const vector& 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::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; diff --git a/source/blender/freestyle/intern/system/Interpreter.h b/source/blender/freestyle/intern/system/Interpreter.h index ce603b17238..45cb7793cfd 100755 --- a/source/blender/freestyle/intern/system/Interpreter.h +++ b/source/blender/freestyle/intern/system/Interpreter.h @@ -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; diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp index 59332229ae2..4d62f967cde 100755 --- a/source/blender/freestyle/intern/system/PseudoNoise.cpp +++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp @@ -36,7 +36,7 @@ PseudoNoise::init (long seed) { _values = new real[NB_VALUE_NOISE]; RandGen::srand48(seed); - for (int i=0; i +//soc #include #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& 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); } } diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index 628b3ad77aa..d9caee85e18 100755 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -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; diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h index 38d0f34e21f..a6235dd53b5 100755 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h @@ -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; diff --git a/source/blender/freestyle/intern/view_map/Interface0D.h b/source/blender/freestyle/intern/view_map/Interface0D.h index eec39d2f7bc..fd2e882e9b6 100755 --- a/source/blender/freestyle/intern/view_map/Interface0D.h +++ b/source/blender/freestyle/intern/view_map/Interface0D.h @@ -52,6 +52,8 @@ class TVertex; class Interface0D { public: + + virtual ~Interface0D() {}; //soc /*! Returns the string "Interface0D".*/ virtual string getExactTypeName() const { diff --git a/source/blender/freestyle/intern/view_map/Interface1D.h b/source/blender/freestyle/intern/view_map/Interface1D.h index 812187e5ec1..96dd94c36f9 100755 --- a/source/blender/freestyle/intern/view_map/Interface1D.h +++ b/source/blender/freestyle/intern/view_map/Interface1D.h @@ -127,6 +127,7 @@ public: /*! Default constructor */ Interface1D() {_timeStamp=0;} + virtual ~Interface1D() {}; //soc /*! Returns the string "Interface1D" .*/ virtual string getExactTypeName() const { diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h index e88bf23b210..958c0545d6d 100755 --- a/source/blender/freestyle/intern/view_map/Silhouette.h +++ b/source/blender/freestyle/intern/view_map/Silhouette.h @@ -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(); diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index b2604606aa7..3870edc2b75 100755 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -26,8 +26,12 @@ #include "../geometry/Geom.h" using namespace Geometry; -#include -#include +//soc #include +//soc #include +#include +#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;ypixel(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(filename.str().c_str()), 0); + } // QString base("SteerableViewMap"); // for(unsigned j=0; j<_imagesPyramids[i]->getNumberOfLevels(); ++j){ diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp index 20b3aeb144d..bf4369bcf41 100755 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp @@ -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::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::iterator we = edgesChain.begin(), weend=edgesChain.end(); we!=weend; ++we){ diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h index 9e2837b49a7..da63fa2f515 100755 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h @@ -35,12 +35,13 @@ # include # include -# 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 -# else -# include -# 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 +// # else +// # include +// # 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; diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp index d68164973a1..4e2796113c8 100755 --- a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp @@ -937,7 +937,7 @@ namespace ViewMapIO { if (!vm) return 1; - unsigned tmp; + //soc unused - unsigned tmp; int err = 0; diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h index 2369caf4566..1ab37246469 100755 --- a/source/blender/freestyle/intern/winged_edge/WEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WEdge.h @@ -117,6 +117,7 @@ public: # else inline incoming_edge_iterator() : iterator() {} # endif + virtual ~incoming_edge_iterator() {}; //soc protected: friend class WVertex; @@ -197,6 +198,7 @@ public: # else inline face_iterator() : iterator() {} # 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); diff --git a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp index cf3734b488e..55fa418d4f5 100755 --- a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp +++ b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp @@ -19,7 +19,7 @@ // /////////////////////////////////////////////////////////////////////////////// -#include "WSEdge.h" +#include "WEdge.h" #include "WSFillGrid.h" void WSFillGrid::fillGrid() { diff --git a/source/blender/freestyle/intern/winged_edge/WSFillGrid.h b/source/blender/freestyle/intern/winged_edge/WSFillGrid.h index 976fdca8e46..2ea5bc6c621 100755 --- a/source/blender/freestyle/intern/winged_edge/WSFillGrid.h +++ b/source/blender/freestyle/intern/winged_edge/WSFillGrid.h @@ -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 diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.h b/source/blender/freestyle/intern/winged_edge/WXEdge.h index beacb1a9ca9..66204ba5e99 100755 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.h @@ -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 diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp index 98e7c269248..e611c1106f2 100755 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp @@ -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(); -- cgit v1.2.3