Page principale | Hiérarchie des classes | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de classe

C:/Projects/ngn/include/camera.h

00001 /***************************************************************************
00002  *            camera.h
00003  *
00004  *  Mon Sep 13 18:25:57 2004
00005  *  Copyright  2004  thierry schartz
00006  *  thierry.schartz@bluebottle.com
00007  ****************************************************************************/
00008 
00009 /*
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00023  */
00024 
00025  #ifndef _CAMERA_H
00026  #define _CAMERA_H
00027 
00028  #ifdef WIN32
00029  #include <windows.h>
00030  #endif
00031 
00032 
00033 #include "input.h"
00034 #include "vector3d.h"
00035 #include "frustum.h"
00036 #include "collision.h"
00037 
00038 
00039 
00040  namespace ngn {
00041 
00042          class Model;
00043 
00050          class NGN_API Camera
00051          {
00052          public:
00054                  Camera( InputHandler *input );
00056                  Camera( const Camera& other );
00058                  Camera operator=( const Camera& other );
00060                  virtual ~Camera();
00061 
00063                  void set( float posX, float posY, float posZ, float viewX, float viewY, float viewZ, float upX, float upY, float upZ );
00065          void set( const core::Vector3df& pos, const core::Vector3df& view, const core::Vector3df& up );
00067                  void setPosition( const core::Vector3df& pos );
00069                  void setView( const core::Vector3df& view );
00071                  void setUpVector( const core::Vector3df& up );
00073                  const core::Vector3df& getPosition() const;
00075                  const core::Vector3df& getView() const;
00077                  const core::Vector3df& getUpVector() const;
00078 
00080                  void update();
00082                  void look();
00084                  void move( float speed );
00086                  void strafe( float speed );
00088                  void rotate( float angle, const core::Vector3df& pos );
00090                  void jump();
00092                  void rotateAround( const core::Vector3df& ref, const core::Vector3df& p );
00094                  void mouseView();
00096                  void fly( bool state );
00097                  
00099                  void setAABB( AABB& aabb );
00101                  void setFov( float fov );
00103                  void setSpeed( float speed );
00105                  void setMouseSpeed( float speed );
00107                  static void setGravity( float gravity );
00108 
00110                  static float getGravity();
00112                  AABB& getAABB();
00114                  float getFov() const;
00116                  float getSpeed() const;
00118                  float getMouseSpeed() const;
00120                  const core::Frustum& getFrustum() const;
00122                  bool isFlying() const;
00123 
00124                  
00125          protected:
00127                  void checkMovements();
00129                  void checkCollisions( const core::Vector3df& oldPos, const core::Vector3df& oldView );
00130 
00131          private:
00132                  
00133                  core::Vector3df m_pos;
00134                  core::Vector3df m_view;
00135                  core::Vector3df m_up;
00136                  core::Vector3df m_strafe;
00137                  core::Vector3df m_velocity;
00138 
00139                  static float m_gravity;
00140 
00141                  float m_fov;
00142                  float m_speed;
00143                  float m_move_speed;
00144                  float m_mouse_speed;
00145                  float m_jump_acceleration;
00146                  // user input
00147                  InputHandler *m_input;
00148                  //frustum test
00149                  core::Frustum m_frustum;
00150                   // collision detection
00151                  core::bsp::BSPCollision m_collision;
00152 
00153                  // min fov value
00154                  const float m_min_fov;
00155                  // max fov value
00156                  const float m_max_fov;
00157                  // true if cam moved backwards
00158                  bool m_move_back;
00159                  // fly mode, no gravity on camera
00160                  bool m_fly;
00161         
00162          };
00163 
00164 
00165  }//ngn
00166 #endif /* _CAMERA_H */
00167  

Généré le Fri Nov 19 14:20:29 2004 pour NGN par  doxygen 1.3.9.1