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

moved vr_scale_factor and vr_zshift to pconf, and added some new projection parameters for the future

This commit is contained in:
Zeno Rogue 2020-12-27 17:11:19 +01:00
parent 319bd1574f
commit ec70119c3e
2 changed files with 13 additions and 7 deletions

View File

@ -259,6 +259,10 @@ struct projection_configuration {
ld product_z_scale;
ld rotational_nil;
ld depth_scaling;
ld hyperboloid_scaling;
ld vr_angle, vr_zshift, vr_scale_factor;
projection_configuration() {
formula = "z^2"; top_z = 5; model_transition = 1; spiral_angle = 70; spiral_x = 10; spiral_y = 7;
rotational_nil = 1;
@ -273,6 +277,11 @@ struct projection_configuration {
loximuthal_parameter = 0;
winkel_parameter = .5;
show_hyperboloid_flat = true;
depth_scaling = 1;
vr_angle = 0;
hyperboloid_scaling = 1;
vr_zshift = 0;
vr_scale_factor = 1;
}
};

11
vr.cpp
View File

@ -387,9 +387,6 @@ EX void vr_shift() {
EX ld absolute_unit_in_meters = 3;
EX ld vr_scale_factor = 2;
EX ld vr_zshift = 0;
void move_according_to(vr::ETrackedControllerRole role, bool last, bool cur) {
if(!last && !cur) return;
int id = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(role);
@ -753,7 +750,7 @@ EX void render() {
transmatrix mu;
bool pers = in_perspective();
ld sca = pers ? absolute_unit_in_meters : vr_scale_factor;
ld sca = pers ? absolute_unit_in_meters : pconf.vr_scale_factor;
for(int i=0; i<4; i++)
for(int j=0; j<4; j++)
mu[i][j] = i!=j ? 0 : i==3 ? 1 : sca;
@ -795,7 +792,7 @@ EX void render() {
hmd_mvp = NLP * hmd_mvp;
}
hmd_mvp = sm * hmd_mvp;
if(vr_zshift) hmd_mvp = euclidean_translate(0, 0, -vr_zshift) * hmd_mvp;
if(pconf.vr_zshift) hmd_mvp = euclidean_translate(0, 0, -pconf.vr_zshift) * hmd_mvp;
hmd_mvp = mu * hmd_mvp;
if(hsm == eHeadset::model_viewing) {
hmd_mvp = sm * hmd_at * inverse(hmd_ref_at) * sm * hmd_mvp;
@ -917,11 +914,11 @@ int readArgs() {
}
else if(argis("-vr-scale")) {
PHASEFROM(2);
shift_arg_formula(vr_scale_factor);
shift_arg_formula(pconf.vr_scale_factor);
}
else if(argis("-vr-z")) {
PHASEFROM(2);
shift_arg_formula(vr_zshift);
shift_arg_formula(pconf.vr_zshift);
}
else if(argis("-d:vr")) {
PHASEFROM(2); launch_dialog(show_vr_settings);