git-svn-id: https://scorched3d.svn.sourceforge.net/svnroot/scorched3d/trunk/scorched...
[scorched3d/parasti.git] / src / client / graph / TargetCamera.h
blob0804ae048dcd334854dc63748af7006c0f260506
1 ////////////////////////////////////////////////////////////////////////////////
2 // Scorched3D (c) 2000-2009
3 //
4 // This file is part of Scorched3D.
5 //
6 // Scorched3D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // Scorched3D is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Scorched3D; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ////////////////////////////////////////////////////////////////////////////////
21 #if !defined(AFX_TARGETCAMERA_H__97593EBB_5901_4D81_BAEB_8ADC76CFB627__INCLUDED_)
22 #define AFX_TARGETCAMERA_H__97593EBB_5901_4D81_BAEB_8ADC76CFB627__INCLUDED_
24 #include <GLEXT/GLCamera.h>
25 #include <GLW/GLWToolTip.h>
26 #include <engine/GameState.h>
27 #include <graph/ParticleEmitter.h>
28 #include <common/Keyboard.h>
30 class TargetCamera
32 public:
33 enum CamType
35 CamTop = 0,
36 CamBehind,
37 CamTank,
38 CamGun,
39 CamAction,
40 CamLeft,
41 CamRight,
42 CamLeftFar,
43 CamRightFar,
44 CamSpectator,
45 CamFree
48 TargetCamera();
49 virtual ~TargetCamera();
51 GLCamera &getCamera() { return mainCam_; }
52 CamType getCameraType() { return cameraPos_; }
53 ParticleEngine &getPrecipitationEngine() { return particleEngine_; }
54 void setCameraType(CamType type) { cameraPos_ = type; }
55 void resetCam();
57 void simulate(float frameTime, bool playing);
58 void draw();
59 void drawPrecipitation();
60 void mouseWheel(int x, int y, int z, bool &skipRest);
61 void mouseDown(GameState::MouseButton button,
62 int x, int y, bool &skipRest);
63 void mouseUp(GameState::MouseButton button,
64 int x, int y, bool &skipRest);
65 void mouseDrag(GameState::MouseButton button,
66 int mx, int my, int x, int y, bool &skipRest);
67 void keyboardCheck(
68 float frameTime,
69 char *buffer, unsigned int keyState,
70 KeyboardHistory::HistoryElement *history, int hisCount,
71 bool &skipRest);
73 static const char **getCameraNames();
74 static ToolTip *getCameraToolTips();
75 static int getNoCameraNames();
76 static float minHeightFunc(int x, int y, void *heightData);
77 static float maxHeightFunc(int x, int y, void *heightData);
79 protected:
80 GLCamera mainCam_;
81 CamType cameraPos_;
82 ParticleEmitter rainEmitter_, snowEmitter_;
83 ParticleEngine particleEngine_;
84 float totalTime_;
85 bool useHeightFunc_;
86 int dragXStart_, dragYStart_;
87 bool dragging_;
88 bool lastLandIntersectValid_;
89 Vector lastLandIntersect_;
91 bool moveCamera(float frameTime, bool playing);
92 bool getLandIntersect(int x, int y, Vector &intersect);
96 #endif // !defined(AFX_TARGETCAMERA_H__97593EBB_5901_4D81_BAEB_8ADC76CFB627__INCLUDED_)