--- ray/src/gen/gendaymtx.c 2015/10/30 17:06:34 2.22 +++ ray/src/gen/gendaymtx.c 2016/08/18 00:52:48 2.23 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: gendaymtx.c,v 2.22 2015/10/30 17:06:34 greg Exp $"; +static const char RCSid[] = "$Id: gendaymtx.c,v 2.23 2016/08/18 00:52:48 greg Exp $"; #endif /* * gendaymtx.c @@ -86,6 +86,7 @@ static const char RCSid[] = "$Id: gendaymtx.c,v 2.22 2 #include #include #include "rtmath.h" +#include "rtio.h" #include "resolu.h" #include "platform.h" #include "color.h" @@ -555,7 +556,7 @@ main(int argc, char *argv[]) break; case 'f': for (j = 0; j < ntsteps; j++) { - fwrite(mtx_data+mtx_offset, sizeof(float), 3, + putbinary(mtx_data+mtx_offset, sizeof(float), 3, stdout); mtx_offset += 3*nskypatch; } @@ -566,7 +567,7 @@ main(int argc, char *argv[]) ment[0] = mtx_data[mtx_offset]; ment[1] = mtx_data[mtx_offset+1]; ment[2] = mtx_data[mtx_offset+2]; - fwrite(ment, sizeof(double), 3, stdout); + putbinary(ment, sizeof(double), 3, stdout); mtx_offset += 3*nskypatch; } break; @@ -1128,6 +1129,10 @@ void CalcSkyPatchLumin( float *parr ) double sspa; /* Sun-sky point angle */ double zsa; /* Zenithal sun angle */ +fprintf(stderr, "Alt, azi: %f %f\n", altitude, azimuth); +fprintf(stderr, "Perez parameters: %f %f %f %f %f\n", + perez_param[0], perez_param[1], perez_param[2], perez_param[3], perez_param[4]); + for (i = 1; i < nskypatch; i++) { /* Calculate sun-sky point azimuthal angle */ @@ -1142,6 +1147,7 @@ void CalcSkyPatchLumin( float *parr ) /* Calculate patch luminance */ parr[3*i] = CalcRelLuminance(sspa, zsa); +fprintf(stderr, "CalcRelLuminance(%f, %f) = %f\n", sspa, zsa, parr[3*i]); if (parr[3*i] < 0) parr[3*i] = 0; parr[3*i+2] = parr[3*i+1] = parr[3*i]; }