-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFirstPersonController.h
More file actions
50 lines (37 loc) · 1.09 KB
/
FirstPersonController.h
File metadata and controls
50 lines (37 loc) · 1.09 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
#ifndef FIRSTPERSONCONTROLLER_H
#define FIRSTPERSONCONTROLLER_H
#include <osg/MatrixTransform>
#include <osgGA/FirstPersonManipulator>
#include <osgViewer/Viewer>
#include <osgGA/GUIEventHandler>
#include <osg/Timer>
#include <osgText/Text>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
class FirstPersonController : public osgGA::FirstPersonManipulator
{
public:
FirstPersonController(osgViewer::Viewer *inputViewer) : _viewer(inputViewer)
{
// Start frame timer
mainTimer.setStartTick();
}
// Overload unnecessary functions from FirstPersonManipulator
bool handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us )
{
return true;
};
virtual bool performMovement();
// Override handle function for keyboard input
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &);
virtual void accept(osgGA::GUIEventHandlerVisitor &v)
{
v.visit(*this);
};
protected:
osgViewer::Viewer *_viewer;
osg::Timer mainTimer;
};
#endif // FIRSTPERSONCONTROLLER_H