1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

2D3D:: eye level

This commit is contained in:
Zeno Rogue 2019-06-01 19:58:07 +02:00
parent 5d7a01febe
commit 01763d4f12
5 changed files with 28 additions and 2 deletions

View File

@ -736,7 +736,9 @@ void geometry_information::adjust_eye(hpcshape& eye, hpcshape head, ld shift_eye
qtyall++;
}
if(&eye == &shSkullEyes) pos = zc(eyepos) - 0.06 * SH * 0.05;
if(&eye == &shSkullEyes) cgi.eyelevel_human = pos = zc(eyepos) - 0.06 * SH * 0.05;
if(&eye == &shWolf1) cgi.eyelevel_dog = pos;
if(&eye == &shFamiliarEye) cgi.eyelevel_familiar = pos;
make_ball(eye, rad, 0);
transmatrix T = zpush(-shift_eye) * rgpushxto0(center) * zpush(pos);

View File

@ -220,6 +220,9 @@ void initConfig() {
addsaver(vid.gp_autoscale_heights, "3D Goldberg autoscaling", true);
addsaver(vid.always3, "3D always", false);
addsaver(vid.eye, "eyelevel", 0);
addsaver(vid.auto_eye, "auto-eyelevel", false);
addsaver(memory_saving_mode, "memory_saving_mode", (ISMOBILE || ISPANDORA || ISWEB) ? 1 : 0);
addsaver(rug::renderonce, "rug-renderonce");
@ -1282,6 +1285,9 @@ void show3D() {
if(WDIM == 2) {
dialog::addSelItem(XLAT(GDIM == 2 ? "Camera level above the plane" : "Z shift"), fts(vid.camera), 'c');
if(GDIM == 3)
dialog::addSelItem(XLAT("Eye level"), fts(vid.eye), 'E');
dialog::addSelItem(XLAT("Ground level below the plane"), fts(vid.depth), 'g');
if(GDIM == 2)
@ -2089,6 +2095,7 @@ unordered_map<string, ld&> params = {
{"ballangle", vid.ballangle},
{"yshift", vid.yshift},
{"cameraangle", vid.camera_angle},
{"eye", vid.eye},
{"depth", vid.depth},
{"camera", vid.camera},
{"wall_height", vid.wall_height},

View File

@ -217,6 +217,17 @@ namespace geom3 {
return vid.depth - projection_to_abslev(factor_to_projection(fac));
}
void do_auto_eye() {
if(!vid.auto_eye) return;
auto& cs = getcs();
if(cs.charid < 4)
vid.eye = cgi.eyelevel_human;
else if(cs.charid < 8)
vid.eye = cgi.eyelevel_dog;
else if(cs.charid == 8)
vid.eye = cgi.eyelevel_familiar;
}
// how should we scale at level lev
ld scale_at_lev(ld lev) {
if(sphere || euclid) return 1;

View File

@ -312,6 +312,9 @@ struct videopar {
int tc_alpha, tc_depth, tc_camera;
ld highdetail, middetail;
bool gp_autoscale_heights;
ld eye;
bool auto_eye;
};
extern videopar vid;
@ -4350,6 +4353,8 @@ struct geometry_information {
ALEG0, ALEG, ABODY, AHEAD, BIRD, LOWSKY, SKY, HIGH, HIGH2;
ld human_height, slev;
ld eyelevel_familiar, eyelevel_human, eyelevel_dog;
#if CAP_SHAPES
hpcshape
shSemiFloorSide[SIDEPARS],

View File

@ -1159,8 +1159,9 @@ void centerpc(ld aspd) {
transmatrix T = cwtV;
#if MAXMDIM >= 4
if(GDIM == 3 && WDIM == 2) {
geom3::do_auto_eye();
int sl = snakelevel(cwt.at);
if(sl) T = T * zpush(cgi.SLEV[sl] - cgi.FLOOR);
if(sl || vid.eye) T = T * zpush(cgi.SLEV[sl] - cgi.FLOOR + vid.eye);
}
#endif
hyperpoint H = inverse(actual_view_transform) * tC0(T);