mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-13 02:40:33 +00:00
shift_method gets more possible arguments
This commit is contained in:
parent
5da1b8f88e
commit
814467082f
@ -5042,11 +5042,11 @@ EX ld wall_radar(cell *c, transmatrix T, transmatrix LPe, ld max) {
|
||||
ld step = max / 20;
|
||||
ld fixed_yshift = 0;
|
||||
for(int i=0; i<20; i++) {
|
||||
T = shift_object(T, ori, ztangent(-step), shift_method(false));
|
||||
T = shift_object(T, ori, ztangent(-step), shift_method(smaWallRadar));
|
||||
virtualRebase(c, T);
|
||||
color_t col;
|
||||
if(isWall3(c, col) || (WDIM == 2 && GDIM == 3 && tC0(T)[2] > cgi.FLOOR)) {
|
||||
T = shift_object(T, ori, ztangent(step), shift_method(false));
|
||||
T = shift_object(T, ori, ztangent(step), shift_method(smaWallRadar));
|
||||
step /= 2; i = 17;
|
||||
if(step < 1e-3) break;
|
||||
}
|
||||
|
@ -1629,24 +1629,30 @@ EX ld xcross(ld x1, ld y1, ld x2, ld y2) { return x1 + (x2 - x1) * y1 / (y1 - y2
|
||||
#if HDR
|
||||
enum eShiftMethod { smProduct, smIsometric, smEmbedded, smLie, smGeodesic };
|
||||
enum eEmbeddedShiftMethodChoice { smcNone, smcBoth, smcAuto };
|
||||
enum eShiftMethodApplication { smaManualCamera, smaAutocenter, smaObject, smaWallRadar };
|
||||
#endif
|
||||
|
||||
EX eEmbeddedShiftMethodChoice embedded_shift_method_choice = smcBoth;
|
||||
|
||||
EX bool use_embedded_shift(bool automatic) {
|
||||
if(automatic) return embedded_shift_method_choice;
|
||||
return embedded_shift_method_choice == smcBoth;
|
||||
EX bool use_embedded_shift(eShiftMethodApplication sma) {
|
||||
switch(sma) {
|
||||
case smaAutocenter: return embedded_shift_method_choice != smcNone;
|
||||
case smaManualCamera: return embedded_shift_method_choice == smcBoth;
|
||||
case smaObject: return true;
|
||||
case smaWallRadar: return among(pmodel, mdLiePerspective, mdLieOrthogonal);
|
||||
default: throw hr_exception("unknown sma");
|
||||
}
|
||||
}
|
||||
|
||||
EX eShiftMethod shift_method(bool automatic IS(false)) {
|
||||
EX eShiftMethod shift_method(eShiftMethodApplication sma) {
|
||||
if(gproduct) return smProduct;
|
||||
if(embedded_plane && use_embedded_shift(automatic)) return nonisotropic ? smLie : smEmbedded;
|
||||
if(embedded_plane && use_embedded_shift(sma)) return nonisotropic ? smLie : smEmbedded;
|
||||
if(!nonisotropic && !stretch::in()) return smIsometric;
|
||||
if(!nisot::geodesic_movement && !embedded_plane) return smLie;
|
||||
return smGeodesic;
|
||||
}
|
||||
|
||||
EX transmatrix shift_object(const transmatrix Position, const transmatrix& ori, const hyperpoint direction, eShiftMethod sm IS(shift_method(true))) {
|
||||
EX transmatrix shift_object(const transmatrix Position, const transmatrix& ori, const hyperpoint direction, eShiftMethod sm IS(shift_method(smaObject))) {
|
||||
switch(sm) {
|
||||
case smGeodesic:
|
||||
return nisot::parallel_transport(Position, direction);
|
||||
@ -1665,7 +1671,7 @@ EX transmatrix shift_object(const transmatrix Position, const transmatrix& ori,
|
||||
}
|
||||
}
|
||||
|
||||
EX void apply_shift_object(transmatrix& Position, const transmatrix orientation, const hyperpoint direction, eShiftMethod sm IS(shift_method(true))) {
|
||||
EX void apply_shift_object(transmatrix& Position, const transmatrix orientation, const hyperpoint direction, eShiftMethod sm IS(shift_method(smaObject))) {
|
||||
Position = shift_object(Position, orientation, direction, sm);
|
||||
}
|
||||
|
||||
|
12
hypgraph.cpp
12
hypgraph.cpp
@ -2115,9 +2115,9 @@ EX void centerpc(ld aspd) {
|
||||
if(R < aspd) fix_whichcopy_if_near();
|
||||
|
||||
if(R < aspd)
|
||||
shift_view_to(shiftless(H), shift_method(true));
|
||||
shift_view_to(shiftless(H), shift_method(smaAutocenter));
|
||||
else
|
||||
shift_view_towards(shiftless(H), aspd, shift_method(true));
|
||||
shift_view_towards(shiftless(H), aspd, shift_method(smaAutocenter));
|
||||
|
||||
fixmatrix(View);
|
||||
fixmatrix(current_display->which_copy);
|
||||
@ -3207,7 +3207,7 @@ EX hyperpoint lie_log(hyperpoint h) {
|
||||
}
|
||||
|
||||
/** shift the view according to the given tangent vector */
|
||||
EX transmatrix get_shift_view_of(const hyperpoint H, const transmatrix V, eShiftMethod sm IS(shift_method())) {
|
||||
EX transmatrix get_shift_view_of(const hyperpoint H, const transmatrix V, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
||||
switch(sm) {
|
||||
case smProduct:
|
||||
return rgpushxto0(direct_exp(lp_iapply(H))) * V;
|
||||
@ -3230,7 +3230,7 @@ EX transmatrix get_shift_view_of(const hyperpoint H, const transmatrix V, eShift
|
||||
}
|
||||
|
||||
/** shift the view according to the given tangent vector */
|
||||
EX void shift_view(hyperpoint H, eShiftMethod sm IS(shift_method())) {
|
||||
EX void shift_view(hyperpoint H, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
||||
if(callhandlers(false, hooks_shift_view, H)) return;
|
||||
static bool recursive = false;
|
||||
if(!recursive && intra::in) {
|
||||
@ -3310,7 +3310,7 @@ EX transmatrix map_relative_push(hyperpoint h) {
|
||||
return rgpushxto0(h);
|
||||
}
|
||||
|
||||
EX void shift_view_to(shiftpoint H, eShiftMethod sm IS(shift_method())) {
|
||||
EX void shift_view_to(shiftpoint H, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
||||
switch(sm) {
|
||||
case smIsometric:
|
||||
case smEmbedded:
|
||||
@ -3328,7 +3328,7 @@ EX void shift_view_to(shiftpoint H, eShiftMethod sm IS(shift_method())) {
|
||||
}
|
||||
}
|
||||
|
||||
EX void shift_view_towards(shiftpoint H, ld l, eShiftMethod sm IS(shift_method())) {
|
||||
EX void shift_view_towards(shiftpoint H, ld l, eShiftMethod sm IS(shift_method(smaManualCamera))) {
|
||||
switch(sm) {
|
||||
case smIsometric:
|
||||
case smEmbedded:
|
||||
|
Loading…
Reference in New Issue
Block a user