|
@ -4,23 +4,35 @@ |
|
|
* |
|
|
* |
|
|
* Copyright (c) 2017 Victor Fisac |
|
|
* Copyright (c) 2017 Victor Fisac |
|
|
* |
|
|
* |
|
|
|
|
|
* 19-Jun-2020 - modified by Giuseppe Mastrangelo (@peppemas) - VFlip Support |
|
|
|
|
|
* |
|
|
**********************************************************************************************/ |
|
|
**********************************************************************************************/ |
|
|
|
|
|
|
|
|
#version 330 |
|
|
|
|
|
|
|
|
#version 110 |
|
|
|
|
|
|
|
|
// Input vertex attributes (from vertex shader) |
|
|
// Input vertex attributes (from vertex shader) |
|
|
in vec3 fragPosition; |
|
|
in vec3 fragPosition; |
|
|
|
|
|
|
|
|
// Input uniform values |
|
|
// Input uniform values |
|
|
uniform samplerCube environmentMap; |
|
|
uniform samplerCube environmentMap; |
|
|
|
|
|
uniform bool vflipped; |
|
|
|
|
|
|
|
|
// Output fragment color |
|
|
// Output fragment color |
|
|
out vec4 finalColor; |
|
|
out vec4 finalColor; |
|
|
|
|
|
|
|
|
|
|
|
vec4 flipTextureCube(samplerCube sampler, vec3 texCoord) { |
|
|
|
|
|
return texture(sampler, vec3(texCoord.x,-texCoord.y,texCoord.z)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void main() |
|
|
void main() |
|
|
{ |
|
|
{ |
|
|
// Fetch color from texture map |
|
|
// Fetch color from texture map |
|
|
vec3 color = texture(environmentMap, fragPosition).rgb; |
|
|
|
|
|
|
|
|
vec3 color; |
|
|
|
|
|
|
|
|
|
|
|
if (vflipped ) |
|
|
|
|
|
color = flipTextureCube(environmentMap, fragPosition).rgb; |
|
|
|
|
|
else |
|
|
|
|
|
color = texture(environmentMap, fragPosition).rgb; |
|
|
|
|
|
|
|
|
// Apply gamma correction |
|
|
// Apply gamma correction |
|
|
color = color/(color + vec3(1.0)); |
|
|
color = color/(color + vec3(1.0)); |
|
|