Camera.cpp

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @file   Camera.cpp
00003    @author Matthew Jacobs (jacobs.mh@gmail.com)
00004    @author Travis Fischer (fisch0920@gmail.com)
00005    @date   Fall 2008
00006    
00007    @brief
00008       Abstract camera that all Milton cameras subclass, representing a 
00009    mapping from film-space to world-space and vice-versa. Cameras may 
00010    optionally also specify an OpenGL preview projection matrix that can be 
00011    used by OpenGLRenderer.
00012       Film-space is represented by (slightly modified) Normalized Device 
00013    Coordinates (NDC), which are unit film-plane coordinates, with (x,y) both 
00014    ranging inbetween 0 and 1. NDC lie in the unit square [0,1]^2, where [0,0] 
00015    gets mapped to the upper left corner of the corresponding Viewport/Image, 
00016    and [1,1] is the lower right corner. NDC film-space allows for mapping 
00017    rendering results onto an arbitrarily-sized Viewport/Image. 
00018    
00019    @see ThinLensCamera
00020    <!-------------------------------------------------------------------->**/
00021 
00022 #include "Camera.h"
00023 #include <SurfacePoint.h>
00024 #include <Viewport.h>
00025 
00026 Point2 Camera::getProjection(const Point3 &p, const Viewport &v) const {
00027    const Point2 &NDC = getProjection(p);
00028    unsigned outX = 0, outY = 0;
00029    
00030    v.getBin(NDC, outX, outY);
00031    return Point2(outX, outY);
00032 }
00033 
00034 Point3 Camera::getPosition(const UV &uv) {
00035    return getWorldRay(Point2(0.5, 0.5)).origin;
00036 }
00037 
00038 void Camera::_getUV(SurfacePoint &pt) const {
00039    NYI();
00040 }
00041 
00042 void Camera::_getGeometricNormal(SurfacePoint &pt) const {
00043    pt.normalG = getWorldRay(Point2(pt.uv.u, pt.uv.v)).direction;
00044 }
00045 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6