Repository navigation
Expand file tree
/
Copy pathGaCameraComponent.h
More file actions
74 lines (57 loc) · 1.76 KB
/
Copy pathGaCameraComponent.h
File metadata and controls
74 lines (57 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**************************************************************************
*
* File: GaCameraComponent.h
* Author: Neil Richardson
* Ver/Date: 15/12/12
* Description:
* Camera component.
*
*
*
*
**************************************************************************/
#ifndef __GACAMERACOMPONENT_H__
#define __GACAMERACOMPONENT_H__
#include "Psybrus.h"
#include "System/Os/OsEvents.h"
#include "System/Scene/ScnEntity.h"
//////////////////////////////////////////////////////////////////////////
// GaExampleComponentRef
typedef ReObjectRef< class GaCameraComponent > GaCameraComponentRef;
//////////////////////////////////////////////////////////////////////////
// GaCameraComponent
class GaCameraComponent:
public ScnComponent
{
public:
REFLECTION_DECLARE_DERIVED( GaCameraComponent, ScnComponent );
GaCameraComponent();
virtual ~GaCameraComponent();
virtual void preUpdate( BcF32 Tick );
virtual void onAttach( ScnEntityWeakRef Parent );
virtual void onDetach( ScnEntityWeakRef Parent );
eEvtReturn onMouseDown( EvtID ID, const EvtBaseEvent& Event );
eEvtReturn onMouseUp( EvtID ID, const EvtBaseEvent& Event );
eEvtReturn onMouseMove( EvtID ID, const EvtBaseEvent& Event );
eEvtReturn onMouseWheel( EvtID ID, const EvtBaseEvent& Event );
eEvtReturn onKeyDown( EvtID ID, const EvtBaseEvent& Event );
eEvtReturn onKeyUp( EvtID ID, const EvtBaseEvent& Event );
MaMat4d getCameraRotationMatrix() const;
private:
MaVec3d CameraTarget_;
MaVec3d CameraRotation_;
BcF32 CameraDistance_;
BcF32 CameraZoom_;
MaVec3d CameraRotationDelta_;
enum CameraState
{
STATE_IDLE = 0,
STATE_ROTATE,
STATE_PAN
};
CameraState CameraState_;
CameraState NextCameraState_;
OsEventInputMouse LastMouseEvent_;
OsEventInputKeyboard LastKeyboardEvent_;
};
#endif