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 "camera.h"
00025 #include "dynload.h"
00026
00027 namespace lux
00028 {
00029
00030 struct Lens {
00031 Lens(const bool ent, const float n, const float ap,
00032 boost::shared_ptr<Shape> shape)
00033 : entering(ent), eta(n), aperture(ap), shape(shape) {}
00034 bool entering;
00035 float eta;
00036 float aperture;
00037 boost::shared_ptr<Shape> shape;
00038 };
00039
00040 class RealisticCamera : public Camera {
00041 public:
00042 RealisticCamera(const Transform &world2camStart, const Transform &world2camEnd,
00043 const float Screen[4],
00044 float hither, float yon, float sopen,
00045 float sclose, int sdist, float filmdistance, float aperture_diameter, string specfile,
00046 float filmdiag, Film *film);
00047 virtual ~RealisticCamera(void);
00048 virtual float GenerateRay(const Sample &sample, Ray *) const;
00049
00050 virtual RealisticCamera* Clone() const {
00051 return new RealisticCamera(*this);
00052 }
00053
00054 static Camera *CreateCamera(const Transform &world2cam, const Transform &world2camEnd, const ParamSet ¶ms, Film *film);
00055
00056 private:
00057 float ParseLensData(const string& specfile);
00058
00059 float filmDistance, filmDist2, filmDiag;
00060 float apertureDiameter, distToBack, backAperture;
00061
00062 vector<boost::shared_ptr<Lens> > lenses;
00063
00064 Transform RasterToFilm, RasterToCamera, FilmToCamera;
00065 };
00066
00067 }
00068