Recast Navigation
Navigation-mesh Toolset for Games
Loading...
Searching...
No Matches
AppState.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "SDL.h"
4
#include "
SampleInterfaces.h
"
5
6
#include <memory>
7
#include <string>
8
#include <vector>
9
10
class
TestCase
;
11
class
Sample
;
12
class
InputGeom
;
13
14
struct
AppState
15
{
16
SDL_Window*
window
;
17
SDL_GLContext
glContext
;
18
19
double
projectionMatrix
[16];
20
int
viewport
[4];
21
22
// Drawable width vs logical width (important for high-dpi screens)
23
int
width
;
24
int
height
;
25
int
drawableWidth
;
26
int
drawableHeight
;
27
28
// Recast data, samples, and test cases
29
BuildContext
buildContext
;
30
std::unique_ptr<InputGeom>
inputGeometry
;
31
std::unique_ptr<Sample>
sample
;
32
std::unique_ptr<TestCase>
testCase
;
33
34
// Time
35
float
timeAcc
= 0.0f;
36
Uint32
prevFrameTime
= 0;
37
38
// Input
39
int
mousePos
[2]{0, 0};
40
int
origMousePos
[2]{0, 0};
// Used to compute mouse movement totals across frames.
41
42
// Camera
43
float
cameraEulers
[2]{45, -45};
44
float
cameraPos
[3] = {0, 0, 0};
// world space
45
float
camr
= 1000;
46
float
origCameraEulers
[2] = {0, 0};
// Used to compute rotational changes across frames.
47
float
scrollZoom
= 0;
48
49
// Movement
50
float
moveFront
= 0.0f;
51
float
moveBack
= 0.0f;
52
float
moveLeft
= 0.0f;
53
float
moveRight
= 0.0f;
54
float
moveUp
= 0.0f;
55
float
moveDown
= 0.0f;
56
57
// Input state
58
bool
isRotatingCamera
=
false
;
59
bool
movedDuringRotate
=
false
;
60
bool
mouseOverMenu
=
false
;
61
62
// Raycasts
63
float
rayStart
[3];
// world space
64
float
rayEnd
[3];
// world space
65
66
// UI state
67
int
sampleIndex
= -1;
68
std::string
meshName
=
"Choose Mesh..."
;
69
bool
showMenu
=
true
;
70
bool
showLog
=
false
;
71
bool
showTools
=
true
;
72
bool
showTestCases
=
false
;
73
int
logScroll
= 0;
74
75
// Files
76
std::vector<std::string>
files
;
77
std::string
meshesFolder
=
"Meshes"
;
78
std::string
testCasesFolder
=
"TestCases"
;
79
80
void
resetCamera
();
81
void
updateWindowSize
();
82
void
updateUIScale
()
const
;
83
void
worldToScreen
(
float
x,
float
y,
float
z,
float
* screenX,
float
* screenY)
const
;
84
};
SampleInterfaces.h
BuildContext
Recast build context.
Definition
SampleInterfaces.h:34
InputGeom
Definition
InputGeom.h:96
Sample
Definition
Sample.h:116
TestCase
Definition
TestCase.h:28
AppState
Definition
AppState.h:15
AppState::showTools
bool showTools
Definition
AppState.h:71
AppState::mouseOverMenu
bool mouseOverMenu
Definition
AppState.h:60
AppState::meshesFolder
std::string meshesFolder
Definition
AppState.h:77
AppState::isRotatingCamera
bool isRotatingCamera
Definition
AppState.h:58
AppState::logScroll
int logScroll
Definition
AppState.h:73
AppState::origCameraEulers
float origCameraEulers[2]
Definition
AppState.h:46
AppState::showMenu
bool showMenu
Definition
AppState.h:69
AppState::scrollZoom
float scrollZoom
Definition
AppState.h:47
AppState::updateWindowSize
void updateWindowSize()
Definition
AppState.cpp:39
AppState::testCase
std::unique_ptr< TestCase > testCase
Definition
AppState.h:32
AppState::testCasesFolder
std::string testCasesFolder
Definition
AppState.h:78
AppState::files
std::vector< std::string > files
Definition
AppState.h:76
AppState::width
int width
Definition
AppState.h:23
AppState::sampleIndex
int sampleIndex
Definition
AppState.h:67
AppState::cameraEulers
float cameraEulers[2]
Definition
AppState.h:43
AppState::rayEnd
float rayEnd[3]
Definition
AppState.h:64
AppState::rayStart
float rayStart[3]
Definition
AppState.h:63
AppState::worldToScreen
void worldToScreen(float x, float y, float z, float *screenX, float *screenY) const
Definition
AppState.cpp:62
AppState::height
int height
Definition
AppState.h:24
AppState::glContext
SDL_GLContext glContext
Definition
AppState.h:17
AppState::showTestCases
bool showTestCases
Definition
AppState.h:72
AppState::buildContext
BuildContext buildContext
Definition
AppState.h:29
AppState::sample
std::unique_ptr< Sample > sample
Definition
AppState.h:31
AppState::origMousePos
int origMousePos[2]
Definition
AppState.h:40
AppState::inputGeometry
std::unique_ptr< InputGeom > inputGeometry
Definition
AppState.h:30
AppState::viewport
int viewport[4]
Definition
AppState.h:20
AppState::camr
float camr
Definition
AppState.h:45
AppState::prevFrameTime
Uint32 prevFrameTime
Definition
AppState.h:36
AppState::meshName
std::string meshName
Definition
AppState.h:68
AppState::moveUp
float moveUp
Definition
AppState.h:54
AppState::moveLeft
float moveLeft
Definition
AppState.h:52
AppState::resetCamera
void resetCamera()
Definition
AppState.cpp:14
AppState::drawableHeight
int drawableHeight
Definition
AppState.h:26
AppState::moveDown
float moveDown
Definition
AppState.h:55
AppState::updateUIScale
void updateUIScale() const
Definition
AppState.cpp:53
AppState::moveRight
float moveRight
Definition
AppState.h:53
AppState::moveFront
float moveFront
Definition
AppState.h:50
AppState::window
SDL_Window * window
Definition
AppState.h:16
AppState::cameraPos
float cameraPos[3]
Definition
AppState.h:44
AppState::movedDuringRotate
bool movedDuringRotate
Definition
AppState.h:59
AppState::timeAcc
float timeAcc
Definition
AppState.h:35
AppState::drawableWidth
int drawableWidth
Definition
AppState.h:25
AppState::mousePos
int mousePos[2]
Definition
AppState.h:39
AppState::showLog
bool showLog
Definition
AppState.h:70
AppState::projectionMatrix
double projectionMatrix[16]
Definition
AppState.h:19
AppState::moveBack
float moveBack
Definition
AppState.h:51
RecastDemo
Include
AppState.h
Project Home
|
Licence (ZLib)
| Copyright 2009 Mikko Mononen