AtmosphereTestScene.hpp 1.4 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 13

class AtmosphereTestScene : public Scene {
private:
  OrbitalSimulationSystem* m_orbitals;
  PlayerSystem* m_player;

14 15
  Console m_console;

Dario Seyb's avatar
Dario Seyb committed
16 17
  Light::Handle sunLight;
  Entity sun;
Dario Seyb's avatar
Dario Seyb committed
18 19
  Entity skybox;

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

Dario Seyb's avatar
Dario Seyb committed
22
  Entity earth;
Dario Seyb's avatar
Dario Seyb committed
23
  Entity cockpit;
Dario Seyb's avatar
merged  
Dario Seyb committed
24 25
  Entity cockpitSun;
  Light::Handle cockpitSunLight;
Dario Seyb's avatar
Dario Seyb committed
26

Dario Seyb's avatar
Dario Seyb committed
27
  Entity consoleCamera;
28
  SoundSource::Handle consoleSoundSource;
Dario Seyb's avatar
Dario Seyb committed
29
  SoundSource::Handle cockpitSoundSource;
Dario Seyb's avatar
Dario Seyb committed
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

  Material cockpitMaterial, sunMaterial, skyboxMaterial;
  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;

  const glm::dvec3 CAM_CONSOLE_POS = { 0, -0.05, -1.95 };
  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
50 51
  bool didOneFrame = false;

Dario Seyb's avatar
Dario Seyb committed
52 53
public:
  CONSTRUCT_SCENE(AtmosphereTestScene) { };
Dario Seyb's avatar
Dario Seyb committed
54 55 56
  
  void switchToMainScene();
  void loadMainSceneResources();
Dario Seyb's avatar
Dario Seyb committed
57 58
  void switchConsole();

Dario Seyb's avatar
Dario Seyb committed
59 60
  bool startup() override;
  void shutdown() override;
Dario Seyb's avatar
Dario Seyb committed
61

Dario Seyb's avatar
Dario Seyb committed
62
};