mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
- fixed brightmaps.
They are no longer run through the texture postprocessor and the shader now applies them correctly.
This commit is contained in:
parent
de59841961
commit
6282062492
2 changed files with 11 additions and 18 deletions
|
@ -96,7 +96,7 @@ FHardwareTexture* GLInstance::CreateTrueColorTexture(FTexture* tex, int palid, b
|
|||
{
|
||||
auto palette = palid < 0? nullptr : palmanager.GetPaletteData(palid);
|
||||
if (palid >= 0 && palette == nullptr) return nullptr;
|
||||
auto texbuffer = tex->CreateTexBuffer(palette, CTF_ProcessData);
|
||||
auto texbuffer = tex->CreateTexBuffer(palette, checkfulltransparency? 0: CTF_ProcessData);
|
||||
// Check if the texture is fully transparent. When creating a brightmap such textures can be discarded.
|
||||
if (checkfulltransparency)
|
||||
{
|
||||
|
|
|
@ -205,26 +205,19 @@ void main()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (u_tintFlags != -1) color = convertColor(color);
|
||||
color.rgb *= detailColor.rgb;
|
||||
|
||||
vec3 lightcolor = v_color.rgb;
|
||||
bool shadeIt = ((u_flags & RF_FogDisabled) == 0);
|
||||
// The lighting model here does not really allow more than a simple on/off brightmap because anything more complex inteferes with the shade ramp... :(
|
||||
if ((u_flags & RF_Brightmapping) != 0)
|
||||
if (u_tintFlags != -1) color = convertColor(color);
|
||||
if ((u_flags & RF_FogDisabled) == 0)
|
||||
{
|
||||
vec4 brightcolor = texture(s_brightmap, v_texCoord.xy);
|
||||
if (grayscale(brightcolor) > 0.5)
|
||||
{
|
||||
shadeIt = false;
|
||||
}
|
||||
}
|
||||
if (shadeIt)
|
||||
{
|
||||
color.rgb *= lightcolor;
|
||||
shade = clamp(shade * u_shadeDiv, 0.0, 1.0); // u_shadeDiv is really 1/shadeDiv.
|
||||
// Apply the shade as a linear depth fade ramp.
|
||||
color.rgb = mix(color.rgb, u_fogColor.rgb, shade);
|
||||
vec3 lightcolor = v_color.rgb * (1.0 - shade);
|
||||
|
||||
if ((u_flags & RF_Brightmapping) != 0)
|
||||
{
|
||||
lightcolor = texture(s_brightmap, v_texCoord.xy).rgb;
|
||||
}
|
||||
color.rgb *= lightcolor;
|
||||
color.rgb += u_fogColor.rgb * shade;
|
||||
}
|
||||
}
|
||||
if (color.a < u_alphaThreshold) discard; // it's only here that we have the alpha value available to be able to perform the alpha test.
|
||||
|
|
Loading…
Reference in a new issue