diff --git a/basegraph.cpp b/basegraph.cpp index d37f6f2b..3bd0904a 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -292,6 +292,8 @@ void display_data::set_projection(int ed) { shaderside_projection = false; glhr::new_shader_projection = glhr::shader_projection::standard; + + bool in_solnih = false; if(vid.consider_shader_projection && pmodel == mdDisk && !spherespecial && !(hyperbolic && vid.alpha <= -1) && MDIM == 3) shaderside_projection = true; @@ -312,10 +314,15 @@ void display_data::set_projection(int ed) { shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardR3, pers3 = true; if(GDIM == 3 && apply_models && pmodel == mdPerspective && in_h2xe()) shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardEH2, pers3 = true; - if(GDIM == 3 && apply_models && pmodel == mdGeodesic && sol) - shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardSolv, pers3 = true; - if(GDIM == 3 && apply_models && pmodel == mdGeodesic && nih) - shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardNIH, pers3 = true; + if(GDIM == 3 && apply_models && pmodel == mdGeodesic && solnih) { + shaderside_projection = true, pers3 = true, in_solnih = true; + if(sol && nih) + glhr::new_shader_projection = glhr::shader_projection::standardSolvNIH; + else if(sol) + glhr::new_shader_projection = glhr::shader_projection::standardSolv; + else + glhr::new_shader_projection = glhr::shader_projection::standardNIH; + } if(GDIM == 3 && apply_models && pmodel == mdGeodesic && sl2) shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardSL2, pers3 = true; if(GDIM == 3 && apply_models && pmodel == mdGeodesic && nil) @@ -335,7 +342,7 @@ void display_data::set_projection(int ed) { if(pmodel == mdRug) return; #if CAP_SOLV - if(among(glhr::new_shader_projection, glhr::shader_projection::standardSolv, glhr::shader_projection::standardNIH)) { + if(in_solnih) { auto &tab = solnihv::get_tabled(); GLuint invexpid = tab.get_texture_id(); diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 226a3984..c7037bf3 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -534,6 +534,44 @@ EX namespace solnihv { "return res;" "}"; + EX string shader_nsymsol = solnihv::common + R"*( + + vec4 inverse_exp(vec4 h) { + + float ix = h[0] >= 0. ? x_to_ix(h[0]) : x_to_ix(-h[0]); + float iy = h[1] >= 0. ? x_to_ix(h[1]) : x_to_ix(-h[1]); + float iz = (tanh(h[2]/4.)+1.) / 2.; + + vec4 res; + + float cx = ix*(1.-1./PRECX) + .5/PRECX; + float cy = iy*(1.-1./PRECY) + .5/PRECY; + float cz = iz*(1.-1./PRECZ) + .5/PRECZ; + + if(ix > .65 && iy > .5 && iz > .45 && iz < .55) + res = vec4(0.,0.,0.,1.); + else if(ix > .55 && iy > .75 && ix < .7 && iz > .45 && iz < .55) + res = vec4(0.,0.,0.,1.); + else if(ix > .45 && iy > .75 && ix < .7 && iz > .4 && iz < .5) + res = vec4(0.,0.,0.,1.); + else if(ix > .85 && iy > .5 && iz > .55 && iz < .75) + res = vec4(0.,0.,0.,1.); + else if(ix > .7 && iy > .55 && iz > .42 && iz < .58) + res = vec4(0.,0.,0.,1.); + else if(iz > 0.45 && ix > 0.8 && iy > 0.3 && iy < 0.6) + res = vec4(0.,0.,0.,1.); + else if(iz > 0.45 && ix > 0.8 && iy > 0.3 && iy < 0.6) + res = vec4(0.,0.,0.,1.); + else if(iz > .4 && iz < .55 && ix > .7 && iy > .36 && iy < .5 && ix < .8 && ix+iy > 1.2) + res = vec4(0.,0.,0.,1.); + else res = texture3D(tInvExpTable, vec3(cx, cy, cz)); + + if(h[0] < 0.) res[0] = -res[0]; + if(h[1] < 0.) res[1] = -res[1]; + + return res; + })*"; + EX string shader_nsym = solnihv::common + "vec4 inverse_exp(vec4 h) {" diff --git a/shaders.cpp b/shaders.cpp index de2a55f8..97cbe93d 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -53,8 +53,8 @@ glvertex pointtogl(const hyperpoint& t); enum class shader_projection { standard, band, halfplane, standardH3, standardR3, standardS30, standardS31, standardS32, standardS33, - ball, halfplane3, band3, flatten, standardSolv, standardNil, - standardEH2, standardSL2, standardNIH, + ball, halfplane3, band3, flatten, standardSolv, standardNil, + standardEH2, standardSL2, standardNIH, standardSolvNIH, MAX }; @@ -689,7 +689,9 @@ void init() { bool hp = among(sp, shader_projection::halfplane, shader_projection::halfplane3); bool sh3 = (sp == shader_projection::standardH3); bool ssol = (sp == shader_projection::standardSolv); + bool ssln = (sp == shader_projection::standardSolvNIH); bool snih = (sp == shader_projection::standardNIH); + bool sson = ssol || ssln || snih; bool snil = (sp == shader_projection::standardNil); bool ssl2 = (sp == shader_projection::standardSL2); bool sr3 = (sp == shader_projection::standardR3); @@ -700,14 +702,12 @@ void init() { bool seh2 = (sp == shader_projection::standardEH2); bool ss3 = ss30 || ss31 || ss32 || ss33; - bool s3 = (sh3 || sr3 || ss3 || ssol || snil || seh2 || ssl2 || snih); + bool s3 = (sh3 || sr3 || ss3 || sson || snil || seh2 || ssl2); bool dim3 = s3 || among(sp, shader_projection::ball, shader_projection::halfplane3, shader_projection::band3); bool dim2 = !dim3; bool ball = (sp == shader_projection::ball); bool flatten = (sp == shader_projection::flatten); - bool sson = ssol || snih; - if(sson && !CAP_SOLV) continue; programs[i][j] = new GLprogram(stringbuilder( @@ -759,6 +759,7 @@ void init() { #if CAP_SOLV ssol, solnihv::shader_symsol, snih, solnihv::shader_nsym, + ssln, solnihv::shader_nsymsol, #endif snil, nilv::nilshader, ssl2, slr::slshader,