LOTS OF CHANGES. was hoping to get revision 5000 perfect, but really that's never going to happen. this has gone on for too long now.
vulkan, wasapi, quake injector features added. irc, avplug, cef plugins/drivers reworked/updated/added openal reverb, doppler effects added. 'dir' console command now attempts to view clicked files. lots of warning fixes, should now only be deprecation warnings for most targets (depending on compiler version anyway...). SendEntity finally reworked to use flags properly. effectinfo improved, other smc-targetted fixes. mapcluster stuff now has support for linux. .basebone+.baseframe now exist in ssqc. qcc: -Fqccx supports qccx syntax, including qccx hacks. don't expect these to work in fteqw nor dp though. qcc: rewrote function call handling to use refs rather than defs. this makes struct passing more efficient and makes the __out keyword usable with fields etc. qccgui: can cope a little better with non-unicode files. can now represent most quake chars. qcc: suppressed warnings from *extensions.qc git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5000 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
5920bf05fb
commit
27a59a0cbc
271 changed files with 101001 additions and 64352 deletions
|
@ -1,3 +1,4 @@
|
|||
!!ver 100 130
|
||||
!!permu FULLBRIGHT
|
||||
!!permu UPPERLOWER
|
||||
!!permu FRAMEBLEND
|
||||
|
@ -6,6 +7,7 @@
|
|||
!!permu BUMP
|
||||
!!cvarf r_glsl_offsetmapping_scale
|
||||
!!cvarf gl_specular
|
||||
!!cvardf gl_affinemodels=0
|
||||
|
||||
#include "sys/defs.h"
|
||||
|
||||
|
@ -13,7 +15,10 @@
|
|||
//must support skeletal and 2-way vertex blending or Bad Things Will Happen.
|
||||
//the vertex shader is responsible for calculating lighting values.
|
||||
|
||||
varying vec2 tc;
|
||||
#if gl_affinemodels==1 && __VERSION__ >= 130
|
||||
noperspective
|
||||
#endif
|
||||
varying vec2 tc;
|
||||
varying vec3 light;
|
||||
#if defined(SPECULAR) || defined(OFFSETMAPPING)
|
||||
varying vec3 eyevector;
|
||||
|
@ -46,6 +51,7 @@ void main ()
|
|||
}
|
||||
#endif
|
||||
#ifdef FRAGMENT_SHADER
|
||||
|
||||
#include "sys/fog.h"
|
||||
|
||||
#if defined(SPECULAR)
|
||||
|
@ -56,6 +62,17 @@ uniform float cvar_gl_specular;
|
|||
#include "sys/offsetmapping.h"
|
||||
#endif
|
||||
|
||||
#ifdef EIGHTBIT
|
||||
#define s_colourmap s_t0
|
||||
uniform sampler2D s_colourmap;
|
||||
#endif
|
||||
|
||||
#if __VERSION__ >= 130
|
||||
#define gl_FragColor thecolour
|
||||
out vec4 thecolour;
|
||||
#endif
|
||||
|
||||
|
||||
void main ()
|
||||
{
|
||||
vec4 col, sp;
|
||||
|
@ -65,33 +82,46 @@ void main ()
|
|||
#define tc tcoffsetmap
|
||||
#endif
|
||||
|
||||
#ifdef EIGHTBIT
|
||||
vec3 lightlev = light;
|
||||
//FIXME: with this extra flag, half the permutations are redundant.
|
||||
lightlev *= 0.5; //counter the fact that the colourmap contains overbright values and logically ranges from 0 to 2 intead of to 1.
|
||||
float pal = texture2D(s_paletted, tc).r; //the palette index. hopefully not interpolated.
|
||||
lightlev -= 1.0 / 128.0; //software rendering appears to round down, so make sure we favour the lower values instead of rounding to the nearest
|
||||
col.r = texture2D(s_colourmap, vec2(pal, 1.0-lightlev.r)).r; //do 3 lookups. this is to cope with lit files, would be a waste to not support those.
|
||||
col.g = texture2D(s_colourmap, vec2(pal, 1.0-lightlev.g)).g; //its not very softwarey, but re-palettizing is ugly.
|
||||
col.b = texture2D(s_colourmap, vec2(pal, 1.0-lightlev.b)).b; //without lits, it should be identical.
|
||||
col.a = (pal<1.0)?1.0:0.0;
|
||||
#else
|
||||
col = texture2D(s_diffuse, tc);
|
||||
#ifdef UPPER
|
||||
vec4 uc = texture2D(s_upper, tc);
|
||||
col.rgb += uc.rgb*e_uppercolour*uc.a;
|
||||
#endif
|
||||
#ifdef LOWER
|
||||
vec4 lc = texture2D(s_lower, tc);
|
||||
col.rgb += lc.rgb*e_lowercolour*lc.a;
|
||||
#endif
|
||||
#ifdef UPPER
|
||||
vec4 uc = texture2D(s_upper, tc);
|
||||
col.rgb += uc.rgb*e_uppercolour*uc.a;
|
||||
#endif
|
||||
#ifdef LOWER
|
||||
vec4 lc = texture2D(s_lower, tc);
|
||||
col.rgb += lc.rgb*e_lowercolour*lc.a;
|
||||
#endif
|
||||
|
||||
#if defined(BUMP) && defined(SPECULAR)
|
||||
vec3 bumps = normalize(vec3(texture2D(s_normalmap, tc)) - 0.5);
|
||||
vec4 specs = texture2D(s_specular, tc);
|
||||
#if defined(BUMP) && defined(SPECULAR)
|
||||
vec3 bumps = normalize(vec3(texture2D(s_normalmap, tc)) - 0.5);
|
||||
vec4 specs = texture2D(s_specular, 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
|
||||
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
|
||||
|
||||
col.rgb *= light;
|
||||
|
||||
#ifdef FULLBRIGHT
|
||||
vec4 fb = texture2D(s_fullbright, tc);
|
||||
// col.rgb = mix(col.rgb, fb.rgb, fb.a);
|
||||
col.rgb += fb.rgb * fb.a;
|
||||
#ifdef FULLBRIGHT
|
||||
vec4 fb = texture2D(s_fullbright, tc);
|
||||
// col.rgb = mix(col.rgb, fb.rgb, fb.a);
|
||||
col.rgb += fb.rgb * fb.a;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gl_FragColor = fog4(col * e_colourident);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -28,6 +28,6 @@ void main ()
|
|||
vec3 solid = vec3(texture2D(s_t0, tccoord));
|
||||
tccoord = (dir.xy + e_time*0.0625);
|
||||
vec4 clouds = texture2D(s_t1, tccoord);
|
||||
gl_FragColor.rgb = fog3((solid.rgb*(1.0-clouds.a)) + (clouds.a*clouds.rgb));
|
||||
gl_FragColor = vec4(fog3((solid.rgb*(1.0-clouds.a)) + (clouds.a*clouds.rgb)), 1.0);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -23,12 +23,16 @@ varying mat3 invsurface;
|
|||
#endif
|
||||
|
||||
varying vec2 tc;
|
||||
#ifdef LIGHTSTYLED
|
||||
//we could use an offset, but that would still need to be per-surface which would break batches
|
||||
//fixme: merge attributes?
|
||||
varying vec2 lm0, lm1, lm2, lm3;
|
||||
#ifdef VERTEXLIT
|
||||
varying vec4 vc;
|
||||
#else
|
||||
varying vec2 lm0;
|
||||
#ifdef LIGHTSTYLED
|
||||
//we could use an offset, but that would still need to be per-surface which would break batches
|
||||
//fixme: merge attributes?
|
||||
varying vec2 lm0, lm1, lm2, lm3;
|
||||
#else
|
||||
varying vec2 lm0;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
|
@ -46,11 +50,20 @@ void main ()
|
|||
invsurface[2] = v_normal;
|
||||
#endif
|
||||
tc = v_texcoord;
|
||||
#ifdef VERTEXLIT
|
||||
#ifdef LIGHTSTYLED
|
||||
//FIXME, only one colour.
|
||||
vc = v_colour * e_lmscale[0];
|
||||
#else
|
||||
vc = v_colour * e_lmscale;
|
||||
#endif
|
||||
#else
|
||||
lm0 = v_lmcoord;
|
||||
#ifdef LIGHTSTYLED
|
||||
lm1 = v_lmcoord2;
|
||||
lm2 = v_lmcoord3;
|
||||
lm3 = v_lmcoord4;
|
||||
#endif
|
||||
#endif
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
|
@ -81,7 +94,7 @@ void main ()
|
|||
//optional: round the lightmap coords to ensure all pixels within a texel have different lighting values either. it just looks wrong otherwise.
|
||||
//don't bother if its lightstyled, such cases will have unpredictable correlations anyway.
|
||||
//FIXME: this rounding is likely not correct with respect to software rendering. oh well.
|
||||
vec2 lmcoord0 = floor(lm0 * 256.0*8.0)/(256.0*8.0);
|
||||
vec2 lmcoord0 = floor(lm0 * 512.0*16.0)/(512.0*16.0);
|
||||
#define lm0 lmcoord0
|
||||
#endif
|
||||
|
||||
|
@ -96,33 +109,41 @@ void main ()
|
|||
#endif
|
||||
|
||||
//modulate that by the lightmap(s) including deluxemap(s)
|
||||
#ifdef LIGHTSTYLED
|
||||
vec3 lightmaps;
|
||||
#ifdef DELUXE
|
||||
lightmaps = texture2D(s_lightmap0, lm0).rgb * e_lmscale[0].rgb * dot(norm, 2.0*texture2D(s_deluxmap0, lm0).rgb-0.5);
|
||||
lightmaps += texture2D(s_lightmap1, lm1).rgb * e_lmscale[1].rgb * dot(norm, 2.0*texture2D(s_deluxmap1, lm1).rgb-0.5);
|
||||
lightmaps += texture2D(s_lightmap2, lm2).rgb * e_lmscale[2].rgb * dot(norm, 2.0*texture2D(s_deluxmap2, lm2).rgb-0.5);
|
||||
lightmaps += texture2D(s_lightmap3, lm3).rgb * e_lmscale[3].rgb * dot(norm, 2.0*texture2D(s_deluxmap3, lm3).rgb-0.5);
|
||||
#ifdef VERTEXLIT
|
||||
#ifdef LIGHTSTYLED
|
||||
vec3 lightmaps = vc.rgb;
|
||||
#else
|
||||
lightmaps = texture2D(s_lightmap0, lm0).rgb * e_lmscale[0].rgb;
|
||||
lightmaps += texture2D(s_lightmap1, lm1).rgb * e_lmscale[1].rgb;
|
||||
lightmaps += texture2D(s_lightmap2, lm2).rgb * e_lmscale[2].rgb;
|
||||
lightmaps += texture2D(s_lightmap3, lm3).rgb * e_lmscale[3].rgb;
|
||||
vec3 lightmaps = vc.rgb;
|
||||
#endif
|
||||
#else
|
||||
vec3 lightmaps = (texture2D(s_lightmap, lm0) * e_lmscale).rgb;
|
||||
//modulate by the bumpmap dot light
|
||||
#ifdef DELUXE
|
||||
vec3 delux = 2.0*(texture2D(s_deluxmap, lm0).rgb-0.5);
|
||||
lightmaps *= 1.0 / max(0.25, delux.z); //counter the darkening from deluxmaps
|
||||
lightmaps *= dot(norm, delux);
|
||||
#ifdef LIGHTSTYLED
|
||||
vec3 lightmaps;
|
||||
#ifdef DELUXE
|
||||
lightmaps = texture2D(s_lightmap0, lm0).rgb * e_lmscale[0].rgb * dot(norm, 2.0*texture2D(s_deluxmap0, lm0).rgb-0.5);
|
||||
lightmaps += texture2D(s_lightmap1, lm1).rgb * e_lmscale[1].rgb * dot(norm, 2.0*texture2D(s_deluxmap1, lm1).rgb-0.5);
|
||||
lightmaps += texture2D(s_lightmap2, lm2).rgb * e_lmscale[2].rgb * dot(norm, 2.0*texture2D(s_deluxmap2, lm2).rgb-0.5);
|
||||
lightmaps += texture2D(s_lightmap3, lm3).rgb * e_lmscale[3].rgb * dot(norm, 2.0*texture2D(s_deluxmap3, lm3).rgb-0.5);
|
||||
#else
|
||||
lightmaps = texture2D(s_lightmap0, lm0).rgb * e_lmscale[0].rgb;
|
||||
lightmaps += texture2D(s_lightmap1, lm1).rgb * e_lmscale[1].rgb;
|
||||
lightmaps += texture2D(s_lightmap2, lm2).rgb * e_lmscale[2].rgb;
|
||||
lightmaps += texture2D(s_lightmap3, lm3).rgb * e_lmscale[3].rgb;
|
||||
#endif
|
||||
#else
|
||||
vec3 lightmaps = (texture2D(s_lightmap, lm0) * e_lmscale).rgb;
|
||||
//modulate by the bumpmap dot light
|
||||
#ifdef DELUXE
|
||||
vec3 delux = 2.0*(texture2D(s_deluxmap, lm0).rgb-0.5);
|
||||
lightmaps *= 1.0 / max(0.25, delux.z); //counter the darkening from deluxmaps
|
||||
lightmaps *= dot(norm, delux);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//add in specular, if applicable.
|
||||
#ifdef SPECULAR
|
||||
vec4 specs = texture2D(s_specular, tc);
|
||||
#ifdef DELUXE
|
||||
#if defined(DELUXE) && !defined(VERTEXLIT)
|
||||
//not lightstyled...
|
||||
vec3 halfdir = normalize(normalize(eyevector) + 2.0*(texture2D(s_deluxmap0, lm0).rgb-0.5)); //this norm should be the deluxemap info instead
|
||||
#else
|
||||
|
|
41
engine/shaders/glsl/fixedemu.glsl
Normal file
41
engine/shaders/glsl/fixedemu.glsl
Normal file
|
@ -0,0 +1,41 @@
|
|||
//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.
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
attribute vec2 v_texcoord;
|
||||
varying vec2 tc;
|
||||
#ifndef UC
|
||||
attribute vec4 v_colour;
|
||||
varying vec4 vc;
|
||||
#endif
|
||||
void main ()
|
||||
{
|
||||
tc = v_texcoord;
|
||||
#ifndef UC
|
||||
vc = v_colour;
|
||||
#endif
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
#ifdef FRAGMENT_SHADER
|
||||
uniform sampler2D s_t0;
|
||||
varying vec2 tc;
|
||||
#ifndef UC
|
||||
varying vec4 vc;
|
||||
#else
|
||||
uniform vec4 s_colour;
|
||||
#define vc s_colour
|
||||
#endif
|
||||
float e_time;
|
||||
void main ()
|
||||
{
|
||||
vec4 fc = texture2D(s_t0, tc) * vc;
|
||||
#ifdef ALPHATEST
|
||||
if (!(fc.a ALPHATEST))
|
||||
discard;
|
||||
#endif
|
||||
gl_FragColor = fc;
|
||||
}
|
||||
#endif
|
31
engine/shaders/glsl/postproc_equirectangular.glsl
Normal file
31
engine/shaders/glsl/postproc_equirectangular.glsl
Normal file
|
@ -0,0 +1,31 @@
|
|||
!!cvarf ffov
|
||||
|
||||
//equirectangular view rendering, commonly used for sphere->2d map projections.
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
attribute vec2 v_texcoord;
|
||||
varying vec2 texcoord;
|
||||
void main()
|
||||
{
|
||||
texcoord = v_texcoord.xy;
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
#ifdef FRAGMENT_SHADER
|
||||
uniform samplerCube s_t0;
|
||||
varying vec2 texcoord;
|
||||
uniform float cvar_ffov;
|
||||
|
||||
#define PI 3.1415926535897932384626433832795
|
||||
void main()
|
||||
{
|
||||
vec3 tc;
|
||||
float lng = (texcoord.x - 0.5) * PI * 2.0;
|
||||
float lat = (texcoord.y) * PI * 1.0;
|
||||
|
||||
tc.z = cos(lng) * sin(lat);
|
||||
tc.x = sin(lng) * sin(lat);
|
||||
tc.y = cos(lat);
|
||||
gl_FragColor = textureCube(s_t0, tc);
|
||||
}
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue