mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
pointing in 2D modes
This commit is contained in:
parent
3b6071e9fb
commit
e6ff8c041f
@ -4243,7 +4243,12 @@ EX void drawMarkers() {
|
|||||||
|
|
||||||
#if CAP_QUEUE
|
#if CAP_QUEUE
|
||||||
if(lmouseover && vid.drawmousecircle && ok && DEFAULTCONTROL && MOBON && WDIM == 2) {
|
if(lmouseover && vid.drawmousecircle && ok && DEFAULTCONTROL && MOBON && WDIM == 2) {
|
||||||
queuecircleat(lmouseover, .8, darkena(lmouseover->cpdist > 1 ? 0x00FFFF : 0xFF0000, 0, 0xFF));
|
cell *at = lmouseover;
|
||||||
|
#if CAP_VR
|
||||||
|
if(vrhr::state == 2 && vrhr::forward_cell)
|
||||||
|
at = vrhr::forward_cell;
|
||||||
|
#endif
|
||||||
|
queuecircleat(at, .8, darkena(lmouseover->cpdist > 1 ? 0x00FFFF : 0xFF0000, 0, 0xFF));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(global_pushto && vid.drawmousecircle && ok && DEFAULTCONTROL && MOBON && WDIM == 2) {
|
if(global_pushto && vid.drawmousecircle && ok && DEFAULTCONTROL && MOBON && WDIM == 2) {
|
||||||
|
85
vr.cpp
85
vr.cpp
@ -394,12 +394,11 @@ void move_according_to(vr::ETrackedControllerRole role, bool last, bool cur) {
|
|||||||
int id = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(role);
|
int id = vr::VRSystem()->GetTrackedDeviceIndexForControllerRole(role);
|
||||||
if(id >= 0 && id < int(vr::k_unMaxTrackedDeviceCount)) {
|
if(id >= 0 && id < int(vr::k_unMaxTrackedDeviceCount)) {
|
||||||
hyperpoint h;
|
hyperpoint h;
|
||||||
if(true) {
|
if(in_perspective_v()) {
|
||||||
E4;
|
E4;
|
||||||
transmatrix T = (hsm == eHeadset::none ? hmd_at : hmd_ref_at) * vrdata.pose_matrix[id] * sm;
|
transmatrix T = (hsm == eHeadset::none ? hmd_at : hmd_ref_at) * vrdata.pose_matrix[id] * sm;
|
||||||
vrhr::be_33(T);
|
vrhr::be_33(T);
|
||||||
h = T * point31(0, 0, -0.01);
|
h = T * point31(0, 0, -0.01);
|
||||||
}
|
|
||||||
if(last && !cur)
|
if(last && !cur)
|
||||||
movevrdir(h);
|
movevrdir(h);
|
||||||
else {
|
else {
|
||||||
@ -408,6 +407,34 @@ void move_according_to(vr::ETrackedControllerRole role, bool last, bool cur) {
|
|||||||
forward_cell = xc.at;
|
forward_cell = xc.at;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
gen_mv();
|
||||||
|
forward_cell = nullptr;
|
||||||
|
ld best = 1e9;
|
||||||
|
dynamicval<int> dvs (vrhr::state, 2);
|
||||||
|
for(auto p: current_display->all_drawn_copies) {
|
||||||
|
for(auto& V: p.second) {
|
||||||
|
hyperpoint hscr;
|
||||||
|
applymodel(V*C0, hscr);
|
||||||
|
bool changed = false;
|
||||||
|
if(1) {
|
||||||
|
E4; hscr[3] = 1;
|
||||||
|
hyperpoint h = inverse(sm * hmd_at * vrdata.pose_matrix[id] * sm) * hmd_mv * hscr;
|
||||||
|
|
||||||
|
if(h[2] > 0.1) continue;
|
||||||
|
ld d = sqhypot_d(2, h);
|
||||||
|
if(d < best) best = d, forward_cell = p.first, changed = true;
|
||||||
|
}
|
||||||
|
if(changed) mouseh = V * C0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(forward_cell && last && !cur) {
|
||||||
|
calcMousedest();
|
||||||
|
if(!canmove) movepcto(mousedest), remission(); else movepcto(mousedest);
|
||||||
|
forward_cell = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct digital_action_data {
|
struct digital_action_data {
|
||||||
@ -718,6 +745,32 @@ EX void draw_eyes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX void gen_mv() {
|
||||||
|
transmatrix mu;
|
||||||
|
bool pers = in_perspective();
|
||||||
|
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;
|
||||||
|
if(!pers) mu[1][1] *= pconf.stretch;
|
||||||
|
|
||||||
|
hmd_mv = Id;
|
||||||
|
bool nlpu = nisot::local_perspective_used();
|
||||||
|
if(1) {
|
||||||
|
E4;
|
||||||
|
if(nlpu) {
|
||||||
|
be_33(NLP);
|
||||||
|
hmd_mv = NLP * hmd_mv;
|
||||||
|
}
|
||||||
|
hmd_mv = sm * hmd_mv;
|
||||||
|
if(pconf.vr_zshift) hmd_mv = euclidean_translate(0, 0, -pconf.vr_zshift) * hmd_mv;
|
||||||
|
hmd_mv = mu * hmd_mv;
|
||||||
|
if(hsm == eHeadset::model_viewing) {
|
||||||
|
hmd_mv = sm * hmd_at * inverse(hmd_ref_at) * sm * hmd_mv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EX void render() {
|
EX void render() {
|
||||||
|
|
||||||
resetbuffer rb;
|
resetbuffer rb;
|
||||||
@ -744,14 +797,6 @@ EX void render() {
|
|||||||
|
|
||||||
calcparam();
|
calcparam();
|
||||||
|
|
||||||
transmatrix mu;
|
|
||||||
bool pers = in_perspective();
|
|
||||||
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;
|
|
||||||
if(!pers) mu[1][1] *= pconf.stretch;
|
|
||||||
|
|
||||||
if(1) {
|
if(1) {
|
||||||
make_actual_view();
|
make_actual_view();
|
||||||
shiftmatrix Tv = cview();
|
shiftmatrix Tv = cview();
|
||||||
@ -779,27 +824,17 @@ EX void render() {
|
|||||||
// View * inverse(Tv.T);
|
// View * inverse(Tv.T);
|
||||||
// inverse(inverse_shift(cview(), Tv));
|
// inverse(inverse_shift(cview(), Tv));
|
||||||
|
|
||||||
hmd_mvp = Id;
|
|
||||||
bool nlpu = nisot::local_perspective_used();
|
|
||||||
if(1) {
|
if(1) {
|
||||||
|
gen_mv();
|
||||||
E4;
|
E4;
|
||||||
if(nlpu) {
|
|
||||||
be_33(NLP);
|
|
||||||
hmd_mvp = NLP * hmd_mvp;
|
|
||||||
}
|
|
||||||
hmd_mvp = sm * 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;
|
|
||||||
}
|
|
||||||
if(eyes == eEyes::equidistant) {
|
if(eyes == eEyes::equidistant) {
|
||||||
hmd_mvp = inverse(vrdata.eyepos[i]) * hmd_mvp;
|
hmd_mv = inverse(vrdata.eyepos[i]) * hmd_mv;
|
||||||
}
|
}
|
||||||
hmd_mv = hmd_mvp;
|
hmd_mvp = vrdata.proj[i] * hmd_mv;
|
||||||
hmd_mvp = vrdata.proj[i] * hmd_mvp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
eyeproj = vrdata.iproj[i];
|
eyeproj = vrdata.iproj[i];
|
||||||
|
|
||||||
drawqueue();
|
drawqueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user