00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __CAMERA_H__
00014 #define __CAMERA_H__
00015
00016
00017 #include "i_event_callback.h"
00018
00019
00020 #include <ltbasedefs.h>
00021
00022
00024 enum ECameraState
00025 {
00026 CAMS_FIRST_PERSON = 0,
00027 CAMS_THIRD_PERSON,
00028
00029 CAMS_NUM_STATES
00030 };
00031
00032 enum ECameraViewportType
00033 {
00034 CAMV_FULLSCREEN = 0,
00035 CAMV_HORIZONTAL_TOP,
00036 CAMV_HORIZONTAL_BOTTOM,
00037 CAMV_VERTICAL_LEFT,
00038 CAMV_VERTICAL_RIGHT,
00039 CAMV_QUARTER_TOPLEFT,
00040 CAMV_QUARTER_TOPRIGHT,
00041 CAMV_QUARTER_BOTTOMLEFT,
00042 CAMV_QUARTER_BOTTOMRIGHT,
00043 };
00044
00046 class CCamera : public IEventCallback
00047 {
00048 public:
00049
00050 CCamera();
00051 virtual ~CCamera();
00052
00053 void Init(ECameraViewportType eType = CAMV_FULLSCREEN);
00054 void Term();
00055 LTRESULT CreateCamera();
00056
00057 void OnCommandOn(int32 command, uint32 nActCmd);
00058 void OnCommandOff(int32 command, uint32 nActCmd);
00059
00060 LTRESULT Update(float fFrameTime);
00061 LTRESULT PhysicsUpdate(float fFrameTime);
00062 virtual void Event(uint32 nEvent, float fFrameTime, float fGameTime,
00063 IEventData *pEventData, uint32 nPriority,
00064 ECallbackType eCT,
00065 uint32 nCountRemaining, float fTimeRemaining,
00066 float fLoopTime);
00067
00068
00069 HLOCALOBJ GetCameraHandle() { return m_hCamera; }
00070
00071 void SetRotation(LTOrientation oRot);
00072 LTOrientation GetRotation();
00073 LTVector3f GetPosition();
00074
00075 void SetState(ECameraState state) { m_eState = state; }
00076 uint32 GetState() { return m_eState; }
00077 void CycleState();
00078
00079 void SetCameraViewport(uint32 nPosition);
00080
00081 LTRESULT HandleInput();
00082 void AdjustCamera();
00083
00084 LTRESULT Render();
00085
00086 void SetSyncObject(HLOCALOBJ hObject) {m_hSyncObject = hObject;};
00087 HLOCALOBJ GetSyncObject() {return m_hSyncObject;};
00088 void SetSyncRotation(bool bSR = true) {m_bSyncRotation = bSR;};
00089 bool GetSyncRotation() {return m_bSyncRotation;};
00090
00091 protected:
00092 HLOCALOBJ m_hCamera;
00093 uint32 m_eState;
00094
00095 HLOCALOBJ m_hSyncObject;
00096 bool m_bSyncRotation;
00097 };
00098
00099
00100 #endif // __CAMERA_H__