diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-11-05 14:21:25 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-11-05 14:21:25 -0700 |
commit | 5c5894d842b86294485bbee7079439b998aa5344 (patch) | |
tree | d5828075eb2652ab675c8a41f06cf84bf415316e /tests/raytrace.cpp | |
parent | 80d618d0452420b9c3f5a67fccbb94ba1e70785e (diff) |
fix raytrace test and benchmark
Diffstat (limited to 'tests/raytrace.cpp')
-rw-r--r-- | tests/raytrace.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/tests/raytrace.cpp b/tests/raytrace.cpp index 317e0f42..08209a00 100644 --- a/tests/raytrace.cpp +++ b/tests/raytrace.cpp @@ -9,8 +9,6 @@ //#include "emscripten.h" -static int outputLeft = 550; // limit output, so we do not benchmark speed of printing - #define GIMME_SHADOWS // usage: ./sphereflake [lvl=6] >pix.ppm enum { childs = 9, ss= 2, ss_sqr = ss*ss }; /* not really tweakable anymore */ @@ -114,24 +112,19 @@ static void trace_rgss(const int width,const int height) { } v_t scan(0,w-1,std::max(w,h)); /*scan line*/ for(int i=height;i;--i) { + int lineMean = 0; for(int j=width;j;--j) { double g=0; for(int idx=0;idx < ss_sqr;++idx){ /*AA*/ ray.d=(scan+rgss[idx]).norm(); g+=ray_trace(pool,ray); /*trace*/ } - if (outputLeft) { - printf("%d ", int(scale*g)); // std::cout << int(scale*g)<< " "; - outputLeft--; - } + lineMean += int(scale*g); scan.x+=1; /*next pixel*/ } + printf("%d : %d\n", i, lineMean/width); scan.x=0;scan.y-=1; /*next line*/ } - if (outputLeft) { - printf("\n"); // std::cout << "\n"; // XXX Emscripten: std::endl crashes... - outputLeft--; - } } struct basis_t{ /* bogus and compact, exactly what we need */ |