mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-18 23:10:26 +00:00
vr:: renamed functions to more accurate names, and fixed pointing in WDIM==2
This commit is contained in:
parent
5ec9f06383
commit
9fc21b67e1
2
rug.cpp
2
rug.cpp
@ -1344,7 +1344,7 @@ EX shiftpoint gethyper(ld x, ld y) {
|
|||||||
mx = my = 0;
|
mx = my = 0;
|
||||||
E4;
|
E4;
|
||||||
vrhr::gen_mv();
|
vrhr::gen_mv();
|
||||||
T = vrhr::screen_to_controller(which_pointer);
|
T = vrhr::model_to_controller(which_pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
calcparam();
|
calcparam();
|
||||||
|
14
vr.cpp
14
vr.cpp
@ -148,7 +148,8 @@ struct vrdata_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** 0,1 == eyes, 2 == headset */
|
/** 0,1 == eyes, 2 == headset */
|
||||||
transmatrix hmd_mv_for[3], hmd_pre_for[3];
|
EX transmatrix hmd_mv_for[3];
|
||||||
|
EX transmatrix hmd_pre_for[3];
|
||||||
|
|
||||||
vrdata_t vrdata;
|
vrdata_t vrdata;
|
||||||
|
|
||||||
@ -475,11 +476,11 @@ EX eModel pmodel_3d_version() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** convert model coordinates to controller-relative coordinates */
|
/** convert model coordinates to controller-relative coordinates */
|
||||||
EX transmatrix screen_to_controller(int id) {
|
EX transmatrix model_to_controller(int id) {
|
||||||
return inverse(sm * hmd_at * vrdata.pose_matrix[id] * sm) * hmd_mv;
|
return inverse(sm * hmd_at * vrdata.pose_matrix[id] * sm) * hmd_mv;
|
||||||
}
|
}
|
||||||
|
|
||||||
hyperpoint perceived_location(shiftpoint h, int id, bool& bad) {
|
EX hyperpoint model_location(shiftpoint h, bool& bad) {
|
||||||
if(eyes == eEyes::truesim) {
|
if(eyes == eEyes::truesim) {
|
||||||
|
|
||||||
hyperpoint eye_at[2], tangent[2];
|
hyperpoint eye_at[2], tangent[2];
|
||||||
@ -530,10 +531,11 @@ hyperpoint perceived_location(shiftpoint h, int id, bool& bad) {
|
|||||||
ld vr_distance(const shiftpoint& h, int id, ld& dist) {
|
ld vr_distance(const shiftpoint& h, int id, ld& dist) {
|
||||||
|
|
||||||
bool bad;
|
bool bad;
|
||||||
hyperpoint hscr = perceived_location(h, id, bad);
|
hyperpoint hscr = model_location(h, bad);
|
||||||
if(bad) return 1e5;
|
if(bad) return 1e5;
|
||||||
E4; hyperpoint hc = screen_to_controller(id) * hscr;
|
bool flat = WDIM == 2;
|
||||||
if(WDIM == 2) {
|
E4; hyperpoint hc = model_to_controller(id) * hscr;
|
||||||
|
if(flat) {
|
||||||
if(hc[2] > 0.1) return 1e6; /* behind */
|
if(hc[2] > 0.1) return 1e6; /* behind */
|
||||||
dist = -hc[2];
|
dist = -hc[2];
|
||||||
return sqhypot_d(2, hc);
|
return sqhypot_d(2, hc);
|
||||||
|
Loading…
Reference in New Issue
Block a user