Added gl_stipplealpha for fun, as well as rm_unlit_additive and rm_unlit_texture

to override the expected behaviour of rendering additive/texture rendermode
surfaces fullbright.
This commit is contained in:
Marco Cawthorne 2020-10-24 07:04:30 +02:00
parent 2daf3da59f
commit cce2429308
2 changed files with 44 additions and 4 deletions

View file

@ -10,6 +10,7 @@
!!samps =LIGHTSTYLED lightmap1 lightmap2 lightmap3
!!cvardf gl_mono=0
!!cvardf gl_kdither=0
!!cvardf gl_stipplealpha=0
#include "sys/defs.h"
@ -143,6 +144,33 @@ varying mat3 invsurface;
diffuse_f *= e_colourident;
// awful stipple alpha code
if (gl_stipplealpha == 1.0) {
float alpha = e_colourident.a;
int x = int(mod(gl_FragCoord.x, 2.0));
int y = int(mod(gl_FragCoord.y, 2.0));
if (alpha <= 0.0) {
discard;
} else if (alpha <= 0.25) {
diffuse_f.a = 1.0f;
if (x + y == 2)
discard;
if (x + y == 1)
discard;
} else if (alpha <= 0.5) {
diffuse_f.a = 1.0f;
if (x + y == 2)
discard;
if (x + y == 0)
discard;
} else if (alpha < 1.0) {
diffuse_f.a = 1.0f;
if (x + y == 2)
discard;
}
}
if (gl_mono == 1.0) {
float bw = (diffuse_f.r + diffuse_f.g + diffuse_f.b) / 3.0;
diffuse_f.rgb = vec3(bw, bw, bw);

View file

@ -19,6 +19,8 @@
* for reference. I thank thee fellow soldiers at sven manor! */
var int autocvar_cl_showtriggers = FALSE;
var int autocvar_rm_unlit_additive = TRUE;
var int autocvar_rm_unlit_texture = TRUE;
string __fullspawndata;
string Sentences_GetSamples(string);
@ -47,8 +49,13 @@ CBaseEntity::RenderFXPass(void)
case RM_COLOR:
break;
case RM_TEXTURE:
drawflags = 7;
abslight = 255;
if (autocvar_rm_unlit_texture == 0) {
drawflags = 0;
abslight = 0;
} else {
drawflags = 7;
abslight = 255;
}
break;
case RM_GLOW:
if (checkpvs(vecPlayer, this) == FALSE)
@ -76,8 +83,13 @@ CBaseEntity::RenderFXPass(void)
break;
case RM_ADDITIVE:
effects = EF_ADDITIVE;
drawflags = 7;
abslight = 255;
if (autocvar_rm_unlit_additive == 0) {
drawflags = 0;
abslight = 0;
} else {
drawflags = 7;
abslight = 255;
}
break;
case RM_FULLBRIGHT:
alpha = 1.0f;