From 59ff4c226699e4e9072e9f8c03574c4732b0547e Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 3 Sep 2018 16:32:11 +0200 Subject: [PATCH] depth inversion in rug (used in pentagonal exploration) --- hyper.h | 1 + rug.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hyper.h b/hyper.h index 1771f05e..94df37ee 100644 --- a/hyper.h +++ b/hyper.h @@ -1225,6 +1225,7 @@ extern eGeometry gwhere; extern bool no_fog; extern ld lowrug, hirug, ruggospeed; extern GLuint alternate_texture; +extern bool invert_depth; #endif } diff --git a/rug.cpp b/rug.cpp index 9dec74f6..e37d720a 100644 --- a/rug.cpp +++ b/rug.cpp @@ -1264,6 +1264,8 @@ ld lowrug = 1e-2, hirug = 1e3; GLuint alternate_texture; +bool invert_depth; + void drawRugScene() { glbuf->use_as_texture(); if(alternate_texture) @@ -1274,16 +1276,16 @@ void drawRugScene() { else glhr::colorClear(backcolor << 8 | 0xFF); #ifdef GLES_ONLY - glClearDepthf(1.0f); + glClearDepthf(invert_depth ? -1.0f : 1.0f); #else - glClearDepth(1.0f); + glClearDepth(invert_depth ? -1.0f : 1.0f); #endif glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glDisable(GL_BLEND); glhr::switch_mode(glhr::gmLightFog); 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) { use_precompute = false;