1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-07-01 09:22:51 +00:00

solv:: CAP_SOLV

This commit is contained in:
Zeno Rogue 2019-09-13 17:45:31 +02:00
parent a4579e95c1
commit 2a950369ba
5 changed files with 29 additions and 6 deletions

View File

@ -324,13 +324,14 @@ void display_data::set_projection(int ed) {
start_projection(ed, shaderside_projection); start_projection(ed, shaderside_projection);
if(pmodel == mdRug) return; if(pmodel == mdRug) return;
#if CAP_SOLV
if(glhr::new_shader_projection == glhr::shader_projection::standardSolv) { if(glhr::new_shader_projection == glhr::shader_projection::standardSolv) {
static bool toload = true; static bool toload = true;
static GLuint invexpid = 0; static GLuint invexpid = 0;
if(toload) { // if(!has_table.count(_program)) { if(toload) {
solv::load_table(); solv::load_table();
if(!solv::table_loaded) { pmodel = mdPerspective; set_projection(ed); return; } if(!solv::table_loaded) { pmodel = mdPerspective; set_projection(ed); return; }
@ -375,6 +376,7 @@ void display_data::set_projection(int ed) {
glhr::set_solv_prec(solv::PRECX, solv::PRECY, solv::PRECZ); glhr::set_solv_prec(solv::PRECX, solv::PRECY, solv::PRECZ);
} }
#endif
if(glhr::new_shader_projection == glhr::shader_projection::standardSL2) { if(glhr::new_shader_projection == glhr::shader_projection::standardSL2) {
glhr::set_index_sl(0); glhr::set_index_sl(0);

View File

@ -422,6 +422,8 @@ void ge_select_tiling() {
dynamicval<eGeometry> cg(geometry, g); dynamicval<eGeometry> cg(geometry, g);
if(archimedean && !CAP_ARCM) continue; if(archimedean && !CAP_ARCM) continue;
if(cryst && !CAP_CRYSTAL) continue; if(cryst && !CAP_CRYSTAL) continue;
if(sol && !CAP_SOLV) continue;
if(WDIM == 3 && MAXMDIM == 3) continue;
if(geometry == gFieldQuotient && !CAP_FIELD) continue; if(geometry == gFieldQuotient && !CAP_FIELD) continue;
if((!!quotient) ^ select_quotient) continue; if((!!quotient) ^ select_quotient) continue;
if((WDIM == 3) ^ select_dims) continue; if((WDIM == 3) ^ select_dims) continue;
@ -481,7 +483,9 @@ void ge_select_tiling() {
dialog::addBreak(100); dialog::addBreak(100);
dialog::addBoolItem_action(XLAT("show quotient spaces"), select_quotient, 'Q'); dialog::addBoolItem_action(XLAT("show quotient spaces"), select_quotient, 'Q');
#if MAXMDIM == 4
dialog::addBoolItem_action(XLAT("three-dimensional"), select_dims, 'D'); dialog::addBoolItem_action(XLAT("three-dimensional"), select_dims, 'D');
#endif
dual::add_choice(); dual::add_choice();
dialog::addBack(); dialog::addBack();

View File

@ -37,7 +37,7 @@ EX namespace nisot {
EX } EX }
EX namespace solv { EX namespace solv {
#if CAP_SOLV
EX int PRECX, PRECY, PRECZ; EX int PRECX, PRECY, PRECZ;
EX vector<nisot::ptlow> inverse_exp_table; EX vector<nisot::ptlow> inverse_exp_table;
@ -336,6 +336,7 @@ EX namespace solv {
"return res;" "return res;"
"}"; "}";
#endif
EX } EX }
EX namespace nilv { EX namespace nilv {
@ -1319,14 +1320,18 @@ EX }
EX namespace nisot { EX namespace nisot {
EX hyperpoint christoffel(const hyperpoint at, const hyperpoint velocity, const hyperpoint transported) { EX hyperpoint christoffel(const hyperpoint at, const hyperpoint velocity, const hyperpoint transported) {
if(sol) return solv::christoffel(at, velocity, transported); if(nil) return nilv::christoffel(at, velocity, transported);
else if(nil) return nilv::christoffel(at, velocity, transported); #if CAP_SOLV
else if(sol) return solv::christoffel(at, velocity, transported);
#endif
else if(sl2) return slr::christoffel(at, velocity, transported); else if(sl2) return slr::christoffel(at, velocity, transported);
else return point3(0, 0, 0); else return point3(0, 0, 0);
} }
EX bool in_table_range(hyperpoint h) { EX bool in_table_range(hyperpoint h) {
#if CAP_SOLV
if(sol) return solv::in_table_range(h); if(sol) return solv::in_table_range(h);
#endif
return true; return true;
} }
@ -1415,7 +1420,9 @@ EX namespace nisot {
} }
EX hrmap *new_map() { EX hrmap *new_map() {
#if CAP_SOLV
if(sol) return new solv::hrmap_sol; if(sol) return new solv::hrmap_sol;
#endif
if(nil) return new nilv::hrmap_nil; if(nil) return new nilv::hrmap_nil;
if(prod) return new product::hrmap_product; if(prod) return new product::hrmap_product;
if(hybri) return new rots::hrmap_rotation_space; if(hybri) return new rots::hrmap_rotation_space;
@ -1424,15 +1431,18 @@ EX namespace nisot {
auto config = addHook(hooks_args, 0, [] () { auto config = addHook(hooks_args, 0, [] () {
using namespace arg; using namespace arg;
#if CAP_SOLV
if(argis("-solrange")) { if(argis("-solrange")) {
shift_arg_formula(solv::solrange_xy); shift_arg_formula(solv::solrange_xy);
shift_arg_formula(solv::solrange_z); shift_arg_formula(solv::solrange_z);
return 0; return 0;
} }
#endif
if(argis("-slrange")) { if(argis("-slrange")) {
shift_arg_formula(slr::range_xy); shift_arg_formula(slr::range_xy);
return 0; return 0;
} }
#if CAP_SOLV
else if(argis("-fsol")) { else if(argis("-fsol")) {
shift(); solv::solfname = args(); shift(); solv::solfname = args();
return 0; return 0;
@ -1442,6 +1452,7 @@ EX namespace nisot {
shift_arg_formula(solv::glitch_z); shift_arg_formula(solv::glitch_z);
return 0; return 0;
} }
#endif
else if(argis("-solgeo")) { else if(argis("-solgeo")) {
geodesic_movement = true; geodesic_movement = true;
pmodel = mdGeodesic; pmodel = mdGeodesic;

View File

@ -695,7 +695,7 @@ void init() {
bool ball = (sp == shader_projection::ball); bool ball = (sp == shader_projection::ball);
bool flatten = (sp == shader_projection::flatten); bool flatten = (sp == shader_projection::flatten);
if(ssol && ISWEB) continue; if(ssol && !CAP_SOLV) continue;
programs[i][j] = new GLprogram(stringbuilder( programs[i][j] = new GLprogram(stringbuilder(
1, "#define PI 3.14159265358979324\n", 1, "#define PI 3.14159265358979324\n",
@ -743,7 +743,9 @@ void init() {
1, " return (h[2] < 0.0 ? -1.0 : 1.0) * sqrt(h[2]*h[2] - h[0]*h[0] - h[1]*h[1]);", 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, " }",
ssol, solv::solshader, #if CAP_SOLV
ssol, solv::solshader,
#endif
snil, nilv::nilshader, snil, nilv::nilshader,
ssl2, slr::slshader, ssl2, slr::slshader,

View File

@ -504,6 +504,10 @@ union SDL_Event;
#define CAP_STARTANIM (!(ISMINI)) #define CAP_STARTANIM (!(ISMINI))
#endif #endif
#ifndef CAP_SOLV
#define CAP_SOLV (MAXMDIM >= 4 && !ISWEB)
#endif
#ifndef CAP_FIELD #ifndef CAP_FIELD
#define CAP_FIELD (!(ISMINI)) #define CAP_FIELD (!(ISMINI))
#endif #endif