aboutsummaryrefslogtreecommitdiff
path: root/src/GPU3D_Soft.cpp
diff options
context:
space:
mode:
authorJaklyy <102590697+Jaklyy@users.noreply.github.com>2023-08-12 23:38:26 -0400
committerGitHub <noreply@github.com>2023-08-13 05:38:26 +0200
commitf454eba3c3243b095f0e6b9ddde3e68b095c5d8d (patch)
tree8f940032d8def2492a5f5e42fae1ec502c0cf0db /src/GPU3D_Soft.cpp
parent5f9e7e19f39f89bed202ae528d4ed1a2d25794b1 (diff)
check lower pixel when top pixel ignores fog (#1808)
Diffstat (limited to 'src/GPU3D_Soft.cpp')
-rw-r--r--src/GPU3D_Soft.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp
index 0f8c602..6975eb4 100644
--- a/src/GPU3D_Soft.cpp
+++ b/src/GPU3D_Soft.cpp
@@ -1423,26 +1423,27 @@ void SoftRenderer::ScanlineFinalPass(s32 y)
u32 density, srccolor, srcR, srcG, srcB, srcA;
u32 attr = AttrBuffer[pixeladdr];
- if (!(attr & (1<<15))) continue;
-
- density = CalculateFogDensity(pixeladdr);
+ if (attr & (1<<15))
+ {
+ density = CalculateFogDensity(pixeladdr);
- srccolor = ColorBuffer[pixeladdr];
- srcR = srccolor & 0x3F;
- srcG = (srccolor >> 8) & 0x3F;
- srcB = (srccolor >> 16) & 0x3F;
- srcA = (srccolor >> 24) & 0x1F;
+ srccolor = ColorBuffer[pixeladdr];
+ srcR = srccolor & 0x3F;
+ srcG = (srccolor >> 8) & 0x3F;
+ srcB = (srccolor >> 16) & 0x3F;
+ srcA = (srccolor >> 24) & 0x1F;
- if (fogcolor)
- {
- srcR = ((fogR * density) + (srcR * (128-density))) >> 7;
- srcG = ((fogG * density) + (srcG * (128-density))) >> 7;
- srcB = ((fogB * density) + (srcB * (128-density))) >> 7;
- }
+ if (fogcolor)
+ {
+ srcR = ((fogR * density) + (srcR * (128-density))) >> 7;
+ srcG = ((fogG * density) + (srcG * (128-density))) >> 7;
+ srcB = ((fogB * density) + (srcB * (128-density))) >> 7;
+ }
- srcA = ((fogA * density) + (srcA * (128-density))) >> 7;
+ srcA = ((fogA * density) + (srcA * (128-density))) >> 7;
- ColorBuffer[pixeladdr] = srcR | (srcG << 8) | (srcB << 16) | (srcA << 24);
+ ColorBuffer[pixeladdr] = srcR | (srcG << 8) | (srcB << 16) | (srcA << 24);
+ }
// fog for lower pixel
// TODO: make this code nicer, but avoid using a loop