Commited the GLSL I wrote.
This commit is contained in:
parent
380cc9374e
commit
beb526a896
7 changed files with 246 additions and 0 deletions
36
valve/glsl/default2d.glsl
Normal file
36
valve/glsl/default2d.glsl
Normal file
|
@ -0,0 +1,36 @@
|
|||
!!ver 100-450
|
||||
!!samps 1
|
||||
!!cvardf gl_fake16bit=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
|
||||
gl_FragColor = f;
|
||||
}
|
||||
#endif
|
21
valve/glsl/defaultfill.glsl
Normal file
21
valve/glsl/defaultfill.glsl
Normal file
|
@ -0,0 +1,21 @@
|
|||
!!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
|
58
valve/glsl/defaultskin.glsl
Normal file
58
valve/glsl/defaultskin.glsl
Normal file
|
@ -0,0 +1,58 @@
|
|||
!!ver 130
|
||||
!!permu FRAMEBLEND
|
||||
!!permu SKELETAL
|
||||
!!permu FOG
|
||||
!!samps diffuse
|
||||
!!cvardf gl_affinemodels=0
|
||||
!!cvardf gl_fake16bit=0
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
#if gl_affinemodels == 1
|
||||
#define affine noperspective
|
||||
#else
|
||||
#define affine
|
||||
#endif
|
||||
|
||||
affine varying vec2 tex_c;
|
||||
varying vec3 light;
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
#include "sys/skeletal.h"
|
||||
|
||||
/*float hl( vec3 normal, vec3 dir ) {
|
||||
return ( dot( normal, dir ) * 0.5 ) + 0.5;
|
||||
}*/
|
||||
|
||||
void main ()
|
||||
{
|
||||
vec3 n, s, t, w;
|
||||
gl_Position = skeletaltransform_wnst(w,n,s,t);
|
||||
tex_c = v_texcoord;
|
||||
light = e_light_ambient + ( e_light_mul * dot( n, e_light_dir ) );
|
||||
|
||||
if (light.r > 1.0f) {
|
||||
light.r = 1.0f;
|
||||
}
|
||||
if (light.g > 1.0f) {
|
||||
light.g = 1.0f;
|
||||
}
|
||||
if (light.b > 1.0f) {
|
||||
light.b = 1.0f;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
void main ()
|
||||
{
|
||||
vec4 diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
diffuse_f.rgb *= light;
|
||||
diffuse_f *= e_colourident;
|
||||
#if gl_fake16bit == 1
|
||||
diffuse_f.rgb = floor(diffuse_f.rgb * vec3(32,64,32))/vec3(32,64,32);
|
||||
#endif
|
||||
gl_FragColor = diffuse_f * e_colourident;
|
||||
}
|
||||
#endif
|
15
valve/glsl/defaultsky.glsl
Normal file
15
valve/glsl/defaultsky.glsl
Normal file
|
@ -0,0 +1,15 @@
|
|||
!!ver 110
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void main ()
|
||||
{
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
void main ()
|
||||
{
|
||||
discard;
|
||||
}
|
||||
#endif
|
27
valve/glsl/defaultskybox.glsl
Normal file
27
valve/glsl/defaultskybox.glsl
Normal file
|
@ -0,0 +1,27 @@
|
|||
!!ver 110
|
||||
!!permu FOG
|
||||
!!samps reflectcube
|
||||
!!cvardf gl_fake16bit=0
|
||||
|
||||
#include "sys/defs.h"
|
||||
#include "sys/fog.h"
|
||||
|
||||
varying vec3 pos;
|
||||
#ifdef VERTEX_SHADER
|
||||
void main ()
|
||||
{
|
||||
pos = v_position.xyz - e_eyepos;
|
||||
pos.y = -pos.y;
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
#ifdef FRAGMENT_SHADER
|
||||
void main ()
|
||||
{
|
||||
vec4 skybox = textureCube(s_reflectcube, pos);
|
||||
#if gl_fake16bit == 1
|
||||
skybox.rgb = floor(skybox.rgb * vec3(32,64,32))/vec3(32,64,32);
|
||||
#endif
|
||||
gl_FragColor = vec4(fog3(skybox.rgb), 1.0);
|
||||
}
|
||||
#endif
|
42
valve/glsl/defaultsprite.glsl
Normal file
42
valve/glsl/defaultsprite.glsl
Normal file
|
@ -0,0 +1,42 @@
|
|||
!!permu FOG
|
||||
!!samps 1
|
||||
!!cvardf gl_fake16bit=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
|
||||
|
||||
gl_FragColor = col;
|
||||
}
|
||||
#endif
|
47
valve/glsl/defaultwall.glsl
Normal file
47
valve/glsl/defaultwall.glsl
Normal file
|
@ -0,0 +1,47 @@
|
|||
!!ver 110
|
||||
!!samps diffuse lightmap
|
||||
!!cvardf gl_fake16bit=0
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
varying vec2 tex_c;
|
||||
varying vec2 lm_c;
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
void main ()
|
||||
{
|
||||
tex_c = v_texcoord;
|
||||
lm_c = v_lmcoord;
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
void main ( void )
|
||||
{
|
||||
vec4 diffuse_f = texture2D(s_diffuse, tex_c);
|
||||
vec3 light = texture2D(s_lightmap, lm_c).rgb;
|
||||
|
||||
if (light.r > 1.0f) {
|
||||
light.r = 1.0f;
|
||||
}
|
||||
if (light.g > 1.0f) {
|
||||
light.g = 1.0f;
|
||||
}
|
||||
if (light.b > 1.0f) {
|
||||
light.b = 1.0f;
|
||||
}
|
||||
|
||||
if (diffuse_f.a < 0.5) {
|
||||
discard;
|
||||
}
|
||||
|
||||
diffuse_f.rgb *= light.rgb;
|
||||
diffuse_f *= e_colourident;
|
||||
|
||||
#if gl_fake16bit == 1
|
||||
diffuse_f.rgb = floor(diffuse_f.rgb * vec3(32,64,32))/vec3(32,64,32);
|
||||
#endif
|
||||
gl_FragColor = diffuse_f;
|
||||
}
|
||||
#endif
|
Loading…
Reference in a new issue