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

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); Q_snprintfz (name, sizeof(name), "%s_pants", skin->name);
TEXASSIGN(skin->textures.loweroverlay, R_LoadHiResTexture(name, skinpath, 0)); 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); Q_snprintfz (name, sizeof(name), "%s_luma", skin->name);
TEXASSIGN(skin->textures.fullbright, R_LoadHiResTexture(skin->name, skinpath, IF_NOALPHA)); TEXASSIGN(skin->textures.fullbright, R_LoadHiResTexture(skin->name, skinpath, IF_NOALPHA));
Q_snprintfz (name, sizeof(name), "%s_gloss", skin->name); 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)) if (p & (1u<<n))
permutationdefines[pn++] = permutationname[n]; permutationdefines[pn++] = permutationname[n];
} }
if (p & PERMUTATION_UPPERLOWER)
permutationdefines[pn++] = "#define UPPER\n#define LOWER\n";
if (p & PERMUTATION_BUMPMAP) if (p & PERMUTATION_BUMPMAP)
{ {
if (r_glsl_offsetmapping.ival) if (r_glsl_offsetmapping.ival)

View file

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

View file

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