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
This commit is contained in:
Maxime Curioni 2008-05-09 23:06:28 +00:00
parent 64e4a3ec9a
commit fd9ad58298
37 changed files with 279 additions and 133 deletions

@ -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'

@ -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

@ -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}'
###########################

@ -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

@ -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

@ -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

@ -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

@ -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] )
########################################################
# 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

@ -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];
}

@ -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_;
};
//

@ -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:

@ -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);

@ -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"

@ -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;

@ -20,7 +20,6 @@
///////////////////////////////////////////////////////////////////////////////
#include <fstream>
#include <qimage.h>
#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 <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:

@ -25,14 +25,19 @@
#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){

@ -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

@ -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));

@ -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);

@ -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;

@ -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;

@ -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();
}

@ -19,10 +19,14 @@
//
///////////////////////////////////////////////////////////////////////////////
#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);
}
}

@ -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;

@ -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;

@ -52,6 +52,8 @@ class TVertex;
class Interface0D
{
public:
virtual ~Interface0D() {}; //soc
/*! Returns the string "Interface0D".*/
virtual string getExactTypeName() const {

@ -127,6 +127,7 @@ public:
/*! Default constructor */
Interface1D() {_timeStamp=0;}
virtual ~Interface1D() {}; //soc
/*! Returns the string "Interface1D" .*/
virtual string getExactTypeName() const {

@ -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();

@ -26,8 +26,12 @@
#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){

@ -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){

@ -35,12 +35,13 @@
# 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;

@ -937,7 +937,7 @@ namespace ViewMapIO {
if (!vm)
return 1;
unsigned tmp;
//soc unused - unsigned tmp;
int err = 0;

@ -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);

@ -19,7 +19,7 @@
//
///////////////////////////////////////////////////////////////////////////////
#include "WSEdge.h"
#include "WEdge.h"
#include "WSFillGrid.h"
void WSFillGrid::fillGrid() {

@ -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

@ -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

@ -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();