1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-09-11 23:06:00 +00:00

various changes and fixes to make coolfog and sky work correctly in VR

This commit is contained in:
Zeno Rogue
2021-03-09 13:12:53 +01:00
parent 9f5591249a
commit 56485f20a9
6 changed files with 44 additions and 32 deletions

26
sky.cpp
View File

@@ -138,13 +138,8 @@ void compute_skyvertices(const vector<sky_item>& sky) {
void dqi_sky::draw() {
if(!vid.usingGL || sky.empty()) return;
if(centerover != sky_centerover) {
sky_centerover = centerover;
sky_cview = cview();
compute_skyvertices(sky);
}
transmatrix s = cview().T * inverse(sky_cview.T);
transmatrix s = (vrhr::rendering() ? vrhr::master_cview : cview()).T * inverse(sky_cview.T);
for(int ed = current_display->stereo_active() ? -1 : 0; ed<2; ed+=2) {
if(global_projection && global_projection != ed) continue;
current_display->next_shader_flags = GF_VARCOLOR;
@@ -153,8 +148,9 @@ void dqi_sky::draw() {
glhr::projection_multiply(glhr::tmtogl(xpush(-vid.ipd * global_projection/2)));
glapplymatrix(xpush(vid.ipd * global_projection/2) * s);
}
else
else {
glapplymatrix(s);
}
glhr::prepare(skyvertices);
glhr::set_fogbase(1.0 + 5 / sightranges[geometry]);
glhr::set_depthtest(model_needs_depth() && prio < PPR::SUPERLINE);
@@ -382,7 +378,15 @@ EX struct renderbuffer *airbuf;
EX void make_air() {
if(!sky) return;
if(vrhr::active()) return;
if(centerover != sky_centerover) {
sky_centerover = centerover;
sky_cview = cview();
compute_skyvertices(sky->sky);
}
if(!context_fog) return;
const int AIR_TEXTURE = 512;
if(!airbuf) {
airbuf = new renderbuffer(AIR_TEXTURE, AIR_TEXTURE, true);
@@ -394,6 +398,10 @@ EX void make_air() {
}
}
#if CAP_VR
dynamicval<int> i(vrhr::state, 0);
#endif
if(1) {
//shot::take("airtest.png", drawqueue);
dynamicval<videopar> v(vid, vid);