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 "transport.h"
00026 #include "geometry/point.h"
00027 #include "geometry/normal.h"
00028 #include "spectrumwavelengths.h"
00029
00030 namespace lux
00031 {
00032
00033
00034 struct VirtualLight {
00035 VirtualLight() { }
00036 VirtualLight(const TsPack *tspack, const Point &pp, const Normal &nn,
00037 const SWCSpectrum &le)
00038 : Le(le), p(pp), n(nn) {
00039 for (u_int i = 0; i < WAVELENGTH_SAMPLES; ++i)
00040 w[i] = tspack->swl->w[i];
00041 }
00042 SWCSpectrum GetSWCSpectrum(const TsPack *tspack) const;
00043 SWCSpectrum Le;
00044 float w[WAVELENGTH_SAMPLES];
00045 Point p;
00046 Normal n;
00047 };
00048
00049 class IGIIntegrator : public SurfaceIntegrator {
00050 public:
00051
00052 IGIIntegrator(int nl, int ns, int d, float md);
00053 virtual ~IGIIntegrator () {
00054 delete[] lightSampleOffset;
00055 delete[] bsdfSampleOffset;
00056 delete[] bsdfComponentOffset;
00057 }
00058 virtual int Li(const TsPack *tspack, const Scene *scene, const Sample *sample) const;
00059 virtual void RequestSamples(Sample *sample, const Scene *scene);
00060 virtual void Preprocess(const TsPack *tspack, const Scene *scene);
00061 static SurfaceIntegrator *CreateSurfaceIntegrator(const ParamSet ¶ms);
00062 private:
00063
00064 u_int nLightPaths, nLightSets;
00065 vector<vector<VirtualLight> > virtualLights;
00066 int maxSpecularDepth;
00067 float minDist2;
00068 int vlSetOffset, bufferId;
00069
00070 int *lightSampleOffset, lightNumOffset;
00071 int *bsdfSampleOffset, *bsdfComponentOffset;
00072 };
00073
00074 }