diff options
| author | peppemas <[email protected]> | 2020-06-20 17:55:56 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-06-20 17:55:56 +0200 |
| commit | 0e26d514b87e641277293964291fb98dfa0f4ace (patch) | |
| tree | 0f78a39f3a0b82608bf5e392314ad8196bbfde4e /examples/models/resources | |
| parent | c833644a0e1d7031bad9c925994598d97970c0c4 (diff) | |
| download | raylib-0e26d514b87e641277293964291fb98dfa0f4ace.tar.gz raylib-0e26d514b87e641277293964291fb98dfa0f4ace.zip | |
Fix bug #1270 (#1282)
* Fix bug #1270
Added an argument to the shader in order to flip the texture
* Fix Bug #1270
* Fix bug #1270
Diffstat (limited to 'examples/models/resources')
| -rw-r--r-- | examples/models/resources/shaders/glsl100/skybox.fs | 16 | ||||
| -rw-r--r-- | examples/models/resources/shaders/glsl330/skybox.fs | 14 |
2 files changed, 27 insertions, 3 deletions
diff --git a/examples/models/resources/shaders/glsl100/skybox.fs b/examples/models/resources/shaders/glsl100/skybox.fs index 053a2517..ca542303 100644 --- a/examples/models/resources/shaders/glsl100/skybox.fs +++ b/examples/models/resources/shaders/glsl100/skybox.fs @@ -4,23 +4,35 @@ * * 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) in vec3 fragPosition; // Input uniform values uniform samplerCube environmentMap; +uniform bool vflipped; // Output fragment color out vec4 finalColor; +vec4 flipTextureCube(samplerCube sampler, vec3 texCoord) { + return texture(sampler, vec3(texCoord.x,-texCoord.y,texCoord.z)); +} + void main() { // 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 color = color/(color + vec3(1.0)); diff --git a/examples/models/resources/shaders/glsl330/skybox.fs b/examples/models/resources/shaders/glsl330/skybox.fs index 053a2517..e1085bd9 100644 --- a/examples/models/resources/shaders/glsl330/skybox.fs +++ b/examples/models/resources/shaders/glsl330/skybox.fs @@ -4,6 +4,8 @@ * * Copyright (c) 2017 Victor Fisac * +* 19-Jun-2020 - modified by Giuseppe Mastrangelo (@peppemas) - VFlip Support +* **********************************************************************************************/ #version 330 @@ -13,14 +15,24 @@ in vec3 fragPosition; // Input uniform values uniform samplerCube environmentMap; +uniform bool vflipped; // Output fragment color out vec4 finalColor; +vec4 flipTextureCube(samplerCube sampler, vec3 texCoord) { + return texture(sampler, vec3(texCoord.x,-texCoord.y,texCoord.z)); +} + void main() { // 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 color = color/(color + vec3(1.0)); |
