generated from ange-yaghi/delta-template
-
Notifications
You must be signed in to change notification settings - Fork 868
Expand file tree
/
Copy pathengine_sim_application.h
More file actions
196 lines (156 loc) · 6.03 KB
/
engine_sim_application.h
File metadata and controls
196 lines (156 loc) · 6.03 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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#ifndef ATG_ENGINE_SIM_ENGINE_SIM_APPLICATION_H
#define ATG_ENGINE_SIM_ENGINE_SIM_APPLICATION_H
#include "geometry_generator.h"
#include "simulator.h"
#include "engine.h"
#include "simulation_object.h"
#include "ui_manager.h"
#include "dynamometer.h"
#include "oscilloscope.h"
#include "audio_buffer.h"
#include "convolution_filter.h"
#include "shaders.h"
#include "engine_view.h"
#include "right_gauge_cluster.h"
#include "cylinder_temperature_gauge.h"
#include "synthesizer.h"
#include "oscilloscope_cluster.h"
#include "performance_cluster.h"
#include "load_simulation_cluster.h"
#include "mixer_cluster.h"
#include "info_cluster.h"
#include "application_settings.h"
#include "transmission.h"
#include "delta.h"
#include "dtv.h"
#include "joystick.h"
#include <vector>
class EngineSimApplication {
private:
static std::string s_buildVersion;
public:
EngineSimApplication();
virtual ~EngineSimApplication();
static std::string getBuildVersion() { return s_buildVersion; }
void initialize(void *instance, ysContextObject::DeviceAPI api);
void run();
void destroy();
void loadEngine(Engine *engine, Vehicle *vehicle, Transmission *transmission);
void drawGenerated(
const GeometryGenerator::GeometryIndices &indices,
int layer = 0);
void drawGeneratedUi(
const GeometryGenerator::GeometryIndices &indices,
int layer = 0);
void drawGenerated(
const GeometryGenerator::GeometryIndices &indices,
int layer,
dbasic::StageEnableFlags flags);
void configure(const ApplicationSettings &settings);
GeometryGenerator *getGeometryGenerator() { return &m_geometryGenerator; }
Shaders *getShaders() { return &m_shaders; }
dbasic::TextRenderer *getTextRenderer() { return &m_textRenderer; }
void createObjects(Engine *engine);
void destroyObjects();
dbasic::DeltaEngine *getEngine() { return &m_engine; }
float pixelsToUnits(float pixels) const;
float unitsToPixels(float units) const;
ysVector getBackgroundColor() const { return m_background; }
ysVector getForegroundColor() const { return m_foreground; }
ysVector getHightlight1Color() const { return m_highlight1; }
ysVector getPink() const { return m_pink; }
ysVector getGreen() const { return m_green; }
ysVector getYellow() const { return m_yellow; }
ysVector getRed() const { return m_red; }
ysVector getOrange() const { return m_orange; }
ysVector getBlue() const { return m_blue; }
const SimulationObject::ViewParameters &getViewParameters() const;
void setViewLayer(int view) { m_viewParameters.Layer0 = view; }
dbasic::AssetManager *getAssetManager() { return &m_assetManager; }
int getScreenWidth() const { return m_screenWidth; }
int getScreenHeight() const { return m_screenHeight; }
Simulator *getSimulator() { return &m_simulator; }
InfoCluster *getInfoCluster() { return m_infoCluster; }
ApplicationSettings* getAppSettings() { return &m_applicationSettings; }
protected:
void loadScript();
void processEngineInput();
void renderScene();
void refreshUserInterface();
protected:
double m_speedSetting = 1.0;
double m_targetSpeedSetting = 1.0;
double m_clutchPressure = 1.0;
double m_targetClutchPressure = 1.0;
int m_lastMouseWheel = 0;
protected:
virtual void initialize();
virtual void process(float dt);
virtual void render();
float m_displayAngle;
float m_displayHeight;
int m_gameWindowHeight;
int m_screenWidth;
int m_screenHeight;
ApplicationSettings m_applicationSettings;
dbasic::ShaderSet m_shaderSet;
Shaders m_shaders;
dbasic::DeltaEngine m_engine;
dbasic::AssetManager m_assetManager;
std::string m_assetPath;
ysRenderTarget *m_mainRenderTarget;
ysGPUBuffer *m_geometryVertexBuffer;
ysGPUBuffer *m_geometryIndexBuffer;
GeometryGenerator m_geometryGenerator;
dbasic::TextRenderer m_textRenderer;
std::vector<SimulationObject *> m_objects;
Engine *m_iceEngine;
Vehicle *m_vehicle;
Transmission *m_transmission;
Simulator m_simulator;
double m_dynoSpeed;
double m_torque;
UiManager m_uiManager;
EngineView *m_engineView;
RightGaugeCluster *m_rightGaugeCluster;
OscilloscopeCluster *m_oscCluster;
CylinderTemperatureGauge *m_temperatureGauge;
PerformanceCluster *m_performanceCluster;
LoadSimulationCluster *m_loadSimulationCluster;
MixerCluster *m_mixerCluster;
InfoCluster *m_infoCluster;
SimulationObject::ViewParameters m_viewParameters;
bool m_paused;
Joystick j_Controller;
protected:
void startRecording();
void updateScreenSizeStability();
bool readyToRecord();
void stopRecording();
void recordFrame();
bool isRecording() const { return m_recording; }
static constexpr int ScreenResolutionHistoryLength = 5;
int m_screenResolution[ScreenResolutionHistoryLength][2];
int m_screenResolutionIndex;
bool m_recording;
ysVector m_background;
ysVector m_foreground;
ysVector m_shadow;
ysVector m_highlight1;
ysVector m_highlight2;
ysVector m_pink;
ysVector m_orange;
ysVector m_yellow;
ysVector m_red;
ysVector m_green;
ysVector m_blue;
ysAudioBuffer *m_outputAudioBuffer;
AudioBuffer m_audioBuffer;
ysAudioSource *m_audioSource;
int m_oscillatorSampleOffset;
int m_screen;
#ifdef ATG_ENGINE_SIM_VIDEO_CAPTURE
atg_dtv::Encoder m_encoder;
#endif /* ATG_ENGINE_SIM_VIDEO_CAPTURE */
};
#endif /* ATG_ENGINE_SIM_ENGINE_SIM_APPLICATION_H */