1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-19 19:54:47 +00:00

shader flag to use no fog -- useful to display ultra-ideal points

This commit is contained in:
Zeno Rogue 2022-10-11 19:56:37 +02:00
parent 9184532036
commit 73c689211f
2 changed files with 9 additions and 2 deletions

View File

@ -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);
}

View File

@ -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<glhr::GLprogram> 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"