mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-23 15:36:59 +00:00
product:: 'flat' wall faces
This commit is contained in:
parent
43a3d0130e
commit
e02290ec98
@ -30,7 +30,7 @@ vector<hyperpoint> geometry_information::get_shape(hpcshape sh) {
|
||||
return res;
|
||||
}
|
||||
|
||||
hyperpoint normalize_flat(hyperpoint h) {
|
||||
EX hyperpoint normalize_flat(hyperpoint h) {
|
||||
if(prod) return product_decompose(h).second;
|
||||
return normalize(h);
|
||||
}
|
||||
|
@ -842,6 +842,7 @@ EX namespace nisot {
|
||||
PHASEFROM(2);
|
||||
stop_game();
|
||||
product::configure();
|
||||
if(vid.texture_step < 4) vid.texture_step = 4;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
27
polygons.cpp
27
polygons.cpp
@ -707,9 +707,24 @@ void geometry_information::make_wall(int id, vector<hyperpoint> vertices, vector
|
||||
|
||||
hyperpoint center = Hypc;
|
||||
int n = isize(vertices);
|
||||
|
||||
vector<ld> altitudes;
|
||||
if(prod) {
|
||||
altitudes.resize(n);
|
||||
for(int i=0; i<n; i++) {
|
||||
auto d = product_decompose(vertices[i]);
|
||||
altitudes[i] = d.first;
|
||||
vertices[i] = d.second;
|
||||
}
|
||||
}
|
||||
|
||||
ld w = 0;
|
||||
for(int i=0; i<n; i++) center += vertices[i] * weights[i], w += weights[i];
|
||||
center /= w;
|
||||
if(prod) center = normalize_flat(center);
|
||||
else center /= w;
|
||||
|
||||
ld center_altitude = 0;
|
||||
if(prod) for(int i=0; i<n; i++) center_altitude += altitudes[i] * weights[i] / w;
|
||||
|
||||
for(int a=0; a<n; a++) {
|
||||
hyperpoint v1 = vertices[a] - center;
|
||||
@ -718,7 +733,10 @@ void geometry_information::make_wall(int id, vector<hyperpoint> vertices, vector
|
||||
hyperpoint h = center + v1 * x + v2 * y;
|
||||
if(nil && (x || y))
|
||||
h = nilv::on_geodesic(center, nilv::on_geodesic(v1+center, v2+center, y / (x+y)), x + y);
|
||||
if(prod) { hpcpush(h); return; }
|
||||
if(prod) {
|
||||
h = zshift(normalize_flat(h), center_altitude * (1-x-y) + altitudes[a] * x + altitudes[(a+1)%n] * y);
|
||||
hpcpush(h); return;
|
||||
}
|
||||
if(sol || !binarytiling) { hpcpush(normalize(h)); return; }
|
||||
hyperpoint res = binary::parabolic3(h[0], h[1]) * xpush0(yy*h[2]);
|
||||
hpcpush(res);
|
||||
@ -730,7 +748,10 @@ void geometry_information::make_wall(int id, vector<hyperpoint> vertices, vector
|
||||
int STEP = vid.texture_step;
|
||||
for(int a=0; a<n; a++) for(int y=0; y<STEP; y++) {
|
||||
hyperpoint h = (vertices[a] * (STEP-y) + vertices[(a+1)%n] * y)/STEP;
|
||||
if(prod) { hpcpush(h); continue; }
|
||||
if(prod) {
|
||||
h = zshift(normalize_flat(h), (altitudes[a] * (STEP-y) + altitudes[(a+1)%n] * y) / STEP);
|
||||
hpcpush(h); continue;
|
||||
}
|
||||
if(nil)
|
||||
h = nilv::on_geodesic(vertices[a], vertices[(a+1)%n], y * 1. / STEP);
|
||||
if(sol || !binarytiling) { hpcpush(normalize(h)); continue; }
|
||||
|
Loading…
Reference in New Issue
Block a user