AtmosphereTestScene.hpp 1.57 KB
Newer Older
Dario Seyb's avatar
Dario Seyb committed
1 2 3 4 5
#pragma once
#include <engine/scene/Scene.hpp>
#include <engine/scene/OrbitalSimulationSystem.hpp>
#include <engine/scene/PlayerSystem.hpp>
#include <engine/audio/SoundSource.hpp>
6 7
#include <engine/scene/scenes/Console.hpp>

Dario Seyb's avatar
Dario Seyb committed
8 9 10 11 12
class AtmosphereTestScene : public Scene {
private:
  OrbitalSimulationSystem* m_orbitals;
  PlayerSystem* m_player;

13 14
  Console m_console;

David Gilbert's avatar
David Gilbert committed
15
  Light::Handle sunLight, sunLight2;
Dario Seyb's avatar
Dario Seyb committed
16
  Entity sun;
David Gilbert's avatar
David Gilbert committed
17
  Entity sun2;
Dario Seyb's avatar
Dario Seyb committed
18 19
  Entity skybox;

Dario Seyb's avatar
Dario Seyb committed
20 21
  Entity loadingText;

David Gilbert's avatar
David Gilbert committed
22 23
  Entity mercury;
  Entity venus;
Dario Seyb's avatar
Dario Seyb committed
24
  Entity earth;
David Gilbert's avatar
David Gilbert committed
25 26 27 28 29 30
  Entity mars;
  Entity jupiter;
  Entity saturn;
  Entity uranus;
  Entity neptune;

Dario Seyb's avatar
Dario Seyb committed
31
  Entity cockpit;
Dario Seyb's avatar
merged  
Dario Seyb committed
32 33
  Entity cockpitSun;
  Light::Handle cockpitSunLight;
Dario Seyb's avatar
Dario Seyb committed
34

Dario Seyb's avatar
Dario Seyb committed
35
  Entity consoleCamera;
36
  SoundSource::Handle consoleSoundSource;
Dario Seyb's avatar
Dario Seyb committed
37
  SoundSource::Handle cockpitSoundSource;
Dario Seyb's avatar
Dario Seyb committed
38

Dario Seyb's avatar
Dario Seyb committed
39
  Material cockpitMaterial, sunMaterial, skyboxMaterial, windshieldMaterial;
Dario Seyb's avatar
Dario Seyb committed
40 41 42 43 44 45 46 47 48 49 50 51 52
  Geometry cockpitGeometry, sunGeometry, skyboxGeometry;

  bool resourceLoadingFinished = false;
  bool mainSceneRunning = false;
 
  bool isInterpolatingCamera = false;
  float interpolationTime, totalInterpolationTime;
  glm::dvec3 camStartPos;
  glm::dvec3 camTargetPos;

  glm::quat camStartRot;
  glm::quat camTargetRot;

Dario Seyb's avatar
Dario Seyb committed
53
  const glm::dvec3 CAM_CONSOLE_POS = { 0, -0.24977, -2.79714 };
Dario Seyb's avatar
Dario Seyb committed
54 55 56 57
  const glm::mat4 CAM_CONSOLE_ROT = glm::rotate(-1.05, glm::dvec3{ 1.0, 0.0, 0.0 });

  bool isFocusedOnConsole = true;

Dario Seyb's avatar
Dario Seyb committed
58 59
  bool didOneFrame = false;

Dario Seyb's avatar
Dario Seyb committed
60 61
public:
  CONSTRUCT_SCENE(AtmosphereTestScene) { };
Dario Seyb's avatar
Dario Seyb committed
62 63 64
  
  void switchToMainScene();
  void loadMainSceneResources();
Dario Seyb's avatar
Dario Seyb committed
65 66
  void switchConsole();

Dario Seyb's avatar
Dario Seyb committed
67 68
  bool startup() override;
  void shutdown() override;
Dario Seyb's avatar
Dario Seyb committed
69

Dario Seyb's avatar
Dario Seyb committed
70
};