00001 /* 00002 toxic - A Global Illumination Renderer 00003 Copyright (C) 2003-2004 Francois Beaune 00004 Contact: http://toxicengine.sourceforge.net/ 00005 00006 This file is part of toxic. 00007 00008 toxic is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 toxic is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with toxic; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 #ifndef TOXIC_RENDERER_PINHOLECAMERA_H 00024 #define TOXIC_RENDERER_PINHOLECAMERA_H 00025 00026 #include "common/math/matrix4.h" 00027 #include "common/math/point2.h" 00028 #include "common/math/point3.h" 00029 #include "common/math/real.h" 00030 #include "globals.h" 00031 #include "icamera.h" 00032 00033 namespace toxic { 00034 00035 class Context; 00036 class Ray; 00037 00038 class PinholeCamera : public ICamera { 00039 public: 00040 //! 'm' is the object space to world space transformation matrix. 00041 //! 'hfov' is the horizontal field of view, expressed in radians. 00042 PinholeCamera( 00043 const sheep::Matrix4 &m, 00044 sheep::Real hfov, 00045 sheep::Real aspect_ratio 00046 ); 00047 00048 //! Returns a ray whose origin is at camera location, and which 00049 //! is directed toward the point 'p'. 'p' is a point on the film 00050 //! plane. It is expressed in NDC. The returned ray is expressed 00051 //! in world space. The direction of the returned ray IS unit-length. 00052 virtual Ray ComputeRay( 00053 const Context &context, 00054 const sheep::Point2 &p 00055 ) const; 00056 00057 //! Projects a point in the scene to the image plane. 00058 virtual sheep::Point2 Project( 00059 const sheep::Point3 &p 00060 ) const; 00061 }; 00062 00063 #include "pinholecamera.inl" 00064 00065 } 00066 00067 #endif // !TOXIC_RENDERER_PINHOLECAMERA_H
1.3.6