1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

product:: wallradar and TPP

This commit is contained in:
Zeno Rogue 2019-08-20 18:02:03 +02:00
parent 47823ef0fb
commit 597140e28d
4 changed files with 24 additions and 10 deletions

View File

@ -7161,16 +7161,16 @@ EX purehookset hooks_drawmap;
EX transmatrix actual_view_transform;
EX ld wall_radar(cell *c, transmatrix T, ld max) {
EX ld wall_radar(cell *c, transmatrix T, transmatrix LPe, ld max) {
if(pmodel != mdPerspective || !vid.use_wall_radar) return max;
ld step = max / 20;
ld fixed_yshift = 0;
for(int i=0; i<20; i++) {
T = solmul_pt(T, cpush(2, -step));
virtualRebase(c, T, false);
T = solmul_pt(T, LPe, zpush(-step));
virtualRebase(c, T, true);
color_t col;
if(isWall3(c, col) || (WDIM == 2 && GDIM == 3 && tC0(T)[2] > cgi.FLOOR)) {
T = solmul_pt(T, cpush(2, step));
T = solmul_pt(T, LPe, zpush(step));
step /= 2; i = 17;
if(step < 1e-3) break;
}
@ -7187,8 +7187,11 @@ EX void make_actual_view() {
#if MAXMDIM >= 4
if(GDIM == 3) {
ld max = WDIM == 2 ? vid.camera : vid.yshift;
if(max)
actual_view_transform = solmul(zpush(wall_radar((masterless ? centerover.at : viewcenter()), inverse(View), max)), nisot::local_perspective, actual_view_transform * View) * inverse(View);
if(max) {
transmatrix Start = inverse(actualV(viewctr, actual_view_transform * View));
ld d = wall_radar(viewcenter(), Start, nisot::local_perspective, max);
actual_view_transform = solmul(zpush(d), nisot::local_perspective, actual_view_transform * View) * inverse(View);
}
camera_level = asin_auto(tC0(inverse(actual_view_transform * View))[2]);
}
if(nonisotropic) {

View File

@ -951,7 +951,12 @@ EX transmatrix solmul(const transmatrix T, const transmatrix LPe, const transmat
}
EX transmatrix solmul_pt(const transmatrix Position, const transmatrix T) {
if(nonisotropic) return nisot::parallel_transport(Position, T);
if(nonisotropic) return nisot::parallel_transport(Position, Id, T);
else return Position * T;
}
EX transmatrix solmul_pt(const transmatrix Position, const transmatrix LPe, const transmatrix T) {
if(nonisotropic || prod) return nisot::parallel_transport(Position, LPe, T);
else return Position * T;
}

View File

@ -911,6 +911,7 @@ EX bool confusingGeometry() {
}
EX ld master_to_c7_angle() {
if(prod) return product::in_underlying_geometry(master_to_c7_angle);
ld alpha = 0;
#if CAP_GP
if(cgi.gpdata) alpha = cgi.gpdata->alpha;
@ -919,6 +920,7 @@ EX ld master_to_c7_angle() {
}
EX transmatrix actualV(const heptspin& hs, const transmatrix& V) {
if(prod) return PIU(actualV(hs, V));
if(WDIM == 3) return V;
#if CAP_IRR
if(IRREGULAR)

View File

@ -821,8 +821,12 @@ EX namespace nisot {
{ dynamicval<eGeometry> g(geometry, gSphere); hr::fixmatrix(gtl); }
T = push * gtl;
}
EX transmatrix parallel_transport(const transmatrix Position, const transmatrix T) {
EX transmatrix parallel_transport(const transmatrix Position, const transmatrix LPe, const transmatrix T) {
if(prod) {
hyperpoint h = product::direct_exp(inverse(LPe) * product::inverse_exp(tC0(T)));
return Position * rgpushxto0(h);
}
auto P = Position;
nisot::fixmatrix(P);
if(!geodesic_movement) return inverse(eupush(Position * inverse(T) * inverse(Position) * C0)) * Position;
@ -840,7 +844,7 @@ EX namespace nisot {
const transmatrix V1 = inverse(IV);
return V1 * eupush(IV * T * V1 * C0);
}
return inverse(parallel_transport(inverse(V), inverse(T)));
return inverse(parallel_transport(inverse(V), Id, inverse(T)));
}
EX transmatrix spin_towards(const transmatrix Position, const hyperpoint goal) {