00001 00002 // camera.h // 00003 // -------- // 00004 // begin : Nov 18 2003 // 00005 // copyright : (C) 2003 by cbaudry (CEA/DSM/SPP) // 00006 // email : cedric.baudry@tremplin-utc.fr // 00008 00010 // // 00011 // This program is free software; you can redistribute it and/or modify // 00012 // it under the terms of the GNU General Public License as published by // 00013 // the Free Software Foundation, version 2 of the License // 00014 // // 00016 #pragma once 00017 00018 #include <GL/glu.h> 00019 #include <GL/gl.h> 00020 #include <assert.h> 00021 #include <stdio.h> 00022 00023 #include "viewmodel.h" 00024 #include "configini.h" 00025 #include "structure.h" 00026 00035 class Camera 00036 { 00037 00038 public: 00039 00040 Camera (); 00041 ~Camera (); 00042 00047 ViewModel vm; 00048 vec3 BoundingBoxMin; 00049 vec3 BoundingBoxMax; 00051 /* 00052 * Depth buffer precision is affected by the values specified for zNear and zFar. 00053 * The greater the ratio of zFar to zNear is, the less effective the depth buffer 00054 * will be at distinguishing between surfaces that are near each other. Let 00055 * r = zFar / zNear then roughly log2(r) bits of depth buffer precision are lost. 00056 * to lose only 6 bits, znear =zfar/(2 pow 6) or zfar=znear * (2 pow 6) 00057 */ 00058 00059 unsigned int perspective_znear; 00060 unsigned int perspective_zfar; 00061 unsigned int perspective_angle; 00063 void loadConfigData (void); 00064 void resetView (); 00065 void lookTo (float x, float y, float z); 00066 void getBoundingBox (SCENE * scene); 00067 void setPerspective (); 00068 };