00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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