diff options
author | Bastiaan Olij <mux213@gmail.com> | 2018-12-15 16:27:03 +1100 |
---|---|---|
committer | Bastiaan Olij <mux213@gmail.com> | 2018-12-15 19:41:34 +1100 |
commit | f3dd3c0830e620b20ba6d0364537bf6e9235a8fb (patch) | |
tree | 8f1436334ce4e0493afdeafc9ea95f2cd1733a75 /drivers/gles2/shaders | |
parent | 5f32fc82087404ac2c803770dc9d1e3711fc14fd (diff) |
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)); |