diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-12-16 22:56:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-16 22:56:43 +0100 |
commit | 20379119c3946096bfb0b45668034fcfa7048692 (patch) | |
tree | e6084b0f2277c8dfa50dfe92ea9c7cc59895518b /drivers/gles2/shaders | |
parent | 4cf2d5bffed895aff00626bdf53300c9ddbd9cf1 (diff) | |
parent | f3dd3c0830e620b20ba6d0364537bf6e9235a8fb (diff) |
Merge pull request #24366 from BastiaanOlij/adjust_sky_orientation
Adding option to re-orient our sky
Diffstat (limited to 'drivers/gles2/shaders')
-rw-r--r-- | drivers/gles2/shaders/copy.glsl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl index 0b8da4f875..97a24212a5 100644 --- a/drivers/gles2/shaders/copy.glsl +++ b/drivers/gles2/shaders/copy.glsl @@ -92,6 +92,7 @@ uniform float custom_alpha; #endif #if defined(USE_PANORAMA) || defined(USE_ASYM_PANO) +uniform highp mat4 sky_transform; vec4 texturePanorama(sampler2D pano, vec3 normal) { @@ -113,7 +114,12 @@ void main() { #ifdef USE_PANORAMA - vec4 color = texturePanorama(source, normalize(cube_interp)); + vec3 cube_normal = normalize(cube_interp); + cube_normal.z = -cube_normal.z; + cube_normal = mat3(sky_transform) * cube_normal; + cube_normal.z = -cube_normal.z; + + vec4 color = texturePanorama(source, cube_normal); #elif defined(USE_ASYM_PANO) @@ -125,7 +131,7 @@ void main() { cube_normal.z = -1000000.0; cube_normal.x = (cube_normal.z * (-uv_interp.x - asym_proj.x)) / asym_proj.y; cube_normal.y = (cube_normal.z * (-uv_interp.y - asym_proj.z)) / asym_proj.a; - cube_normal = mat3(pano_transform) * cube_normal; + cube_normal = mat3(sky_transform) * mat3(pano_transform) * cube_normal; cube_normal.z = -cube_normal.z; vec4 color = texturePanorama(source, normalize(cube_normal.xyz)); |