AtmosphereTestScene.cpp 15.8 KB
Newer Older
Dario Seyb's avatar
Dario Seyb committed
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
#include <engine/scene/scenes/AtmosphereTestScene.hpp>

#include <engine/ui/UISystem.hpp>

#include <ACGL/ACGL.hh>

#include <ACGL/OpenGL/Objects.hh>
#include <ACGL/Base/Settings.hh>
#include <ACGL/Math/Math.hh>
#include <ACGL/OpenGL/Data/TextureLoadStore.hh>
#include <ACGL/OpenGL/Managers.hh>

#include <ACGL/OpenGL/Creator/ShaderProgramCreator.hh>
#include <ACGL/OpenGL/Creator/VertexArrayObjectCreator.hh>
#include <ACGL/OpenGL/Creator/Texture2DCreator.hh>

#include <engine/scene/Transform.hpp>
#include <engine/scene/Drawable.hpp>
#include <engine/scene/Planet.hpp>

#include <engine/events/MouseEvent.hpp>
#include <engine/events/KeyboardEvent.hpp>

#include <engine/graphics/BloomPostFX.hpp>

Dario Seyb's avatar
Dario Seyb committed
26

Dario Seyb's avatar
Dario Seyb committed
27 28 29 30
using namespace ACGL::OpenGL;
using namespace ACGL::Base;
using namespace ACGL::Utils;

Dario Seyb's avatar
Dario Seyb committed
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
void AtmosphereTestScene::switchConsole() {
  if (isInterpolatingCamera) return;
  m_player->setHasControl(false);

  if (isFocusedOnConsole) {
    camStartPos = m_player->getCockpitPosition();
    camTargetPos = { 0, 0 , 0 };
    camStartRot = glm::quat_cast(m_player->getRotation());
    camTargetRot = glm::quat();
    m_console.pause();
    m_renderer->setRenderPassActive("Main"_sh, true);
    m_renderer->setRenderPassActive("Skybox"_sh, true);
    cockpitSoundSource->setVolume(0);
    cockpitSoundSource->play();
  } else {
    // TODO: Fix returning to console!
    return;
    camStartPos = m_player->getCockpitPosition();
    camTargetPos = CAM_CONSOLE_POS;
    camStartRot = glm::quat_cast(m_player->getRotation());
    camTargetRot = glm::quat_cast(CAM_CONSOLE_ROT);
    m_console.play();
  }

  isFocusedOnConsole = !isFocusedOnConsole;
  interpolationTime = 0;
  totalInterpolationTime = 4;
  isInterpolatingCamera = true;
}

Dario Seyb's avatar
Dario Seyb committed
61 62 63 64 65 66 67 68 69
bool AtmosphereTestScene::startup() {
  if (!Scene::startup()) {
    return false;
  }

  RESOLVE_DEPENDENCY(m_player);
  RESOLVE_DEPENDENCY(m_orbitals);

  m_renderer->addEffect<BloomPostFX>();
Dario Seyb's avatar
Dario Seyb committed
70

Dario Seyb's avatar
Dario Seyb committed
71 72 73 74
  consoleCamera = m_sceneGraph->create();
  consoleCamera.assign<Transform>();
  consoleCamera.assign<Camera>(50, 0.1, 50);

Dario Seyb's avatar
Dario Seyb committed
75 76 77 78 79
  m_audio->setListener(consoleCamera);

  m_renderer->setRenderPassActive("Main"_sh, false);
  m_renderer->setRenderPassActive("Skybox"_sh, false);

Dario Seyb's avatar
Dario Seyb committed
80
  m_renderer->addRenderPass(consoleCamera, "Console"_sh);
81 82 83 84 85 86
  
  m_console.m_events = m_events;
  m_console.m_renderer = m_renderer;
  m_console.m_sceneGraph = m_sceneGraph;
  m_console.m_audio = m_audio;

Dario Seyb's avatar
Dario Seyb committed
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
  auto textTexture =
    Texture2DFileManager::the()->get(Texture2DCreator("none.png"));
  auto textGeom = Geometry{ VertexArrayObjectCreator("loading_text.obj").create() };
  textGeom.vao->setMode(GL_PATCHES);

  auto textShader =
    ShaderProgramFileManager::the()->get(ShaderProgramCreator("console/Title")
      .attributeLocations(textGeom.vao->getAttributeLocations())
      .fragmentDataLocations(m_renderer->getGBufferLocations()));

  loadingText = m_sceneGraph->create();
  loadingText.assign<Drawable>(textGeom,
    Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 } * 10,
    textTexture, nullptr, nullptr, textShader,
    false, RenderQueue::OPAQUE, GL_BACK },
    0, m_renderer->getRenderPassId("Console"_sh));

  auto textTransform = loadingText.assign<Transform>();
  textTransform->position = { 0, -3, -11 };
  loadingText.assign<Light>(glm::vec4(0, 0.2, 1.0, 5), glm::vec3(1, 0, 0),
    false, LightType::POINT, m_renderer->getRenderPassId("Console"_sh));
Dario Seyb's avatar
Dario Seyb committed
108 109 110 111 112 113 114 115


  SDL_SetRelativeMouseMode(SDL_TRUE);
  m_player->setHasControl(false);
  m_player->setCockpitPosition(CAM_CONSOLE_POS);
  m_player->setRotation(CAM_CONSOLE_ROT);

  m_events->subscribe<SimulateEvent>([this](const SimulateEvent &e) {
Dario Seyb's avatar
Dario Seyb committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129

    if (didOneFrame && !resourceLoadingFinished) {
      loadMainSceneResources();
      switchToMainScene();
      m_renderer->setRenderPassOnlyTexture("Console"_sh, true);
      m_console.startup();
    }

    didOneFrame = true;

    if (!resourceLoadingFinished) {
      return;
    }

130 131 132
    sunLight->dir = -glm::normalize(m_player->getWorldPosition());
    cockpitSunLight->dir =
      glm::vec3(glm::dvec4(sunLight->dir, 0) * m_player->getRotation());
Dario Seyb's avatar
Dario Seyb committed
133
    
134

Dario Seyb's avatar
Dario Seyb committed
135 136 137 138 139
    if (isFocusedOnConsole) {
      if (m_console.update(e, m_player->getKeyTable())) {
        switchConsole();
      }
    }
Dario Seyb's avatar
Dario Seyb committed
140 141 142 143 144 145 146

    if (isInterpolatingCamera) {
      double interpolationPercent = 1.0 - glm::pow(1 - interpolationTime / totalInterpolationTime, 2);
      m_player->setCockpitPosition(camStartPos + (camTargetPos-camStartPos)*interpolationPercent);

      interpolationPercent = 1.0 - glm::pow(1 - interpolationTime / totalInterpolationTime, 5);

Dario Seyb's avatar
Dario Seyb committed
147 148
      consoleSoundSource->setVolume((1.0f - interpolationTime / totalInterpolationTime) * 0.5);
      cockpitSoundSource->setVolume(interpolationTime / totalInterpolationTime);
149

Dario Seyb's avatar
Dario Seyb committed
150 151 152 153 154 155 156 157
      glm::quat rot = glm::slerp(camStartRot, camTargetRot, (float)interpolationPercent);
      m_player->setRotation(glm::mat4_cast(rot));
      interpolationTime += e.dt;
      if (interpolationTime >= totalInterpolationTime) {
        m_player->setCockpitPosition(camTargetPos);
        m_player->setRotation(glm::mat4_cast(camTargetRot));
        isInterpolatingCamera = false;
        m_player->setHasControl(true);
Dario Seyb's avatar
Dario Seyb committed
158
        m_renderer->setRenderPassActive("Console"_sh, false);
159
        consoleSoundSource->setVolume(0);
Dario Seyb's avatar
Dario Seyb committed
160
        cockpitSoundSource->setVolume(1);
Dario Seyb's avatar
Dario Seyb committed
161 162 163 164 165 166 167 168 169 170 171 172 173 174
      }
    }
  });

  m_events->subscribe<KeyboardEvent>([this](const KeyboardEvent &e) {
    switch (e.originalEvent.key.keysym.scancode) {
    case SDL_SCANCODE_TAB:
        if (e.originalEvent.key.type == SDL_KEYDOWN) {
          m_player->attachToParent(earth);
          float r = earth.component<Transform>()->scale.x;
          m_player->setPosition(glm::vec3(0, 0, r * 1.2));
          m_player->setRotation(glm::mat4());
        }
      break;
Dario Seyb's avatar
Dario Seyb committed
175
    case SDL_SCANCODE_RETURN:
Dario Seyb's avatar
Dario Seyb committed
176
      if (e.originalEvent.key.type == SDL_KEYDOWN) {
Dario Seyb's avatar
Dario Seyb committed
177 178
        switchConsole();
      }
Dario Seyb's avatar
Dario Seyb committed
179
      break;
Dario Seyb's avatar
Dario Seyb committed
180 181 182
    case SDL_SCANCODE_R:
      if (e.originalEvent.key.type == SDL_KEYDOWN) {
        ShaderProgramFileManager::the()->updateAll();
Dario Seyb's avatar
Dario Seyb committed
183
        Texture2DFileManager::the()->updateAll();
Dario Seyb's avatar
Dario Seyb committed
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
      }
    default:
      break;
    }
  });

  // Subscribe to the UI drawing event.
  // This is called once per frame
  m_events->subscribe<"DrawUI"_sh>([this]() {

    ImGui::Begin("Camera Control", 0,
                 ImGuiWindowFlags_::ImGuiWindowFlags_AlwaysAutoResize);

    float r;
    if (ImGui::Button("Sun/Global", glm::vec2(100, 20))) {
      // Reset the camera to sun coords
      m_player->attachToParent(sun);
      r = sun.component<Transform>()->scale.x;
      m_player->setPosition(glm::dvec3(0, 0, r * 1.2));
      m_player->setRotation(glm::dmat4());
    }

    if (ImGui::Button("Earth", glm::vec2(100, 20))) {
      m_player->attachToParent(earth);
      r = earth.component<Transform>()->scale.x;
      m_player->setPosition(glm::dvec3(0, 0, r * 1.2));
      m_player->setRotation(glm::dmat4());
    }
Dario Seyb's avatar
Dario Seyb committed
212

Dario Seyb's avatar
Dario Seyb committed
213 214
    ImGui::End();
  });
Dario Seyb's avatar
Dario Seyb committed
215

Dario Seyb's avatar
Dario Seyb committed
216 217 218 219 220 221
  return true;
}

void AtmosphereTestScene::switchToMainScene() {
  {
    auto skyboxPassId = m_renderer->getRenderPassId("Skybox"_sh);
Dario Seyb's avatar
Dario Seyb committed
222

Dario Seyb's avatar
Dario Seyb committed
223 224
    skybox = m_sceneGraph->create();
    skybox.assign<Transform>();
Dario Seyb's avatar
Dario Seyb committed
225 226 227
    skybox.assign<Drawable>(skyboxGeometry, skyboxMaterial, 0, skyboxPassId);
    skybox.assign<Light>(glm::vec4(1, 1, 1, 1), glm::vec3(1, 0, 0), false,
                         LightType::POINT, skyboxPassId);
Dario Seyb's avatar
Dario Seyb committed
228
  }
Dario Seyb's avatar
Dario Seyb committed
229

Dario Seyb's avatar
Dario Seyb committed
230 231 232 233 234 235 236 237
  {
    auto mainPassId = m_renderer->getRenderPassId("Main"_sh);

    // Let's create a placeholder sun
    sun = m_sceneGraph->create();
    // Add a transform component to it so we are able to position it in space
    auto sunTransform = sun.assign<Transform>();
    // Add a Drawable component to it so the renderer has something to draw
Dario Seyb's avatar
Dario Seyb committed
238
    sun.assign<Drawable>(sunGeometry, sunMaterial, 0, mainPassId);
Dario Seyb's avatar
Dario Seyb committed
239 240
    float scale = m_orbitals->solarRadius * m_orbitals->scaleFactor * 0.1;
    sunTransform->scale = glm::dvec3(scale);
Dario Seyb's avatar
Dario Seyb committed
241 242 243 244 245 246 247 248 249 250 251 252
    sunLight = sun.assign<Light>(glm::vec4(1, 1, 1, 3), glm::vec3(1, 0, 0),
                                 false, LightType::DIRECTIONAL, mainPassId);

    // create a planet!
    // Mass in solar masses, Radius in solar radii, Eccentricity, Semimajor
    // axis, Inclination, Ascending Node, Arg. of Periapsis, time at perihelion
    //																mass              radius
    //e
    // a        i          N          w
    earth = m_orbitals->addPlanet(sunTransform, "Earth", 0.000002988,
                                  0.009153735632184, 0.016713, 1.000000,
                                  0.0000000, 0.00000, 4.93533, 0);
Dario Seyb's avatar
Dario Seyb committed
253 254 255 256

    m_player->attachToParent(earth);
    double r = earth.component<Transform>()->scale.x;
    m_player->setPosition(glm::dvec3(0, 0, r * 1.2));
Dario Seyb's avatar
Dario Seyb committed
257
  }
Dario Seyb's avatar
Dario Seyb committed
258

Dario Seyb's avatar
Dario Seyb committed
259
  {
Dario Seyb's avatar
Dario Seyb committed
260
    auto cockpitPassId = m_renderer->getRenderPassId("Cockpit"_sh);
Dario Seyb's avatar
Dario Seyb committed
261

Dario Seyb's avatar
Dario Seyb committed
262

Dario Seyb's avatar
Dario Seyb committed
263

Dario Seyb's avatar
Dario Seyb committed
264
    cockpit = m_sceneGraph->create();
Dario Seyb's avatar
Dario Seyb committed
265 266
    auto cockpitDrawable = cockpit.assign<Drawable>(
        cockpitGeometry, cockpitMaterial, 0, cockpitPassId);
Dario Seyb's avatar
Dario Seyb committed
267 268 269
    auto cockpitTransform = cockpit.assign<Transform>();
    cockpitTransform->position = glm::dvec3(0, 0, 0);
    cockpitDrawable->visible = true;
Dario Seyb's avatar
Dario Seyb committed
270 271 272
    auto cockpitLight =
        cockpit.assign<Light>(glm::vec4(1, 1, 1, 0.2), glm::vec3(1, 0, 0),
                              false, LightType::POINT, cockpitPassId);
Dario Seyb's avatar
Dario Seyb committed
273

Dario Seyb's avatar
Dario Seyb committed
274 275 276 277

    auto soundTrack = m_audio->createSound("chipzel - Spectra - 04 Formed in the Clouds (Interlude).mp3", SoundMode::MODE_2D);
    cockpitSoundSource = cockpit.assign<SoundSource>(soundTrack);

Dario Seyb's avatar
merged  
Dario Seyb committed
278 279
    cockpitSun = m_sceneGraph->create();
    cockpitSun.assign<Transform>();
Dario Seyb's avatar
Dario Seyb committed
280 281 282
    cockpitSunLight =
        cockpitSun.assign<Light>(glm::vec4(1, 1, 1, 3), glm::vec3(1, 0, 0),
                                 true, LightType::DIRECTIONAL, cockpitPassId);
Dario Seyb's avatar
merged  
Dario Seyb committed
283

Dario Seyb's avatar
Dario Seyb committed
284 285
    /*auto blinkButton = m_sceneGraph->create();
    blinkButton.assign<Light>(glm::vec4(0.2, 0.2, 0.6, 5), glm::vec3(1, 0, 0),
Dario Seyb's avatar
Dario Seyb committed
286
                              false, LightType::POINT, cockpitPassId);
Dario Seyb's avatar
Dario Seyb committed
287 288
    auto transform = blinkButton.assign<Transform>();
    transform->parent = cockpitTransform;
Dario Seyb's avatar
Dario Seyb committed
289
    transform->position = {0.7655, -0.4545, -1.643};
Dario Seyb's avatar
Dario Seyb committed
290 291

    blinkButton = m_sceneGraph->create();
Dario Seyb's avatar
Dario Seyb committed
292
    blinkButton.assign<Light>(glm::vec4(0.1, 0.7, 0.2, 5), glm::vec3(1, 0, 0),
Dario Seyb's avatar
Dario Seyb committed
293
                              false, LightType::POINT, cockpitPassId);
Dario Seyb's avatar
Dario Seyb committed
294 295
    transform = blinkButton.assign<Transform>();
    transform->parent = cockpitTransform;
Dario Seyb's avatar
Dario Seyb committed
296
    transform->position = {-0.7655, -0.4545, -1.643};*/
Dario Seyb's avatar
Dario Seyb committed
297 298

    auto console = m_sceneGraph->create();
Dario Seyb's avatar
Dario Seyb committed
299
    auto consoleGeom = Geometry{ VertexArrayObjectCreator("cockpit/cockpit_v2_maindisplay.obj").create() };
Dario Seyb's avatar
Dario Seyb committed
300 301 302 303 304 305 306
    consoleGeom.vao->setMode(GL_PATCHES);
    console.assign<Drawable>(
        consoleGeom,
        Material{glm::vec4{1, 1, 1, 1}, glm::vec4{1, 1, 1, 1},
                 m_renderer->getRenderPassTarget("Console"_sh), nullptr, nullptr,
                 skyboxMaterial.prog, false, RenderQueue::OPAQUE, GL_BACK},
        0, cockpitPassId);
307
    auto consoleTransform = console.assign<Transform>();
308

Dario Seyb's avatar
Dario Seyb committed
309
    soundTrack = m_audio->createSound("chipzel - Spectra - 01 Spectra.mp3", SoundMode::MODE_2D);
310
    consoleSoundSource = console.assign<SoundSource>(soundTrack);
Dario Seyb's avatar
Dario Seyb committed
311
    consoleSoundSource->setVolume(0.5);
312
    consoleSoundSource->play();
Dario Seyb's avatar
Dario Seyb committed
313 314 315 316 317 318 319 320


    auto consoleFront = m_sceneGraph->create();
    consoleGeom = Geometry{ VertexArrayObjectCreator("cockpit/cockpit_v2_console_front.obj").create() };
    consoleGeom.vao->setMode(GL_PATCHES);
    consoleFront.assign<Drawable>(
      consoleGeom,
      Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 },
David Gilbert's avatar
Try #3  
David Gilbert committed
321
      m_renderer->getRenderPassTarget("Main"_sh), nullptr, nullptr,
Dario Seyb's avatar
Dario Seyb committed
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
      skyboxMaterial.prog, false, RenderQueue::OPAQUE, GL_BACK },
      0, cockpitPassId);
    consoleFront.assign<Transform>();

    auto consoleBack = m_sceneGraph->create();
    consoleGeom = Geometry{ VertexArrayObjectCreator("cockpit/cockpit_v2_console_back.obj").create() };
    consoleGeom.vao->setMode(GL_PATCHES);
    consoleBack.assign<Drawable>(
      consoleGeom,
      Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 },
      m_renderer->getRenderPassTarget("Console"_sh), nullptr, nullptr,
      skyboxMaterial.prog, false, RenderQueue::OPAQUE, GL_BACK },
      0, cockpitPassId);
    consoleBack.assign<Transform>();

    auto consoleMiddle= m_sceneGraph->create();
    consoleGeom = Geometry{ VertexArrayObjectCreator("cockpit/cockpit_v2_console_middle.obj").create() };
    consoleGeom.vao->setMode(GL_PATCHES);
    consoleMiddle.assign<Drawable>(
      consoleGeom,
      Material{ glm::vec4{ 1, 1, 1, 1 }, glm::vec4{ 1, 1, 1, 1 },
      m_renderer->getRenderPassTarget("Console"_sh), nullptr, nullptr,
      skyboxMaterial.prog, false, RenderQueue::OPAQUE, GL_BACK },
      0, cockpitPassId);
    consoleMiddle.assign<Transform>();

Dario Seyb's avatar
Dario Seyb committed
348 349 350 351 352 353 354 355 356 357
    auto windShield = m_sceneGraph->create();
    auto windShieldGeom = Geometry{
      VertexArrayObjectCreator("cockpit/cockpit_v2_windshield.obj").create() };
    windShieldGeom.vao->setMode(GL_PATCHES);
    windShield.assign<Drawable>(
      windShieldGeom,
      windshieldMaterial,
      0, cockpitPassId);
    windShield.assign<Transform>();

Dario Seyb's avatar
Dario Seyb committed
358
  }
Dario Seyb's avatar
Dario Seyb committed
359 360 361

  loadingText.component<Drawable>()->visible = false;
  loadingText.destroy();
Dario Seyb's avatar
Dario Seyb committed
362
}
Dario Seyb's avatar
Dario Seyb committed
363

Dario Seyb's avatar
Dario Seyb committed
364 365 366 367 368 369 370 371 372 373 374 375 376 377
void AtmosphereTestScene::loadMainSceneResources() {
  {
    auto vaoSkybox = VertexArrayObjectCreator("skybox.obj").create();
    auto skyboxShader = ShaderProgramFileManager::the()->get(
        ShaderProgramCreator("Skybox")
            .attributeLocations(vaoSkybox->getAttributeLocations())
            .fragmentDataLocations(m_renderer->getGBufferLocations()));

    auto skyboxTexture = 
       Texture2DFileManager::the()->get(Texture2DCreator("skybox.png"));

    skyboxGeometry = {vaoSkybox};
    skyboxGeometry.vao->setMode(GL_PATCHES);
    skyboxMaterial = {glm::vec4{1, 1, 1, 1},
Dario Seyb's avatar
Dario Seyb committed
378
                      glm::vec4{0.15, 0.15, 0.15, 1},
Dario Seyb's avatar
Dario Seyb committed
379 380 381 382 383 384 385 386
                      skyboxTexture,
                      nullptr,
                      nullptr,
                      skyboxShader,
                      false,
                      RenderQueue::OPAQUE,
                      GL_BACK};
  }
Dario Seyb's avatar
Dario Seyb committed
387

Dario Seyb's avatar
Dario Seyb committed
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
  {
    auto vaoSun = VertexArrayObjectCreator("uvsphere.obj").create();
    auto checkboardTexture =
        Texture2DFileManager::the()->get(Texture2DCreator("checkerboard.png"));

    auto sunShader =
        ShaderProgramCreator("PBR")
            .attributeLocations(vaoSun->getAttributeLocations())
            .fragmentDataLocations(m_renderer->getGBufferLocations())
            .create();

    sunGeometry = {vaoSun};
    sunGeometry.vao->setMode(GL_PATCHES);

    sunMaterial = {glm::vec4{1, 1, 1, 1},
                   glm::vec4{2, 2, 1, 20},
                   checkboardTexture,
                   nullptr,
                   nullptr,
                   sunShader,
                   false,
                   RenderQueue::OPAQUE,
                   GL_BACK};
  }
Dario Seyb's avatar
Dario Seyb committed
412

Dario Seyb's avatar
Dario Seyb committed
413 414
  {
    // create cockpit
Dario Seyb's avatar
Dario Seyb committed
415
    auto vaoCockpit = VertexArrayObjectCreator("cockpit/cockpit_v2_outer.obj").create();
Dario Seyb's avatar
Dario Seyb committed
416 417 418 419 420 421 422 423 424
    auto cockpitShader =
        ShaderProgramCreator("PBR")
            .attributeLocations(vaoCockpit->getAttributeLocations())
            .fragmentDataLocations(m_renderer->getGBufferLocations())
            .create();

    cockpitMaterial = {
        glm::vec4{0.4, 0.4, 0.4, 1}, glm::vec4{0, 0, 0, 1},
        Texture2DFileManager::the()->get(Texture2DCreator(
Dario Seyb's avatar
Dario Seyb committed
425
            "cockpit_v2/cockpit_v2_outer_DefaultMaterial_AlbedoTransparency.png")),
Dario Seyb's avatar
Dario Seyb committed
426
        Texture2DFileManager::the()->get(
Dario Seyb's avatar
Dario Seyb committed
427
            Texture2DCreator("cockpit_v2/cockpit_v2_outer_DefaultMaterial_Normal.png")),
Dario Seyb's avatar
Dario Seyb committed
428
        Texture2DFileManager::the()->get(Texture2DCreator(
Dario Seyb's avatar
Dario Seyb committed
429
            "cockpit_v2/cockpit_v2_outer_DefaultMaterial_SpecularSmoothness.png")),
Dario Seyb's avatar
Dario Seyb committed
430 431 432 433
        cockpitShader, true, RenderQueue::OPAQUE, GL_BACK};

    cockpitGeometry = {vaoCockpit};
    cockpitGeometry.vao->setMode(GL_PATCHES);
Dario Seyb's avatar
Dario Seyb committed
434

Dario Seyb's avatar
Dario Seyb committed
435
    windshieldMaterial = Material{ glm::vec4{ 0.2, 0.3, 1.0, 0.6 }, glm::vec4{ 0.02, 0.03, 0.1, 1 },
Dario Seyb's avatar
Dario Seyb committed
436 437 438
      Texture2DFileManager::the()->get(Texture2DCreator(
        "cockpit_v2/"
        "windshield_DefaultMaterial_AlbedoTransparency.png")),
Dario Seyb's avatar
Dario Seyb committed
439
      nullptr, nullptr, cockpitShader, false,
Dario Seyb's avatar
Dario Seyb committed
440
      RenderQueue::OPAQUE, GL_NONE };
Dario Seyb's avatar
Dario Seyb committed
441
  }
Dario Seyb's avatar
Dario Seyb committed
442

Dario Seyb's avatar
Dario Seyb committed
443
  resourceLoadingFinished = true;
Dario Seyb's avatar
Dario Seyb committed
444 445
}

Dario Seyb's avatar
Dario Seyb committed
446
void AtmosphereTestScene::shutdown() {}