TargetCamera.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D 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
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(AFX_TARGETCAMERA_H__97593EBB_5901_4D81_BAEB_8ADC76CFB627__INCLUDED_)
00022 #define AFX_TARGETCAMERA_H__97593EBB_5901_4D81_BAEB_8ADC76CFB627__INCLUDED_
00023 
00024 #include <GLEXT/GLCamera.h>
00025 #include <GLW/GLWToolTip.h>
00026 #include <engine/GameState.h>
00027 #include <graph/ParticleEmitter.h>
00028 #include <common/Keyboard.h>
00029 
00030 class TargetCamera 
00031 {
00032 public:
00033         enum CamType
00034         {
00035                 CamTop = 0,
00036                 CamBehind,
00037                 CamTank,
00038                 CamGun,
00039                 CamAction,
00040                 CamLeft,
00041                 CamRight,
00042                 CamLeftFar,
00043                 CamRightFar,
00044                 CamSpectator,
00045                 CamFree
00046         };
00047 
00048         TargetCamera();
00049         virtual ~TargetCamera();
00050 
00051         GLCamera &getCamera() { return mainCam_; }
00052         CamType getCameraType() { return cameraPos_; }
00053         ParticleEngine &getPrecipitationEngine() { return particleEngine_; }
00054         void setCameraType(CamType type) { cameraPos_ = type; }
00055         void resetCam();
00056 
00057         void simulate(float frameTime, bool playing);
00058         void draw();
00059         void drawPrecipitation();
00060         void mouseWheel(int x, int y, int z, bool &skipRest);
00061         void mouseDown(GameState::MouseButton button, 
00062                 int x, int y, bool &skipRest);
00063         void mouseUp(GameState::MouseButton button, 
00064                 int x, int y, bool &skipRest);
00065         void mouseDrag(GameState::MouseButton button,
00066                 int mx, int my, int x, int y, bool &skipRest);
00067         bool keyboardCheck(
00068                 float frameTime, 
00069                 char *buffer, unsigned int keyState,
00070                 KeyboardHistory::HistoryElement *history, int hisCount, 
00071                 bool &skipRest);
00072 
00073         static const char **getCameraNames();
00074         static ToolTip *getCameraToolTips();
00075         static int getNoCameraNames();
00076         static float minHeightFunc(int x, int y, void *heightData);
00077         static float maxHeightFunc(int x, int y, void *heightData);
00078 
00079 protected:
00080         GLCamera mainCam_;
00081         CamType cameraPos_;
00082         ParticleEmitter rainEmitter_, snowEmitter_;
00083         ParticleEngine particleEngine_;
00084         float totalTime_;
00085         bool useHeightFunc_;
00086         int dragXStart_, dragYStart_;
00087         bool dragging_;
00088         bool lastLandIntersectValid_;
00089         Vector lastLandIntersect_;
00090 
00091         bool moveCamera(float frameTime, bool playing);
00092         bool getLandIntersect(int x, int y, Vector &intersect);
00093 
00094 };
00095 
00096 #endif // !defined(AFX_TARGETCAMERA_H__97593EBB_5901_4D81_BAEB_8ADC76CFB627__INCLUDED_)
00097 

Generated on Mon Feb 16 15:14:46 2009 for Scorched3D by  doxygen 1.5.3