mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 14:42:13 +00:00
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:
parent
c3ea880846
commit
7865011806
2 changed files with 55 additions and 4 deletions
|
@ -320,10 +320,29 @@ 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));
|
||||
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;
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue