From 73c689211fc8613c8b02915c0d15a36af06de003 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 11 Oct 2022 19:56:37 +0200 Subject: [PATCH] shader flag to use no fog -- useful to display ultra-ideal points --- drawing.cpp | 3 +++ shaders.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index 96921ec1..47a72229 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -39,6 +39,7 @@ static const int POLY_FAT = (1<<26); // fatten this model in WRL expo static const int POLY_SHADE_TEXTURE = (1<<27); // texture has 'z' coordinate for shading static const int POLY_ONE_LEVEL = (1<<28); // only one level of the universal cover in SL(2,R) static const int POLY_APEIROGONAL = (1<<29); // only vertices indexed up to she are drawn as the boundary +static const int POLY_NO_FOG = (1<<30); // disable fog for this /** \brief A graphical element that can be drawn. Objects are not drawn immediately but rather queued. * @@ -679,6 +680,7 @@ void dqi_poly::gldraw() { else glhr::be_textured(); if(flags & POLY_SHADE_TEXTURE) current_display->next_shader_flags |= GF_TEXTURE_SHADED; + if(flags & POLY_NO_FOG) current_display->next_shader_flags |= GF_NO_FOG; glBindTexture(GL_TEXTURE_2D, tinf->texture_id); if(isize(tinf->colors)) glhr::vertices_texture_color(v, tinf->tvertices, tinf->colors, offset, offset_texture); @@ -688,6 +690,7 @@ void dqi_poly::gldraw() { } else { glhr::be_nontextured(); + if(flags & POLY_NO_FOG) current_display->next_shader_flags |= GF_NO_FOG; glhr::vertices(v); } diff --git a/shaders.cpp b/shaders.cpp index ee56a1d4..51d63c4b 100644 --- a/shaders.cpp +++ b/shaders.cpp @@ -18,8 +18,9 @@ constexpr flagtype GF_VARCOLOR = 2; constexpr flagtype GF_LIGHTFOG = 4; constexpr flagtype GF_LEVELS = 8; constexpr flagtype GF_TEXTURE_SHADED = 16; +constexpr flagtype GF_NO_FOG = 32; -constexpr flagtype GF_which = 31; +constexpr flagtype GF_which = 63; constexpr flagtype SF_PERS3 = 256; constexpr flagtype SF_BAND = 512; @@ -393,7 +394,10 @@ shared_ptr write_shader(flagtype shader_flags) { if(!skip_t) { vmain += "mediump vec4 t = uMV * aPosition;\n"; vmain += coordinator; - if(GDIM == 3 && WDIM == 2 && hyperbolic && context_fog && pmodel == mdPerspective) { + if(shader_flags & GF_NO_FOG) { + vmain += "// no fog used"; + } + else if(GDIM == 3 && WDIM == 2 && hyperbolic && context_fog && pmodel == mdPerspective) { vsh += "uniform mediump mat4 uRadarTransform;\n" "uniform mediump sampler2D tAirMap;\n"