From d218896b63c20e1eb0938459100446b6b0473437 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 14 Oct 2022 00:54:31 +0200 Subject: [PATCH] sl2:: more projections allowed --- hypgraph.cpp | 7 +++++++ models.cpp | 2 +- shaders.cpp | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hypgraph.cpp b/hypgraph.cpp index f0065113..fa5d8d4c 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -744,6 +744,13 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) { case mdHorocyclic: { + if(sl2) { + ret = unshift(H_orig); + ret *= .5; + ret[LDIM] = 1; + ret = lp_apply(ret); + break; + } find_zlev(H); apply_nil_rotation(H); diff --git a/models.cpp b/models.cpp index 41c94e9e..e79ca405 100644 --- a/models.cpp +++ b/models.cpp @@ -192,7 +192,7 @@ EX namespace models { if(among(pm, mdBall, mdHemisphere)) return false; return PIU(model_available(pm)); } - if(sl2) return pm == mdGeodesic; + if(sl2) return among(pm, mdGeodesic, mdEquidistant, mdHorocyclic, mdPerspective); if(nonisotropic) return among(pm, mdDisk, mdPerspective, mdHorocyclic, mdGeodesic, mdEquidistant, mdFisheye, mdLiePerspective, mdLieOrthogonal); if(sphere && (pm == mdHalfplane || pm == mdBall)) return false; diff --git a/shaders.cpp b/shaders.cpp index 51d63c4b..0ff264ad 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -349,6 +349,14 @@ shared_ptr write_shader(flagtype shader_flags) { } else if(pmodel == mdPerspective) { shader_flags |= SF_PERS3 | SF_DIRECT; + if(sl2) { + vsh += "uniform mediump float uIndexSL;\n"; + coordinator += + "float ca = cos(uIndexSL); float sa = -sin(uIndexSL);\n" + "vec4 h1 = t;\n" + "t[2] = h1[2] * ca - h1[3] * sa; t[3] = 1.;\n" + "t[0] = h1[0] * ca - h1[1] * sa; t[1] = h1[1] * ca + h1[0] * sa;\n"; + } #if CAP_VR if(vrhr::rendering() && hyperbolic && vrhr::eyes != vrhr::eEyes::truesim) { azi_hyperbolic = true;