mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
product:: works for bitruncated tilings
This commit is contained in:
parent
ebcaabf692
commit
a2919f5a9c
@ -773,8 +773,14 @@ void set_floor(const transmatrix& spin, hpcshape& sh) {
|
|||||||
qfi.usershape = -1;
|
qfi.usershape = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int shvid(cell *c) {
|
EX int shvid(cell *c) {
|
||||||
if(geosupport_football() == 2)
|
if(prod) {
|
||||||
|
int d;
|
||||||
|
cell *c1 = product::get_where(c).first;
|
||||||
|
product::in_underlying_map([&] { d = shvid(c1); });
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
else if(geosupport_football() == 2)
|
||||||
return pseudohept(c);
|
return pseudohept(c);
|
||||||
else if(geometry == gBinaryTiling)
|
else if(geometry == gBinaryTiling)
|
||||||
return c->type-6;
|
return c->type-6;
|
||||||
|
@ -272,6 +272,8 @@ hpcshape
|
|||||||
|
|
||||||
int SD3, SD6, SD7, S12, S14, S21, S28, S42, S36, S84;
|
int SD3, SD6, SD7, S12, S14, S21, S28, S42, S36, S84;
|
||||||
|
|
||||||
|
vector<int> walloffsets;
|
||||||
|
|
||||||
vector<array<int, 3>> symmetriesAt;
|
vector<array<int, 3>> symmetriesAt;
|
||||||
|
|
||||||
#ifndef SCALETUNER
|
#ifndef SCALETUNER
|
||||||
@ -311,6 +313,9 @@ hpcshape
|
|||||||
void make_sidewalls();
|
void make_sidewalls();
|
||||||
void procedural_shapes();
|
void procedural_shapes();
|
||||||
void make_wall(int id, const vector<hyperpoint> vertices, vector<ld> weights = equal_weights);
|
void make_wall(int id, const vector<hyperpoint> vertices, vector<ld> weights = equal_weights);
|
||||||
|
|
||||||
|
void reserve_wall3d(int i);
|
||||||
|
void compute_cornerbonus();
|
||||||
void create_wall3d();
|
void create_wall3d();
|
||||||
void configure_floorshapes();
|
void configure_floorshapes();
|
||||||
|
|
||||||
|
@ -4524,6 +4524,7 @@ void radar_grid(cell *c, const transmatrix& V) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int wall_offset(cell *c) {
|
int wall_offset(cell *c) {
|
||||||
|
if(prod) return product::wall_offset(c);
|
||||||
if(penrose && kite::getshape(c->master) == kite::pKite) return 10;
|
if(penrose && kite::getshape(c->master) == kite::pKite) return 10;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -641,6 +641,36 @@ EX namespace product {
|
|||||||
dynamicval<geometry_information*> gc(cgip, underlying_cgip);
|
dynamicval<geometry_information*> gc(cgip, underlying_cgip);
|
||||||
return mscale(get_corner_position(c, i), exp(plevel * z/2));
|
return mscale(get_corner_position(c, i), exp(plevel * z/2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX int wall_offset(cell *c) {
|
||||||
|
int id = shvid(c);
|
||||||
|
if(isize(cgi.walloffsets) <= id) cgi.walloffsets.resize(id+1, -1);
|
||||||
|
int &wo = cgi.walloffsets[id];
|
||||||
|
if(wo == -1) {
|
||||||
|
cell *c1 = get_where(c).first;
|
||||||
|
wo = isize(cgi.shWall3D);
|
||||||
|
println(hlog, "generating a model for ", c->type-2, "+2");
|
||||||
|
int won = wo + c->type;
|
||||||
|
cgi.shWall3D.resize(won);
|
||||||
|
cgi.shPlainWall3D.resize(won);
|
||||||
|
cgi.shWireframe3D.resize(won);
|
||||||
|
cgi.shMiniWall3D.resize(won);
|
||||||
|
|
||||||
|
for(int i=0; i<c1->type; i++)
|
||||||
|
cgi.make_wall(wo + i, {product::get_corner(c1, i, -1), product::get_corner(c1, i, +1), product::get_corner(c1, i+1, +1), product::get_corner(c1, i+1, -1)});
|
||||||
|
for(int a: {0,1}) {
|
||||||
|
vector<hyperpoint> l;
|
||||||
|
int z = a ? 1 : -1;
|
||||||
|
for(int i=0; i<c1->type; i++)
|
||||||
|
l.push_back(product::get_corner(c1, i, z));
|
||||||
|
cgi.make_wall(won-2+a, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
cgi.compute_cornerbonus();
|
||||||
|
cgi.extra_vertices();
|
||||||
|
}
|
||||||
|
return wo;
|
||||||
|
}
|
||||||
|
|
||||||
EX bool product_sphere() { return ginf[underlying].cclass == gcSphere; }
|
EX bool product_sphere() { return ginf[underlying].cclass == gcSphere; }
|
||||||
|
|
||||||
|
29
polygons.cpp
29
polygons.cpp
@ -781,13 +781,16 @@ vector<hyperpoint> make5(hyperpoint a, hyperpoint b, hyperpoint c) {
|
|||||||
return {a, (a+b)/2, b, b+c-a, c};
|
return {a, (a+b)/2, b, b+c-a, c};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void geometry_information::reserve_wall3d(int i) {
|
||||||
|
shWall3D.resize(i);
|
||||||
|
shPlainWall3D.resize(i);
|
||||||
|
shWireframe3D.resize(i);
|
||||||
|
shMiniWall3D.resize(i);
|
||||||
|
}
|
||||||
|
|
||||||
void geometry_information::create_wall3d() {
|
void geometry_information::create_wall3d() {
|
||||||
if(WDIM == 2) return;
|
if(WDIM == 2) return;
|
||||||
int howmany = penrose ? 22 : prod ? S7+2 : S7;
|
reserve_wall3d(penrose ? 22 : prod ? 0 : S7);
|
||||||
shWall3D.resize(howmany);
|
|
||||||
shPlainWall3D.resize(howmany);
|
|
||||||
shWireframe3D.resize(howmany);
|
|
||||||
shMiniWall3D.resize(howmany);
|
|
||||||
if(GDIM == 3 && binarytiling && geometry == gBinary3) {
|
if(GDIM == 3 && binarytiling && geometry == gBinary3) {
|
||||||
hyperpoint h00 = point3(-1,-1,-1);
|
hyperpoint h00 = point3(-1,-1,-1);
|
||||||
hyperpoint h01 = point3(-1,0,-1);
|
hyperpoint h01 = point3(-1,0,-1);
|
||||||
@ -885,17 +888,7 @@ void geometry_information::create_wall3d() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(prod) {
|
if(prod) {
|
||||||
cell model;
|
walloffsets.clear();
|
||||||
model.type = S7;
|
|
||||||
for(int i=0; i<S7; i++)
|
|
||||||
make_wall(i, {product::get_corner(&model, i, -1), product::get_corner(&model, i, +1), product::get_corner(&model, i+1, +1), product::get_corner(&model, i+1, -1)});
|
|
||||||
for(int a: {0,1}) {
|
|
||||||
vector<hyperpoint> l;
|
|
||||||
int z = a ? 1 : -1;
|
|
||||||
for(int i=0; i<S7; i++)
|
|
||||||
l.push_back(product::get_corner(&model, i, z));
|
|
||||||
make_wall(S7+a, l);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GDIM == 3 && euclid && S7 == 6) {
|
if(GDIM == 3 && euclid && S7 == 6) {
|
||||||
@ -991,6 +984,10 @@ void geometry_information::create_wall3d() {
|
|||||||
for(int i=0; i<isize(kv.first); i++) make_wall(i, kv.first[i], kv.second[i]);
|
for(int i=0; i<isize(kv.first); i++) make_wall(i, kv.first[i], kv.second[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compute_cornerbonus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void geometry_information::compute_cornerbonus() {
|
||||||
corner_bonus = 0;
|
corner_bonus = 0;
|
||||||
for(hpcshape sh: shWall3D) for(int i=sh.s; i<sh.e; i++)
|
for(hpcshape sh: shWall3D) for(int i=sh.s; i<sh.e; i++)
|
||||||
corner_bonus = max(corner_bonus, hdist0(hpc[i]));
|
corner_bonus = max(corner_bonus, hdist0(hpc[i]));
|
||||||
|
Loading…
Reference in New Issue
Block a user