-
Notifications
You must be signed in to change notification settings - Fork 1
/
displaywidget.h
77 lines (68 loc) · 1.78 KB
/
displaywidget.h
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
74
75
76
77
#ifndef _DISPLAYWIDGET_
#define _DISPLAYWIDGET_
#include <QtOpenGL\qgl.h>
#include <QtGui\qopenglfunctions.h>
#include <QtCore\qtimer.h>
#include <QtCore\qdebug.h>
#include "display\ms3d.h"
#include <gl/gl.h>
#include "display\math.h"
#include "display\ms3d.h"
#include "display\CameraDisplay.h"
#include "display\SkyBox.h"
#include "display\Terrain.h"
#include "globalDefs.h"
static bool viewLocked = true;
static bool showBackground = false;
static bool showTerrain = false;
static bool showInfo = true;
#define PI 3.1415
class DisplayWidget : public QGLWidget
{
public:
DisplayWidget(QString, QString, QWidget *parent);
protected:
void initializeGL();
void resizeGL(int, int);
void paintGL();
private:
CMs3d *m_ms3d;
CameraDisplay g_camera;
CSkyBox g_skybox;
CTerrain g_terrain;
QTimer *m_pTimer;
QString m_sFileName;
QString m_sDisplayMode;
static float fRot;
static float fAnimSpeed;
static float fCurTime;
const char * szTitle = "Ms3d";
const float MS3D_FIX_X = 490.0f;
const float MS3D_FIX_Y = 220.0f;
const float MS3D_FIX_Z = 300.0f;
void print(float, float, const char*, ...);
void Init();
void UpdateCamera();
};
//-------------------------------------------------------------
//- KeyPressOnce
//- Check to see if a key has been pressed, only trigger once
//- per press (no press and hold)
//-------------------------------------------------------------
inline bool KeyPressOnce(int iKey)
{
if (GetAsyncKeyState(iKey) == -32767)
return true;
return false;
}
//-------------------------------------------------------------
//- KeyPress
//- Check to see if a key is
//-------------------------------------------------------------
inline bool KeyPress(int iKey)
{
if (GetAsyncKeyState(iKey) == -32767 || GetAsyncKeyState(iKey) == -32768)
return true;
return false;
}
#endif