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

added CAP_VR

This commit is contained in:
Zeno Rogue 2019-09-16 10:39:00 +02:00
parent a59dc8be58
commit 5c1568d288
2 changed files with 16 additions and 0 deletions

View File

@ -245,8 +245,15 @@ EX void start_projection(int ed, bool perspective) {
glhr::projection_multiply(glhr::translate(tx, -ty, 0));
}
#if CAP_VR
EX hookset<bool()> *hooks_vr_eye_view, *hooks_vr_eye_projection;
#endif
EX void eyewidth_translate(int ed) {
glhr::using_eyeshift = false;
#if CAP_VR
if(callhandlers(false, hooks_vr_eye_view)) ; else
#endif
if(ed) glhr::projection_multiply(glhr::translate(-ed * current_display->eyewidth(), 0, 0));
}
@ -414,6 +421,9 @@ void display_data::set_projection(int ed) {
eyewidth_translate(ed);
#if CAP_VR
if(callhandlers(false, hooks_vr_eye_projection)) ; else
#endif
if(pers3) {
glhr::projection_multiply(glhr::frustum(current_display->tanfov, current_display->tanfov * cd->ysize / cd->xsize));
glhr::projection_multiply(glhr::scale(1, -1, -1));

View File

@ -1852,6 +1852,9 @@ EX void draw_main() {
}
}
#if CAP_VR
EX hookset<bool()> *hooks_vr_draw_all;
#endif
EX void drawqueue() {
callhooks(hook_drawqueue);
@ -1906,6 +1909,9 @@ EX void drawqueue() {
spherephase = 0;
reset_projection();
#if CAP_VR
if(callhandlers(false, hooks_vr)) {} else
#endif
if(model_needs_depth() && current_display->stereo_active()) {
global_projection = -1;
draw_main();