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
!!samps 1
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0
//this shader is present for support for gles/gl3core contexts
//it is single-texture-with-vertex-colours, and doesn't do anything special.
//beware that a few things use this, including apparently fonts and bloom rescaling.
//its really not meant to do anything special.
varying vec2 tc;
varying vec4 vc;
#ifdef VERTEX_SHADER
attribute vec2 v_texcoord;
attribute vec4 v_colour;
void main ()
{
tc = v_texcoord;
vc = v_colour;
gl_Position = ftetransform();
}
#endif
#ifdef FRAGMENT_SHADER
void main ()
{
vec4 f = vc;
#ifdef PREMUL
f.rgb *= f.a;
#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
!!ver 100-450
!!samps 1
varying vec2 tc;
varying vec4 vc;
#ifdef VERTEX_SHADER
attribute vec2 v_texcoord;
attribute vec4 v_colour;
void main ()
{
tc = v_texcoord;
vc = v_colour;
gl_Position = ftetransform();
}
#endif
#ifdef FRAGMENT_SHADER
void main ()
{
vec4 f = vc;
#ifdef PREMUL
f.rgb *= f.a;
#endif
f *= texture2D(s_t0, tc);
gl_FragColor = f;
}
#endif

View file

@ -1,47 +1,27 @@
!!permu FOG
!!samps 1
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0
!!cvardf gl_brighten=0
//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.
//includes fog, apparently.
#include "sys/fog.h"
#ifdef VERTEX_SHADER
attribute vec2 v_texcoord;
attribute vec4 v_colour;
varying vec2 tc;
varying vec4 vc;
void main ()
{
tc = v_texcoord;
vc = v_colour;
gl_Position = ftetransform();
}
#endif
#ifdef FRAGMENT_SHADER
varying vec2 tc;
varying vec4 vc;
uniform vec4 e_colourident;
void main ()
{
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
!!permu FOG
!!samps 1
#include "sys/fog.h"
#ifdef VERTEX_SHADER
attribute vec2 v_texcoord;
attribute vec4 v_colour;
varying vec2 tc;
varying vec4 vc;
void main ()
{
tc = v_texcoord;
vc = v_colour;
gl_Position = ftetransform();
}
#endif
#ifdef FRAGMENT_SHADER
varying vec2 tc;
varying vec4 vc;
uniform vec4 e_colourident;
void main ()
{
vec4 diffuse_f = texture2D(s_t0, tc);
gl_FragColor = fog4additive(diffuse_f * vc * e_colourident);
}
#endif

View file

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

View file

@ -4,9 +4,6 @@
!!permu FOG
!!samps diffuse reflectcube
!!cvardf gl_affinemodels=0
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0
!!cvardf gl_brighten=0
#include "sys/defs.h"
@ -97,19 +94,6 @@ varying vec3 light;
#endif
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;
}
#endif

View file

@ -1,9 +1,6 @@
!!ver 110
!!permu FOG
!!samps reflectcube
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0
!!cvardf gl_brighten=0
#include "sys/defs.h"
#include "sys/fog.h"
@ -21,20 +18,6 @@ void main ()
void main ()
{
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);
}
#endif

View file

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

View file

@ -1,8 +1,5 @@
!!ver 110
!!samps diffuse lightmap reflectcube normalmap
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0
!!cvardf gl_brighten=0
#include "sys/defs.h"
@ -72,18 +69,6 @@ varying mat3 invsurface;
#endif
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;
}

View file

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

View file

@ -1,7 +1,5 @@
!!ver 110
!!samps diffuse reflectcube normalmap
!!cvardf gl_fake16bit=0
!!cvardf gl_monochrome=0
#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);
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;
}
#endif