diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-06-11 23:21:04 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-06-11 23:21:04 +0200 |
commit | da042f527536ba2ba82e5aa823e4fd132afebe1e (patch) | |
tree | 8ee1a9ecbc915b2b6a29882ca32272c91ee91190 /shaders | |
parent | 565570f905be11faa17c1c95c7ac207c641c395d (diff) |
a
Diffstat (limited to 'shaders')
-rw-r--r-- | shaders/tile-shader.vert | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/shaders/tile-shader.vert b/shaders/tile-shader.vert index 10b17f38..a7e9e660 100644 --- a/shaders/tile-shader.vert +++ b/shaders/tile-shader.vert @@ -2,7 +2,7 @@ precision highp float; layout(location = 0) in vec4 position; layout(location = 1) in vec2 textureCoordinates; -layout(location = 0) uniform mat4 projection; +layout(location = 0) uniform vec2 projection; layout(location = 1) uniform float y_scale; out vec2 interpolatedTextureCoordinates; @@ -11,6 +11,8 @@ out float interpolated_frag_depth; void main() { interpolatedTextureCoordinates = textureCoordinates; - gl_Position = projection * vec4(position.xy, 0, position.w) + vec4(0, position.z * y_scale, 0, 0); + float cx = 2/projection.x, cy = 2/projection.y; + float x = position.x, y = position.y, z = position.z*y_scale; + gl_Position = vec4((x-y)*cx, (x+y+z*2)*cx, 0, 1); interpolated_frag_depth = -position.z; } |