fix some of the things that baker didn't like. sorry it took so long.

try to appease msvc6, just because.
update the downloads menu. now even betterer!...
fix proquake server angle snapping precision issue.
also accept _glow textures as an alternative to the more standard _luma.
compat for dp_water shader terms. tcgen stuff is still fscked up.
menu tooltip code can now properly deal with variable width etc stuff.
add missing te_flamejet builtin.
r_dynamic -1 can now cope with q3bsp for a small speedup.
added -watch commandline arg, to make it easier to figure out where cvar changes are coming from.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5015 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2016-08-25 00:12:14 +00:00
parent 8d2af6ff7b
commit c08a0aa139
104 changed files with 3629 additions and 2828 deletions

View file

@ -1,25 +1,71 @@
!!cvarf r_glsl_turbscale
//modifier: REFLECT (s_t2 is a reflection instead of diffusemap)
//modifier: STRENGTH (0.1 = fairly gentle, 0.2 = big waves)
//modifier: FRESNEL (5=water)
//modifier: TXSCALE (0.2 - wave strength)
//modifier: RIPPLEMAP (s_t3 contains a ripplemap
//modifier: TINT (some colour value)
!!cvardf r_glsl_turbscale_reflect=1 //simpler scaler
!!cvardf r_glsl_turbscale_refract=1 //simpler scaler
!!samps 4 diffuse
#include "sys/defs.h"
//modifier: REFLECT (s_t2 is a reflection instead of diffusemap)
//modifier: STRENGTH_REFL (distortion strength - 0.1 = fairly gentle, 0.2 = big waves)
//modifier: STRENGTH_REFL (distortion strength - 0.1 = fairly gentle, 0.2 = big waves)
//modifier: FRESNEL_EXP (5=water)
//modifier: TXSCALE (wave size - 0.2)
//modifier: RIPPLEMAP (s_t3 contains a ripplemap
//modifier: TINT_REFR (some colour value)
//modifier: TINT_REFL (some colour value)
//modifier: ALPHA (mix in the normal water texture over the top)
//modifier: USEMODS (use single-texture scrolling via tcmods - note, also forces the engine to actually use tcmod etc)
//a few notes on DP compat:
//'dpwater' makes numerous assumptions about DP internals
//by default there is a single pass that uses the pass's normal tcmods
//the fresnel has a user-supplied min+max rather than an exponent
//both parts are tinted individually
//if alpha is enabled, the regular water texture is blended over the top, again using the same crappy tcmods...
//legacy crap
#ifndef FRESNEL
#define FRESNEL 5.0
#endif
#ifndef TINT
#define TINT 0.7,0.8,0.7
#endif
#ifndef STRENGTH
#define STRENGTH 0.1
#endif
#ifndef TXSCALE
#define TXSCALE 0.2
#endif
#ifndef TINT
#define TINT vec3(0.7, 0.8, 0.7)
//current values (referring to legacy defaults where needed)
#ifndef FRESNEL_EXP
#define FRESNEL_EXP 5.0
#endif
#ifndef FRESNEL_MIN
#define FRESNEL_MIN 0.0
#endif
#ifndef FRESNEL_RANGE
#define FRESNEL_RANGE 1.0
#endif
#ifndef STRENGTH_REFL
#define STRENGTH_REFL STRENGTH
#endif
#ifndef STRENGTH_REFR
#define STRENGTH_REFR STRENGTH
#endif
#ifndef TXSCALE1
#define TXSCALE1 TXSCALE
#endif
#ifndef TXSCALE2
#define TXSCALE2 TXSCALE
#endif
#ifndef TINT_REFR
#define TINT_REFR TINT
#endif
#ifndef TINT_REFL
#define TINT_REFL 1.0,1.0,1.0
#endif
#ifndef FOGTINT
#define FOGTINT vec3(0.2, 0.3, 0.2)
#define FOGTINT 0.2,0.3,0.2
#endif
varying vec2 tc;
@ -27,9 +73,6 @@ varying vec4 tf;
varying vec3 norm;
varying vec3 eye;
#ifdef VERTEX_SHADER
attribute vec2 v_texcoord;
attribute vec3 v_normal;
uniform vec3 e_eyepos;
void main (void)
{
tc = v_texcoord.st;
@ -40,45 +83,48 @@ void main (void)
}
#endif
#ifdef FRAGMENT_SHADER
#ifdef ALPHA
#include "sys/fog.h"
#endif
#define s_refract s_t0
#define s_reflect s_t1
#define s_ripplemap s_t2
#define s_refractdepth s_t3
uniform float cvar_r_glsl_turbscale;
uniform sampler2D s_normalmap;
uniform sampler2D s_diffuse;
uniform sampler2D s_refract; //refract
uniform sampler2D s_reflect; //reflection
uniform sampler2D s_refractdepth; //refraction depth
uniform sampler2D s_ripplemap; //ripplemap
uniform float e_time;
void main (void)
{
vec2 stc, ntc;
vec2 stc; //screen tex coords
vec2 ntc; //normalmap/diffuse tex coords
vec3 n, refr, refl;
float fres;
float depth;
stc = (1.0 + (tf.xy / tf.w)) * 0.5;
//hack the texture coords slightly so that there are no obvious gaps
//hack the texture coords slightly so that there are less obvious gaps
stc.t -= 1.5*norm.z/1080.0;
#if 0//def USEMODS
ntc = tc;
n = texture2D(s_normalmap, ntc).xyz - 0.5;
#else
//apply q1-style warp, just for kicks
ntc.s = tc.s + sin(tc.t+e_time)*0.125;
ntc.t = tc.t + sin(tc.s+e_time)*0.125;
//generate the two wave patterns from the normalmap
n = (texture2D(s_normalmap, TXSCALE*tc + vec2(e_time*0.1, 0.0)).xyz);
n += (texture2D(s_normalmap, TXSCALE*tc - vec2(0, e_time*0.097)).xyz);
n = (texture2D(s_normalmap, vec2(TXSCALE1)*tc + vec2(e_time*0.1, 0.0)).xyz);
n += (texture2D(s_normalmap, vec2(TXSCALE2)*tc - vec2(0, e_time*0.097)).xyz);
n -= 1.0 - 4.0/256.0;
#endif
#ifdef RIPPLEMAP
n += texture2D(s_ripplemap, stc).rgb*3.0;
#endif
n = normalize(n);
//the fresnel term decides how transparent the water should be
fres = pow(1.0-abs(dot(normalize(n), normalize(eye))), float(FRESNEL));
fres = pow(1.0-abs(dot(n, normalize(eye))), float(FRESNEL_EXP)) * float(FRESNEL_RANGE) + float(FRESNEL_MIN);
#ifdef DEPTH
float far = #include "cvar/gl_maxdist";
@ -111,22 +157,30 @@ void main (void)
//refraction image (and water fog, if possible)
refr = texture2D(s_refract, stc + n.st*STRENGTH*cvar_r_glsl_turbscale).rgb * TINT;
refr = texture2D(s_refract, stc + n.st*float(STRENGTH_REFR)*float(r_glsl_turbscale_refract)).rgb * vec3(TINT_REFR);
#ifdef DEPTH
refr = mix(refr, FOGTINT, min(depth/4096.0, 1.0));
refr = mix(refr, vec3(FOGTINT), min(depth/4096.0, 1.0));
#endif
//reflection/diffuse
#ifdef REFLECT
refl = texture2D(s_reflect, stc - n.st*STRENGTH*cvar_r_glsl_turbscale).rgb;
refl = texture2D(s_reflect, stc - n.st*float(STRENGTH_REFL)*float(r_glsl_turbscale_reflect)).rgb * vec3(TINT_REFL);
#else
refl = texture2D(s_diffuse, ntc).xyz;
refl = texture2D(s_diffuse, ntc).xyz * vec3(TINT_REFL);
#endif
//FIXME: add specular
//interplate by fresnel
refr = mix(refr, refl, fres);
#ifdef ALPHA
vec4 ts = texture2D(s_diffuse, ntc);
vec4 surf = fog4blend(vec4(ts.rgb, float(ALPHA)*ts.a));
refr = mix(refr, surf.rgb, surf.a);
#endif
//done
gl_FragColor = vec4(refr, 1.0);
}