00001 // This is core/vgui/vgui_camera.h 00002 #ifndef vgui_camera_h_ 00003 #define vgui_camera_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \author Geoffrey Cross, Oxford RRG 00010 // \date 03 Nov 99 00011 // \brief Projects 3D models into a GL context given a camera projection matrix. 00012 // 00013 // \verbatim 00014 // Modifications 00015 // 991103 Geoff Initial version. 00016 // 26-APR-2002 K.Y.McGaul - Converted to doxygen style comments. 00017 // \endverbatim 00018 00019 #include <vnl/vnl_matrix_fixed.h> 00020 00021 //: Projects 3D models into a GL context given a camera projection matrix. 00022 // 00023 // vgui_camera is a utility class which allows 3D models to projected into 00024 // a GL context given a known camera projection matrix. Note comments in 00025 // code about clipping planes which is really rather important if you care 00026 // about such things. Use the class in conjunction with a vgui_load (if 00027 // you dare), or a vgui_mult to change the GL_PROJECTION_MATRIX 00028 // appropriately. 00029 class vgui_camera 00030 { 00031 public: 00032 //: Constructor - create a camera with a default projection matrix. 00033 vgui_camera() {} 00034 00035 //: Constructor - create a camera with the given projection matrix. 00036 vgui_camera(vnl_matrix_fixed<double,3,4> const& P) : pmatrix(P) {} 00037 00038 //: Set the projection matrix to the given matrix. 00039 void set_pmatrix(vnl_matrix_fixed<double,3,4> const& m) { pmatrix= m; } 00040 00041 //: Plug this matrix into a vgui_loader_tableau. 00042 // Note: this will return a GL_PROJECTION_MATRIX with the assumption that 00043 // you have a Euclidean reconstruction. The result is that the front and 00044 // back clipping planes will be PARALLEL (note: not projective frame!) to 00045 // the image plane. 00046 vnl_matrix_fixed<double,3,4> get_glprojmatrix( const int imagesizex= 720, 00047 const int imagesizey= 576) const; 00048 00049 protected: 00050 //: The projection matrix. 00051 vnl_matrix_fixed<double,3,4> pmatrix; 00052 }; 00053 00054 #endif // vgui_camera_h_