mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- Fix dynamic light clamping issue in truecolor drawers
This commit is contained in:
parent
bf4d7234e1
commit
1ce3b4c79c
4 changed files with 12 additions and 0 deletions
|
@ -355,6 +355,10 @@ namespace swrenderer
|
|||
lit.b += (light_color.b * attenuation) >> 8;
|
||||
}
|
||||
|
||||
lit.r = MIN<uint32_t>(lit.r, 256);
|
||||
lit.g = MIN<uint32_t>(lit.g, 256);
|
||||
lit.b = MIN<uint32_t>(lit.b, 256);
|
||||
|
||||
fgcolor.r = MIN<uint32_t>(fgcolor.r + ((material.r * lit.r) >> 8), 255);
|
||||
fgcolor.g = MIN<uint32_t>(fgcolor.g + ((material.g * lit.g) >> 8), 255);
|
||||
fgcolor.b = MIN<uint32_t>(fgcolor.b + ((material.b * lit.b) >> 8), 255);
|
||||
|
|
|
@ -399,6 +399,8 @@ namespace swrenderer
|
|||
lit = _mm_add_epi16(lit, _mm_srli_epi16(_mm_mullo_epi16(light_color, attenuation), 8));
|
||||
}
|
||||
|
||||
lit = _mm_min_epi16(lit, _mm_set1_epi16(256));
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, lit), 8));
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
|
||||
return fgcolor;
|
||||
|
|
|
@ -269,6 +269,10 @@ namespace swrenderer
|
|||
lit.b += (light_color.b * attenuation) >> 8;
|
||||
}
|
||||
|
||||
lit.r = MIN<uint32_t>(lit.r, 256);
|
||||
lit.g = MIN<uint32_t>(lit.g, 256);
|
||||
lit.b = MIN<uint32_t>(lit.b, 256);
|
||||
|
||||
fgcolor.r = MIN<uint32_t>(fgcolor.r + ((material.r * lit.r) >> 8), 255);
|
||||
fgcolor.g = MIN<uint32_t>(fgcolor.g + ((material.g * lit.g) >> 8), 255);
|
||||
fgcolor.b = MIN<uint32_t>(fgcolor.b + ((material.b * lit.b) >> 8), 255);
|
||||
|
|
|
@ -315,6 +315,8 @@ namespace swrenderer
|
|||
lit = _mm_add_epi16(lit, _mm_srli_epi16(_mm_mullo_epi16(light_color, attenuation), 8));
|
||||
}
|
||||
|
||||
lit = _mm_min_epi16(lit, _mm_set1_epi16(256));
|
||||
|
||||
fgcolor = _mm_add_epi16(fgcolor, _mm_srli_epi16(_mm_mullo_epi16(material, lit), 8));
|
||||
fgcolor = _mm_min_epi16(fgcolor, _mm_set1_epi16(255));
|
||||
return fgcolor;
|
||||
|
|
Loading…
Reference in a new issue