1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-20 12:20:01 +00:00

2D3D: switch without changing the display

This commit is contained in:
Zeno Rogue 2019-05-09 01:39:32 +02:00
parent f675c08e7e
commit 450739b133
4 changed files with 17 additions and 6 deletions

View File

@ -1185,6 +1185,15 @@ void show3D() {
using namespace geom3;
dialog::init(XLAT("3D configuration"));
if(WDIM == 2) {
dialog::addBoolItem(XLAT("use the full 3D models"), geom3::always3, 'U');
dialog::add_action([] {
geom3::always3 = !geom3::always3;
need_reset_geometry = true;
callhooks(hooks_swapdim);
});
}
if(vid.use_smart_range == 0 && DIM == 2) {
dialog::addSelItem(XLAT("High detail range"), fts(highdetail), 'n');
dialog::addSelItem(XLAT("Mid detail range"), fts(middetail), 'm');
@ -1218,7 +1227,7 @@ void show3D() {
dialog::editNumber(mouseaim_sensitivity, -1, 1, 0.002, 0.01, XLAT("mouse aiming sensitivity"), "set to 0 to disable");
});
}
if(DIM == 2) dialog::addSelItem(XLAT("camera rotation"), fts3(vid.camera_angle), 's');
dialog::addSelItem(XLAT("camera rotation"), fts3(vid.camera_angle), 's');
if(DIM == 2) {
dialog::addSelItem(XLAT("fixed facing"), vid.fixed_facing ? fts(vid.fixed_facing_dir) : XLAT("OFF"), 'f');
dialog::add_action([] () { vid.fixed_facing = !vid.fixed_facing;
@ -1228,7 +1237,7 @@ void show3D() {
}
});
}
if(DIM == 2) {
if(true) {
dialog::addBreak(50);
dialog::addSelItem(XLAT("projection"), current_proj_name(), 'M');
}

View File

@ -890,7 +890,6 @@ void make_floor_textures() {
dynamicval<bool> a3(geom3::always3, false);
dynamicval<bool> hq(inHighQual, true);
dynamicval<int> hd(darken, 0);
dynamicval<ld> ga(vid.alpha, 1);
dynamicval<ld> gd(geom3::depth, 1);
dynamicval<ld> gc(geom3::camera, 1);
@ -899,6 +898,8 @@ void make_floor_textures() {
vid.xres = FLOORTEXTURESIZE;
vid.yres = FLOORTEXTURESIZE;
vid.scale = 0.25;
vid.camera_angle = 0;
vid.alpha = 1;
dynamicval<ld> lw(vid.linewidth, 2);
floor_textures = new renderbuffer(vid.xres, vid.yres, vid.usingGL);

View File

@ -250,7 +250,7 @@ namespace geom3 {
ld lev_to_factor(ld lev) {
if(WDIM == 3) return lev;
if(GDIM == 3) return lev - depth;
if(GDIM == 3) return depth - lev;
return projection_to_factor(lev_to_projection(lev));
}
ld factor_to_lev(ld fac) {
@ -335,7 +335,7 @@ namespace geom3 {
BIRD = 1.20;
}
else {
INFDEEP = GDIM == 3 ? -10 : (euclid || sphere) ? 0.01 : lev_to_projection(0) * tanh(camera);
INFDEEP = GDIM == 3 ? +10 : (euclid || sphere) ? 0.01 : lev_to_projection(0) * tanh(camera);
ld wh = actual_wall_height();
WALL = lev_to_factor(wh);
FLOOR = lev_to_factor(0);

View File

@ -3723,7 +3723,7 @@ void pushdown(cell *c, int& q, const transmatrix &V, double down, bool rezoom, b
auto pp = dynamic_cast<dqi_poly*> (&*ptds[q++]);
if(!pp) continue;
auto& ptd = *pp;
ptd.V = ptd.V * zpush(-down);
ptd.V = ptd.V * zpush(+down);
}
return;
}
@ -6100,6 +6100,7 @@ void make_actual_view() {
if(WDIM == 3) { actual_view_transform = Id; return; }
if(sphereflipped()) sphereflip[DIM][DIM] = -1;
actual_view_transform = ypush(vid.yshift) * sphereflip;
if(geom3::always3) actual_view_transform = zpush(+geom3::camera) * actual_view_transform;
}
transmatrix cview() {