------------------------------------------------------------------------

r4238 | acceptthis | 2013-03-06 18:19:50 +0000 (Wed, 06 Mar 2013) | 1 line

Add fullbright instead of mixing fullbright. This at least shows something when fullbrights are used, instead of potential blackness if the fullbright image universally contains 1 in the alpha channel.
------------------------------------------------------------------------


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4234 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-03-12 23:14:57 +00:00
parent 5141aeda5f
commit 197bb250dd
4 changed files with 23 additions and 18 deletions

View File

@ -309,6 +309,9 @@ qbyte *Skin_Cache8 (skin_t *skin)
Q_snprintfz (name, sizeof(name), "%s_pants", skin->name);
TEXASSIGN(skin->textures.loweroverlay, R_LoadHiResTexture(name, skinpath, 0));
if (!TEXVALID(skin->textures.upperoverlay) && !TEXVALID(skin->textures.loweroverlay))
Con_DPrintf("skin \"%s\" has no colourmapping info\n", skin->name);
Q_snprintfz (name, sizeof(name), "%s_luma", skin->name);
TEXASSIGN(skin->textures.fullbright, R_LoadHiResTexture(skin->name, skinpath, IF_NOALPHA));
Q_snprintfz (name, sizeof(name), "%s_gloss", skin->name);

View File

@ -1057,6 +1057,8 @@ static qboolean Shader_LoadPermutations(char *name, program_t *prog, char *scrip
if (p & (1u<<n))
permutationdefines[pn++] = permutationname[n];
}
if (p & PERMUTATION_UPPERLOWER)
permutationdefines[pn++] = "#define UPPER\n#define LOWER\n";
if (p & PERMUTATION_BUMPMAP)
{
if (r_glsl_offsetmapping.ival)

View File

@ -463,6 +463,7 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"!!permu FRAMEBLEND\n"
"!!permu SKELETAL\n"
"!!permu FOG\n"
"!!permu BUMP\n"
"!!cvarf r_glsl_offsetmapping_scale\n"
"!!cvarf gl_specular\n"
@ -470,11 +471,6 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
//must support skeletal and 2-way vertex blending or Bad Things Will Happen.
//the vertex shader is responsible for calculating lighting values.
"#ifdef UPPERLOWER\n"
"#define UPPER\n"
"#define LOWER\n"
"#endif\n"
"varying vec2 tc;\n"
"varying vec3 light;\n"
"#if defined(SPECULAR) || defined(OFFSETMAPPING)\n"
@ -526,8 +522,11 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"uniform sampler2D s_t3;\n"
"#endif\n"
"#if defined(SPECULAR)\n"
"#if defined(BUMP)\n"
"uniform sampler2D s_t4;\n"
"#endif\n"
"#if defined(SPECULAR)\n"
"uniform sampler2D s_t5;\n"
"uniform float cvar_gl_specular;\n"
"#endif\n"
@ -544,7 +543,7 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"vec4 col, sp;\n"
"#ifdef OFFSETMAPPING\n"
"vec2 tcoffsetmap = offsetmap(s_t1, tcbase, eyevector);\n"
"vec2 tcoffsetmap = offsetmap(s_t4, tcbase, eyevector);\n"
"#define tc tcoffsetmap\n"
"#endif\n"
@ -559,7 +558,7 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"#endif\n"
"col.rgb *= light;\n"
"#if defined(SPECULAR)\n"
"#if defined(BUMP) && defined(SPECULAR)\n"
"vec3 bumps = normalize(vec3(texture2D(s_t4, tc)) - 0.5);\n"
"vec4 specs = texture2D(s_t5, tc);\n"
@ -570,7 +569,8 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"#ifdef FULLBRIGHT\n"
"vec4 fb = texture2D(s_t3, tc);\n"
"col.rgb = mix(col.rgb, fb.rgb, fb.a);\n"
// col.rgb = mix(col.rgb, fb.rgb, fb.a);
"col.rgb += fb.rgb * fb.a;\n"
"#endif\n"
"gl_FragColor = fog4(col * e_colourident);\n"

View File

@ -3,6 +3,7 @@
!!permu FRAMEBLEND
!!permu SKELETAL
!!permu FOG
!!permu BUMP
!!cvarf r_glsl_offsetmapping_scale
!!cvarf gl_specular
@ -10,11 +11,6 @@
//must support skeletal and 2-way vertex blending or Bad Things Will Happen.
//the vertex shader is responsible for calculating lighting values.
#ifdef UPPERLOWER
#define UPPER
#define LOWER
#endif
varying vec2 tc;
varying vec3 light;
#if defined(SPECULAR) || defined(OFFSETMAPPING)
@ -66,8 +62,11 @@ uniform vec3 e_uppercolour;
uniform sampler2D s_t3;
#endif
#if defined(SPECULAR)
#if defined(BUMP)
uniform sampler2D s_t4;
#endif
#if defined(SPECULAR)
uniform sampler2D s_t5;
uniform float cvar_gl_specular;
#endif
@ -84,7 +83,7 @@ void main ()
vec4 col, sp;
#ifdef OFFSETMAPPING
vec2 tcoffsetmap = offsetmap(s_t1, tcbase, eyevector);
vec2 tcoffsetmap = offsetmap(s_t4, tcbase, eyevector);
#define tc tcoffsetmap
#endif
@ -99,7 +98,7 @@ void main ()
#endif
col.rgb *= light;
#if defined(SPECULAR)
#if defined(BUMP) && defined(SPECULAR)
vec3 bumps = normalize(vec3(texture2D(s_t4, tc)) - 0.5);
vec4 specs = texture2D(s_t5, tc);
@ -110,7 +109,8 @@ void main ()
#ifdef FULLBRIGHT
vec4 fb = texture2D(s_t3, tc);
col.rgb = mix(col.rgb, fb.rgb, fb.a);
// col.rgb = mix(col.rgb, fb.rgb, fb.a);
col.rgb += fb.rgb * fb.a;
#endif
gl_FragColor = fog4(col * e_colourident);