1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-20 15:40:26 +00:00

depth inversion in rug (used in pentagonal exploration)

This commit is contained in:
Zeno Rogue 2018-09-03 16:32:11 +02:00
parent 638032c47c
commit 59ff4c2266
2 changed files with 6 additions and 3 deletions

View File

@ -1225,6 +1225,7 @@ extern eGeometry gwhere;
extern bool no_fog; extern bool no_fog;
extern ld lowrug, hirug, ruggospeed; extern ld lowrug, hirug, ruggospeed;
extern GLuint alternate_texture; extern GLuint alternate_texture;
extern bool invert_depth;
#endif #endif
} }

View File

@ -1264,6 +1264,8 @@ ld lowrug = 1e-2, hirug = 1e3;
GLuint alternate_texture; GLuint alternate_texture;
bool invert_depth;
void drawRugScene() { void drawRugScene() {
glbuf->use_as_texture(); glbuf->use_as_texture();
if(alternate_texture) if(alternate_texture)
@ -1274,16 +1276,16 @@ void drawRugScene() {
else else
glhr::colorClear(backcolor << 8 | 0xFF); glhr::colorClear(backcolor << 8 | 0xFF);
#ifdef GLES_ONLY #ifdef GLES_ONLY
glClearDepthf(1.0f); glClearDepthf(invert_depth ? -1.0f : 1.0f);
#else #else
glClearDepth(1.0f); glClearDepth(invert_depth ? -1.0f : 1.0f);
#endif #endif
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glDisable(GL_BLEND); glDisable(GL_BLEND);
glhr::switch_mode(glhr::gmLightFog); glhr::switch_mode(glhr::gmLightFog);
glhr::set_depthtest(true); glhr::set_depthtest(true);
glDepthFunc(GL_LESS); glDepthFunc(invert_depth ? GL_GREATER : GL_LESS);
for(int ed=stereo::active() && stereo::mode != stereo::sODS ? -1 : 0; ed < 2; ed += 2) { for(int ed=stereo::active() && stereo::mode != stereo::sODS ? -1 : 0; ed < 2; ed += 2) {
use_precompute = false; use_precompute = false;