Removing stuff that should really go into r_postprocess from the GLSL

This commit is contained in:
Marco Cawthorne 2019-08-18 12:01:57 -07:00
parent 02c7eeb671
commit 304d0969ad
9 changed files with 158 additions and 278 deletions

View file

@ -1,44 +1,29 @@
!!ver 100-450 !!ver 100-450
!!samps 1 !!samps 1
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0 varying vec2 tc;
varying vec4 vc;
//this shader is present for support for gles/gl3core contexts
//it is single-texture-with-vertex-colours, and doesn't do anything special. #ifdef VERTEX_SHADER
//beware that a few things use this, including apparently fonts and bloom rescaling. attribute vec2 v_texcoord;
//its really not meant to do anything special. attribute vec4 v_colour;
void main ()
varying vec2 tc; {
varying vec4 vc; tc = v_texcoord;
vc = v_colour;
#ifdef VERTEX_SHADER gl_Position = ftetransform();
attribute vec2 v_texcoord; }
attribute vec4 v_colour; #endif
void main ()
{ #ifdef FRAGMENT_SHADER
tc = v_texcoord; void main ()
vc = v_colour; {
gl_Position = ftetransform(); vec4 f = vc;
} #ifdef PREMUL
#endif f.rgb *= f.a;
#ifdef FRAGMENT_SHADER #endif
void main () f *= texture2D(s_t0, tc);
{
vec4 f = vc; gl_FragColor = f;
#ifdef PREMUL }
f.rgb *= f.a; #endif
#endif
f *= texture2D(s_t0, tc);
#if gl_fake16bit == 1
f.rgb = floor(f.rgb * vec3(32,64,32))/vec3(32,64,32);
#endif
#if gl_monochrome == 1
float m = (f.r + f.g + f.b) / 3.0f;
f.rgb = vec3(m,m,m);
#endif
gl_FragColor = f;
}
#endif

View file

@ -1,47 +1,27 @@
!!permu FOG !!permu FOG
!!samps 1 !!samps 1
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0 #include "sys/fog.h"
!!cvardf gl_brighten=0 #ifdef VERTEX_SHADER
attribute vec2 v_texcoord;
//meant to be used for additive stuff. presumably particles and sprites. though actually its only flashblend effects that use this at the time of writing. attribute vec4 v_colour;
//includes fog, apparently. varying vec2 tc;
varying vec4 vc;
#include "sys/fog.h" void main ()
#ifdef VERTEX_SHADER {
attribute vec2 v_texcoord; tc = v_texcoord;
attribute vec4 v_colour; vc = v_colour;
varying vec2 tc; gl_Position = ftetransform();
varying vec4 vc; }
void main () #endif
{
tc = v_texcoord; #ifdef FRAGMENT_SHADER
vc = v_colour; varying vec2 tc;
gl_Position = ftetransform(); varying vec4 vc;
} uniform vec4 e_colourident;
#endif void main ()
#ifdef FRAGMENT_SHADER {
varying vec2 tc; vec4 diffuse_f = texture2D(s_t0, tc);
varying vec4 vc; gl_FragColor = fog4additive(diffuse_f * vc * e_colourident);
uniform vec4 e_colourident; }
void main () #endif
{
vec4 diffuse_f = texture2D(s_t0, tc);
#if gl_brighten == 1
diffuse_f.rgb += vec3(0.1f,0.1f,0.1f) * 0.9f;
#endif
#if gl_fake16bit == 1
diffuse_f.rgb = floor(diffuse_f.rgb * vec3(32,64,32))/vec3(32,64,32);
#endif
#if gl_monochrome == 1
float m = (diffuse_f.r + diffuse_f.g + diffuse_f.b) / 3.0f;
diffuse_f.rgb = vec3(m,m,m);
#endif
gl_FragColor = fog4additive(diffuse_f * vc * e_colourident);
}
#endif

View file

@ -1,21 +1,20 @@
!!ver 100-450 !!ver 100-450
!!cvardf gl_fake16bit=0
#ifdef VERTEX_SHADER
#ifdef VERTEX_SHADER attribute vec4 v_colour;
attribute vec4 v_colour; varying vec4 vc;
varying vec4 vc;
void main ()
void main () {
{ vc = v_colour;
vc = v_colour; gl_Position = ftetransform();
gl_Position = ftetransform(); }
} #endif
#endif
#ifdef FRAGMENT_SHADER
#ifdef FRAGMENT_SHADER varying vec4 vc;
varying vec4 vc; void main ()
void main () {
{ gl_FragColor = vc;
gl_FragColor = vc; }
} #endif
#endif

View file

@ -4,9 +4,6 @@
!!permu FOG !!permu FOG
!!samps diffuse reflectcube !!samps diffuse reflectcube
!!cvardf gl_affinemodels=0 !!cvardf gl_affinemodels=0
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0
!!cvardf gl_brighten=0
#include "sys/defs.h" #include "sys/defs.h"
@ -97,19 +94,6 @@ varying vec3 light;
#endif #endif
diffuse_f *= e_colourident; diffuse_f *= e_colourident;
#if gl_brighten == 1
diffuse_f.rgb += vec3(0.1f,0.1f,0.1f) * 0.9f;
#endif
#if gl_fake16bit == 1
diffuse_f.rgb = floor(diffuse_f.rgb * vec3(32,64,32))/vec3(32,64,32);
#endif
#if gl_monochrome == 1
float m = (diffuse_f.r + diffuse_f.g + diffuse_f.b) / 3.0f;
diffuse_f.rgb = vec3(m,m,m);
#endif
gl_FragColor = diffuse_f * e_colourident; gl_FragColor = diffuse_f * e_colourident;
} }
#endif #endif

View file

@ -1,9 +1,6 @@
!!ver 110 !!ver 110
!!permu FOG !!permu FOG
!!samps reflectcube !!samps reflectcube
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0
!!cvardf gl_brighten=0
#include "sys/defs.h" #include "sys/defs.h"
#include "sys/fog.h" #include "sys/fog.h"
@ -21,20 +18,6 @@ void main ()
void main () void main ()
{ {
vec4 skybox = textureCube(s_reflectcube, pos); vec4 skybox = textureCube(s_reflectcube, pos);
#if gl_brighten == 1
skybox.rgb += vec3(0.1f,0.1f,0.1f) * 0.9f;
#endif
#if gl_fake16bit == 1
skybox.rgb = floor(skybox.rgb * vec3(32,64,32))/vec3(32,64,32);
#endif
#if gl_monochrome == 1
float m = (skybox.r + skybox.g + skybox.b) / 3.0f;
skybox.rgb = vec3(m,m,m);
#endif
gl_FragColor = vec4(fog3(skybox.rgb), 1.0); gl_FragColor = vec4(fog3(skybox.rgb), 1.0);
} }
#endif #endif

View file

@ -1,48 +1,36 @@
!!permu FOG !!permu FOG
!!samps 1 !!samps 1
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0 #include "sys/fog.h"
//used by both particles and sprites. #ifdef VERTEX_SHADER
//note the fog blending mode is all that differs from defaultadditivesprite attribute vec2 v_texcoord;
attribute vec4 v_colour;
#include "sys/fog.h" varying vec2 tc;
#ifdef VERTEX_SHADER varying vec4 vc;
attribute vec2 v_texcoord; void main ()
attribute vec4 v_colour; {
varying vec2 tc; tc = v_texcoord;
varying vec4 vc; vc = v_colour;
void main () gl_Position = ftetransform();
{ }
tc = v_texcoord; #endif
vc = v_colour;
gl_Position = ftetransform(); #ifdef FRAGMENT_SHADER
} varying vec2 tc;
#endif varying vec4 vc;
#ifdef FRAGMENT_SHADER uniform vec4 e_colourident;
varying vec2 tc; uniform vec4 e_vlscale;
varying vec4 vc; void main ()
uniform vec4 e_colourident; {
uniform vec4 e_vlscale; vec4 col = texture2D(s_t0, tc);
void main ()
{ #ifdef MASK
vec4 col = texture2D(s_t0, tc); if (col.a < float(MASK))
discard;
#ifdef MASK #endif
if (col.a < float(MASK))
discard; col = fog4blend(col * vc * e_colourident * e_vlscale);
#endif
gl_FragColor = col;
col = fog4blend(col * vc * e_colourident * e_vlscale); }
#endif
#if gl_fake16bit == 1
col.rgb = floor(col.rgb * vec3(32,64,32))/vec3(32,64,32);
#endif
#if gl_monochrome == 1
float m = (col.r + col.g + col.b) / 3.0f;
col.rgb = vec3(m,m,m);
#endif
gl_FragColor = col;
}
#endif

View file

@ -1,8 +1,5 @@
!!ver 110 !!ver 110
!!samps diffuse lightmap reflectcube normalmap !!samps diffuse lightmap reflectcube normalmap
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0
!!cvardf gl_brighten=0
#include "sys/defs.h" #include "sys/defs.h"
@ -72,18 +69,6 @@ varying mat3 invsurface;
#endif #endif
diffuse_f *= e_colourident; diffuse_f *= e_colourident;
#if gl_brighten == 1
diffuse_f.rgb += vec3(0.1f,0.1f,0.1f) * 0.9f;
#endif
#if gl_fake16bit == 1
diffuse_f.rgb = floor(diffuse_f.rgb * vec3(32,64,32))/vec3(32,64,32);
#endif
#if gl_monochrome == 1
float m = (diffuse_f.r + diffuse_f.g + diffuse_f.b) / 3.0f;
diffuse_f.rgb = vec3(m,m,m);
#endif
gl_FragColor = diffuse_f; gl_FragColor = diffuse_f;
} }

View file

@ -1,60 +1,46 @@
!!ver 100 450 !!ver 100 450
!!permu FOG !!permu FOG
!!cvarf r_wateralpha !!cvarf r_wateralpha
!!samps diffuse lightmap !!samps diffuse lightmap
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0 #include "sys/defs.h"
#include "sys/defs.h" #include "sys/fog.h"
varying vec2 tc;
//this is the shader that's responsible for drawing default q1 turbulant water surfaces #ifdef LIT
//this is expected to be moderately fast. varying vec2 lm0;
#endif
#include "sys/fog.h" #ifdef VERTEX_SHADER
varying vec2 tc; void main ()
#ifdef LIT {
varying vec2 lm0; tc = v_texcoord.st;
#endif #ifdef FLOW
#ifdef VERTEX_SHADER tc.s += e_time * -0.5;
void main () #endif
{ #ifdef LIT
tc = v_texcoord.st; lm0 = v_lmcoord;
#ifdef FLOW #endif
tc.s += e_time * -0.5; gl_Position = ftetransform();
#endif }
#ifdef LIT #endif
lm0 = v_lmcoord; #ifdef FRAGMENT_SHADER
#endif #ifndef ALPHA
gl_Position = ftetransform(); uniform float cvar_r_wateralpha;
} #define USEALPHA cvar_r_wateralpha
#endif #else
#ifdef FRAGMENT_SHADER #define USEALPHA float(ALPHA)
#ifndef ALPHA #endif
uniform float cvar_r_wateralpha; void main ()
#define USEALPHA cvar_r_wateralpha {
#else vec2 ntc;
#define USEALPHA float(ALPHA) ntc.s = tc.s + sin(tc.t+e_time)*0.125;
#endif ntc.t = tc.t + sin(tc.s+e_time)*0.125;
void main () vec3 ts = vec3(texture2D(s_diffuse, ntc));
{
vec2 ntc; #ifdef LIT
ntc.s = tc.s + sin(tc.t+e_time)*0.125; ts *= (texture2D(s_lightmap, lm0) * e_lmscale).rgb;
ntc.t = tc.t + sin(tc.s+e_time)*0.125; #endif
vec3 ts = vec3(texture2D(s_diffuse, ntc));
gl_FragColor = fog4(vec4(ts, USEALPHA) * e_colourident);
#ifdef LIT }
ts *= (texture2D(s_lightmap, lm0) * e_lmscale).rgb; #endif
#endif
#if gl_fake16bit == 1
ts.rgb = floor(ts.rgb * vec3(32,64,32))/vec3(32,64,32);
#endif
#if gl_monochrome == 1
float m = (ts.r + ts.g + ts.b) / 3.0f;
ts.rgb = vec3(m,m,m);
#endif
gl_FragColor = fog4(vec4(ts, USEALPHA) * e_colourident);
}
#endif

View file

@ -1,7 +1,5 @@
!!ver 110 !!ver 110
!!samps diffuse reflectcube normalmap !!samps diffuse reflectcube normalmap
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0
#include "sys/defs.h" #include "sys/defs.h"
@ -59,14 +57,6 @@ varying mat3 invsurface;
out_f.rgb = mix( textureCube(s_reflectcube, cube_c ).rgb, diffuse_f.rgb, diffuse_f.a); out_f.rgb = mix( textureCube(s_reflectcube, cube_c ).rgb, diffuse_f.rgb, diffuse_f.a);
diffuse_f = out_f * e_colourident; diffuse_f = out_f * e_colourident;
#if gl_fake16bit == 1
diffuse_f.rgb = floor(diffuse_f.rgb * vec3(32,64,32))/vec3(32,64,32);
#endif
#if gl_monochrome == 1
float m = (diffuse_f.r + diffuse_f.g + diffuse_f.b) / 3.0f;
diffuse_f.rgb = vec3(m,m,m);
#endif
gl_FragColor = diffuse_f; gl_FragColor = diffuse_f;
} }
#endif #endif