00001 // Copyright (C) 2005 Dave Griffiths 00002 // 00003 // This program is free software; you can redistribute it and/or modify 00004 // it under the terms of the GNU General Public License as published by 00005 // the Free Software Foundation; either version 2 of the License, or 00006 // (at your option) any later version. 00007 // 00008 // This program is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with this program; if not, write to the Free Software 00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00016 00017 #ifndef FLUX_CAMERA 00018 #define FLUX_CAMERA 00019 00020 #include "Primitive.h" 00021 00022 namespace Fluxus 00023 { 00024 00027 class Camera 00028 { 00029 public: 00030 Camera(); 00031 ~Camera(); 00032 00036 00040 bool NeedsInit() { return !m_Initialised; } 00041 00043 void DoProjection(); 00044 00046 void DoCamera(); 00048 00052 dMatrix *GetMatrix() { return &m_Transform; } 00053 void SetMatrix(const dMatrix &m) { m_Transform=m; } 00054 dMatrix *GetLockedMatrix() { return &m_LockedMatrix; } 00055 dMatrix GetProjection(); 00056 float GetUp() { return m_Up; } 00057 float GetLeft() { return m_Left; } 00059 void LockCamera(Primitive *p); 00060 void SetCameraLag(float s) { m_CameraLag=s; } 00061 void SetOrtho(bool s) { m_Ortho=s; m_Initialised=false; } 00062 void SetOrthoZoom(float s) { m_OrthZoom=s; m_Initialised=false; } 00063 void SetFrustum(float u, float d, float l, float r) { m_Up=u; m_Down=d; m_Left=l; m_Right=r; m_Initialised=false; } 00064 void SetClip(float f, float b) { m_Front=f; m_Back=b; m_Initialised=false; } 00066 00067 private: 00068 00069 bool m_Initialised; 00070 dMatrix m_Transform; 00071 bool m_Ortho; 00072 Primitive *m_CameraAttached; 00073 float m_CameraLag; 00074 dMatrix m_LockedMatrix; 00075 float m_Up,m_Down,m_Left,m_Right,m_Front,m_Back; 00076 float m_OrthZoom; 00077 }; 00078 00079 } 00080 00081 #endif