hlmdl: added "support" for fullbright and chrome materials. still requires GLSL additions upstream.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5389 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Eukara 2019-01-22 00:52:35 +00:00
parent c3ea880846
commit 7865011806
2 changed files with 55 additions and 4 deletions

View file

@ -320,11 +320,30 @@ qboolean QDECL Mod_LoadHLModel (model_t *mod, void *buffer, size_t fsize)
for(i = 0; i < texheader->numtextures; i++)
{
Q_snprintfz(shaders[i].name, sizeof(shaders[i].name), "%s/%s", mod->name, COM_SkipPath(tex[i].name));
/* handle the special textures - eukara */
if (tex[i].flags) {
char *shader;
if (tex[i].flags & HLMDLFL_FULLBRIGHT) {
if (tex[i].flags & HLMDLFL_CHROME) {
shader = HLSHADER_FULLBRIGHTCHROME;
} else {
shader = HLSHADER_FULLBRIGHT;
}
} else if (tex[i].flags & HLMDLFL_CHROME) {
shader = HLSHADER_CHROME;
}
shaders[i].shader = R_RegisterShader(shaders[i].name, SUF_NONE, shader);
shaders[i].shader->defaulttextures->base = Image_GetTexture(shaders[i].name, "", IF_NOALPHA, (qbyte *) texheader + tex[i].offset, (qbyte *) texheader + tex[i].w * tex[i].h + tex[i].offset, tex[i].w, tex[i].h, TF_8PAL24);
shaders[i].shader->width = tex[i].w;
shaders[i].shader->height = tex[i].h;
} else {
memset(&shaders[i].defaulttex, 0, sizeof(shaders[i].defaulttex));
shaders[i].defaulttex.base = Image_GetTexture(shaders[i].name, "", IF_NOALPHA, (qbyte *) texheader + tex[i].offset, (qbyte *) texheader + tex[i].w * tex[i].h + tex[i].offset, tex[i].w, tex[i].h, TF_8PAL24);
shaders[i].w = tex[i].w;
shaders[i].h = tex[i].h;
}
}
model->numskinrefs = texheader->skinrefs;
model->numskingroups = texheader->skingroups;

View file

@ -14,6 +14,38 @@
#define HLPOLYHEADER (('T' << 24) + ('S' << 16) + ('D' << 8) + 'I') /* little-endian "IDST" */
#define HLMDLHEADER "IDST"
/* flags - eukara */
#define HLMDLFL_FLAT 0x0001
#define HLMDLFL_CHROME 0x0002
#define HLMDLFL_FULLBRIGHT 0x0004
#define HLSHADER_FULLBRIGHT \
"{\n" \
"program defaultskin\n" \
"{\n" \
"map $diffuse\n" \
"}\n" \
"}\n"
#define HLSHADER_CHROME \
"{\n" \
"program defaultskin#CHROME\n" \
"{\n" \
"map $diffuse\n" \
"tcgen environment\n" \
"rgbgen lightingdiffuse\n" \
"}\n" \
"}\n"
#define HLSHADER_FULLBRIGHTCHROME \
"{\n" \
"program defaultskin#CHROME\n" \
"{\n" \
"map $diffuse\n" \
"tcgen environment\n" \
"}\n" \
"}\n"
/*
-----------------------------------------------------------------------------------------------------------------------
main model header