apparently I forgot to add some files.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5122 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-06-30 05:32:00 +00:00
parent 783ef32e67
commit a255ee0def
7 changed files with 191 additions and 0 deletions

View File

@ -0,0 +1,36 @@
!!cvard3 r_floorcolour
!!cvard3 r_wallcolour
//FIXME !!permu FOG
struct a2v {
float4 pos: POSITION;
float2 lmtc: TEXCOORD1;
float3 normal: NORMAL;
};
struct v2f {
#ifndef FRAGMENT_SHADER
float4 pos: POSITION;
#endif
float2 lmtc: TEXCOORD0;
float4 col: TEXCOORD1; //tc not colour to preserve range for oversaturation
};
#ifdef VERTEX_SHADER
float4x4 m_modelviewprojection;
float4 e_lmscale;
v2f main (a2v inp)
{
v2f outp;
outp.pos = mul(m_modelviewprojection, inp.pos);
outp.lmtc = inp.lmtc;
outp.col = e_lmscale * float4(((inp.normal.z < 0.73)?r_wallcolour:r_floorcolour)/255.0, 1.0);
return outp;
}
#endif
#ifdef FRAGMENT_SHADER
sampler s_t0;
float4 main (v2f inp) : COLOR0
{
return inp.col * tex2D(s_t0, inp.lmtc).xyzw;
}
#endif

View File

@ -0,0 +1,23 @@
!!samps 1
#include "sys/defs.h"
//apply gaussian filter
varying vec2 tc;
#ifdef VERTEX_SHADER
void main ()
{
tc = v_texcoord;
gl_Position = ftetransform();
}
#endif
#ifdef FRAGMENT_SHADER
/*offset should be 1.2 pixels away from the center*/
void main ()
{
gl_FragColor =
0.3125 * texture2D(s_t0, tc - e_glowmod.st) +
0.375 * texture2D(s_t0, tc) +
0.3125 * texture2D(s_t0, tc + e_glowmod.st);
}
#endif

View File

@ -0,0 +1,21 @@
!!samps 1
!!cvar3f r_bloom_filter=.7,.7,.7
#include "sys/defs.h"
//the bloom filter
//filter out any texels which are not to bloom
varying vec2 tc;
#ifdef VERTEX_SHADER
void main ()
{
tc = v_texcoord;
gl_Position = ftetransform();
}
#endif
#ifdef FRAGMENT_SHADER
void main ()
{
gl_FragColor.rgb = (texture2D(s_t0, tc).rgb - cvar_r_bloom_filter)/(1.0-cvar_r_bloom_filter);
}
#endif

View File

@ -0,0 +1,28 @@
!!samps 4
!!cvarf r_bloom
!!cvarf r_bloom_retain=1.0
#include "sys/defs.h"
//add them together
//optionally apply tonemapping
varying vec2 tc;
#ifdef VERTEX_SHADER
void main ()
{
tc = v_texcoord;
gl_Position = ftetransform();
}
#endif
#ifdef FRAGMENT_SHADER
void main ()
{
gl_FragColor =
cvar_r_bloom_retain * texture2D(s_t0, tc) +
cvar_r_bloom*(
texture2D(s_t1, tc) +
texture2D(s_t2, tc) +
texture2D(s_t3, tc)
) ;
}
#endif

View File

@ -0,0 +1,19 @@
#include "sys/defs.h"
#ifdef VERTEX_SHADER
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

@ -0,0 +1,31 @@
!!permu FOG
!!samps 1
!!argf MASK=0
!!cvarb r_fog_exp2=true
//used by both particles and sprites.
//note the fog blending mode is all that differs from defaultadditivesprite
#include "sys/defs.h"
#include "sys/fog.h"
#ifdef VERTEX_SHADER
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;
void main ()
{
vec4 col = texture2D(s_t0, tc);
if (arg_MASK!=0.0 && col.a < float(arg_MASK))
discard;
gl_FragColor = fog4blend(col * vc * e_colourident);
}
#endif

View File

@ -0,0 +1,33 @@
!!permu FOG
!!cvar3f r_floorcolor
!!cvar3f r_wallcolor
!!cvarb r_fog_exp2=true
!!samps 1
#include "sys/defs.h"
//this is for the '286' preset walls, and just draws lightmaps coloured based upon surface normals.
#include "sys/fog.h"
varying vec4 col;
#ifdef VERTEX_SHADER
//attribute vec3 v_normal;
//attribute vec2 v_lmcoord;
varying vec2 lm;
//uniform vec3 cvar_r_wallcolor;
//uniform vec3 cvar_r_floorcolor;
//uniform vec4 e_lmscale;
void main ()
{
col = vec4(e_lmscale.rgb/255.0 * ((v_normal.z < 0.73)?cvar_r_wallcolor:cvar_r_floorcolor), e_lmscale.a);
lm = v_lmcoord;
gl_Position = ftetransform();
}
#endif
#ifdef FRAGMENT_SHADER
//uniform sampler2D s_t0;
varying vec2 lm;
void main ()
{
gl_FragColor = fog4(col * texture2D(s_t0, lm));
}
#endif