mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
an option to add more projections via plugins
This commit is contained in:
parent
166f076f2d
commit
5a73eccd4c
@ -497,6 +497,8 @@ EX void threepoint_projection(const hyperpoint& H, hyperpoint& ret) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
EX vector<hr::function<void(shiftpoint& H_orig, hyperpoint& H, hyperpoint& ret)>> extra_projections;
|
||||||
|
|
||||||
EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
||||||
|
|
||||||
hyperpoint H = H_orig.h;
|
hyperpoint H = H_orig.h;
|
||||||
@ -1345,6 +1347,11 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case mdGUARD: case mdManual: break;
|
case mdGUARD: case mdManual: break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if(md < isize(extra_projections) && extra_projections[md])
|
||||||
|
extra_projections[md](H_orig, H, ret);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ghcheck(ret,H_orig);
|
ghcheck(ret,H_orig);
|
||||||
|
@ -186,6 +186,7 @@ EX namespace models {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EX bool model_available(eModel pm) {
|
EX bool model_available(eModel pm) {
|
||||||
|
if(mdinf[pm].flags & mf::technical) return false;
|
||||||
if(prod) {
|
if(prod) {
|
||||||
if(pm == mdPerspective) return true;
|
if(pm == mdPerspective) return true;
|
||||||
if(among(pm, mdBall, mdHemisphere)) return false;
|
if(among(pm, mdBall, mdHemisphere)) return false;
|
||||||
@ -360,7 +361,7 @@ EX namespace models {
|
|||||||
USING_NATIVE_GEOMETRY_IN_RUG;
|
USING_NATIVE_GEOMETRY_IN_RUG;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(int i=0; i<mdGUARD; i++) {
|
for(int i=0; i<isize(mdinf); i++) {
|
||||||
eModel m = eModel(i);
|
eModel m = eModel(i);
|
||||||
if(m == mdFormula && ISMOBILE) continue;
|
if(m == mdFormula && ISMOBILE) continue;
|
||||||
if(model_available(m)) {
|
if(model_available(m)) {
|
||||||
@ -773,7 +774,7 @@ EX namespace models {
|
|||||||
|
|
||||||
#if CAP_COMMANDLINE
|
#if CAP_COMMANDLINE
|
||||||
|
|
||||||
eModel read_model(const string& ss) {
|
EX eModel read_model(const string& ss) {
|
||||||
for(int i=0; i<isize(mdinf); i++) {
|
for(int i=0; i<isize(mdinf); i++) {
|
||||||
if(appears(mdinf[i].name_hyperbolic, ss)) return eModel(i);
|
if(appears(mdinf[i].name_hyperbolic, ss)) return eModel(i);
|
||||||
if(appears(mdinf[i].name_euclidean, ss)) return eModel(i);
|
if(appears(mdinf[i].name_euclidean, ss)) return eModel(i);
|
||||||
|
Loading…
Reference in New Issue
Block a user