# HG changeset patch # User Radek Brich # Date 1210059598 -7200 # Node ID 96d65f841791faf0d11d6f9f231c7cc7d51d40e8 # Parent 9af5c039b6781db301138b19b04e68cbe92deaf1 more build script tuning make all float constants single precision solve many warnings from msvc and gcc with various -W... flags add common.cc file for dbgmsg() function witch apparently cannot be inlined fix python module building with msvc, add manifest file handling remove forgotten RenderrowData class add stanford models download script for windows (.bat) diff -r 9af5c039b678 -r 96d65f841791 SConstruct --- a/SConstruct Mon May 05 15:31:14 2008 +0200 +++ b/SConstruct Tue May 06 09:39:58 2008 +0200 @@ -42,7 +42,7 @@ else: tools = ['default'] -env = Environment(tools = tools) +env = Environment(tools = tools, CPPPATH = ['.','#include']) opt = Options(['build/.optioncache']) opt.AddOptions( @@ -84,6 +84,7 @@ context.Result(platform) return True +intelcversion = '' def CheckIntelC(context): global intelc, intelcversion context.Message('Checking for IntelC compiler... ') @@ -94,7 +95,6 @@ intelcversion = str(testenv['INTEL_C_COMPILER_VERSION']/10.) context.Result(intelcversion) else: - intelcversion = '' context.Result(intelc) return intelc @@ -185,8 +185,6 @@ if conf.env['precision'] == 'double': conf.Define("PYRIT_DOUBLE") -elif cc == 'gcc': - add_flags += '-fsingle-precision-constant ' if not conf.env['simd'] or conf.env['precision'] == 'double': conf.Define("NO_SIMD") @@ -195,6 +193,9 @@ conf.env.Append(CCFLAGS="-O3 -w1 " + add_flags) elif cc == 'gcc': conf.env.Append(CCFLAGS="-O3 -Wall -pipe " + add_flags) + # Other useful flags: + # -Wunsafe-loop-optimizations -Wpointer-arith -Wcast-align -Wconversion + # -Wmissing-noreturn -Winline -Wdisabled-optimization elif cc == 'msvc': conf.env.Append(CCFLAGS="/Ox /Ob2 /GS- /Gy /GF /GR- /Zp16 /MD /EHsc /vmb " + add_flags) else: @@ -204,16 +205,19 @@ print "Using compiler: " + cc print "Additional flags: " + add_flags +if conf.env['profile'] and cc == 'gcc': + conf.env.Append(CCFLAGS="-pg", LINKFLAGS="-pg") + + +# configure pthread pthread = True -if conf.env['PLATFORM'] == 'win32': +if platform == 'win32': if cc == 'msvc': if not conf.CheckLib('pthreadVC2'): pthread = False - conf.env.Append(LIBS=["pthreadVC2"]) elif cc == 'gcc': if not conf.CheckLib('pthreadGC2'): pthread = False - conf.env.Append(LIBS=["pthreadGC2"]) else: conf.env.Append(CCFLAGS="-pthread ") @@ -221,43 +225,73 @@ print 'Error: Cannot build without pthread.' Exit(1) + +# configure libpng if conf.CheckLibWithHeader('png', 'png.h', 'C'): conf.Define('HAVE_PNG') - conf.env.Append(LIBS=['png']) -elif conf.CheckLib('libpng13'): +elif conf.CheckLib('libpng'): conf.Define('HAVE_PNG') - conf.env.Append(LIBS=['libpng13']) - -if conf.env['profile'] and cc == 'gcc': - conf.env.Append(CCFLAGS="-pg", LINKFLAGS="-pg") env = conf.Finish() + +# configure Python +pyenv = env.Clone() +have_python = True +if platform == 'win32': + pythonver = '%c%c' % (sys.version[0], sys.version[2]) + pythonlib = 'python'+pythonver + pythonpath = [env['pythonpath'], + 'C:\\Program Files\\Python'+pythonver] + pyenv.Append(CPPPATH=[s+'\\include' for s in pythonpath]) + pyenv.Append(LIBPATH=[s+'\\libs' for s in pythonpath]) + pyenv.Replace(SHLIBSUFFIX='.pyd') + conf = Configure(pyenv, conf_dir=conf_dir, log_file=log_file, config_h=config_h) + if not conf.CheckLib(pythonlib): + have_python = False + pyenv = conf.Finish() +else: + try: + pyenv.ParseConfig('python-config --includes --libs') + except: + have_python = False + +if not have_python: + print "Error: Python is required." + Exit(1) + # configure SDL sdlenv = env.Clone() -if cc != 'msvc': +if cc == 'msvc': + sdlenv.Append(LIBS=['SDL', 'SDLmain']) + sdlenv.Append(LINKFLAGS="/SUBSYSTEM:WINDOWS") +else: try: sdlenv.ParseConfig('sh sdl-config --cflags') sdlenv.ParseConfig('sh sdl-config --libs') except: pass -else: - sdlenv.Append(LIBS=['SDL', 'SDLmain']) -conf = Configure(sdlenv, conf_dir=conf_dir, log_file=log_file, config_h=config_h) -have_sdl = False -if conf.CheckLib('SDL'): - have_sdl = True -else: - print "SDL not found, some demos will not built." +def CheckSDL(context): + global have_sdl + context.Message('Checking for SDL... ') + if context.TryLink("#include \n"+ + "int main(int argc,char **argv){return 0;}", '.cc'): + context.Result(1) + return True + else: + context.Result("no (some demos won't be built)") + return False + +conf = Configure(sdlenv, conf_dir=conf_dir, log_file=log_file, config_h=config_h, + custom_tests = {'CheckSDL' : CheckSDL} ) +have_sdl = conf.CheckSDL() sdlenv = conf.Finish() -if cc == 'msvc': - sdlenv.Append(LINKFLAGS="/SUBSYSTEM:WINDOWS") ### build targets -Export('env sdlenv cc') +Export('env pyenv sdlenv cc') lib = SConscript('src/SConscript', build_dir='build/lib', duplicate=0, exports={'buildmodule':False}) pymodule = SConscript('src/SConscript', build_dir='build/pymodule', duplicate=0, diff -r 9af5c039b678 -r 96d65f841791 ccdemos/SConscript --- a/ccdemos/SConscript Mon May 05 15:31:14 2008 +0200 +++ b/ccdemos/SConscript Tue May 06 09:39:58 2008 +0200 @@ -1,6 +1,6 @@ Import('env sdlenv lib') myenv = sdlenv.Clone() -myenv.Append(CPPPATH = ['.','#include'], LIBPATH='#build/lib') +myenv.Append(LIBPATH=['#build/lib']) myenv.Prepend(LIBS=['pyrit']) l = [] diff -r 9af5c039b678 -r 96d65f841791 ccdemos/common_ply.h --- a/ccdemos/common_ply.h Mon May 05 15:31:14 2008 +0200 +++ b/ccdemos/common_ply.h Tue May 06 09:39:58 2008 +0200 @@ -86,7 +86,7 @@ for (int i = 0; i < vertex_num; i++) if (vertex_face_num.at(i)) { - normals[i] /= vertex_face_num.at(i); + normals[i] /= (Float)vertex_face_num.at(i); normals[i].normalize(); vertices.at(i)->N = normals[i]; } diff -r 9af5c039b678 -r 96d65f841791 ccdemos/common_sdl.h --- a/ccdemos/common_sdl.h Mon May 05 15:31:14 2008 +0200 +++ b/ccdemos/common_sdl.h Tue May 06 09:39:58 2008 +0200 @@ -94,11 +94,11 @@ break; } if (event.key.keysym.sym == SDLK_LEFT) { - roty = +0.01; + roty = +0.01f; break; } if (event.key.keysym.sym == SDLK_RIGHT) { - roty = -0.01; + roty = -0.01f; break; } if (event.key.keysym.sym == SDLK_DOWN) { @@ -152,8 +152,6 @@ cam.rotate(Quaternion(cos(roty),0,sin(roty),0).normalize()); cam.rotate(Quaternion(cos(rotx), cam.getu()[0]*sin(rotx),0,cam.getu()[2]*sin(rotx)).normalize()); - //cam.u.y = 0; - //cam.u.normalize(); if (move != 0.0) cam.move(move,0,0); if (update_callback != NULL) diff -r 9af5c039b678 -r 96d65f841791 ccdemos/realtime.cc --- a/ccdemos/realtime.cc Mon May 05 15:31:14 2008 +0200 +++ b/ccdemos/realtime.cc Tue May 06 09:39:58 2008 +0200 @@ -11,21 +11,23 @@ KdTree top; Camera cam; - rt.setMaxDepth(3); + rt.setMaxDepth(2); rt.setTop(&top); - Light light1(Vector(2.0f, -5.0f, -5.0f), Colour(0.7f, 0.3f, 0.6f)); + Light light1(Vector(2.0f, -5.0f, -5.0f), Colour(0.2f, 0.3f, 0.8f)); light1.castShadows(false); rt.addLight(&light1); - Light light2(Vector(-2.0f, 10.0f, 2.0f), Colour(0.4f, 0.6f, 0.3f)); + Light light2(Vector(-2.0f, 10.0f, 2.0f), Colour(0.5f, 0.6f, 0.3f)); light2.castShadows(false); rt.addLight(&light2); Material mat_sph(Colour(1.0f, 1.0f, 1.0f)); + mat_sph.setPhong(0.2f, 0.9f, 0.0f, 1.0f); + mat_sph.setReflectivity(0.3f); for (int y=0; y<10; y++) for (int x=0; x<10; x++) - rt.addShape(new Sphere(Vector(x*2-10, (Float)rand()/RAND_MAX*5.0f, y*2-10), 0.45f, &mat_sph)); + rt.addShape(new Sphere(Vector((Float)x*2-10, (Float)rand()/RAND_MAX*5.0f, (Float)y*2-10), 0.45f, &mat_sph)); rt.setCamera(&cam); cam.setEye(Vector(0,0,10)); diff -r 9af5c039b678 -r 96d65f841791 ccdemos/textures.cc --- a/ccdemos/textures.cc Mon May 05 15:31:14 2008 +0200 +++ b/ccdemos/textures.cc Tue May 06 09:39:58 2008 +0200 @@ -3,8 +3,8 @@ #include "common_sdl.h" -Camera cam(Vector(0.,6.,6.), Vector(0.,2.,-7.), Vector(0.,0.,-1.)); -Light light(Vector(-2.0, 10.0, -2.0), Colour(0.9, 0.9, 0.9)); +Camera cam(Vector(0.0f,6.0f,6.0f), Vector(0.0f,2.0f,-7.0f), Vector(0.0f,0.0f,-1.0f)); +Light light(Vector(-2.0f, 10.0f, -2.0f), Colour(0.9f, 0.9f, 0.9f)); Float lx, ly, lz, cf; @@ -25,29 +25,29 @@ switch (key) { case SDLK_r: - lx = -0.1 * down; + lx = -0.1f * down; break; case SDLK_t: - lx = +0.1 * down; + lx = +0.1f * down; break; case SDLK_f: - ly = -0.1 * down; + ly = -0.1f * down; break; case SDLK_g: - ly = +0.1 * down; + ly = +0.1f * down; break; case SDLK_v: - lz = -0.1 * down; + lz = -0.1f * down; break; case SDLK_b: - lz = +0.1 * down; + lz = +0.1f * down; break; case SDLK_z: - cf = -0.02 * down; + cf = -0.02f * down; break; case SDLK_x: - cf = +0.02 * down; + cf = +0.02f * down; break; } } @@ -63,60 +63,67 @@ rt.addLight(&light); light.castShadows(false); - Material mat0a(Colour(0.7, 0.7, 0.7)); - mat0a.setReflectivity(0.0); - Box box(Vector(-12.0, -1.2, -20.0), Vector(12.0, -1.0, 0.0), &mat0a); + const Colour c_white(1, 1, 1); + const Colour c_black(0, 0, 0); + + Material mat0a(Colour(0.7f, 0.7f, 0.7f)); + mat0a.setReflectivity(0.0f); + Box box(Vector(-12.0f, -1.2f, -20.0f), Vector(12.0f, -1.0f, 0.0f), &mat0a); rt.addShape(&box); - Material mat0b(Colour(0.1, 0.7, 0.8)); - mat0b.setReflectivity(0.7); - Box box2(Vector(-12.0, -1.2, -10.0), Vector(12.0, 10.0, -10.2), &mat0b); + Material mat0b(Colour(0.1f, 0.7f, 0.8f)); + mat0b.setReflectivity(0.7f); + Box box2(Vector(-12.0f, -1.2f, -10.0f), Vector(12.0f, 10.0f, -10.2f), &mat0b); rt.addShape(&box2); - Float bounds[] = {0.3, 0.6, 1.1}; - Colour colours[] = {Colour(0,0,0), Colour(1,1,1), Colour(0,0,0)}; + Float bounds[] = {0.3f, 0.6f, 1.1f}; + Colour colours[] = {c_black, c_white, c_black}; BoundColourMap cmap(bounds, colours); // spheres - Material mat1(Colour(1.0, 1.0, 1.0)); - mat1.texture = new CheckersTexture(new PlanarMap(Vector(-4.5, 2.0, -7.0), 0.48), &cmap); - Sphere sphere1(Vector(-4.5, 2.0, -7.0), 1.0, &mat1); + Material mat1(c_white); + mat1.texture = new CheckersTexture(new PlanarMap(Vector(-4.5f, 2.0f, -7.0f), 0.48f), &cmap); + Sphere sphere1(Vector(-4.5f, 2.0f, -7.0f), 1, &mat1); rt.addShape(&sphere1); - Material mat2(Colour(1.0, 1.0, 1.0)); - mat2.texture = new CheckersTexture(new CubicMap(Vector(-1.5, 2.0, -7.0), 0.48), &cmap); - Sphere sphere2(Vector(-1.5, 2.0, -7.0), 1.0, &mat2); + Material mat2(c_white); + mat2.texture = new CheckersTexture(new CubicMap(Vector(-1.5f, 2.0f, -7.0f), 0.48f), &cmap); + Sphere sphere2(Vector(-1.5f, 2.0f, -7.0f), 1, &mat2); rt.addShape(&sphere2); - Material mat3(Colour(1.0, 1.0, 1.0)); - mat3.texture = new CheckersTexture(new CylinderMap(Vector(1.5, 2.0, -7.0), 0.48), &cmap); - Sphere sphere3(Vector(1.5, 2.0, -7.0), 1.0, &mat3); + Material mat3(c_white); + mat3.texture = new CheckersTexture(new CylinderMap(Vector(1.5f, 2.0f, -7.0f), 0.48f), &cmap); + Sphere sphere3(Vector(1.5f, 2.0f, -7.0f), 1, &mat3); rt.addShape(&sphere3); - Material mat4(Colour(1.0, 1.0, 1.0)); - mat4.texture = new CheckersTexture(new SphereMap(Vector(4.5, 2.0, -7.0), 0.48), &cmap); - Sphere sphere4(Vector(4.5, 2.0, -7.0), 1.0, &mat4); + Material mat4(c_white); + mat4.texture = new CheckersTexture(new SphereMap(Vector(4.5f, 2.0f, -7.0f), 0.48f), &cmap); + Sphere sphere4(Vector(4.5f, 2.0f, -7.0f), 1, &mat4); rt.addShape(&sphere4); // cubes - Material mat5(Colour(1.0, 1.0, 1.0)); - mat5.texture = new CheckersTexture(new PlanarMap(Vector(-4.5, 0.0, -7.0), 0.48), &cmap); - Box cube1(Vector(-4.5, 0.0, -7.0)-1.0, Vector(-4.5, 0.0, -7.0)+1.0, &mat5); + Material mat5(c_white); + const Vector cube1_base(-4.5f, 0.0f, -7.0f); + mat5.texture = new CheckersTexture(new PlanarMap(cube1_base, 0.48f), &cmap); + Box cube1(cube1_base - 1.0f, cube1_base + 1.0f, &mat5); rt.addShape(&cube1); - Material mat6(Colour(1.0, 1.0, 1.0)); - mat6.texture = new CheckersTexture(new CubicMap(Vector(-1.5, 0.0, -7.0), 0.48), &cmap); - Box cube2(Vector(-1.5, 0.0, -7.0)-1.0, Vector(-1.5, 0.0, -7.0)+1.0, &mat6); + Material mat6(c_white); + const Vector cube2_base(-1.5f, 0.0f, -7.0f); + mat6.texture = new CheckersTexture(new CubicMap(cube2_base, 0.48f), &cmap); + Box cube2(cube2_base - 1.0f, cube2_base + 1.0f, &mat6); rt.addShape(&cube2); - Material mat7(Colour(1.0, 1.0, 1.0)); - mat7.texture = new CheckersTexture(new CylinderMap(Vector(1.5, 0.0, -7.0), 0.48), &cmap); - Box cube3(Vector(1.5, 0.0, -7.0)-1.0, Vector(1.5, 0.0, -7.0)+1.0, &mat7); + Material mat7(c_white); + const Vector cube3_base(1.5f, 0.0f, -7.0f); + mat7.texture = new CheckersTexture(new CylinderMap(cube3_base, 0.48f), &cmap); + Box cube3(cube3_base - 1.0f, cube3_base + 1.0f, &mat7); rt.addShape(&cube3); - Material mat8(Colour(1.0, 1.0, 1.0)); - mat8.texture = new CheckersTexture(new SphereMap(Vector(4.5, 0.0, -7.0), 0.48), &cmap); - Box cube4(Vector(4.5, 0.0, -7.0)-1.0, Vector(4.5, 0.0, -7.0)+1.0, &mat8); + Material mat8(c_white); + const Vector cube4_base(4.5f, 0.0f, -7.0f); + mat8.texture = new CheckersTexture(new SphereMap(cube4_base, 0.48f), &cmap); + Box cube4(cube4_base - 1.0f, cube4_base + 1.0f, &mat8); rt.addShape(&cube4); mat1.setReflectivity(0); @@ -140,7 +147,7 @@ if (argc == 2 && !strcmp(argv[1], "-r")) { pyrit_verbosity = 2; - rt.ambientOcclusion(300, 5.0, 0.5); + rt.ambientOcclusion(300, 5.0f, 0.5f); DefaultSampler sampler(w, h); sampler.setOversample(2); sampler.setSubsample(1); diff -r 9af5c039b678 -r 96d65f841791 include/common.h --- a/include/common.h Mon May 05 15:31:14 2008 +0200 +++ b/include/common.h Tue May 06 09:39:58 2008 +0200 @@ -30,7 +30,6 @@ #include "config.h" #include -#include #include #include #include @@ -42,10 +41,12 @@ # define Float double # define Eps DBL_EPSILON # define Inf DBL_MAX +# define PI M_PI #else # define Float float # define Eps 1e-6f # define Inf FLT_MAX +# define PI (float)M_PI #endif // enable M_* constants in MSVC @@ -61,24 +62,7 @@ */ extern int pyrit_verbosity; -inline void dbgmsg(const int vlevel, const char *format, ...) -{ - static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - if (pyrit_verbosity >= vlevel) - { - if (pyrit_verbosity >= 4) - pthread_mutex_lock(&mutex); - - va_list ap; - va_start(ap, format); - vprintf(format, ap); - va_end(ap); - fflush(stdout); - - if (pyrit_verbosity >= 4) - pthread_mutex_unlock(&mutex); - } -} +void dbgmsg(const int vlevel, const char *format, ...); template const Type &min3(const Type &a, const Type &b, const Type &c) { diff -r 9af5c039b678 -r 96d65f841791 include/kdtree.h --- a/include/kdtree.h Mon May 05 15:31:14 2008 +0200 +++ b/include/kdtree.h Tue May 06 09:39:58 2008 +0200 @@ -44,10 +44,7 @@ */ class KdNode { - union { - Float split; - void *pad64; /* pad to 64 bits on 64bit platforms */ - }; + Float split; union { KdNode *children; ShapeList *shapes; @@ -79,16 +76,16 @@ */ class KdTree: public Container { + MemoryPool mempool; KdNode *root; + const int max_depth; bool built; - const int max_depth; - MemoryPool mempool; void recursive_build(KdNode *node, const BBox &bbox, int maxdepth); void recursive_load(istream &st, KdNode *node); public: - KdTree(): Container(), root(NULL), built(false), max_depth(32), mempool(64) {}; - KdTree(int maxdepth): Container(), root(NULL), built(false), max_depth(maxdepth), mempool(64) {}; + KdTree(): Container(), mempool(64), root(NULL), max_depth(32), built(false) {}; + KdTree(int maxdepth): Container(), mempool(64), root(NULL), max_depth(maxdepth), built(false) {}; ~KdTree() { if (root) delete root; }; void addShape(Shape* aShape) { Container::addShape(aShape); built = false; }; Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray, diff -r 9af5c039b678 -r 96d65f841791 include/material.h --- a/include/material.h Mon May 05 15:31:14 2008 +0200 +++ b/include/material.h Tue May 06 09:39:58 2008 +0200 @@ -62,7 +62,7 @@ */ class LinearColourMap: public ColourMap { - Colour col,cdiff; + Colour col, cdiff; public: LinearColourMap(const Colour &clow, const Colour &chigh): col(clow), cdiff(chigh-clow) {}; @@ -193,7 +193,7 @@ void map(const Vector &point, Float &u, Float &v) { const Vector p = point - center; - u = ( M_PI + atan2(p.z, p.x) ) * invsize; + u = ( PI + atan2(p.z, p.x) ) * invsize; v = p.y * invsize; }; }; @@ -209,7 +209,7 @@ void map(const Vector &point, Float &u, Float &v) { const Vector p = point - center; - u = ( M_PI + atan2(p.z, p.x) ) * invsize; + u = ( PI + atan2(p.z, p.x) ) * invsize; v = acos(p.y / p.mag()) * invsize; }; }; @@ -269,11 +269,11 @@ */ class CloudTexture: public Texture { + ColourMap *colourmap; Float detail; - ColourMap *colourmap; public: CloudTexture(const Float &adetail, ColourMap *cmap): - detail(adetail), colourmap(cmap) {}; + colourmap(cmap), detail(adetail) {}; Colour evaluate(const Vector &point) { Float sum = 0.0; @@ -295,7 +295,7 @@ Float ambient, diffuse, specular, shininess; // Phong constants Float reflectivity; // how much reflective is the surface Float transmissivity, refract_index; // part of light which can be refracted; index of refraction - bool smooth; // triangle smoothing + int smooth; // triangle smoothing Material(const Colour &acolour): colour(acolour), texture(NULL), smooth(false) { @@ -313,7 +313,7 @@ void setReflectivity(const Float refl) { reflectivity = refl; }; void setTransmissivity(const Float trans, const Float rindex) { transmissivity = trans; refract_index = rindex; }; - void setSmooth(bool sm) { smooth = sm; }; + void setSmooth(int sm) { smooth = sm; }; void setTexture(Texture *tex) { texture = tex; }; }; diff -r 9af5c039b678 -r 96d65f841791 include/mempool.h --- a/include/mempool.h Mon May 05 15:31:14 2008 +0200 +++ b/include/mempool.h Tue May 06 09:39:58 2008 +0200 @@ -41,7 +41,7 @@ #ifndef NO_SIMD mem = (Type *)_mm_malloc(size * typesize, align); #else - mem = (Type *)malloc(inisize * typesize); + mem = (Type *)malloc(size * typesize); #endif }; public: diff -r 9af5c039b678 -r 96d65f841791 include/octree.h --- a/include/octree.h Mon May 05 15:31:14 2008 +0200 +++ b/include/octree.h Tue May 06 09:39:58 2008 +0200 @@ -73,11 +73,11 @@ class Octree: public Container { OctreeNode *root; + const int max_depth; bool built; - const int max_depth; public: - Octree() : Container(), root(NULL), built(false), max_depth(10) {}; - Octree(int maxdepth) : Container(), root(NULL), built(false), max_depth(maxdepth) {}; + Octree() : Container(), root(NULL), max_depth(10), built(false) {}; + Octree(int maxdepth) : Container(), root(NULL), max_depth(maxdepth), built(false) {}; ~Octree() { if (root) delete root; }; void addShape(Shape* aShape) { Container::addShape(aShape); built = false; }; Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray, diff -r 9af5c039b678 -r 96d65f841791 include/raytracer.h --- a/include/raytracer.h Mon May 05 15:31:14 2008 +0200 +++ b/include/raytracer.h Tue May 06 09:39:58 2008 +0200 @@ -36,13 +36,6 @@ class Raytracer; -struct RenderrowData { - Raytracer *rt; - int w; - Vector eye, dfix, dx, dy; - Float *iter; -}; - /** * main ray tracer class */ @@ -53,8 +46,8 @@ Camera *camera; vector lights; Colour bg_colour; + Float ao_distance, ao_angle; int ao_samples; - Float ao_distance, ao_angle; int num_threads; int max_depth; bool use_packets; diff -r 9af5c039b678 -r 96d65f841791 include/sampler.h --- a/include/sampler.h Mon May 05 15:31:14 2008 +0200 +++ b/include/sampler.h Tue May 06 09:39:58 2008 +0200 @@ -57,7 +57,6 @@ class Sampler { protected: - Pixmap pixmap; bool packetable; public: diff -r 9af5c039b678 -r 96d65f841791 include/scene.h --- a/include/scene.h Mon May 05 15:31:14 2008 +0200 +++ b/include/scene.h Tue May 06 09:39:58 2008 +0200 @@ -79,11 +79,11 @@ Vector eye, p, u, v; Float F; public: - Camera(): eye(0,0,10), p(0,0,-1), u(-1,0,0), v(0,1,0), F(2.*tan(M_PI/8.)) {}; + Camera(): eye(0,0,10), p(0,0,-1), u(-1,0,0), v(0,1,0), F(2*tan(PI/8)) {}; Camera(const Vector &C, const Vector &ap, const Vector &au, const Vector &av): - eye(C), p(ap), u(au), v(av), F(2.*tan(M_PI/8.)) {}; + eye(C), p(ap), u(au), v(av), F(2*tan(PI/8)) {}; Camera(const Vector &from, const Vector &lookat, const Vector &up): - eye(from), F(2.*tan(M_PI/8.)) + eye(from), F(2*tan(PI/8)) { p = lookat - from; u = cross(up, p); p.normalize(); u.normalize(); @@ -100,7 +100,7 @@ void setu(const Vector &au) { u = au; }; void setv(const Vector &av) { v = av; }; void setF(const Float &aF) { F = aF; }; - void setAngle(const Float angle) { F = 2.0f*tan(angle/2.0f); }; + void setAngle(const Float angle) { F = 2*tan(angle/2); }; void rotate(const Quaternion &q); void move(const Float fw, const Float left, const Float up); @@ -173,13 +173,13 @@ public: Vector pos; Colour colour; - bool cast_shadows; + int cast_shadows; Light(): pos(Vector(0,0,0)), colour(Colour(1,1,1)), cast_shadows(true) {}; Light(const Vector &position, const Colour &acolour): pos(position), colour(acolour), cast_shadows(true) {}; - void castShadows(bool cast) { cast_shadows = cast; }; + void castShadows(int cast) { cast_shadows = cast; }; }; /** diff -r 9af5c039b678 -r 96d65f841791 include/shapes.h --- a/include/shapes.h Mon May 05 15:31:14 2008 +0200 +++ b/include/shapes.h Tue May 06 09:39:58 2008 +0200 @@ -49,6 +49,7 @@ { public: Material *material; + Shape() {}; virtual ~Shape() {}; @@ -176,11 +177,12 @@ */ class Triangle: public Shape { + Vector N; #ifdef TRI_BARI_PRE Float nu, nv, nd; - int k; // dominant axis Float bnu, bnv; Float cnu, cnv; + int k; // dominant axis #endif #ifdef TRI_BARI int k; // dominant axis @@ -188,7 +190,7 @@ #ifdef TRI_PLUCKER Float pla[6], plb[6], plc[6]; #endif - Vector N; + const Vector smooth_normal(const Vector &P) const { #ifdef TRI_BARI_PRE @@ -209,6 +211,7 @@ return N; // not implemented for other algorithms #endif }; + public: Vertex *A, *B, *C; diff -r 9af5c039b678 -r 96d65f841791 include/vector.h --- a/include/vector.h Mon May 05 15:31:14 2008 +0200 +++ b/include/vector.h Tue May 06 09:39:58 2008 +0200 @@ -132,9 +132,10 @@ // difference friend Vector operator-(const Vector &a, const Vector &b) { -#ifdef NO_SIMD +#if defined(NO_SIMD) || defined(MSVC) return Vector(a.x - b.x, a.y - b.y, a.z - b.z); #else + // this faults in MSVC, for unknown reason return Vector(msub(a.mf4, b.mf4)); #endif }; diff -r 9af5c039b678 -r 96d65f841791 models/download-stanford.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/models/download-stanford.bat Tue May 06 09:39:58 2008 +0200 @@ -0,0 +1,19 @@ +mkdir %1 +cd %1 + +wget ftp://graphics.stanford.edu/pub/3Dscanrep/bunny.tar.gz +bsdtar xzf bunny.tar.gz +del bunny.tar.gz +rmdir /S /Q bunny\data +move bunny\reconstruction\* bunny +rmdir /S /Q bunny\reconstruction + +wget ftp://graphics.stanford.edu/pub/3Dscanrep/happy/happy_recon.tar.gz +bsdtar xzf happy_recon.tar.gz +del happy_recon.tar.gz +move happy_recon happy + +wget ftp://graphics.stanford.edu/pub/3Dscanrep/dragon/dragon_recon.tar.gz +bsdtar xzf dragon_recon.tar.gz +del dragon_recon.tar.gz +move dragon_recon dragon diff -r 9af5c039b678 -r 96d65f841791 src/SConscript --- a/src/SConscript Mon May 05 15:31:14 2008 +0200 +++ b/src/SConscript Tue May 06 09:39:58 2008 +0200 @@ -1,44 +1,36 @@ -Import('env buildmodule cc') - -myenv = env.Clone(CPPPATH = '#include') -pyenv = myenv.Clone() -if env['PLATFORM'] == 'win32': - import sys - pythonver = '%c%c' % (sys.version[0], sys.version[2]) - pythonlib = 'python'+pythonver - pythonpath = [env['pythonpath'], - 'C:\\Program Files\\Python'+pythonver] - pyenv.Append(LIBS=pythonlib) - pyenv.Append(CPPPATH=[s+'\\include' for s in pythonpath]) - pyenv.Append(LIBPATH=[s+'\\libs' for s in pythonpath]) - pyenv.Replace(SHLIBSUFFIX='.pyd') -else: - pyenv.ParseConfig('python-config --includes --libs') +Import('env pyenv buildmodule cc') sources = [ - 'raytracer.cc', 'scene.cc', 'shapes.cc', 'sampler.cc', - 'container.cc', 'kdtree.cc', 'octree.cc', 'material.cc', - 'serialize.cc', 'pixmap.cc'] - -objs = [] -shared_objs = [] -for src in sources: - objs.append( myenv.Object(src) ) - shared_objs.append( myenv.SharedObject(src) ) + 'common.cc', 'raytracer.cc', 'sampler.cc', 'scene.cc', + 'shapes.cc', 'material.cc', 'pixmap.cc', 'serialize.cc', + 'container.cc', 'kdtree.cc', 'octree.cc'] if buildmodule: + shared_objs = [] + for src in sources: + shared_objs.append( pyenv.SharedObject(src) ) if cc == 'gcc': ccflags = '$CCFLAGS -Wno-write-strings' else: ccflags = '$CCFLAGS' + if cc == 'msvc': + linkflags = '$LINKFLAGS /export:initpyrit' + else: + linkflags = '$LINKFLAGS' pymodule = pyenv.SharedLibrary('pyrit', ['raytracermodule.cc']+shared_objs, - SHLIBPREFIX = '', CCFLAGS = ccflags) + SHLIBPREFIX = '', CCFLAGS = ccflags, + LINKFLAGS=linkflags) + if cc == 'msvc': + pyenv.AddPostAction(pymodule, 'mt /nologo /manifest ${TARGET}.manifest /outputresource:$TARGET;2') env.Alias('shared-objs', shared_objs) env.Alias('python-module', pymodule) Return('pymodule') else: - lib = myenv.StaticLibrary('pyrit', objs) + objs = [] + for src in sources: + objs.append( env.Object(src) ) + lib = env.StaticLibrary('pyrit', objs) env.Alias('objs', objs) env.Alias('static-lib', lib) Return('lib') diff -r 9af5c039b678 -r 96d65f841791 src/common.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/common.cc Tue May 06 09:39:58 2008 +0200 @@ -0,0 +1,50 @@ +/* + * common.cc: common functions and definitions + * + * This file is part of Pyrit Ray Tracer. + * + * Copyright 2008 Radek Brich + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "common.h" + +#include + +int pyrit_verbosity = 2; + +void dbgmsg(const int vlevel, const char *format, ...) +{ + static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + if (pyrit_verbosity >= vlevel) + { + if (pyrit_verbosity >= 4) + pthread_mutex_lock(&mutex); + + va_list ap; + va_start(ap, format); + vprintf(format, ap); + va_end(ap); + fflush(stdout); + + if (pyrit_verbosity >= 4) + pthread_mutex_unlock(&mutex); + } +} diff -r 9af5c039b678 -r 96d65f841791 src/kdtree.cc --- a/src/kdtree.cc Mon May 05 15:31:14 2008 +0200 +++ b/src/kdtree.cc Tue May 06 09:39:58 2008 +0200 @@ -109,7 +109,7 @@ int axis = 0; for (int ax = 0; ax < 3; ax++) { - int lnum = 0, rnum = shapes->size(); + int lnum = 0, rnum = (int)shapes->size(); BBox lbb = bounds; BBox rbb = bounds; for (edge = edges[ax].begin(); edge != edges[ax].end(); edge++) diff -r 9af5c039b678 -r 96d65f841791 src/octree.cc --- a/src/octree.cc Mon May 05 15:31:14 2008 +0200 +++ b/src/octree.cc Tue May 06 09:39:58 2008 +0200 @@ -161,7 +161,7 @@ #else OctreeTravState st[max_depth+1]; #endif - register OctreeTravState *st_cur = st; + OctreeTravState *st_cur = st; # define node st_cur->node # define tx0 st_cur->tx0 diff -r 9af5c039b678 -r 96d65f841791 src/raytracer.cc --- a/src/raytracer.cc Mon May 05 15:31:14 2008 +0200 +++ b/src/raytracer.cc Tue May 06 09:39:58 2008 +0200 @@ -30,8 +30,6 @@ #include #include "raytracer.h" -int pyrit_verbosity = 2; - // Hammersley spherical point distribution // http://www.cse.cuhk.edu.hk/~ttwong/papers/udpoint/udpoints.html Vector Raytracer::SphereDistribute(int i, int n, Float extent, const Vector &normal) @@ -40,15 +38,15 @@ int kk; t = 0; - for (p=0.5, kk=i; kk; p*=0.5, kk>>=1) + for (p=0.5f, kk=i; kk; p*=0.5f, kk>>=1) if (kk & 1) t += p; - t = 1.0 + (t - 1.0)*extent; + t = 1.0f + (t - 1.0f)*extent; - phi = (i + 0.5) / n; - phirad = phi * 2.0 * M_PI; + phi = (i + 0.5f) / n; + phirad = phi * 2.0f * PI; - st = sqrt(1.0 - t*t); + st = sqrt(1.0f - t*t); Float x, y, z, xx, yy, zz, q; x = st * cos(phirad); @@ -105,7 +103,7 @@ continue; } - const Vector R = L - 2.0 * L_dot_N * N; + const Vector R = L - 2.0f * L_dot_N * N; const Float R_dot_V = dot(R, V); // diffuse @@ -205,7 +203,7 @@ // reflection if (refl > 0.01) { - Vector newdir = ray.dir + 2.0 * cos_i * normal; + Vector newdir = ray.dir + 2.0f * cos_i * normal; Ray newray = Ray(P, newdir); refl_col = raytrace(newray, depth + 1, shape); } @@ -222,9 +220,9 @@ } else { - n1 = 1.0; + n1 = 1.0f; n2 = shape->material->refract_index; - n = 1.0 / n2; + n = 1.0f / n2; } const Float sin2_t = n*n * (1 - cos_i*cos_i); if (sin2_t >= 1.0) @@ -236,14 +234,14 @@ else { const Float cos_t = sqrtf(1 - sin2_t); - const Float Rdiv = 1.0/(n1*cos_i + n2*cos_t); + const Float Rdiv = 1.0f / (n1*cos_i + n2*cos_t); const Float Rper = (n1*cos_i - n2*cos_t)*Rdiv; const Float Rpar = (n2*cos_i - n1*cos_t)*Rdiv; const Float R = (Rper*Rper + Rpar*Rpar)/2; refl += R*trans; trans = (1-R)*trans; Vector newdir = n * ray.dir + (n*cos_i - cos_t) * normal; - Ray newray = Ray(P + 0.001*newdir, newdir); + Ray newray = Ray(P + 0.001f*newdir, newdir); trans_col = raytrace(newray, depth + 1, NULL); } } @@ -323,7 +321,10 @@ VectorPacket normal; for (int i = 0; i < 4; i++) if (nearest_shapes[i] != NULL) - normal.setVector(i, nearest_shapes[i]->normal(P.getVector(i))); + { + const Vector Pvecti = P.getVector(i); + normal.setVector(i, nearest_shapes[i]->normal(Pvecti)); + } // make shapes double sided mfloat4 from_inside = mcmpgt(dot(normal, rays.dir), mZero); @@ -350,6 +351,11 @@ } #endif +#ifdef MSVC +__declspec(noreturn) +#else +__attribute__((noreturn)) +#endif void *Raytracer::raytrace_worker(void *d) { static const int my_queue_size = 256; @@ -405,11 +411,11 @@ if (can_use_packets) { // packet ray tracing - assert((my_count % 4) == 0); - for (int i = 0; i < my_count; i+=4) + assert((my_count & 3) == 0); + for (int i = 0; i < (my_count >> 2); i++) { - rt->camera->makeRayPacket(my_queue + i, rays); - rt->raytracePacket(rays, my_colours + i); + rt->camera->makeRayPacket(my_queue + (i<<2), rays); + rt->raytracePacket(rays, my_colours + (i<<2)); } } else @@ -429,7 +435,6 @@ rt->sampler->saveSample(my_queue[i], my_colours[i]); pthread_mutex_unlock(&rt->sampler_mutex); } - return NULL; } void Raytracer::render() diff -r 9af5c039b678 -r 96d65f841791 src/raytracermodule.cc --- a/src/raytracermodule.cc Mon May 05 15:31:14 2008 +0200 +++ b/src/raytracermodule.cc Tue May 06 09:39:58 2008 +0200 @@ -110,7 +110,7 @@ static char *kwdlist[] = {"position", "colour", NULL}; PyObject *TPos, *TCol = NULL; Float px, py, pz; - Float cr = 0.9, cg = 0.9, cb = 0.9; + Float cr = 0.9f, cg = 0.9f, cb = 0.9f; if (!PyArg_ParseTupleAndKeywords(args, kwd, "O!|O!", kwdlist, &PyTuple_Type, &TPos, &PyTuple_Type, &TCol)) @@ -374,7 +374,7 @@ static PyObject *Material_setTransmissivity(PyObject* self, PyObject* args) { - Float trans, rindex = 1.3; + Float trans, rindex = 1.3f; if (!PyArg_ParseTuple(args, "f|f", &trans, &rindex)) return NULL; diff -r 9af5c039b678 -r 96d65f841791 src/sampler.cc --- a/src/sampler.cc Mon May 05 15:31:14 2008 +0200 +++ b/src/sampler.cc Tue May 06 09:39:58 2008 +0200 @@ -60,7 +60,7 @@ if ( phase == 1 ) { // finalize subsampling - const Float subsample2 = 1.0/(subsample*subsample); + const Float subsample2 = 1.0f / (subsample*subsample); int num_samples = 0; Colour ic; phase = 2; @@ -95,10 +95,10 @@ for (int i = 0; i < subsample; i++) for (int j = 0; j < subsample; j++) { - ic = c1*(subsample-i)*(subsample-j)*subsample2 - + c2*(i)*(subsample-j)*subsample2 - + c3*(subsample-i)*(j)*subsample2 - + c4*(i)*(j)*subsample2; + ic = c1*(Float)((subsample-i)*(subsample-j)*subsample2) + + c2*(Float)((i)*(subsample-j)*subsample2) + + c3*(Float)((subsample-i)*(j)*subsample2) + + c4*(Float)((i)*(j)*subsample2); p = buffer + 3*((y1+j)*w + x1+i); *(p + 0) = ic.r; *(p + 1) = oversample ? -ic.g : ic.g; @@ -130,13 +130,13 @@ } else { - *buf = *buf * (1.0/samples); - *(buf+1) = *(buf+1) * (1.0/samples); - *(buf+2) = *(buf+2) * (1.0/samples); + *buf = *buf * (1.0f/samples); + *(buf+1) = *(buf+1) * (1.0f/samples); + *(buf+2) = *(buf+2) * (1.0f/samples); } else for (buf = buffer; buf != buffer + w*h*3; buf++) - *buf = *buf * (1.0/samples); + *buf = *buf * (1.0f/samples); } phase = -1; return 0; @@ -153,8 +153,8 @@ if (sx < 0) { // first sample - s->x = -(Float)w/h/2.0; - s->y = -0.5; + s->x = -(Float)w/h/2.0f; + s->y = -0.5f; sx = 0; sy = 0; osa_samp = 0; @@ -177,26 +177,26 @@ sx = w-1; } - s->x = (Float)sx/h - (Float)w/h/2.0; - s->y = (Float)sy/h - 0.5; + s->x = (Float)sx/h - (Float)w/h/2.0f; + s->y = (Float)sy/h - 0.5f; } } else if (phase == 2) { /* grid oversampling */ static const int gridsamples[] = {1,4,9,16}; - static const Float osa4x[] = {-0.25, +0.25, +0.25, -0.25}; - static const Float osa4y[] = {-0.25, -0.25, +0.25, +0.25}; - static const Float osa9x[] = {-0.34, 0.00, +0.34, - -0.34, 0.00, +0.34, -0.34, 0.00, +0.34}; - static const Float osa9y[] = {-0.34, -0.34, -0.34, - 0.00, 0.00, 0.00, +0.34, +0.34, +0.34}; - static const Float osa16x[] = {-0.375, -0.125, +0.125, +0.375, - -0.375, -0.125, +0.125, +0.375, -0.375, -0.125, +0.125, +0.375, - -0.375, -0.125, +0.125, +0.375}; - static const Float osa16y[] = {-0.375, -0.375, -0.375, -0.375, - -0.125, -0.125, -0.125, -0.125, +0.125, +0.125, +0.125, +0.125, - +0.375, +0.375, +0.375, +0.375}; + static const Float osa4x[] = {-0.25f, +0.25f, +0.25f, -0.25f}; + static const Float osa4y[] = {-0.25f, -0.25f, +0.25f, +0.25f}; + static const Float osa9x[] = {-0.34f, 0.00f, +0.34f, + -0.34f, 0.00f, +0.34f, -0.34f, 0.00f, +0.34f}; + static const Float osa9y[] = {-0.34f, -0.34f, -0.34f, + 0.00f, 0.00f, 0.00f, +0.34f, +0.34f, +0.34f}; + static const Float osa16x[] = {-0.375f, -0.125f, +0.125f, +0.375f, + -0.375f, -0.125f, +0.125f, +0.375f, -0.375f, -0.125f, +0.125f, +0.375f, + -0.375f, -0.125f, +0.125f, +0.375f}; + static const Float osa16y[] = {-0.375f, -0.375f, -0.375f, -0.375f, + -0.125f, -0.125f, -0.125f, -0.125f, +0.125f, +0.125f, +0.125f, +0.125f, + +0.375f, +0.375f, +0.375f, +0.375f}; static const Float *osaSx[] = {NULL, osa4x, osa9x, osa16x}; static const Float *osaSy[] = {NULL, osa4y, osa9y, osa16y}; const int samples = gridsamples[oversample]; @@ -206,8 +206,8 @@ if (sx < 0) { // first sample - s->x = -(Float)w/h/2.0; - s->y = -0.5; + s->x = -(Float)w/h/2.0f; + s->y = -0.5f; sx = 0; sy = 0; osa_samp = 0; @@ -218,8 +218,8 @@ if (oversample && oversample <= 3 && osa_samp < samples) { - s->x = osax[osa_samp]/h + (Float)sx/h - (Float)w/h/2.0; - s->y = osay[osa_samp]/h + (Float)sy/h - 0.5; + s->x = osax[osa_samp]/h + (Float)sx/h - (Float)w/h/2.0f; + s->y = osay[osa_samp]/h + (Float)sy/h - 0.5f; } else { @@ -279,8 +279,8 @@ return false; } - s->x = (Float)sx/h - (Float)w/h/2.0; - s->y = (Float)sy/h - 0.5; + s->x = (Float)sx/h - (Float)w/h/2.0f; + s->y = (Float)sy/h - 0.5f; osa_samp = 0; } } diff -r 9af5c039b678 -r 96d65f841791 src/scene.cc --- a/src/scene.cc Mon May 05 15:31:14 2008 +0200 +++ b/src/scene.cc Tue May 06 09:39:58 2008 +0200 @@ -77,7 +77,7 @@ { register Float tnear = -Inf; register Float tfar = Inf; - register Float t1, t2; + register Float t1, t2, t; for (int i = 0; i < 3; i++) { @@ -92,7 +92,11 @@ t2 = (H[i] - ray.o[i]) / ray.dir[i]; if (t1 > t2) - swap(t1, t2); + { + t = t1; + t1 = t2; + t2 = t; + } if (t1 > tnear) tnear = t1; /* want largest Tnear */ diff -r 9af5c039b678 -r 96d65f841791 src/shapes.cc --- a/src/shapes.cc Mon May 05 15:31:14 2008 +0200 +++ b/src/shapes.cc Tue May 06 09:39:58 2008 +0200 @@ -58,9 +58,9 @@ mfloat4 Sphere::intersect_packet(const RayPacket &rays, mfloat4 &dists) const { VectorPacket V = rays.o - VectorPacket(center); - register mfloat4 d = msub(mZero, dot(V, rays.dir)); - register mfloat4 Det = msub(mmul(d, d), msub(dot(V,V), mset1(sqr_radius))); - register mfloat4 t1, t2, mask; + mfloat4 d = msub(mZero, dot(V, rays.dir)); + mfloat4 Det = msub(mmul(d, d), msub(dot(V,V), mset1(sqr_radius))); + mfloat4 t1, t2, mask; mask = mcmpgt(Det, mZero); if (!mmovemask(mask)) @@ -141,7 +141,7 @@ { register Float tnear = -Inf; register Float tfar = Inf; - register Float t1, t2; + register Float t1, t2, t; for (int i = 0; i < 3; i++) { @@ -157,7 +157,11 @@ t2 = (H[i] - ray.o[i]) / ray.dir[i]; if (t1 > t2) - swap(t1, t2); + { + t = t1; + t1 = t2; + t2 = t; + } if (t1 > tnear) tnear = t1; /* want largest Tnear */ @@ -216,8 +220,8 @@ const Vector Box::normal(const Vector &P) const { - register Vector l = P - L; - register Vector h = H - P; + Vector l = P - L; + Vector h = H - P; if (l.x < h.x) h.x = -1; @@ -316,7 +320,7 @@ int u = (k + 1) % 3; int v = (k + 2) % 3; - Float krec = 1.0 / N[k]; + Float krec = 1.0f / N[k]; nu = N[u] * krec; nv = N[v] * krec; nd = dot(N, A->P) * krec; diff -r 9af5c039b678 -r 96d65f841791 tests/SConscript --- a/tests/SConscript Mon May 05 15:31:14 2008 +0200 +++ b/tests/SConscript Tue May 06 09:39:58 2008 +0200 @@ -1,6 +1,6 @@ Import('env lib') myenv = env.Clone() -myenv.Append(CPPPATH = ['.','#include'], LIBPATH='#build/lib') +myenv.Append(LIBPATH='#build/lib') myenv.Prepend(LIBS=['pyrit']) l = []