00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if defined(_MSC_VER)
00025 #pragma once
00026 #endif
00027
00028 #ifndef PBRT_FILM_IMAGE_H
00029 #define PBRT_FILM_IMAGE_H
00030
00031
00032 #include "pbrt.h"
00033 #include "film.h"
00034 #include "sampler.h"
00035 #include "filter.h"
00036 #include "paramset.h"
00037 #ifdef PBRT_HAS_LIBSDL
00038 struct SDL_Surface;
00039 #endif // PBRT_HAS_LIBSDL
00040
00041
00042 class ImageFilm : public Film {
00043 public:
00044
00045 ImageFilm(int xres, int yres, Filter *filt, const float crop[4],
00046 const string &filename, bool openWindow);
00047 ~ImageFilm() {
00048 delete pixels;
00049 delete filter;
00050 delete[] filterTable;
00051 }
00052 void AddSample(const CameraSample &sample, const Spectrum &L);
00053 void Splat(const CameraSample &sample, const Spectrum &L);
00054 void GetSampleExtent(int *xstart, int *xend, int *ystart, int *yend) const;
00055 void GetPixelExtent(int *xstart, int *xend, int *ystart, int *yend) const;
00056 void WriteImage(float splatScale);
00057 void UpdateDisplay(int x0, int y0, int x1, int y1, float splatScale);
00058 private:
00059
00060 Filter *filter;
00061 float cropWindow[4];
00062 string filename;
00063 #ifdef PBRT_HAS_LIBSDL
00064 SDL_Surface *sdlWindow;
00065 #endif // PBRT_HAS_LIBSDL
00066 int xPixelStart, yPixelStart, xPixelCount, yPixelCount;
00067 struct Pixel {
00068 Pixel() {
00069 for (int i = 0; i < 3; ++i) Lxyz[i] = splatXYZ[i] = 0.f;
00070 weightSum = 0.f;
00071 }
00072 float Lxyz[3];
00073 float weightSum;
00074 float splatXYZ[3];
00075 float pad;
00076 };
00077 BlockedArray<Pixel> *pixels;
00078 float *filterTable;
00079 };
00080
00081
00082 ImageFilm *CreateImageFilm(const ParamSet ¶ms, Filter *filter);
00083
00084 #endif // PBRT_FILM_IMAGE_H