mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-05-02 02:23:56 +00:00
Fix software renderer ignoring texture in transparent render path
The transparent code path skipped texture sampling entirely, producing a solid colored rectangle instead of the textured shape. Move texture sampling before the opaque/transparent branch so both paths get texel color modulation, and use texel alpha for per-pixel transparency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
09ed6edb3e
commit
176aef1d90
@ -465,8 +465,7 @@ void Direct3DRMSoftwareRenderer::DrawTriangleProjected(
|
||||
Uint8* pixelAddr = pixels + y * pitch + x * m_bytesPerPixel;
|
||||
Uint32 finalColor;
|
||||
|
||||
if (appearance.color.a == 255) {
|
||||
zref = z;
|
||||
Uint8 alpha = appearance.color.a;
|
||||
|
||||
if (texels) {
|
||||
// Perspective correct interpolate texture coords
|
||||
@ -507,12 +506,21 @@ void Direct3DRMSoftwareRenderer::DrawTriangleProjected(
|
||||
r = (r * tr + 127) / 255;
|
||||
g = (g * tg + 127) / 255;
|
||||
b = (b * tb + 127) / 255;
|
||||
|
||||
// Use texel alpha for per-pixel transparency
|
||||
alpha = ta;
|
||||
}
|
||||
|
||||
if (alpha == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (alpha == 255) {
|
||||
zref = z;
|
||||
finalColor = SDL_MapRGBA(m_format, m_palette, r, g, b, 255);
|
||||
}
|
||||
else {
|
||||
finalColor = BlendPixel(pixelAddr, r, g, b, appearance.color.a);
|
||||
finalColor = BlendPixel(pixelAddr, r, g, b, alpha);
|
||||
}
|
||||
|
||||
switch (m_bytesPerPixel) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user