Blender V2.61 - r43446

BKE_camera.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
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  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00028 #ifndef BKE_CAMERA_H
00029 #define BKE_CAMERA_H
00030 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 #include "DNA_vec_types.h"
00040 
00041 struct Camera;
00042 struct Object;
00043 struct RegionView3D;
00044 struct RenderData;
00045 struct Scene;
00046 struct rctf;
00047 struct View3D;
00048 
00049 /* Camera Datablock */
00050 
00051 void *add_camera(const char *name);
00052 struct Camera *copy_camera(struct Camera *cam);
00053 void make_local_camera(struct Camera *cam);
00054 void free_camera(struct Camera *ca);
00055 
00056 /* Camera Usage */
00057 
00058 float object_camera_dof_distance(struct Object *ob);
00059 void object_camera_mode(struct RenderData *rd, struct Object *ob);
00060 
00061 int camera_sensor_fit(int sensor_fit, float sizex, float sizey);
00062 float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y);
00063 
00064 /* Camera Parameters:
00065  *
00066  * Intermediate struct for storing camera parameters from various sources,
00067  * to unify computation of viewplane, window matrix, ... */
00068 
00069 typedef struct CameraParams {
00070     /* lens */
00071     int is_ortho;
00072     float lens;
00073     float ortho_scale;
00074     float zoom;
00075 
00076     float shiftx;
00077     float shifty;
00078     float offsetx;
00079     float offsety;
00080 
00081     /* sensor */
00082     float sensor_x;
00083     float sensor_y;
00084     int sensor_fit;
00085 
00086     /* clipping */
00087     float clipsta;
00088     float clipend;
00089 
00090     /* fields */
00091     int use_fields;
00092     int field_second;
00093     int field_odd;
00094 
00095     /* computed viewplane */
00096     float ycor;
00097     float viewdx;
00098     float viewdy;
00099     rctf viewplane;
00100 
00101     /* computed matrix */
00102     float winmat[4][4];
00103 } CameraParams;
00104 
00105 void camera_params_init(CameraParams *params);
00106 void camera_params_from_object(CameraParams *params, struct Object *camera);
00107 void camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d);
00108 
00109 void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy);
00110 void camera_params_compute_matrix(CameraParams *params);
00111 
00112 /* Camera View Frame */
00113 
00114 void camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3],
00115                           float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]);
00116 
00117 void camera_view_frame(struct Scene *scene, struct Camera *camera, float r_vec[4][3]);
00118 
00119 int camera_view_frame_fit_to_scene(
00120         struct Scene *scene, struct View3D *v3d, struct Object *camera_ob,
00121         float r_co[3]);
00122 
00123 #ifdef __cplusplus
00124 }
00125 #endif
00126 
00127 #endif
00128