1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-08-29 16:57:56 +00:00

frustum culling in VR

This commit is contained in:
Zeno Rogue
2021-03-09 16:04:53 +01:00
parent 26b53f0db7
commit 16143f3c9f
2 changed files with 99 additions and 38 deletions

17
vr.cpp
View File

@@ -236,6 +236,17 @@ EX int ui_xmin, ui_ymin, ui_xmax, ui_ymax;
EX reaction_t change_ui_bounds;
#if HDR
struct frustum_info {
transmatrix pre;
transmatrix nlp;
bool screen;
transmatrix proj;
};
#endif
EX vector<frustum_info> frusta;
EX void set_ui_bounds() {
ui_xmin = 0;
ui_ymin = 0;
@@ -1011,6 +1022,7 @@ EX void render() {
track_poses();
resetbuffer rb;
state = 2;
vrhr::frusta.clear();
// cscr = lshiftclick ? eCompScreen::eyes : eCompScreen::single;
@@ -1042,6 +1054,11 @@ EX void render() {
hmd_pre = hmd_pre_for[i] = cview().T * inverse(master_cview.T);
radar_transform = trt.backup * inverse(hmd_pre);
if(i < 2)
frusta.push_back(frustum_info{hmd_pre, NLP, false, vrdata.proj[i]});
else
frusta.push_back(frustum_info{hmd_pre, NLP, true, Id});
if(1) {
gen_mv();
E4;