tcpconnect fixes
lots of hexen2 fixes fixed clipped decals again, still not using any... fixed zips over 2g rewrote bloom to use glsl. should be slightly more usable now. lots more hexen2 fixes git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3957 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
5651e77c30
commit
fb214142a3
91 changed files with 4584 additions and 1270 deletions
132
engine/shaders/generatebuiltinsl.c
Normal file
132
engine/shaders/generatebuiltinsl.c
Normal file
|
@ -0,0 +1,132 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
char shaders[][64] =
|
||||
{
|
||||
"bloom_blur",
|
||||
"bloom_filter",
|
||||
"bloom_final",
|
||||
""
|
||||
};
|
||||
|
||||
void dumpprogstring(FILE *out, FILE *src)
|
||||
{
|
||||
int j;
|
||||
char line[1024];
|
||||
|
||||
while(fgets(line, sizeof(line), src))
|
||||
{
|
||||
j = 0;
|
||||
while (line[j] == ' ' || line[j] == '\t')
|
||||
j++;
|
||||
if ((line[j] == '/' && line[j] == '/') || line[j] == '\r' || line[j] == '\n')
|
||||
{
|
||||
while (line[j])
|
||||
fputc(line[j++], out);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputc('\"', out);
|
||||
while (line[j] && line[j] != '\r' && line[j] != '\n')
|
||||
{
|
||||
if (line[j] == '\t')
|
||||
fputc(' ', out);
|
||||
else if (line[j] == '\"')
|
||||
{
|
||||
fputc('\\', out);
|
||||
fputc(line[j], out);
|
||||
}
|
||||
else
|
||||
fputc(line[j], out);
|
||||
j++;
|
||||
}
|
||||
fputs("\\n\"\n", out);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
FILE *c, *s;
|
||||
char line[1024];
|
||||
int i, j, a;
|
||||
c = fopen("../gl/r_bishaders.h", "wt");
|
||||
|
||||
if (!c)
|
||||
{
|
||||
printf("unable to open a file\n");
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(c, "/*\nWARNING: THIS FILE IS GENERATED BY '"__FILE__"'.\nYOU SHOULD NOT EDIT THIS FILE BY HAND\n*/\n\n");
|
||||
|
||||
for (i = 0; *shaders[i]; i++)
|
||||
{
|
||||
for (a = 0; a < 3; a++)
|
||||
{
|
||||
if (a == 0)
|
||||
sprintf(line, "glsl/%s.glsl", shaders[i]);
|
||||
else if (a == 1)
|
||||
sprintf(line, "gles/%s.glsl", shaders[i]);
|
||||
else
|
||||
sprintf(line, "hlsl/%s.hlsl", shaders[i]);
|
||||
s = fopen(line, "rt");
|
||||
if (!s)
|
||||
{
|
||||
printf("unable to open %s\n", line);
|
||||
continue;
|
||||
}
|
||||
if (a == 0)
|
||||
{
|
||||
fprintf(c, "#ifdef GLQUAKE\n");
|
||||
fprintf(c, "{QR_OPENGL, 110, \"%s\",\n", shaders[i]);
|
||||
}
|
||||
else if (a == 1)
|
||||
{
|
||||
fprintf(c, "#ifdef GLQUAKE\n");
|
||||
fprintf(c, "{QR_OPENGL, 100, \"%s\",\n", shaders[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(c, "#ifdef D3DQUAKE\n");
|
||||
fprintf(c, "{QR_DIRECT3D, 9, \"%s\",\n", shaders[i]);
|
||||
}
|
||||
|
||||
while(fgets(line, sizeof(line), s))
|
||||
{
|
||||
j = 0;
|
||||
while (line[j] == ' ' || line[j] == '\t')
|
||||
j++;
|
||||
if ((line[j] == '/' && line[j] == '/') || line[j] == '\r' || line[j] == '\n')
|
||||
{
|
||||
while (line[j])
|
||||
fputc(line[j++], c);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputc('\"', c);
|
||||
while (line[j] && line[j] != '\r' && line[j] != '\n')
|
||||
{
|
||||
if (line[j] == '\t')
|
||||
fputc(' ', c);
|
||||
else if (line[j] == '\"')
|
||||
{
|
||||
fputc('\\', c);
|
||||
fputc(line[j], c);
|
||||
}
|
||||
else
|
||||
fputc(line[j], c);
|
||||
j++;
|
||||
}
|
||||
fputs("\\n\"\n", c);
|
||||
}
|
||||
}
|
||||
fputs("},\n", c);
|
||||
fprintf(c, "#endif\n");
|
||||
fclose(s);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(c);
|
||||
}
|
24
engine/shaders/glsl/bloom_blur.glsl
Normal file
24
engine/shaders/glsl/bloom_blur.glsl
Normal file
|
@ -0,0 +1,24 @@
|
|||
//apply gaussian filter
|
||||
|
||||
varying vec2 tc;
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
attribute vec2 v_texcoord;
|
||||
void main ()
|
||||
{
|
||||
tc = v_texcoord;
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
#ifdef FRAGMENT_SHADER
|
||||
/*offset should be 1.2 pixels away from the center*/
|
||||
uniform vec3 e_glowmod;
|
||||
uniform sampler2D s_t0;
|
||||
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
|
20
engine/shaders/glsl/bloom_filter.glsl
Normal file
20
engine/shaders/glsl/bloom_filter.glsl
Normal file
|
@ -0,0 +1,20 @@
|
|||
//the bloom filter
|
||||
//filter out any texels which are not to bloom
|
||||
|
||||
varying vec2 tc;
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
attribute vec2 v_texcoord;
|
||||
void main ()
|
||||
{
|
||||
tc = v_texcoord;
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
#ifdef FRAGMENT_SHADER
|
||||
uniform sampler2D s_t0;
|
||||
void main ()
|
||||
{
|
||||
gl_FragColor = (texture2D(s_t0, tc) - vec4(0.5, 0.5, 0.5, 0.0)) * vec4(2.0,2.0,2.0,1.0);
|
||||
}
|
||||
#endif
|
27
engine/shaders/glsl/bloom_final.glsl
Normal file
27
engine/shaders/glsl/bloom_final.glsl
Normal file
|
@ -0,0 +1,27 @@
|
|||
//add them together
|
||||
//optionally apply tonemapping
|
||||
|
||||
varying vec2 tc;
|
||||
|
||||
#ifdef VERTEX_SHADER
|
||||
attribute vec2 v_texcoord;
|
||||
void main ()
|
||||
{
|
||||
tc = v_texcoord;
|
||||
gl_Position = ftetransform();
|
||||
}
|
||||
#endif
|
||||
#ifdef FRAGMENT_SHADER
|
||||
uniform sampler2D s_t0;
|
||||
uniform sampler2D s_t1;
|
||||
uniform sampler2D s_t2;
|
||||
uniform sampler2D s_t3;
|
||||
void main ()
|
||||
{
|
||||
gl_FragColor =
|
||||
texture2D(s_t0, tc) +
|
||||
texture2D(s_t1, tc) +
|
||||
texture2D(s_t2, tc) +
|
||||
texture2D(s_t3, tc) ;
|
||||
}
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue