00001 /***************************************************************************** 00002 * SGL: A Scene Graph Library 00003 * 00004 * Copyright (C) 1997-2001 Scott McMillan All Rights Reserved. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public 00017 * License along with this library; if not, write to the Free 00018 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00019 ***************************************************************************** 00020 * File: sgluCamera.hpp 00021 * Created: 21 March 1997 00022 * Summary: base camera class - was dmGLCamera.hpp 00023 *****************************************************************************/ 00024 00025 #ifndef __SGLU_CAMERA_HPP 00026 #define __SGLU_CAMERA_HPP 00027 00028 #include <sglu.h> 00029 #include <sgluMouse.hpp> 00030 00031 class SGLU_DLL_API sgluCamera 00032 { 00033 public: 00034 sgluCamera(); 00035 virtual ~sgluCamera(); 00036 00037 void reset(); 00038 00039 void setPerspective(GLfloat fov, GLfloat aspect, 00040 GLfloat near_clip, GLfloat far_clip); 00041 void applyPerspective(); 00042 00043 // set/get/update view functions 00044 void setViewMat(GLfloat mat[4][4]); 00045 void getViewMat(GLfloat mat[4][4]); 00046 void updateViewMat(GLfloat delta_mat[4][4]); 00047 00048 // functions for subclasses to build on 00049 virtual void update(sgluMouse *) {}; 00050 virtual void applyView(); 00051 00052 private: // not implemented 00053 sgluCamera(const sgluCamera&); 00054 sgluCamera &operator=(const sgluCamera&); 00055 00056 protected: 00057 GLfloat m_fov; // field of view angle, degrees 00058 GLfloat m_aspect; 00059 GLfloat m_near_clip, m_far_clip; // near and far clipping planes 00060 00061 GLfloat m_view_mat[4][4]; // eyepoint position and orientation wrt scene. 00062 }; 00063 00064 #endif