Blender V2.61 - r43446

camera.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2011, Blender Foundation.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef __CAMERA_H__
00020 #define __CAMERA_H__
00021 
00022 #include "util_transform.h"
00023 #include "util_types.h"
00024 
00025 CCL_NAMESPACE_BEGIN
00026 
00027 class Device;
00028 class DeviceScene;
00029 
00030 /* Camera
00031  *
00032  * The camera parameters are quite standard, tested to be both compatible with
00033  * Renderman, and Blender after remapping. */
00034 
00035 class Camera {
00036 public:
00037     /* motion blur */
00038     float shutteropen;
00039     float shutterclose;
00040 
00041     /* depth of field */
00042     float focaldistance;
00043     float aperturesize;
00044     uint blades;
00045     float bladesrotation;
00046 
00047     /* orthographic/perspective */
00048     bool ortho;
00049     float fov;
00050 
00051     /* clipping */
00052     float nearclip;
00053     float farclip;
00054 
00055     /* screen */
00056     int width, height;
00057     float left, right, bottom, top;
00058 
00059     /* transformation */
00060     Transform matrix;
00061 
00062     /* computed camera parameters */
00063     Transform screentoworld;
00064     Transform rastertoworld;
00065     Transform ndctoworld;
00066     Transform rastertocamera;
00067     Transform cameratoworld;
00068     Transform worldtoraster;
00069 
00070     float3 dx;
00071     float3 dy;
00072 
00073     /* update */
00074     bool need_update;
00075     bool need_device_update;
00076 
00077     /* functions */
00078     Camera();
00079     ~Camera();
00080 
00081     void update();
00082 
00083     void device_update(Device *device, DeviceScene *dscene);
00084     void device_free(Device *device, DeviceScene *dscene);
00085 
00086     bool modified(const Camera& cam);
00087     void tag_update();
00088 };
00089 
00090 CCL_NAMESPACE_END
00091 
00092 #endif /* __CAMERA_H__ */
00093