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
10class TestCase;
11class Sample;
12class InputGeom;
13
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;
27
28 // Recast data, samples, and test cases
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};
Recast build context.
Definition SampleInterfaces.h:34
Definition InputGeom.h:96
Definition Sample.h:116
Definition TestCase.h:28
Definition AppState.h:15
bool showTools
Definition AppState.h:71
bool mouseOverMenu
Definition AppState.h:60
std::string meshesFolder
Definition AppState.h:77
bool isRotatingCamera
Definition AppState.h:58
int logScroll
Definition AppState.h:73
float origCameraEulers[2]
Definition AppState.h:46
bool showMenu
Definition AppState.h:69
float scrollZoom
Definition AppState.h:47
void updateWindowSize()
Definition AppState.cpp:39
std::unique_ptr< TestCase > testCase
Definition AppState.h:32
std::string testCasesFolder
Definition AppState.h:78
std::vector< std::string > files
Definition AppState.h:76
int width
Definition AppState.h:23
int sampleIndex
Definition AppState.h:67
float cameraEulers[2]
Definition AppState.h:43
float rayEnd[3]
Definition AppState.h:64
float rayStart[3]
Definition AppState.h:63
void worldToScreen(float x, float y, float z, float *screenX, float *screenY) const
Definition AppState.cpp:62
int height
Definition AppState.h:24
SDL_GLContext glContext
Definition AppState.h:17
bool showTestCases
Definition AppState.h:72
BuildContext buildContext
Definition AppState.h:29
std::unique_ptr< Sample > sample
Definition AppState.h:31
int origMousePos[2]
Definition AppState.h:40
std::unique_ptr< InputGeom > inputGeometry
Definition AppState.h:30
int viewport[4]
Definition AppState.h:20
float camr
Definition AppState.h:45
Uint32 prevFrameTime
Definition AppState.h:36
std::string meshName
Definition AppState.h:68
float moveUp
Definition AppState.h:54
float moveLeft
Definition AppState.h:52
void resetCamera()
Definition AppState.cpp:14
int drawableHeight
Definition AppState.h:26
float moveDown
Definition AppState.h:55
void updateUIScale() const
Definition AppState.cpp:53
float moveRight
Definition AppState.h:53
float moveFront
Definition AppState.h:50
SDL_Window * window
Definition AppState.h:16
float cameraPos[3]
Definition AppState.h:44
bool movedDuringRotate
Definition AppState.h:59
float timeAcc
Definition AppState.h:35
int drawableWidth
Definition AppState.h:25
int mousePos[2]
Definition AppState.h:39
bool showLog
Definition AppState.h:70
double projectionMatrix[16]
Definition AppState.h:19
float moveBack
Definition AppState.h:51