From de5dd89b7490e7d0e9ce4d0be120874b53f6918b Mon Sep 17 00:00:00 2001 From: Spoike Date: Mon, 14 Nov 2005 01:33:25 +0000 Subject: [PATCH] Tweeked automatic generation of shaders, we now search for shirt/pants textures for default skin shaders. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1570 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/gl/gl_shader.c | 105 +++++++++++++++++++++++++++++++++++------- 1 file changed, 89 insertions(+), 16 deletions(-) diff --git a/engine/gl/gl_shader.c b/engine/gl/gl_shader.c index f95923087..5dbead51b 100644 --- a/engine/gl/gl_shader.c +++ b/engine/gl/gl_shader.c @@ -1828,26 +1828,99 @@ void Shader_DefaultBSPFlare(char *shortname, shader_t *s) } void Shader_DefaultSkin(char *shortname, shader_t *s) { + int tex; shaderpass_t *pass; - pass = &s->passes[0]; - pass->flags = SHADER_PASS_DEPTHWRITE; - pass->anim_frames[0] = Mod_LoadHiResTexture(shortname, NULL, true, true, true);//GL_FindImage (shortname, 0); - pass->depthfunc = GL_LEQUAL; - pass->rgbgen = RGB_GEN_LIGHTING_DIFFUSE; - pass->numtcmods = 0; - pass->tcgen = TC_GEN_BASE; - pass->blendsrc = GL_SRC_ALPHA; - pass->blenddst = GL_ONE_MINUS_SRC_ALPHA; - pass->blendmode = GL_MODULATE; - pass->numMergedPasses = 1; - pass->flush = R_RenderMeshGeneric; - if ( !pass->anim_frames[0] ) { - Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname ); - pass->anim_frames[0] = 0;//fizme:r_notexture; + s->numpasses = 0; + + tex = Mod_LoadHiResTexture(shortname, NULL, true, true, true); +// if (tex) + { + pass = &s->passes[s->numpasses++]; + pass->flags = SHADER_PASS_DEPTHWRITE; + pass->anim_frames[0] = tex; + pass->depthfunc = GL_LEQUAL; + pass->rgbgen = RGB_GEN_LIGHTING_DIFFUSE; + pass->numtcmods = 0; + pass->tcgen = TC_GEN_BASE; + pass->blendsrc = GL_SRC_ALPHA; + pass->blenddst = GL_ONE_MINUS_SRC_ALPHA; + pass->blendmode = GL_MODULATE; + pass->numMergedPasses = 1; + pass->flush = R_RenderMeshGeneric; + if (!pass->anim_frames[0]) + { + Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname ); + pass->anim_frames[0] = 0;//fizme:r_notexture; + } + } + + tex = Mod_LoadHiResTexture(va("%s_shirt", shortname), NULL, true, true, true); + if (tex) + { + pass = &s->passes[s->numpasses++]; + pass->flags = SHADER_PASS_BLEND; + pass->anim_frames[0] = tex; + pass->depthfunc = GL_EQUAL; + pass->rgbgen = RGB_GEN_TOPCOLOR; + pass->numtcmods = 0; + pass->tcgen = TC_GEN_BASE; + pass->blendsrc = GL_ONE; + pass->blenddst = GL_ONE; + pass->blendmode = GL_MODULATE; + pass->numMergedPasses = 1; + pass->flush = R_RenderMeshGeneric; + if (!pass->anim_frames[0]) + { + Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname ); + pass->anim_frames[0] = 0;//fizme:r_notexture; + } + } + + tex = Mod_LoadHiResTexture(va("%s_pants", shortname), NULL, true, true, true); + if (tex) + { + pass = &s->passes[s->numpasses++]; + pass->flags = SHADER_PASS_BLEND; + pass->anim_frames[0] = tex; + pass->depthfunc = GL_EQUAL; + pass->rgbgen = RGB_GEN_BOTTOMCOLOR; + pass->numtcmods = 0; + pass->tcgen = TC_GEN_BASE; + pass->blendsrc = GL_ONE; + pass->blenddst = GL_ONE; + pass->blendmode = GL_MODULATE; + pass->numMergedPasses = 1; + pass->flush = R_RenderMeshGeneric; + if (!pass->anim_frames[0]) + { + Con_DPrintf ( S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname ); + pass->anim_frames[0] = 0;//fizme:r_notexture; + } + } + + tex = Mod_LoadHiResTexture(va("%s_glow", shortname), NULL, true, true, true); + if (tex) + { + pass = &s->passes[s->numpasses++]; + pass->flags = SHADER_PASS_BLEND; + pass->anim_frames[0] = tex; + pass->depthfunc = GL_EQUAL; + pass->rgbgen = RGB_GEN_LIGHTING_DIFFUSE; + pass->numtcmods = 0; + pass->tcgen = TC_GEN_BASE; + pass->blendsrc = GL_ONE; + pass->blenddst = GL_ONE; + pass->blendmode = GL_MODULATE; + pass->numMergedPasses = 1; + pass->flush = R_RenderMeshGeneric; + if (!pass->anim_frames[0]) + { + Con_DPrintf (S_COLOR_YELLOW "Shader %s has a stage with no image: %s.\n", s->name, shortname); + pass->anim_frames[0] = 0;//fizme:r_notexture; + } } - s->numpasses = 1; s->numdeforms = 0; s->flags = SHADER_DEPTHWRITE|SHADER_CULL_FRONT; s->features = MF_STCOORDS|MF_NORMALS;