GCP Assignment 1
MainState.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <SDL.h>
4 #include <iostream>
5 #include <unordered_map>
6 #include <vector>
7 #include <cstdint>
8 #include <time.h>
9 #include "../PGGAssignment2Code/StateManager.h"
10 #include "../PGGAssignment2Code/Camera.h"
11 #include "../PGGAssignment2Code/State.h"
12 #include "../Core/Logging.h"
13 #include "../Core/PerformanceTest.h"
14 #include "../Maths/Vec2.h"
15 #include "../Maths/Vec4.h"
16 #include "../Maths/Mat4.h"
17 #include "../Maths/Quaternion.h"
18 #include "../Maths/Convert.h"
19 #include "../Sam.h"
20 #include "MainStateUI.h"
21 
25 class MainState : public State
26 {
27 public:
36 
40  ~MainState();
41 
46  bool input();
47 
52  void update(float dt);
53 
57  void draw();
58 
59 private:
62  std::unordered_map<std::string, Object*> objects;
65  std::unordered_map<std::string, Shader*> shaders;
69  Sam* sam;
73  std::vector<Maths::Mat4> matrix;
75  std::vector<Maths::Quaternion> quats;
78 
82  void loadingScreen();
83 
87  void init10MatQuats();
88 
92  void init100MatQuats();
93 
97  void init1000MatQuats();
98 
102  void init10000MatQuats();
103 
107  void performanceTest();
108 
112  void memoryTest();
113 
117  void xAxisMatRotationTest();
118 
122  void yAxisMatRotationTest();
123 
127  void zAxisMatRotationTest();
128 
132  void xAxisQuatRotationTest();
133 
137  void yAxisQuatRotationTest();
138 
142  void zAxisQuatRotationTest();
143 };
Sam * sam
The 3D model.
Definition: MainState.h:69
The main state of the program.
Definition: MainState.h:25
void draw()
A function to draw to the screen.
Definition: MainState.cpp:132
void loadingScreen()
Draws a LoadingScreen.
Definition: MainState.cpp:144
void yAxisQuatRotationTest()
Runs the quat performance test of the Y axis.
Definition: MainState.cpp:375
Creates a State object to be inherited.
Definition: State.h:15
void yAxisMatRotationTest()
Runs the matrix performance test of the Y axis.
Definition: MainState.cpp:338
A UI for the MainState using my old PGG2 UI classes.
Definition: MainStateUI.h:17
std::vector< Maths::Quaternion > quats
The array of quaternion&#39;s to use.
Definition: MainState.h:75
void update(float dt)
A function to update the MainState.
Definition: MainState.cpp:128
void memoryTest()
Runs the memory test.
Definition: MainState.cpp:310
std::unordered_map< std::string, Object * > objects
Definition: MainState.h:62
void init100MatQuats()
Initialise 100 sets of matrixs and quats.
Definition: MainState.cpp:179
Creates a StateManager object.
Definition: StateManager.h:13
MainState(StateManager *stateManager, SDL_Window *window, int screenWidth, int screenHeight)
Constructs a MainState.
Definition: MainState.cpp:3
StateManager * stateManager
A pointer to the state manager.
Definition: State.h:57
Creates a Camera object.
Definition: Camera.h:14
Core::PerformanceTest * tester
The performance tester.
Definition: MainState.h:77
std::vector< Maths::Mat4 > matrix
The array of matrix&#39;s to use.
Definition: MainState.h:73
~MainState()
Destructs a MainState object.
Definition: MainState.cpp:32
SDL_Window * window
The window to display to.
Definition: State.h:59
void zAxisMatRotationTest()
Runs the matrix performance test of the Z axis.
Definition: MainState.cpp:350
void xAxisQuatRotationTest()
Runs the quat performance test of the X axis.
Definition: MainState.cpp:362
bool input()
Handles the MainState input.
Definition: MainState.cpp:49
std::unordered_map< std::string, Shader * > shaders
Definition: MainState.h:65
MainStateUI * userInterface
The MainStateUI.
Definition: MainState.h:67
int screenHeight
The height of the screen.
Definition: State.h:63
void performanceTest()
Runs the performance test.
Definition: MainState.cpp:266
void xAxisMatRotationTest()
Runs the matrix performance test of the X axis.
Definition: MainState.cpp:326
void init10MatQuats()
Initialise 10 sets of matrixs and quats.
Definition: MainState.cpp:158
int screenWidth
The width of the screen.
Definition: State.h:61
void zAxisQuatRotationTest()
Runs the quat performance test of the Z axis.
Definition: MainState.cpp:387
void init10000MatQuats()
Initialise 10000 sets of matrixs and quats.
Definition: MainState.cpp:236
A class that handles the sam objects.
Definition: Sam.h:13
void init1000MatQuats()
Initialise 1000 sets of matrixs and quats.
Definition: MainState.cpp:206
Camera * camera
The Camera for the program.
Definition: MainState.h:71
Contains details and functions for use with testing performance.
Definition: PerformanceTest.h:15