2012-01-17 07:57:46 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
char shaders[][64] =
|
|
|
|
{
|
2012-05-11 01:57:00 +00:00
|
|
|
"altwater",
|
2012-01-17 07:57:46 +00:00
|
|
|
"bloom_blur",
|
|
|
|
"bloom_filter",
|
|
|
|
"bloom_final",
|
2012-05-09 15:30:53 +00:00
|
|
|
"colourtint",
|
|
|
|
"crepuscular_opaque",
|
|
|
|
"crepuscular_rays",
|
|
|
|
"crepuscular_sky",
|
2013-10-08 14:28:11 +00:00
|
|
|
"depthonly",
|
2012-05-09 15:30:53 +00:00
|
|
|
"default2d",
|
|
|
|
"defaultadditivesprite",
|
|
|
|
"defaultskin",
|
|
|
|
"defaultsky",
|
2013-03-12 23:09:25 +00:00
|
|
|
"defaultfill",
|
2012-05-09 15:30:53 +00:00
|
|
|
"defaultsprite",
|
|
|
|
"defaultwall",
|
|
|
|
"defaultwarp",
|
2013-05-11 14:02:55 +00:00
|
|
|
"defaultgammacb",
|
2012-05-09 15:30:53 +00:00
|
|
|
"drawflat_wall",
|
|
|
|
"lpp_depthnorm",
|
|
|
|
"lpp_light",
|
|
|
|
"lpp_wall",
|
|
|
|
"postproc_fisheye",
|
|
|
|
"postproc_panorama",
|
2015-07-03 02:07:41 +00:00
|
|
|
"postproc_laea",
|
|
|
|
"postproc_stereographic",
|
2015-07-14 14:49:47 +00:00
|
|
|
"fxaa",
|
2012-05-09 15:30:53 +00:00
|
|
|
"rtlight",
|
|
|
|
"underwaterwarp",
|
2013-03-12 22:37:59 +00:00
|
|
|
"menutint",
|
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
|
|
|
"terrain",
|
2015-08-28 03:13:45 +00:00
|
|
|
"fixedemu",
|
2012-01-17 07:57:46 +00:00
|
|
|
""
|
|
|
|
};
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-11-27 03:23:19 +00:00
|
|
|
struct shadertype_s
|
|
|
|
{
|
|
|
|
char *filepattern;
|
|
|
|
char *preprocessor;
|
|
|
|
char *rendererapi;
|
|
|
|
int apiversion;
|
|
|
|
} shadertype[] =
|
|
|
|
{
|
|
|
|
{"glsl/%s.glsl", "GLQUAKE", "QR_OPENGL", 110}, //gl2+
|
2015-05-03 19:57:46 +00:00
|
|
|
//{"gles/%s.glsl", "GLQUAKE", "QR_OPENGL", 100}, //gles
|
2012-11-27 03:23:19 +00:00
|
|
|
{"hlsl9/%s.hlsl", "D3D9QUAKE", "QR_DIRECT3D9", 9}, //d3d9
|
|
|
|
{"hlsl11/%s.hlsl", "D3D11QUAKE", "QR_DIRECT3D11", 11}, //d3d11
|
|
|
|
};
|
|
|
|
//tbh we should precompile the d3d shaders.
|
|
|
|
|
2012-01-17 07:57:46 +00:00
|
|
|
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++)
|
|
|
|
{
|
2012-11-27 03:23:19 +00:00
|
|
|
for (a = 0; a < sizeof(shadertype)/sizeof(shadertype[0]); a++)
|
2012-01-17 07:57:46 +00:00
|
|
|
{
|
2012-11-27 03:23:19 +00:00
|
|
|
sprintf(line, shadertype[a].filepattern, shaders[i]);
|
2012-01-17 07:57:46 +00:00
|
|
|
s = fopen(line, "rt");
|
|
|
|
if (!s)
|
|
|
|
{
|
|
|
|
printf("unable to open %s\n", line);
|
|
|
|
continue;
|
|
|
|
}
|
2012-11-27 03:23:19 +00:00
|
|
|
fprintf(c, "#ifdef %s\n", shadertype[a].preprocessor);
|
|
|
|
fprintf(c, "{%s, %i, \"%s\",\n", shadertype[a].rendererapi, shadertype[a].apiversion, shaders[i]);
|
2012-01-17 07:57:46 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|