1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

adjust_animation as a separate function

This commit is contained in:
Zeno Rogue 2020-12-24 22:59:44 +01:00
parent 7c2f343960
commit 7c9bfc7719

View File

@ -1313,6 +1313,26 @@ void settings_menu() {
dialog::display(); dialog::display();
} }
void adjust_animation(ld part) {
if(solnil) {
hyperpoint sh = pView * C0;
sh = lerp(C0, sh, 1-part);
pView = eupush(sh);
smooth = inverse(pView);
}
else {
transmatrix T = pView * inverse(tView);
hyperpoint vec = inverse_exp(shiftless(tC0(T)));
transmatrix Tspin = gpushxto0(tC0(T)) * T;
ld alpha = atan2(Tspin*xpush0(1));
println(hlog, "vec=", vec, " part = ", part);
pView = spin(alpha * part) * gpushxto0(direct_exp(vec*part)) * pView;
fixmatrix(pView);
View = tView;
smooth = inverse(pView) * cview().T;
}
}
void run() { void run() {
clearMessages(); clearMessages();
@ -1336,25 +1356,8 @@ void run() {
View = pView; View = pView;
smooth = Id; smooth = Id;
} }
else if(solnil) { else adjust_animation((ticks - last_adjust) * 1. / (when_t - last_adjust));
ld part = (ticks - last_adjust) * 1. / (when_t - last_adjust);
hyperpoint sh = pView * C0;
sh = lerp(C0, sh, 1-part);
pView = eupush(sh);
smooth = inverse(pView);
}
else {
ld part = (ticks - last_adjust) * 1. / (when_t - last_adjust);
transmatrix T = pView * inverse(tView);
hyperpoint vec = inverse_exp(shiftless(tC0(T)));
transmatrix Tspin = gpushxto0(tC0(T)) * T;
ld alpha = atan2(Tspin*xpush0(1));
pView = spin(alpha * part) * gpushxto0(direct_exp(vec*part)) * pView;
fixmatrix(pView);
View = tView;
smooth = inverse(pView) * cview().T;
// println(hlog, "smooth = ", smooth);
}
last_adjust = ticks; last_adjust = ticks;
ray::want_use = 2; ray::want_use = 2;