Eigene Dateien/FlowVis/src/VCamera.h

Go to the documentation of this file.
00001 #pragma once
00002 
00003 #ifndef __camera_h
00004 #define __camera_h
00005 
00006 #include "VMatrix.h"
00007 #include "VQuaternion.h"
00008 
00014 class VCamera
00015 {
00016 public:
00022         VCamera();
00023 
00030         void setProjection(int width, int height);
00031 
00037         void updateProjMatrix();
00038 
00044         void updateProjMatrixLeft();
00045 
00051         void updateProjMatrixRight();
00052 
00057         void setProjectionToInfinity();
00058 
00063         void setProjectionToNormal();
00064 
00069         void rotateX(float m_degrees);
00070 
00075         void rotateY(float m_degrees);
00076 
00081         void rotateZ(float m_degrees);
00082 
00087         void rotate(float m_degrees, float ax, float ay, float az);
00088 
00095         void lookInDirection(VVector eye, VVector view, VVector up);
00096 
00102         void updateViewMatrix();
00103 
00110         void updateViewMatrixLeft();
00111 
00118         void updateViewMatrixRight();
00119 
00127         void mouseMove(float x, float y, float z);
00128 
00134         void moveForward(float way);
00135 
00142         void moveSideWards(float way);
00143 
00148         const VMatrix getViewMatrix() const
00149         {
00150                 return mViewMatrix;
00151         }
00152 
00157         void setViewMatrix(const VMatrix& m)
00158         {
00159                 mViewMatrix = m;
00160                 mMustUpdateView = false;
00161         }
00162 
00167         const VMatrix getProjMatrix() const
00168         {
00169                 return mProjMatrix;
00170         }
00171 
00176         void setProjMatrix(const VMatrix& m)
00177         {
00178                 mProjMatrix = m;
00179         }
00180 
00185         const VQuaternion getOrientation() const
00186         {
00187                 return mOrientation;
00188         }
00189 
00194         void setOrientation(const VQuaternion& q)
00195         {
00196                 mOrientation = q;
00197         }
00198 
00203         const VVector getPosition() const
00204         {
00205                 return mPosition;
00206         }
00207 
00212         VVector getUpVector()
00213         {
00214                 return mOrientation.getUpVector();
00215         }
00216 
00221         VVector getAtVector()
00222         {
00223                 return mOrientation.getForwardVector();
00224         }
00225 
00230         void setPosition(VVector& v)
00231         {
00232                 mPosition = v;
00233                 mMustUpdateView = true;
00234         }
00235 
00240         float * getViewMatrix()
00241         {
00242                 return &mViewMatrix[0];
00243         }
00244 
00249         float * getProjectionMatrix()
00250         {
00251                 return &mProjMatrix[0];
00252         }
00253 
00258         float getFov() const
00259         {
00260                 return mFov;
00261         }
00262 
00267         void setFov(float m_fov)
00268         {
00269                 mFov = m_fov;
00270                 mMustUpdateProjection = true;
00271         }
00272 
00277         float getAspecRatio() const
00278         {
00279                 return mAspectRatio;
00280         }
00281 
00286         void setAspectRatio(float m_aspect)
00287         {
00288                 mAspectRatio = m_aspect;
00289                 mMustUpdateProjection = true;
00290         }
00291 
00297         void setStereoParameters(float m_ScreenDistance, float m_EyeSeparation);
00298 
00304         void setOrthogonalCamera(VVector m_OrthogonalSize, bool m_OrthogonalCamera = true)
00305         {
00306                 mOrthogonalCamera = m_OrthogonalCamera;
00307                 mOrthogonalSize = m_OrthogonalSize;
00308                 mMustUpdateProjection = true;
00309         }
00310 
00315         void setAsShadowCamera(bool m_IsShadow)
00316         {
00317                 mIsShadowCamera = m_IsShadow;
00318         }
00319 
00320 
00321 private:
00322         
00323         float mFov; 
00324         float mAspectRatio; 
00325         float mNearPlane; 
00326         float mFarPlane; 
00328         VQuaternion mOrientation; 
00329         VVector mPosition; 
00331         VMatrix mViewMatrix; 
00332         VMatrix mLeftViewMatrix; 
00333         VMatrix mRightViewMatrix; 
00334         VMatrix mProjMatrix; 
00335         VMatrix mLeftProjMatrix; 
00336         VMatrix mRightProjMatrix; 
00339         //values for stereo
00340         float mEyeSeparation;   
00341         float mScreenDistance; 
00343         bool mMustUpdateProjection;     
00344         bool mMustUpdateView;           
00346         bool mOrthogonalCamera;                 
00347         VVector mOrthogonalSize;        
00348         bool mIsShadowCamera;                   
00349 };
00350 
00351 
00352 #endif

Generated on Mon Jan 21 01:15:16 2008 for FlowVis by  doxygen 1.5.4