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

simplified the scaling scode

This commit is contained in:
Zeno Rogue 2018-08-28 19:05:57 +02:00
parent 6d5d8d8134
commit 015e69cf30
6 changed files with 386 additions and 431 deletions

View File

@ -34,6 +34,8 @@ ld hexshift;
ld hcrossf7 = 0.620672;
ld hexf7 = 0.378077;
ld scalefactor, orbsize, floorrad0, floorrad1, zhexf;
// the distance between two hexagon centers
void precalc() {
@ -161,10 +163,32 @@ void precalc() {
hexhexdist, hexvdist);
base_distlimit = ginf[geometry].distlimit[!BITRUNCATED];
gp::compute_geometry();
irr::compute_geometry();
if(archimedean) arcm::current.compute_geometry();
if(archimedean) {
arcm::current.compute_geometry();
crossf = hcrossf7 * arcm::current.scale();
hexvdist = arcm::current.scale() * .5;
rhexf = arcm::current.scale() * .5;
}
if(binarytiling) hexvdist = rhexf = 1, tessf = 1, scalefactor = 1, crossf = hcrossf7;
scalefactor = crossf / hcrossf7;
orbsize = crossf;
zhexf = BITRUNCATED ? hexf : crossf* .55;
floorrad0 = hexvdist* 0.92;
floorrad1 = rhexf * 0.94;
if(euclid4) {
if(!BITRUNCATED)
floorrad0 = floorrad1 = rhexf * .94;
else
floorrad0 = hexvdist * .9,
floorrad1 = rhexf * .8;
}
}
transmatrix xspinpush(ld dir, ld dist) {
@ -243,7 +267,7 @@ namespace geom3 {
ld actual_wall_height() {
if(GOLDBERG && gp_autoscale_heights)
return wall_height * min<ld>(4 * gp::scale, 1);
return wall_height * min<ld>(4 / hypot2(gp::next), 1);
return wall_height;
}

View File

@ -2,7 +2,6 @@ namespace hr { namespace gp {
loc param(1, 0);
hyperpoint next;
ld scale;
ld alpha;
int area;
@ -582,9 +581,11 @@ namespace hr { namespace gp {
int y = param.second;
area = ((2*x+y) * (2*x+y) + y*y*3) / 4;
next = hpxyz(x+y/2., -y * sqrt(3) / 2, 0);
scale = 1 / hypot2(next);
ld scale = 1 / hypot2(next);
crossf *= scale;
hepvdist *= scale;
hexhexdist *= scale;
hexvdist *= scale;
rhexf *= scale;
// spin = spintox(next);
// ispin = rspintox(next);
@ -600,7 +601,6 @@ namespace hr { namespace gp {
Xprintf("scale = " LDF "\n", scale);
}
else {
scale = 1;
alpha = 0;
}
}

View File

@ -4734,7 +4734,7 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
if(vid.grid) {
dynamicval<ld> lw(vid.linewidth, vid.linewidth);
if(GOLDBERG) vid.linewidth *= gp::scale * 2;
vid.linewidth *= scalefactor;
// sphere: 0.3948
// sphere heptagonal: 0.5739
@ -5082,8 +5082,7 @@ void drawFlashes() {
kill = tim > 300;
int partcol = darkena(f.color, 0, max(255 - tim*255/300, 0));
poly_outline = OUTLINE_DEFAULT;
ld gps = GOLDBERG ? gp::scale * 1.6 : 1;
queuepoly(V * spin(f.angle) * xpush(f.spd * tim * gps / 50000.), shParticle[f.size], partcol);
queuepoly(V * spin(f.angle) * xpush(f.spd * tim * scalefactor / 50000.), shParticle[f.size], partcol);
}
else if(f.size == 1000) {

View File

@ -2745,7 +2745,6 @@ namespace irr {
extern ld density;
extern ld quality;
extern int cellcount;
extern ld scale;
extern int place_attempts;
extern int rearrange_max_attempts;
extern int rearrange_less;
@ -3073,6 +3072,9 @@ void queueline(const hyperpoint& H1, const hyperpoint& H2, int col, int prf = 0,
void queuelink(const string *link, PPR prio);
extern ld tessf, crossf, hexf, hcrossf, hexhexdist, hexvdist, hepvdist, rhexf;
extern ld scalefactor, orbsize, floorrad0, floorrad1, zhexf;
unsigned char& part(int& col, int i);
unsigned char& part(unsigned& col, int i);
@ -3331,7 +3333,6 @@ namespace gp {
typedef pair<int, int> loc;
void compute_geometry();
void extend_map(cell *c, int d);
extern ld scale;
extern loc param;
extern loc eudir(int dir);
extern int area;

View File

@ -506,18 +506,17 @@ bool step(int delta) {
return false;
}
ld scale;
void compute_geometry() {
if(IRREGULAR) {
scale = sqrt(isize(cells_of_heptagon) * 1. / isize(cells));
ld scale = sqrt(isize(cells_of_heptagon) * 1. / isize(cells));
crossf *= scale;
hepvdist *= scale;
rhexf *= scale;
hexhexdist *= scale;
hexvdist *= scale;
base_distlimit = (base_distlimit + log(scale) / log(2.618)) / scale;
if(base_distlimit > 25) base_distlimit = 25;
}
else scale = 1;
}
bool draw_cell_schematics(cell *c, transmatrix V) {

File diff suppressed because it is too large Load Diff