mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-26 06:49:09 -06:00
Ignore uniform warnings for cases when disabling the night layers on Earth (closes #1136)
This commit is contained in:
@@ -377,16 +377,16 @@ vec4 calculateShadedColor(vec4 currentColor, vec3 ellipsoidNormalCameraSpace,
|
||||
vec3 shadedColor = currentColor.rgb * 0.05;
|
||||
|
||||
vec3 n = normalize(ellipsoidNormalCameraSpace);
|
||||
vec3 l = lightDirectionCameraSpace;
|
||||
|
||||
|
||||
float power = orenNayarDiffuse(
|
||||
-lightDirectionCameraSpace,
|
||||
viewDirectionCameraSpace,
|
||||
viewDirectionCameraSpace,
|
||||
ellipsoidNormalCameraSpace,
|
||||
roughness);
|
||||
|
||||
vec3 l = lightDirectionCameraSpace;
|
||||
power = max(smoothstep(0.0f, 0.1f, max(dot(-l, n), 0.0f)) * power, 0.0f);
|
||||
|
||||
|
||||
vec4 color = vec4(shadedColor + currentColor.rgb * power, currentColor.a);
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -1135,13 +1135,22 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&,
|
||||
|
||||
const glm::vec3 directionToSunCameraSpace = glm::vec3(viewTransform *
|
||||
glm::dvec4(directionToSunWorldSpace, 0));
|
||||
_globalRenderer.program->setUniform(
|
||||
// @TODO (abock, 2020-04-14); This is just a bandaid for issue #1136. The better
|
||||
// way is to figure out with the uniform is optimized away. I assume that it is
|
||||
// because the shader doesn't get recompiled when the last layer of the night
|
||||
// or water is disabled; so the shader thinks it has to do the calculation, but
|
||||
// there are actually no layers left
|
||||
using IgnoreError = ghoul::opengl::ProgramObject::IgnoreError;
|
||||
_localRenderer.program->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
_localRenderer.program->setUniform(
|
||||
"lightDirectionCameraSpace",
|
||||
-glm::normalize(directionToSunCameraSpace)
|
||||
);
|
||||
_localRenderer.program->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Local shader
|
||||
_localRenderer.program->setUniform(
|
||||
"projectionTransform",
|
||||
@@ -1156,10 +1165,18 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&,
|
||||
|
||||
const glm::vec3 directionToSunCameraSpace = glm::vec3(viewTransform *
|
||||
glm::dvec4(directionToSunWorldSpace, 0));
|
||||
_localRenderer.program->setUniform(
|
||||
// @TODO (abock, 2020-04-14); This is just a bandaid for issue #1136. The better
|
||||
// way is to figure out with the uniform is optimized away. I assume that it is
|
||||
// because the shader doesn't get recompiled when the last layer of the night
|
||||
// or water is disabled; so the shader thinks it has to do the calculation, but
|
||||
// there are actually no layers left
|
||||
using IgnoreError = ghoul::opengl::ProgramObject::IgnoreError;
|
||||
_globalRenderer.program->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
_globalRenderer.program->setUniform(
|
||||
"lightDirectionCameraSpace",
|
||||
-glm::normalize(directionToSunCameraSpace)
|
||||
);
|
||||
_globalRenderer.program->setIgnoreUniformLocationError(IgnoreError::Yes);
|
||||
}
|
||||
|
||||
constexpr const int ChunkBufferSize = 2048;
|
||||
@@ -1616,7 +1633,7 @@ void RenderableGlobe::recompileShaders() {
|
||||
//);
|
||||
layeredTextureInfo.lastLayerIdx = static_cast<int>(
|
||||
layerGroup.activeLayers().size() - 1
|
||||
);
|
||||
);
|
||||
layeredTextureInfo.layerBlendingEnabled = layerGroup.layerBlendingEnabled();
|
||||
|
||||
for (Layer* layer : layers) {
|
||||
|
||||
Reference in New Issue
Block a user