Commit 6043e95a authored by Dario Seyb's avatar Dario Seyb

fixed slow down during loading

parent c91733bf
......@@ -40,5 +40,5 @@ vec4 specularSmoothness() {
if(uHasSpecularSmoothnessMap) {
return texture(uSpecularSmoothnessMap, inTexCoord);
}
return vec4(0, 0, 0, 0.2);
return vec4(0.4, 0.4, 0.4, 0.6);
}
......@@ -8,7 +8,7 @@ vec4 color() {
}
vec4 emissive() {
return texture(uTexture, teTexCoord).rgba;
return texture(uTexture, teTexCoord).rgba * uEmissiveColor;
}
vec3 normal() {
......
......@@ -28,7 +28,7 @@ private:
SoundSource::Handle consoleSoundSource;
SoundSource::Handle cockpitSoundSource;
Material cockpitMaterial, sunMaterial, skyboxMaterial;
Material cockpitMaterial, sunMaterial, skyboxMaterial, windshieldMaterial;
Geometry cockpitGeometry, sunGeometry, skyboxGeometry;
bool resourceLoadingFinished = false;
......
......@@ -176,6 +176,7 @@ bool AtmosphereTestScene::startup() {
if (e.originalEvent.key.type == SDL_KEYDOWN) {
switchConsole();
}
break;
case SDL_SCANCODE_R:
if (e.originalEvent.key.type == SDL_KEYDOWN) {
ShaderProgramFileManager::the()->updateAll();
......@@ -257,6 +258,17 @@ void AtmosphereTestScene::switchToMainScene() {
{
auto cockpitPassId = m_renderer->getRenderPassId("Cockpit"_sh);
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>();
cockpit = m_sceneGraph->create();
auto cockpitDrawable = cockpit.assign<Drawable>(
cockpitGeometry, cockpitMaterial, 0, cockpitPassId);
......@@ -341,20 +353,6 @@ void AtmosphereTestScene::switchToMainScene() {
0, cockpitPassId);
consoleMiddle.assign<Transform>();
auto windShield = m_sceneGraph->create();
auto windShieldGeom = Geometry{
VertexArrayObjectCreator("cockpit/cockpit_v2_windshield.obj").create()};
windShieldGeom.vao->setMode(GL_PATCHES);
windShield.assign<Drawable>(
windShieldGeom,
Material{glm::vec4{0.2, 0.2, 0.5, 1}, glm::vec4{0},
Texture2DFileManager::the()->get(Texture2DCreator(
"cockpit_v2/"
"windshield_DefaultMaterial_AlbedoTransparency.png")),
nullptr, nullptr, cockpitMaterial.prog, false,
RenderQueue::OPAQUE, GL_NONE},
0, cockpitPassId);
windShield.assign<Transform>();
}
loadingText.component<Drawable>()->visible = false;
......@@ -375,7 +373,7 @@ void AtmosphereTestScene::loadMainSceneResources() {
skyboxGeometry = {vaoSkybox};
skyboxGeometry.vao->setMode(GL_PATCHES);
skyboxMaterial = {glm::vec4{1, 1, 1, 1},
glm::vec4{1, 1, 1, 1},
glm::vec4{0.15, 0.15, 0.15, 1},
skyboxTexture,
nullptr,
nullptr,
......@@ -431,6 +429,13 @@ void AtmosphereTestScene::loadMainSceneResources() {
cockpitGeometry = {vaoCockpit};
cockpitGeometry.vao->setMode(GL_PATCHES);
windshieldMaterial = Material{ glm::vec4{ 0.2, 0.2, 0.5, 1 }, glm::vec4{ 0 },
Texture2DFileManager::the()->get(Texture2DCreator(
"cockpit_v2/"
"windshield_DefaultMaterial_AlbedoTransparency.png")),
nullptr, nullptr, cockpitMaterial.prog, false,
RenderQueue::OPAQUE, GL_NONE };
}
resourceLoadingFinished = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment