------------------------------------------------------------------------
r4175 | acceptthis | 2013-01-26 18:23:37 +0000 (Sat, 26 Jan 2013) | 8 lines improved replacementdeltas+nq a little, still needs work. embrace the menuqc! pr_dumpplatform now includes MENU defs+builtins. swapped search ordering of paks+dirs, so progs.dat will be used instead of pak0.pak/progs.dat. fteqcc slightly more sensible with if statements and void+vector types. fteqcc shows the first line where models are precached/used instead of showing no line at all. fix missing explosions when running qw gamecode. accept channels between 8 and 255. support for sending fitzquake's increased stat limits. ------------------------------------------------------------------------ git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4173 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
9e2969390d
commit
a339c727d0
55 changed files with 2152 additions and 1541 deletions
|
@ -3,23 +3,50 @@
|
|||
!!permu FRAMEBLEND
|
||||
!!permu SKELETAL
|
||||
!!permu FOG
|
||||
!!cvarf r_glsl_offsetmapping_scale
|
||||
!!cvarf gl_specular
|
||||
|
||||
//standard shader used for models.
|
||||
//must support skeletal and 2-way vertex blending or Bad Things Will Happen.
|
||||
//the vertex shader is responsible for calculating lighting values.
|
||||
|
||||
#ifdef UPPERLOWER
|
||||
#define UPPER
|
||||
#define LOWER
|
||||
#endif
|
||||
|
||||
varying vec2 tc;
|
||||
varying vec3 light;
|
||||
#if defined(SPECULAR) || defined(OFFSETMAPPING)
|
||||
varying vec3 eyevector;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
#include "sys/skeletal.h"
|
||||
attribute vec2 v_texcoord;
|
||||
uniform vec3 e_light_dir;
|
||||
uniform vec3 e_light_mul;
|
||||
uniform vec3 e_light_ambient;
|
||||
#if defined(SPECULAR) || defined(OFFSETMAPPING)
|
||||
uniform vec3 e_eyepos;
|
||||
#endif
|
||||
void main ()
|
||||
{
|
||||
#if defined(SPECULAR)||defined(OFFSETMAPPING)
|
||||
vec3 n, s, t, w;
|
||||
gl_Position = skeletaltransform_wnst(w,n,s,t);
|
||||
vec3 eyeminusvertex = e_eyepos - w.xyz;
|
||||
eyevector.x = -dot(eyeminusvertex, s.xyz);
|
||||
eyevector.y = dot(eyeminusvertex, t.xyz);
|
||||
eyevector.z = dot(eyeminusvertex, n.xyz);
|
||||
#else
|
||||
vec3 n;
|
||||
gl_Position = skeletaltransform_n(n);
|
||||
#endif
|
||||
|
||||
light = e_light_ambient + (dot(n,e_light_dir)*e_light_mul);
|
||||
tc = v_texcoord;
|
||||
}
|
||||
|
@ -38,24 +65,54 @@ uniform vec3 e_uppercolour;
|
|||
#ifdef FULLBRIGHT
|
||||
uniform sampler2D s_t3;
|
||||
#endif
|
||||
|
||||
#if defined(SPECULAR)
|
||||
uniform sampler2D s_t4;
|
||||
uniform sampler2D s_t5;
|
||||
uniform float cvar_gl_specular;
|
||||
#endif
|
||||
|
||||
#ifdef OFFSETMAPPING
|
||||
#include "sys/offsetmapping.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
uniform vec4 e_colourident;
|
||||
void main ()
|
||||
{
|
||||
vec4 col, sp;
|
||||
|
||||
#ifdef OFFSETMAPPING
|
||||
vec2 tcoffsetmap = offsetmap(s_t1, tcbase, eyevector);
|
||||
#define tc tcoffsetmap
|
||||
#endif
|
||||
|
||||
col = texture2D(s_t0, tc);
|
||||
#ifdef UPPER
|
||||
vec4 uc = texture2D(s_t2, tc);
|
||||
col.rgb = mix(col.rgb, uc.rgb*e_uppercolour, uc.a);
|
||||
col.rgb += uc.rgb*e_uppercolour*uc.a;
|
||||
#endif
|
||||
#ifdef LOWER
|
||||
vec4 lc = texture2D(s_t1, tc);
|
||||
col.rgb = mix(col.rgb, lc.rgb*e_lowercolour, lc.a);
|
||||
col.rgb += lc.rgb*e_lowercolour*lc.a;
|
||||
#endif
|
||||
col.rgb *= light;
|
||||
|
||||
#if defined(SPECULAR)
|
||||
vec3 bumps = normalize(vec3(texture2D(s_t4, tc)) - 0.5);
|
||||
vec4 specs = texture2D(s_t5, tc);
|
||||
|
||||
vec3 halfdir = normalize(normalize(eyevector) + vec3(0.0, 0.0, 1.0));
|
||||
float spec = pow(max(dot(halfdir, bumps), 0.0), 32.0 * specs.a);
|
||||
col.rgb += cvar_gl_specular * spec * specs.rgb;
|
||||
#endif
|
||||
|
||||
#ifdef FULLBRIGHT
|
||||
vec4 fb = texture2D(s_t3, tc);
|
||||
col.rgb = mix(col.rgb, fb.rgb, fb.a);
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4(col * e_colourident);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
!!permu BUMP
|
||||
!!permu SKELETAL
|
||||
!!permu UPPERLOWER
|
||||
!!permu FOG
|
||||
!!cvarf r_glsl_offsetmapping_scale
|
||||
|
||||
|
@ -17,6 +18,11 @@
|
|||
#extension GL_ARB_texture_gather : enable
|
||||
#endif
|
||||
|
||||
#ifdef UPPERLOWER
|
||||
#define UPPER
|
||||
#define LOWER
|
||||
#endif
|
||||
|
||||
|
||||
varying vec2 tcbase;
|
||||
varying vec3 lightvector;
|
||||
|
@ -65,20 +71,20 @@ void main ()
|
|||
|
||||
#ifdef FRAGMENT_SHADER
|
||||
#include "sys/fog.h"
|
||||
uniform sampler2D s_t0;
|
||||
uniform sampler2D s_t0; //diffuse
|
||||
|
||||
#if defined(BUMP) || defined(SPECULAR) || defined(OFFSETMAPPING)
|
||||
uniform sampler2D s_t1;
|
||||
uniform sampler2D s_t1; //normalmap
|
||||
#endif
|
||||
#ifdef SPECULAR
|
||||
uniform sampler2D s_t2;
|
||||
uniform sampler2D s_t2; //specular
|
||||
#endif
|
||||
#ifdef CUBEPROJ
|
||||
uniform samplerCube s_t3;
|
||||
uniform samplerCube s_t3; //projected cubemap
|
||||
#endif
|
||||
#ifdef PCF
|
||||
#ifdef CUBESHADOW
|
||||
uniform samplerCubeShadow s_t4;
|
||||
uniform samplerCubeShadow s_t4; //shadowmap
|
||||
#else
|
||||
#if 0//def GL_ARB_texture_gather
|
||||
uniform sampler2D s_t4;
|
||||
|
@ -87,6 +93,14 @@ uniform sampler2DShadow s_t4;
|
|||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifdef LOWER
|
||||
uniform sampler2D s_t5; //pants colours
|
||||
uniform vec3 e_lowercolour;
|
||||
#endif
|
||||
#ifdef UPPER
|
||||
uniform sampler2D s_t6; //shirt colours
|
||||
uniform vec3 e_uppercolour;
|
||||
#endif
|
||||
|
||||
|
||||
uniform float l_lightradius;
|
||||
|
@ -128,7 +142,7 @@ float ShadowmapFilter(void)
|
|||
//assume z is the major axis (ie: forward from the light)
|
||||
vec3 t = shadowcoord;
|
||||
float ma = dir.z;
|
||||
vec4 axis = vec4(1.0, 1.0, 1.0, 0.0);
|
||||
vec3 axis = vec3(1.0, 1.0, 1.0);
|
||||
if (dir.x > ma)
|
||||
{
|
||||
ma = dir.x;
|
||||
|
@ -200,6 +214,14 @@ void main ()
|
|||
#define tcbase tcoffsetmap
|
||||
#endif
|
||||
vec3 bases = vec3(texture2D(s_t0, tcbase));
|
||||
#ifdef UPPER
|
||||
vec4 uc = texture2D(s_t6, tcbase);
|
||||
bases.rgb += uc.rgb*e_uppercolour*uc.a;
|
||||
#endif
|
||||
#ifdef LOWER
|
||||
vec4 lc = texture2D(s_t5, tcbase);
|
||||
bases.rgb += lc.rgb*e_lowercolour*lc.a;
|
||||
#endif
|
||||
#if defined(BUMP) || defined(SPECULAR)
|
||||
vec3 bumps = normalize(vec3(texture2D(s_t1, tcbase)) - 0.5);
|
||||
#endif
|
||||
|
|
|
@ -11,11 +11,11 @@ varying vec2 v_edge;
|
|||
uniform float e_time;
|
||||
void main ()
|
||||
{
|
||||
gl_Position = ftetransform();
|
||||
v_stc = (1.0+(gl_Position.xy / gl_Position.w))/2.0;
|
||||
v_warp.s = e_time * 0.25 + v_texcoord.s;
|
||||
v_warp.t = e_time * 0.25 + v_texcoord.t;
|
||||
v_edge = v_texcoord.xy;
|
||||
gl_Position = ftetransform();
|
||||
v_stc = (1.0+(gl_Position.xy / gl_Position.w))/2.0;
|
||||
v_warp.s = e_time * 0.25 + v_texcoord.s;
|
||||
v_warp.t = e_time * 0.25 + v_texcoord.t;
|
||||
v_edge = v_texcoord.xy;
|
||||
}
|
||||
#endif
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
@ -25,21 +25,21 @@ varying vec2 v_edge;
|
|||
uniform sampler2D s_t0;/*$currentrender*/
|
||||
uniform sampler2D s_t1;/*warp image*/
|
||||
uniform sampler2D s_t2;/*edge image*/
|
||||
uniform vec3 e_rendertexturescale;
|
||||
uniform vec4 e_rendertexturescale;
|
||||
uniform float cvar_r_waterwarp;
|
||||
void main ()
|
||||
{
|
||||
float amptemp;
|
||||
vec3 edge;
|
||||
edge = texture2D( s_t2, v_edge ).rgb;
|
||||
amptemp = (0.010 / 0.625) * cvar_r_waterwarp * edge.x;
|
||||
vec3 offset;
|
||||
offset = texture2D( s_t1, v_warp ).rgb;
|
||||
offset.x = (offset.x - 0.5) * 2.0;
|
||||
offset.y = (offset.y - 0.5) * 2.0;
|
||||
vec2 temp;
|
||||
temp.x = v_stc.x + offset.x * amptemp;
|
||||
temp.y = v_stc.y + offset.y * amptemp;
|
||||
gl_FragColor = texture2D( s_t0, temp*e_rendertexturescale.st );
|
||||
float amptemp;
|
||||
vec3 edge;
|
||||
edge = texture2D( s_t2, v_edge ).rgb;
|
||||
amptemp = (0.010 / 0.625) * cvar_r_waterwarp * edge.x;
|
||||
vec3 offset;
|
||||
offset = texture2D( s_t1, v_warp ).rgb;
|
||||
offset.x = (offset.x - 0.5) * 2.0;
|
||||
offset.y = (offset.y - 0.5) * 2.0;
|
||||
vec2 temp;
|
||||
temp.x = v_stc.x + offset.x * amptemp;
|
||||
temp.y = v_stc.y + offset.y * amptemp;
|
||||
gl_FragColor = texture2D( s_t0, temp*e_rendertexturescale.st );
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue