00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "lux.h"
00025 #include "film.h"
00026 #include "color.h"
00027 #include "paramset.h"
00028 #include "tonemap.h"
00029 #include "sampling.h"
00030 #include <boost/timer.hpp>
00031
00032 namespace lux
00033 {
00034
00035
00036 class ImageFilm : public Film {
00037 public:
00038
00039 ImageFilm(int xres, int yres,
00040 Filter *filt, const float crop[4],
00041 const string &filename, bool premult,
00042 int wf, int wfs);
00043 ~ImageFilm() {
00044 delete pixels;
00045 delete filter;
00046 delete[] filterTable;
00047 }
00048 void AddSample(float sX, float sY,
00049 const Spectrum &L, float alpha);
00050 void GetSampleExtent(int *xstart, int *xend,
00051 int *ystart, int *yend) const;
00052 void WriteImage();
00053 void WriteImage(int oType) {};
00054
00055 unsigned char* getFrameBuffer() { return NULL; };
00056 void updateFrameBuffer() {};
00057 float getldrDisplayInterval() { return 10.0f; }
00058
00059 static Film *CreateFilm(const ParamSet ¶ms, Filter *filter);
00060 private:
00061
00062 Filter *filter;
00063 int writeFrequency, writeFrequencySeconds, sampleCount;
00064 string filename;
00065 bool premultiplyAlpha;
00066 float cropWindow[4];
00067 int xPixelStart, yPixelStart, xPixelCount, yPixelCount;
00068 struct Pixel {
00069 Pixel() : L(0.f) {
00070 alpha = 0.f;
00071 weightSum = 0.f;
00072 }
00073 Spectrum L;
00074 float alpha, weightSum;
00075 };
00076 BlockedArray<Pixel> *pixels;
00077 float *filterTable;
00078 boost::timer Timer;
00079 };
00080
00081 }
00082
00083