1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-11-18 14:45:12 +00:00

glhr:: shader-side band now ignores depth

This commit is contained in:
Zeno Rogue
2018-11-18 17:27:27 +01:00
parent 8e2727882e
commit 50a86d1e88
6 changed files with 23 additions and 5 deletions

View File

@@ -521,6 +521,10 @@ void init() {
1, " return log(sqrt(1.0 + x*x) + x);",
1, " }",
1, "float zlevel(vec4 h) {",
1, " return (h[2] < 0.0 ? -1.0 : 1.0) * sqrt(h[2]*h[2] - h[0]*h[0] - h[1]*h[1]);",
1, " }",
1, "void main() {",
texture, "vTexCoord = aTexture;",
varcol, "vColor = aColor;",
@@ -529,6 +533,10 @@ void init() {
!mps, "gl_Position = uMVP * aPosition;",
mps&&!band,"gl_Position = uP * (uMV * aPosition);",
band, "vec4 t = uMV * aPosition;",
band, "float zlev = zlevel(t);",
band, "t /= zlev;",
band, "float ty = asinh(t.y);",
band, "float tx = asinh(t.x / cosh(ty));",
band, "ty = 2.0 * atan(tanh(ty/2.0));",