Fix the behavior when skybox color is black and skymap is available

This commit is contained in:
samcake 2015-09-30 18:08:01 -07:00
parent d3d4775232
commit 69c4075439
2 changed files with 7 additions and 1 deletions

View file

@ -50,6 +50,10 @@ void Skybox::updateDataBuffer() const {
auto blend = 0.0f;
if (getCubemap() && getCubemap()->isDefined()) {
blend = 1.0f;
// If pitch black neutralize the color
if (glm::all(glm::equal(getColor(), glm::vec3(0.0f)))) {
blend = 2.0f;
}
}
if (blend != _dataBuffer.get<Data>()._blend) {

View file

@ -45,7 +45,9 @@ void main(void) {
vec3 color = _skybox._color.rgb;
if (_skybox._color.a > 0.0) {
vec3 texel = texture(cubeMap, coord).rgb;
color *= texel;
if (_skybox._color.a < 2.0) {
color *= texel;
}
}
vec3 pixel = pow(color, vec3(1.0/2.2)); // manual Gamma correction