mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-02 20:29:17 +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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
hyperpoint normalize_flat(hyperpoint h) {
|
EX hyperpoint normalize_flat(hyperpoint h) {
|
||||||
if(prod) return product_decompose(h).second;
|
if(prod) return product_decompose(h).second;
|
||||||
return normalize(h);
|
return normalize(h);
|
||||||
}
|
}
|
||||||
|
@ -842,6 +842,7 @@ EX namespace nisot {
|
|||||||
PHASEFROM(2);
|
PHASEFROM(2);
|
||||||
stop_game();
|
stop_game();
|
||||||
product::configure();
|
product::configure();
|
||||||
|
if(vid.texture_step < 4) vid.texture_step = 4;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
31
polygons.cpp
31
polygons.cpp
@ -704,13 +704,28 @@ void geometry_information::make_wall(int id, vector<hyperpoint> vertices, vector
|
|||||||
|
|
||||||
bshape(shWall3D[id], PPR::WALL);
|
bshape(shWall3D[id], PPR::WALL);
|
||||||
last->flags |= POLY_TRIANGLES;
|
last->flags |= POLY_TRIANGLES;
|
||||||
|
|
||||||
hyperpoint center = Hypc;
|
hyperpoint center = Hypc;
|
||||||
int n = isize(vertices);
|
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;
|
ld w = 0;
|
||||||
for(int i=0; i<n; i++) center += vertices[i] * weights[i], w += weights[i];
|
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++) {
|
for(int a=0; a<n; a++) {
|
||||||
hyperpoint v1 = vertices[a] - center;
|
hyperpoint v1 = vertices[a] - center;
|
||||||
hyperpoint v2 = vertices[(a+1)%n] - center;
|
hyperpoint v2 = vertices[(a+1)%n] - center;
|
||||||
@ -718,7 +733,10 @@ void geometry_information::make_wall(int id, vector<hyperpoint> vertices, vector
|
|||||||
hyperpoint h = center + v1 * x + v2 * y;
|
hyperpoint h = center + v1 * x + v2 * y;
|
||||||
if(nil && (x || y))
|
if(nil && (x || y))
|
||||||
h = nilv::on_geodesic(center, nilv::on_geodesic(v1+center, v2+center, y / (x+y)), 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; }
|
if(sol || !binarytiling) { hpcpush(normalize(h)); return; }
|
||||||
hyperpoint res = binary::parabolic3(h[0], h[1]) * xpush0(yy*h[2]);
|
hyperpoint res = binary::parabolic3(h[0], h[1]) * xpush0(yy*h[2]);
|
||||||
hpcpush(res);
|
hpcpush(res);
|
||||||
@ -730,7 +748,10 @@ void geometry_information::make_wall(int id, vector<hyperpoint> vertices, vector
|
|||||||
int STEP = vid.texture_step;
|
int STEP = vid.texture_step;
|
||||||
for(int a=0; a<n; a++) for(int y=0; y<STEP; y++) {
|
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;
|
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)
|
if(nil)
|
||||||
h = nilv::on_geodesic(vertices[a], vertices[(a+1)%n], y * 1. / STEP);
|
h = nilv::on_geodesic(vertices[a], vertices[(a+1)%n], y * 1. / STEP);
|
||||||
if(sol || !binarytiling) { hpcpush(normalize(h)); continue; }
|
if(sol || !binarytiling) { hpcpush(normalize(h)); continue; }
|
||||||
|
Loading…
Reference in New Issue
Block a user