1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-03-29 14:57:03 +00:00

preliminary floorshape remapping to syntetic

This commit is contained in:
Zeno Rogue 2018-08-17 21:42:42 +02:00
parent 7064dace81
commit 7fa3de574e
5 changed files with 32 additions and 7 deletions

View File

@ -285,7 +285,7 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
for(auto pfsh: all_plain_floorshapes) {
auto& fsh = *pfsh;
if(!gp::on && !irr::on) {
if(!gp::on && !irr::on && !syntetic) {
// standard and binary
ld hexside = fsh.rad0, heptside = fsh.rad1;
@ -400,7 +400,7 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
sizeto(fsh.b, id);
if(!gp::on && !irr::on && !binarytiling) {
if(!gp::on && !irr::on && !binarytiling && !syntetic) {
generate_matrices_scale(fsh.scale, fsh.noftype);
if(nonbitrunc && geosupport_graveyard() < 2 && fsh.shapeid2) {
if(id == 0) bshape2(fsh.b[0], fsh.prio, fsh.shapeid2, hept_matrices);
@ -474,6 +474,18 @@ void generate_floorshapes() {
else if(gp::on) { /* will be generated on the fly */ }
else if(syntetic) {
heptagon master;
cell model;
model.master = &master;
synt::parent_index_of(&master) = 0;
for(int i=0; i<2*synt::N + (nonbitrunc ? 0 : 2); i++) {
synt::id_of(&master) = i;
model.type = isize(synt::triangles[i]);
generate_floorshapes_for(i, &model, i >= 2*synt::N, 0);
}
}
else {
cell model;
model.type = S6; generate_floorshapes_for(0, &model, 0, 0);
@ -592,6 +604,8 @@ void draw_shapevec(cell *c, const transmatrix& V, const vector<hpcshape> &shv, i
queuepolyat(V, shv[pseudohept(c)], col, prio);
else if(binarytiling)
queuepolyat(V, shv[c->type-6], col, prio);
else if(syntetic)
queuepolyat(V, shv[synt::id_of(c->master)], col, prio);
else
queuepolyat(V, shv[ctof(c)], col, prio);
}

View File

@ -53,7 +53,10 @@ void precalc() {
int vertexdegree = S6/2;
ld fmin, fmax;
if(syntetic) return;
if(syntetic) {
synt::prepare();
return;
}
if(euclid) {
// dynamicval<eGeometry> g(geometry, gNormal);

View File

@ -356,6 +356,10 @@ hyperpoint get_corner_position(cell *c, int cid, ld cf) {
vertices[6] = get_horopoint(-yy, 0);
return mid_at_actual(vertices[cid], 3/cf);
}
if(syntetic) {
int id = synt::id_of(c->master);
return spin(M_PI / c->type * (2*cid+0)) * xpush(synt::circumradius[id/2] * 3 / cf) * C0;
}
if(nonbitrunc) {
return ddspin(c,cid,S6) * xpush0(hcrossf * 3 / cf);
}
@ -394,6 +398,7 @@ hyperpoint midcorner(cell *c, int i, ld v) {
hyperpoint nlfar = rel * vs2.vertices[(spin+2)%cor2];
return mid_at(nfar, nlfar, .49);
}
if(syntetic) return C0;
printf("midcorner not handled\n");
exit(1);
}
@ -411,6 +416,11 @@ hyperpoint nearcorner(cell *c, int i) {
hyperpoint nc = vs.jpoints[vs.neid[i]];
return mid_at(C0, nc, .94);
}
if(syntetic) {
int id = synt::id_of(c->master);
auto& t1 = synt::triangles[id][i];
return spin(-t1.first) * xpush(t1.second) * C0;
}
if(binarytiling) {
ld yx = log(2) / 2;
ld yy = yx;
@ -456,7 +466,7 @@ hyperpoint farcorner(cell *c, int i, int which) {
if(which == 0) return rel * vs2.vertices[(spin+2)%cor2];
if(which == 1) return rel * vs2.vertices[(spin+cor2-1)%cor2];
}
if(binarytiling)
if(binarytiling || syntetic)
return nearcorner(c, (i+which) % c->type); // lazy
printf("farcorner not handled\n");
exit(1);

View File

@ -3190,7 +3190,7 @@ bool placeSidewall(cell *c, int i, int sidepar, const transmatrix& V, int col) {
transmatrix V2 = V * ddspin(c, i);
if(gp::on || irr::on || binarytiling) {
if(gp::on || irr::on || binarytiling || syntetic) {
draw_shapevec(c, V2, qfi.fshape->gpside[sidepar][i], col, prio);
return false;
}

View File

@ -239,8 +239,6 @@ void prepare() {
void initialize(heptagon *h) {
prepare();
/* initialize the root */
parent_index_of(h) = 0;