mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-02 09:52:49 +00:00
matrix dialog now used for models::rotation
This commit is contained in:
parent
3eb2813667
commit
757579fb18
@ -430,7 +430,7 @@ EX void full_rotate_camera(int dir, ld val) {
|
|||||||
|
|
||||||
EX void full_rotate_view(ld h, ld v) {
|
EX void full_rotate_view(ld h, ld v) {
|
||||||
if(history::on && !rug::rug_control())
|
if(history::on && !rug::rug_control())
|
||||||
models::rotation += h * camera_rot_speed;
|
models::rotation = spin(h * camera_rot_speed) * models::rotation;
|
||||||
else {
|
else {
|
||||||
rotate_view(cspin(0, 1, v * camera_rot_speed));
|
rotate_view(cspin(0, 1, v * camera_rot_speed));
|
||||||
didsomething = true;
|
didsomething = true;
|
||||||
|
@ -453,7 +453,7 @@ EX namespace history {
|
|||||||
if(1) {
|
if(1) {
|
||||||
// block for RAII
|
// block for RAII
|
||||||
dynamicval<videopar> dv(vid, vid);
|
dynamicval<videopar> dv(vid, vid);
|
||||||
dynamicval<ld> dr(models::rotation, 0);
|
dynamicval<trans23> dr(models::rotation, Id);
|
||||||
dynamicval<bool> di(inHighQual, true);
|
dynamicval<bool> di(inHighQual, true);
|
||||||
|
|
||||||
renderbuffer glbuf(bandfull, bandfull, vid.usingGL);
|
renderbuffer glbuf(bandfull, bandfull, vid.usingGL);
|
||||||
|
@ -221,6 +221,10 @@ struct trans23 {
|
|||||||
dim = 4; t.v3 = v3 * T.v3;
|
dim = 4; t.v3 = v3 * T.v3;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
friend trans23 operator * (transmatrix M, trans23 T) {
|
||||||
|
trans23 t(M);
|
||||||
|
return M * T;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** mirror image */
|
/** mirror image */
|
||||||
|
@ -2073,10 +2073,10 @@ EX void spinEdge(ld aspd) {
|
|||||||
}
|
}
|
||||||
else if(keep_vertical()) {
|
else if(keep_vertical()) {
|
||||||
hyperpoint h = vertical_vector();
|
hyperpoint h = vertical_vector();
|
||||||
downspin = -atan2(h[0], h[1]);
|
|
||||||
if(ds.qty && GDIM == 2) {
|
if(ds.qty && GDIM == 2) {
|
||||||
downspin += models::rotation * degree;
|
h = rot_inverse(models::rotation.get()) * h;
|
||||||
}
|
}
|
||||||
|
downspin = -atan2(h[0], h[1]);
|
||||||
if(ds.qty) {
|
if(ds.qty) {
|
||||||
cyclefix(downspin, 0);
|
cyclefix(downspin, 0);
|
||||||
downspin = downspin * min(ds.speed, (double)1);
|
downspin = downspin * min(ds.speed, (double)1);
|
||||||
|
@ -363,6 +363,13 @@ int read_legacy_args() {
|
|||||||
shift(); println(hlog, "-ballangle not implemented");
|
shift(); println(hlog, "-ballangle not implemented");
|
||||||
// shift_arg_formula(vpconf.ballangle);
|
// shift_arg_formula(vpconf.ballangle);
|
||||||
}
|
}
|
||||||
|
else if(argis("-crot")) {
|
||||||
|
PHASEFROM(2);
|
||||||
|
shift(); shift(); shift(); println(hlog, "-crot not implemented");
|
||||||
|
/* shift_arg_formula(models::rotation);
|
||||||
|
if(GDIM == 3) shift_arg_formula(models::rotation_xz);
|
||||||
|
if(GDIM == 3) shift_arg_formula(models::rotation_xy2); */
|
||||||
|
}
|
||||||
else return 1;
|
else return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
60
models.cpp
60
models.cpp
@ -142,9 +142,7 @@ projection_configuration::projection_configuration() {
|
|||||||
|
|
||||||
EX namespace models {
|
EX namespace models {
|
||||||
|
|
||||||
EX ld rotation = 0;
|
EX trans23 rotation;
|
||||||
EX ld rotation_xz = 90;
|
|
||||||
EX ld rotation_xy2 = 90;
|
|
||||||
EX int do_rotate = 1;
|
EX int do_rotate = 1;
|
||||||
EX bool model_straight, model_straight_yz;
|
EX bool model_straight, model_straight_yz;
|
||||||
|
|
||||||
@ -157,8 +155,8 @@ EX namespace models {
|
|||||||
EX void scr_to_ori(transmatrix& h) { if(!model_straight) h = iso_inverse(pconf.mori().get()) * h; }
|
EX void scr_to_ori(transmatrix& h) { if(!model_straight) h = iso_inverse(pconf.mori().get()) * h; }
|
||||||
|
|
||||||
EX transmatrix rotmatrix() {
|
EX transmatrix rotmatrix() {
|
||||||
if(GDIM == 2 || gproduct) return spin(rotation * degree);
|
if(gproduct) return rotation.v2;
|
||||||
return spin(rotation_xy2 * degree) * cspin(0, 2, -rotation_xz * degree) * spin(rotation * degree);
|
return rotation.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
int spiral_id = 7;
|
int spiral_id = 7;
|
||||||
@ -356,30 +354,6 @@ EX namespace models {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void edit_rotation(ld& which) {
|
|
||||||
dialog::editNumber(which, 0, 360, 90, 0, XLAT("rotation"),
|
|
||||||
"This controls the automatic rotation of the world. "
|
|
||||||
"It affects the line animation in the history mode, and "
|
|
||||||
"lands which have a special direction. Note that if finding this special direction is a part of the puzzle, "
|
|
||||||
"it works only in the cheat mode.");
|
|
||||||
dialog::get_di().dialogflags |= sm::CENTER;
|
|
||||||
dialog::get_di().extra_options = [] () {
|
|
||||||
dialog::addBreak(100);
|
|
||||||
dialog::addBoolItem_choice("line animation only", models::do_rotate, 0, 'N');
|
|
||||||
dialog::addBoolItem_choice("gravity lands", models::do_rotate, 1, 'G');
|
|
||||||
dialog::addBoolItem_choice("all directional lands", models::do_rotate, 2, 'D');
|
|
||||||
if(GDIM == 3) {
|
|
||||||
dialog::addBreak(100);
|
|
||||||
dialog::addSelItem(XLAT("XY plane"), fts(models::rotation) + "°", 'A');
|
|
||||||
dialog::add_action([] { popScreen(); edit_rotation(models::rotation); });
|
|
||||||
dialog::addSelItem(XLAT("XZ plane"), fts(models::rotation_xz) + "°", 'B');
|
|
||||||
dialog::add_action([] { popScreen(); edit_rotation(models::rotation_xz); });
|
|
||||||
dialog::addSelItem(XLAT("XY plane #2"), fts(models::rotation_xy2) + "°", 'C');
|
|
||||||
dialog::add_action([] { popScreen(); edit_rotation(models::rotation_xy2); });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
EX void model_list() {
|
EX void model_list() {
|
||||||
cmode = sm::SIDE | sm::MAYDARK | sm::CENTER;
|
cmode = sm::SIDE | sm::MAYDARK | sm::CENTER;
|
||||||
gamescreen();
|
gamescreen();
|
||||||
@ -456,13 +430,9 @@ EX namespace models {
|
|||||||
if(nonisotropic && !sl2)
|
if(nonisotropic && !sl2)
|
||||||
dialog::addBoolItem_action(XLAT("geodesic movement in Sol/Nil"), nisot::geodesic_movement, 'G');
|
dialog::addBoolItem_action(XLAT("geodesic movement in Sol/Nil"), nisot::geodesic_movement, 'G');
|
||||||
|
|
||||||
dialog::addBoolItem(XLAT("rotation"), do_rotate == 2, 'r');
|
add_edit((GDIM == 2 || gproduct) ? rotation.v2 : rotation.v3);
|
||||||
if(do_rotate == 0) dialog::lastItem().value = XLAT("NEVER");
|
if(do_rotate == 0) { dialog::lastItem().value = XLAT("NEVER"); dialog::lastItem().type = dialog::diItem; }
|
||||||
if(GDIM == 2)
|
else { dialog::lastItem().value = ONOFF(do_rotate == 2); }
|
||||||
dialog::lastItem().value += " " + its(rotation) + "°";
|
|
||||||
else
|
|
||||||
dialog::lastItem().value += " " + its(rotation) + "°" + its(rotation_xz) + "°" + its(rotation_xy2) + "°";
|
|
||||||
dialog::add_action([] { edit_rotation(rotation); });
|
|
||||||
|
|
||||||
bool vr_settings = vrhr::active() && set_vr_settings;
|
bool vr_settings = vrhr::active() && set_vr_settings;
|
||||||
|
|
||||||
@ -870,12 +840,6 @@ EX namespace models {
|
|||||||
PHASEFROM(2);
|
PHASEFROM(2);
|
||||||
shift_arg_formula(vpconf.rotational_nil);
|
shift_arg_formula(vpconf.rotational_nil);
|
||||||
}
|
}
|
||||||
else if(argis("-crot")) {
|
|
||||||
PHASEFROM(2);
|
|
||||||
shift_arg_formula(models::rotation);
|
|
||||||
if(GDIM == 3) shift_arg_formula(models::rotation_xz);
|
|
||||||
if(GDIM == 3) shift_arg_formula(models::rotation_xy2);
|
|
||||||
}
|
|
||||||
else if(argis("-clip")) {
|
else if(argis("-clip")) {
|
||||||
PHASEFROM(2);
|
PHASEFROM(2);
|
||||||
shift_arg_formula(vpconf.clip_min);
|
shift_arg_formula(vpconf.clip_min);
|
||||||
@ -968,9 +932,15 @@ EX namespace models {
|
|||||||
addsaver(polygonal::coefi[i], "polynomial "+its(i)+".imag");
|
addsaver(polygonal::coefi[i], "polynomial "+its(i)+".imag");
|
||||||
}
|
}
|
||||||
|
|
||||||
param_f(models::rotation, "rotation", "conformal rotation");
|
auto setrot = [] {
|
||||||
addsaver(models::rotation_xz, "conformal rotation_xz");
|
dialog::addBreak(100);
|
||||||
addsaver(models::rotation_xy2, "conformal rotation_2");
|
dialog::addBoolItem_choice("line animation only", models::do_rotate, 0, 'N');
|
||||||
|
dialog::addBoolItem_choice("gravity lands", models::do_rotate, 1, 'G');
|
||||||
|
dialog::addBoolItem_choice("all directional lands", models::do_rotate, 2, 'D');
|
||||||
|
};
|
||||||
|
|
||||||
|
param_matrix(models::rotation.v2, "rotation", 2)->editable("conformal rotation", "", 'r')->set_extra(setrot);
|
||||||
|
param_matrix(models::rotation.v3, "rotation3", 3)->editable("conformal rotation in 3D", "", 'r')->set_extra(setrot);
|
||||||
addsaver(models::do_rotate, "conformal rotation mode", 1);
|
addsaver(models::do_rotate, "conformal rotation mode", 1);
|
||||||
|
|
||||||
param_f(pconf.halfplane_scale, "hp", "halfplane scale", 1);
|
param_f(pconf.halfplane_scale, "hp", "halfplane scale", 1);
|
||||||
|
4
quit.cpp
4
quit.cpp
@ -236,9 +236,9 @@ EX hint hints[] = {
|
|||||||
popScreen();
|
popScreen();
|
||||||
auto m = pmodel;
|
auto m = pmodel;
|
||||||
pmodel = mdBand;
|
pmodel = mdBand;
|
||||||
int r = models::rotation;
|
auto r = models::rotation;
|
||||||
bool h = history::includeHistory;
|
bool h = history::includeHistory;
|
||||||
models::rotation = 0;
|
models::rotation = Id;
|
||||||
history::includeHistory = true;
|
history::includeHistory = true;
|
||||||
history::create_playerpath();
|
history::create_playerpath();
|
||||||
cancel = [m,r,h] () {
|
cancel = [m,r,h] () {
|
||||||
|
6
tour.cpp
6
tour.cpp
@ -829,8 +829,8 @@ EX slide default_slides[] = {
|
|||||||
if(mode == 1)
|
if(mode == 1)
|
||||||
pmodel = mdHalfplane, smart = vid.use_smart_range, vid.use_smart_range = 2;
|
pmodel = mdHalfplane, smart = vid.use_smart_range, vid.use_smart_range = 2;
|
||||||
if(mode == 2)
|
if(mode == 2)
|
||||||
models::rotation = cwt.at->land == laDungeon ? 0 : 2;
|
models::rotation = cwt.at->land == laDungeon ? Id : spin(M_PI);
|
||||||
if(mode == 3) pmodel = mdDisk, models::rotation = 0, vid.use_smart_range = smart;
|
if(mode == 3) pmodel = mdDisk, models::rotation = Id, vid.use_smart_range = smart;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{"Curvature", 29, LEGAL::ANY,
|
{"Curvature", 29, LEGAL::ANY,
|
||||||
@ -978,7 +978,7 @@ EX slide default_slides[] = {
|
|||||||
"memory.",
|
"memory.",
|
||||||
[] (presmode mode) {
|
[] (presmode mode) {
|
||||||
static int smart;
|
static int smart;
|
||||||
if(mode == 1) pmodel = mdBand, history::create_playerpath(), models::rotation = 0,
|
if(mode == 1) pmodel = mdBand, history::create_playerpath(), models::rotation = Id,
|
||||||
smart = vid.use_smart_range, vid.use_smart_range = 2;
|
smart = vid.use_smart_range, vid.use_smart_range = 2;
|
||||||
if(mode == 3) {
|
if(mode == 3) {
|
||||||
history::clear(), pmodel = mdDisk;
|
history::clear(), pmodel = mdDisk;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user