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_INTEGRATORS_DIPOLESUBSURFACE_H
00029 #define PBRT_INTEGRATORS_DIPOLESUBSURFACE_H
00030
00031
00032 #include "pbrt.h"
00033 #include "integrator.h"
00034 #include "kdtree.h"
00035 #include "renderers/surfacepoints.h"
00036 struct SubsurfaceOctreeNode;
00037
00038
00039 struct IrradiancePoint {
00040 IrradiancePoint() { }
00041 IrradiancePoint(const SurfacePoint &sp, const Spectrum &ee)
00042 : p(sp.p), n(sp.n), E(ee), area(sp.area),
00043 rayEpsilon(sp.rayEpsilon) { }
00044 Point p;
00045 Normal n;
00046 Spectrum E;
00047 float area, rayEpsilon;
00048 };
00049
00050
00051
00052
00053 class DipoleSubsurfaceIntegrator : public SurfaceIntegrator {
00054 public:
00055
00056 DipoleSubsurfaceIntegrator(int mdepth, float merror, float mindist,
00057 const string &fn) {
00058 maxSpecularDepth = mdepth;
00059 maxError = merror;
00060 minSampleDist = mindist;
00061 filename = fn;
00062 octree = NULL;
00063 }
00064 ~DipoleSubsurfaceIntegrator();
00065 Spectrum Li(const Scene *scene, const Renderer *renderer,
00066 const RayDifferential &ray, const Intersection &isect, const Sample *sample,
00067 RNG &rng, MemoryArena &arena) const;
00068 void RequestSamples(Sampler *sampler, Sample *sample, const Scene *scene);
00069 void Preprocess(const Scene *, const Camera *, const Renderer *);
00070 private:
00071
00072 int maxSpecularDepth;
00073 float maxError, minSampleDist;
00074 string filename;
00075 vector<IrradiancePoint> irradiancePoints;
00076 BBox octreeBounds;
00077 SubsurfaceOctreeNode *octree;
00078 MemoryArena octreeArena;
00079
00080
00081 LightSampleOffsets *lightSampleOffsets;
00082 BSDFSampleOffsets *bsdfSampleOffsets;
00083 };
00084
00085
00086 DipoleSubsurfaceIntegrator *CreateDipoleSubsurfaceIntegrator(const ParamSet ¶ms);
00087
00088 #endif // PBRT_INTEGRATORS_DIPOLESUBSURFACE_H