1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-12-17 03:28:05 +00:00

3D:: shader variants for R3 and S3

This commit is contained in:
?
2019-02-25 04:04:26 +01:00
committed by Zeno Rogue
parent 4b356d9945
commit 1fcf58e17a
4 changed files with 19 additions and 9 deletions

View File

@@ -491,7 +491,11 @@ void init() {
bool mps = j != 0;
bool band = (sp == shader_projection::band);
bool hp = (sp == shader_projection::halfplane);
bool s3 = (sp == shader_projection::standard3);
bool sh3 = (sp == shader_projection::standardH3);
bool sr3 = (sp == shader_projection::standardR3);
bool ss3 = (sp == shader_projection::standardS3);
bool s3 = (sh3 || sr3 || ss3);
programs[i][j] = new GLprogram(stringbuilder(
@@ -555,10 +559,12 @@ void init() {
hp, "t.x /= -rads; t.y /= -rads; t.z = 1.0; t[3] = 1.0;",
s3, "vec4 t = uMV * aPosition;",
s3, "vColor.xyz = vColor.xyz * (1.0 - acosh(t[3]) / uFog);",
s3, "t[3] = 1.0;",
sh3, "vColor.xyz = vColor.xyz * (1.0 - acosh(t[3]) / uFog);",
sr3, "vColor.xyz = vColor.xyz * (1.0 - sqrt(t[0]*t[0] + t[1]*t[1] + t[2]*t[2]) / 7.);",
ss3, "vColor.xyz = vColor.xyz * (1.0 - acos(t[3]) / 1.6);",
sh3 || sr3,"t[3] = 1.0;",
band || hp,"gl_Position = uP * t;",
band || hp || s3,"gl_Position = uP * t;",
1, "}"),
stringbuilder(