mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
geom3:: gp:: autoscaling
This commit is contained in:
parent
4a8e33a2d5
commit
e43d630185
@ -176,6 +176,7 @@ void initConfig() {
|
||||
addsaver(geom3::tc_alpha, "3D TC alpha");
|
||||
addsaver(geom3::highdetail, "3D highdetail");
|
||||
addsaver(geom3::middetail, "3D middetail");
|
||||
addsaver(geom3::gp_autoscale_heights, "3D Goldberg autoscaling");
|
||||
|
||||
addsaver(memory_saving_mode, "memory_saving_mode", (ISMOBILE || ISPANDORA || ISWEB) ? 1 : 0);
|
||||
|
||||
@ -985,7 +986,7 @@ string explain3D(ld *param) {
|
||||
XLAT(
|
||||
"The height of walls, in absolute units. For the current values of g and c, "
|
||||
"wall height of %1 absolute units corresponds to projection value of %2.",
|
||||
fts3(wall_height), fts3(factor_to_projection(geom3::WALL)));
|
||||
fts3(actual_wall_height()), fts3(factor_to_projection(geom3::WALL)));
|
||||
|
||||
if(param == &rock_wall_ratio)
|
||||
return
|
||||
|
10
dialogs.cpp
10
dialogs.cpp
@ -703,6 +703,9 @@ namespace dialog {
|
||||
|
||||
if(ne.editwhat == &vid.linewidth)
|
||||
addBoolItem("finer lines at the boundary", vid.antialias & AA_LINEWIDTH, 'o');
|
||||
|
||||
if(ne.editwhat == &geom3::wall_height)
|
||||
addBoolItem("auto-adjust in Goldberg grids", geom3::gp_autoscale_heights, 'o');
|
||||
|
||||
display();
|
||||
|
||||
@ -758,6 +761,13 @@ namespace dialog {
|
||||
genrange_bonus = sightrange_bonus;
|
||||
doOvergenerate();
|
||||
}
|
||||
else if(uni == 'o' && ne.editwhat == &geom3::wall_height) {
|
||||
geom3::gp_autoscale_heights = !geom3::gp_autoscale_heights;
|
||||
buildpolys();
|
||||
#if CAP_GL
|
||||
resetGL();
|
||||
#endif
|
||||
}
|
||||
else if(uni == 'O' && ne.editwhat == &ne.intbuf && ne.intval == &sightrange_bonus && allowChangeRange()) {
|
||||
gamerange_bonus = sightrange_bonus;
|
||||
}
|
||||
|
18
geometry.cpp
18
geometry.cpp
@ -193,6 +193,7 @@ namespace geom3 {
|
||||
ld rock_wall_ratio = .9;
|
||||
ld human_wall_ratio = .7;
|
||||
ld human_height;
|
||||
bool gp_autoscale_heights = true;
|
||||
|
||||
ld highdetail = 8, middetail = 8;
|
||||
|
||||
@ -247,6 +248,12 @@ namespace geom3 {
|
||||
|
||||
string invalid;
|
||||
|
||||
ld actual_wall_height() {
|
||||
if(gp::on && gp_autoscale_heights)
|
||||
return wall_height * min<ld>(4 * gp::scale, 1);
|
||||
return wall_height;
|
||||
}
|
||||
|
||||
void compute() {
|
||||
// tanh(depth) / tanh(camera) == vid.alpha
|
||||
invalid = "";
|
||||
@ -294,9 +301,10 @@ namespace geom3 {
|
||||
}
|
||||
else {
|
||||
INFDEEP = (euclid || sphere) ? 0.01 : lev_to_projection(0) * tanh(camera);
|
||||
WALL = lev_to_factor(wall_height);
|
||||
ld wh = actual_wall_height();
|
||||
WALL = lev_to_factor(wh);
|
||||
|
||||
human_height = human_wall_ratio * wall_height;
|
||||
human_height = human_wall_ratio * wh;
|
||||
|
||||
LEG1 = lev_to_factor(human_height * .1);
|
||||
LEG = lev_to_factor(human_height * .2);
|
||||
@ -311,13 +319,13 @@ namespace geom3 {
|
||||
|
||||
ABODY = lev_to_factor(human_height * .4);
|
||||
AHEAD = lev_to_factor(human_height * .6);
|
||||
BIRD = lev_to_factor((human_wall_ratio+1)/2 * wall_height * .8);
|
||||
BIRD = lev_to_factor((human_wall_ratio+1)/2 * wh * .8);
|
||||
GHOST = lev_to_factor(human_height * .5);
|
||||
FLATEYE = lev_to_factor(human_height * .15);
|
||||
|
||||
slev = rock_wall_ratio * wall_height / 3;
|
||||
slev = rock_wall_ratio * wh / 3;
|
||||
for(int s=0; s<=3; s++)
|
||||
SLEV[s] = lev_to_factor(rock_wall_ratio * wall_height * s/3);
|
||||
SLEV[s] = lev_to_factor(rock_wall_ratio * wh * s/3);
|
||||
LAKE = lev_to_factor(-lake_top);
|
||||
HELLSPIKE = lev_to_factor(-(lake_top+lake_bottom)/2);
|
||||
BOTTOM = lev_to_factor(-lake_bottom);
|
||||
|
10
graph.cpp
10
graph.cpp
@ -3169,7 +3169,7 @@ void escherSidewall(cell *c, int sidepar, const transmatrix& V, int col) {
|
||||
else if(sidepar == SIDE_WALL) {
|
||||
const int layers = 2 << detaillevel;
|
||||
for(int z=1; z<layers; z++)
|
||||
warpfloor(c, mscale(V, zgrad0(0, geom3::wall_height, z, layers)), col, PPR_WALL3+z-layers, false);
|
||||
warpfloor(c, mscale(V, zgrad0(0, geom3::actual_wall_height(), z, layers)), col, PPR_WALL3+z-layers, false);
|
||||
}
|
||||
else if(sidepar == SIDE_LAKE) {
|
||||
const int layers = 1 << (detaillevel-1);
|
||||
@ -3439,7 +3439,7 @@ void draw_wall(cell *c, const transmatrix& V, int wcol, int& zcol, int ct6, int
|
||||
if(conegraph(c)) {
|
||||
const int layers = 2 << detaillevel;
|
||||
for(int z=1; z<layers; z++) {
|
||||
double zg = zgrad0(0, geom3::wall_height, z, layers);
|
||||
double zg = zgrad0(0, geom3::actual_wall_height(), z, layers);
|
||||
warpfloor(c, xyzscale(V, zg*(layers-z)/layers, zg),
|
||||
darkena(gradient(0, wcol, -layers, z, layers), 0, 0xFF), PPR_WALL3+z-layers+2, isWarped(c));
|
||||
}
|
||||
@ -3892,7 +3892,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
if(wmspatial) {
|
||||
const int layers = 2 << detaillevel;
|
||||
for(int z=1; z<layers; z++)
|
||||
queuepolyat(mscale(V2, zgrad0(0, geom3::wall_height, z, layers)), shHalfMirror[2], 0xC0C0C080, PPR_WALL3+z-layers);
|
||||
queuepolyat(mscale(V2, zgrad0(0, geom3::actual_wall_height(), z, layers)), shHalfMirror[2], 0xC0C0C080, PPR_WALL3+z-layers);
|
||||
}
|
||||
else
|
||||
queuepolyat(V2, shHalfMirror[2], 0xC0C0C080, PPR_WALL3);
|
||||
@ -3910,7 +3910,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
if(wmspatial) {
|
||||
const int layers = 2 << detaillevel;
|
||||
for(int z=1; z<layers; z++)
|
||||
queuepolyat(mscale(V2, zgrad0(0, geom3::wall_height, z, layers)), shHalfMirror[ct6], 0xC0C0C080, PPR_WALL3+z-layers);
|
||||
queuepolyat(mscale(V2, zgrad0(0, geom3::actual_wall_height(), z, layers)), shHalfMirror[ct6], 0xC0C0C080, PPR_WALL3+z-layers);
|
||||
}
|
||||
else
|
||||
queuepolyat(V2, shHalfMirror[ct6], 0xC0C0C080, PPR_WALL3);
|
||||
@ -4520,7 +4520,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
||||
dynamicval<const hpcshape*> ds(qfi.shape, &shCircleFloor);
|
||||
dynamicval<bool> db(qfi.special, true);
|
||||
for(int z=1; z<layers; z++) {
|
||||
double zg = zgrad0(-geom3::lake_top, geom3::wall_height, z, layers);
|
||||
double zg = zgrad0(-geom3::lake_top, geom3::actual_wall_height(), z, layers);
|
||||
warpfloor(c, xyzscale(V, zg*(layers-z)/layers, zg),
|
||||
darkena(gradient(0, wcol, -layers, z, layers), 0, 0xFF), PPR_WALL3+z-layers+2, isWarped(c));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user