Nori

include/nori/camera.h

Go to the documentation of this file.
00001 /*
00002     This file is part of Nori, a simple educational ray tracer
00003 
00004     Copyright (c) 2012 by Wenzel Jakob and Steve Marschner.
00005 
00006     Nori is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License Version 3
00008     as published by the Free Software Foundation.
00009 
00010     Nori is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 #if !defined(__CAMERA_H)
00020 #define __CAMERA_H
00021 
00022 #include <nori/object.h>
00023 
00024 NORI_NAMESPACE_BEGIN
00025 
00026 /**
00027  * \brief Generic camera interface
00028  * 
00029  * This class provides an abstract interface to cameras in Nori and
00030  * exposes the ability to sample their response function. By default, only
00031  * a perspective camera implementation exists, but you may choose to
00032  * implement other types (e.g. an environment camera, or a physically-based 
00033  * camera model that simulates the behavior actual lenses)
00034  *
00035  */
00036 class Camera : public NoriObject {
00037 public:
00038         /**
00039          * \brief Importance sample a ray according to the camera's response function
00040          *
00041          * \param ray
00042          *    A ray data structure to be filled with a position 
00043          *    and direction value
00044          *
00045          * \param samplePosition
00046          *    Denotes the desired sample position on the film
00047          *    expressed in fractional pixel coordinates
00048          *
00049          * \param apertureSample
00050          *    A uniformly distributed 2D vector that is used to sample
00051          *    a position on the aperture of the sensor if necessary.
00052          *
00053          * \return
00054          *    An importance weight associated with the sampled ray.
00055          *    This accounts for the difference in the camera response
00056          *    function and the sampling density.
00057          */
00058         virtual Color3f sampleRay(Ray3f &ray,
00059                 const Point2f &samplePosition,
00060                 const Point2f &apertureSample) const = 0;
00061 
00062         /// Return the size of the output image in pixels
00063         inline const Vector2i &getOutputSize() const { return m_outputSize; }
00064 
00065         /// Return the camera's reconstruction filter in image space
00066         inline const ReconstructionFilter *getReconstructionFilter() const { return m_rfilter; }
00067 
00068         /**
00069          * \brief Return the type of object (i.e. Mesh/Camera/etc.) 
00070          * provided by this instance
00071          * */
00072         EClassType getClassType() const { return ECamera; }
00073 protected:
00074         Vector2i m_outputSize;
00075         ReconstructionFilter *m_rfilter;
00076 };
00077 
00078 NORI_NAMESPACE_END
00079 
00080 #endif /* __CAMERA_H */
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines