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

new hypot functions in textures

This commit is contained in:
? 2019-02-27 23:41:45 +01:00 committed by Zeno Rogue
parent a0bd6bf4b5
commit d95a6ae0d7

View File

@ -621,7 +621,8 @@ ld magic_quality() {
applymodel(ggmatrix(p.c) * p.cell_relative, inmodel);
inmodel[0] *= current_display->radius * 1. / current_display->scrsize;
inmodel[1] *= current_display->radius * 1. / current_display->scrsize;
q += intvalxy(inmodel, p.texture_coords);
using namespace hyperpoint_vec;
q += sqhypot_d(2, inmodel - p.texture_coords);
}
return q;
}
@ -697,7 +698,7 @@ void mousemovement() {
// do not zoom in portrait!
if(nonzero && !newmove) {
View = inverse(spintox(mouseeu)) * spintox(lastmouse) * View;
vid.scale = vid.scale * sqrt(intvalxy(C0, mouseeu)) / sqrt(intvalxy(C0, lastmouse));
vid.scale = vid.scale * sqhypot_d(2, mouseeu) / sqhypot_d(2, lastmouse);
config.perform_mapping();
}
if(nonzero) lastmouse = mouseeu;
@ -707,7 +708,7 @@ void mousemovement() {
case tpsProjection: {
if(nonzero && !newmove) {
vid.alpha = vid.alpha * sqrt(intvalxy(C0, mouseeu)) / sqrt(intvalxy(C0, lastmouse));
vid.alpha = vid.alpha * sqhypot_d(2, mouseeu) / sqhypot_d(2, lastmouse);
}
if(nonzero) lastmouse = mouseeu;
newmove = false;