mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-29 07:02:12 +00:00
31ced9384d
implement cfg_save_auto cvar, to replicated vanilla quake, ish. default off, obviously. support for Q2RDF_IRGOGGLES (in combination with Q2RF_IR_VISIBLE). untested. rework vectorvectors to be more predictable. v_right_z is now _much_ more commonly 0. fix potential sound-related lock-up/console spam. implement $colored_armor+$colored_powerup macros. if command now copes with ' quotes. fix crash on flushing q3bsps. fix black bits with r_renderscale+cl_sbar 1 implement emulation for legacy q3 shaders when glsl is required. this is primarily for webgl right now, but potentially also useful with any gles2 port (fixme: still need to tweak d3d11 backend to support this too). include scrollbar glyphs in the fallback font logic. this is primarily for download progress bars, especially with webgl. don't try applying gamma to screenshots when using glsl. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4976 fc73d0e0-1445-4013-8a0c-d673dee63da5
158 lines
3.1 KiB
C
158 lines
3.1 KiB
C
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
char shaders[][64] =
|
|
{
|
|
"altwater",
|
|
"bloom_blur",
|
|
"bloom_filter",
|
|
"bloom_final",
|
|
"colourtint",
|
|
"crepuscular_opaque",
|
|
"crepuscular_rays",
|
|
"crepuscular_sky",
|
|
"depthonly",
|
|
"default2d",
|
|
"defaultadditivesprite",
|
|
"defaultskin",
|
|
"defaultsky",
|
|
"defaultfill",
|
|
"defaultsprite",
|
|
"defaultwall",
|
|
"defaultwarp",
|
|
"defaultgammacb",
|
|
"drawflat_wall",
|
|
"lpp_depthnorm",
|
|
"lpp_light",
|
|
"lpp_wall",
|
|
"postproc_fisheye",
|
|
"postproc_panorama",
|
|
"postproc_laea",
|
|
"postproc_stereographic",
|
|
"fxaa",
|
|
"rtlight",
|
|
"underwaterwarp",
|
|
"menutint",
|
|
"terrain",
|
|
"fixedemu",
|
|
""
|
|
};
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
struct shadertype_s
|
|
{
|
|
char *filepattern;
|
|
char *preprocessor;
|
|
char *rendererapi;
|
|
int apiversion;
|
|
} shadertype[] =
|
|
{
|
|
{"glsl/%s.glsl", "GLQUAKE", "QR_OPENGL", 110}, //gl2+
|
|
//{"gles/%s.glsl", "GLQUAKE", "QR_OPENGL", 100}, //gles
|
|
{"hlsl9/%s.hlsl", "D3D9QUAKE", "QR_DIRECT3D9", 9}, //d3d9
|
|
{"hlsl11/%s.hlsl", "D3D11QUAKE", "QR_DIRECT3D11", 11}, //d3d11
|
|
};
|
|
//tbh we should precompile the d3d shaders.
|
|
|
|
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 < sizeof(shadertype)/sizeof(shadertype[0]); a++)
|
|
{
|
|
sprintf(line, shadertype[a].filepattern, shaders[i]);
|
|
s = fopen(line, "rt");
|
|
if (!s)
|
|
{
|
|
printf("unable to open %s\n", line);
|
|
continue;
|
|
}
|
|
fprintf(c, "#ifdef %s\n", shadertype[a].preprocessor);
|
|
fprintf(c, "{%s, %i, \"%s\",\n", shadertype[a].rendererapi, shadertype[a].apiversion, 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);
|
|
}
|