surface 3D graphics are now automatically disabled in rug (won't work correctly with quotient rugs anyway) and in pmodels which do not support it

This commit is contained in:
Zeno Rogue 2018-12-05 19:57:35 +01:00
parent e68da3d9a9
commit d8bf550d37
6 changed files with 35 additions and 14 deletions

View File

@ -1294,10 +1294,18 @@ void show3D() {
dialog::addSelItem(XLAT("model used"), conformal::get_model_name(pmodel), 'M'); dialog::addSelItem(XLAT("model used"), conformal::get_model_name(pmodel), 'M');
dialog::addBreak(50); dialog::addBreak(50);
if(!(wmspatial || mmspatial)) if(rug::rugged) {
dialog::addBoolItem(XLAT("3D monsters/walls on the surface"), rug::spatial_rug, 'S');
dialog::add_action([] () { rug::spatial_rug = !rug::spatial_rug; });
}
if(rug::rugged && !rug::spatial_rug)
dialog::addBreak(100);
else if(non_spatial_model())
dialog::addInfo(XLAT("no 3D effects available in this projection"), 0xC00000);
else if(!spatial_graphics)
dialog::addInfo(XLAT("set 3D monsters or walls in basic config first")); dialog::addInfo(XLAT("set 3D monsters or walls in basic config first"));
else if(invalid != "") else if(invalid != "")
dialog::addInfo(XLAT("error: "+invalid)); dialog::addInfo(XLAT("error: "+invalid), 0xC00000);
else else
dialog::addInfo(XLAT("parameters set correctly")); dialog::addInfo(XLAT("parameters set correctly"));
dialog::addBreak(50); dialog::addBreak(50);

View File

@ -8,6 +8,7 @@ namespace hr {
int inmirrorcount = 0; int inmirrorcount = 0;
bool spatial_graphics;
bool wmspatial, wmescher, wmplain, wmblack, wmascii; bool wmspatial, wmescher, wmplain, wmblack, wmascii;
bool mmspatial, mmhigh, mmmon, mmitem; bool mmspatial, mmhigh, mmmon, mmitem;
@ -5301,6 +5302,13 @@ void drawthemap() {
mmmon = vid.monmode >= 2; mmmon = vid.monmode >= 2;
mmhigh = vid.monmode == 3 || vid.monmode == 5; mmhigh = vid.monmode == 3 || vid.monmode == 5;
mmspatial = vid.monmode == 4 || vid.monmode == 5; mmspatial = vid.monmode == 4 || vid.monmode == 5;
spatial_graphics = wmspatial || mmspatial;
if(rug::rugged && !rug::spatial_rug) spatial_graphics = false;
if(non_spatial_model())
spatial_graphics = false;
if(!spatial_graphics) wmspatial = mmspatial = false;
DEBB(DF_GRAPH, (debugfile,"draw the map\n")); DEBB(DF_GRAPH, (debugfile,"draw the map\n"));

View File

@ -949,6 +949,7 @@ void applymodel(hyperpoint H, hyperpoint& Hscr);
void drawCircle(int x, int y, int size, color_t color, color_t fillcolor = 0); void drawCircle(int x, int y, int size, color_t color, color_t fillcolor = 0);
void fixcolor(int& col); void fixcolor(int& col);
ld displayspin(cell *c, int d); ld displayspin(cell *c, int d);
bool non_spatial_model();
hyperpoint gethyper(ld x, ld y); hyperpoint gethyper(ld x, ld y);
void resetview(); void resetview();
void drawthemap(); void drawthemap();
@ -1208,6 +1209,7 @@ struct renderbuffer;
namespace rug { namespace rug {
extern bool rugged; extern bool rugged;
extern bool spatial_rug;
extern bool computed; extern bool computed;
extern bool renderonce; extern bool renderonce;
extern bool rendernogl; extern bool rendernogl;
@ -2019,6 +2021,7 @@ bool playerInBoat(int i);
extern int lowfar; extern int lowfar;
extern bool wmspatial, wmescher, wmplain, wmblack, wmascii; extern bool wmspatial, wmescher, wmplain, wmblack, wmascii;
extern bool mmspatial, mmhigh, mmmon, mmitem; extern bool mmspatial, mmhigh, mmmon, mmitem;
extern bool spatial_graphics;
extern int maxreclevel, reclevel; extern int maxreclevel, reclevel;
string explain3D(ld *param); string explain3D(ld *param);

View File

@ -24,6 +24,14 @@ hyperpoint perspective_to_space(hyperpoint h, ld alpha = vid.alpha, eGeometryCla
hyperpoint dhp(ld x, ld y, ld z) { return hpxyz(x, y, z); } hyperpoint dhp(ld x, ld y, ld z) { return hpxyz(x, y, z); }
bool non_spatial_model() {
if(among(pmodel, mdRotatedHyperboles, mdJoukowsky, mdJoukowskyInverted, mdPolygonal, mdPolynomial))
return true;
if(pmodel == mdSpiral && euclid)
return true;
return vid.consider_shader_projection && shaderside_projection && pmodel;
}
hyperpoint perspective_to_space(hyperpoint h, ld alpha, eGeometryClass gc) { hyperpoint perspective_to_space(hyperpoint h, ld alpha, eGeometryClass gc) {
ld hx = h[0], hy = h[1]; ld hx = h[0], hy = h[1];
@ -136,7 +144,7 @@ bool twopoint_do_flips;
ld find_zlev(hyperpoint& H) { ld find_zlev(hyperpoint& H) {
if(wmspatial || mmspatial) { if(spatial_graphics) {
ld zlev = zlevel(H); ld zlev = zlevel(H);
using namespace hyperpoint_vec; using namespace hyperpoint_vec;
if(zlev > 1-1e-6 && zlev < 1+1e-6) return 1; if(zlev > 1-1e-6 && zlev < 1+1e-6) return 1;

View File

@ -28,6 +28,7 @@ struct rug_exception { };
bool fast_euclidean = true; bool fast_euclidean = true;
bool good_shape; bool good_shape;
bool subdivide_first = false; bool subdivide_first = false;
bool spatial_rug = false;
bool subdivide_further(); bool subdivide_further();
void subdivide(); void subdivide();
@ -1791,6 +1792,8 @@ void show() {
} }
dialog::addSelItem(XLAT("automatic move speed"), fts(ruggo), 'G'); dialog::addSelItem(XLAT("automatic move speed"), fts(ruggo), 'G');
dialog::addSelItem(XLAT("anti-crossing"), fts(anticusp_factor), 'A'); dialog::addSelItem(XLAT("anti-crossing"), fts(anticusp_factor), 'A');
dialog::addBoolItem(XLAT("3D monsters/walls on the surface"), spatial_rug, 'S');
dialog::add_action([] () { spatial_rug = !spatial_rug; });
#if CAP_SURFACE #if CAP_SURFACE
if(hyperbolic) { if(hyperbolic) {

View File

@ -412,19 +412,10 @@ slide default_slides[] = {
#endif #endif
[] (presmode mode) { [] (presmode mode) {
#if CAP_RUG #if CAP_RUG
static int wm, mm; if(mode == 1)
if(mode == 1) {
rug::init(); rug::init();
wm = vid.wallmode; if(mode == 3)
mm = vid.monmode;
vid.wallmode = 3;
vid.monmode = 2;
}
if(mode == 3) {
rug::close(); rug::close();
vid.wallmode = wm;
vid.monmode = mm;
}
slidecommand = "switch renderer"; slidecommand = "switch renderer";
if(mode == 4) { if(mode == 4) {
rug::close(); rug::close();