Skip to content

Commit

Permalink
softgpu: Pass in the right value for fog.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed Nov 26, 2015
1 parent 7bfe100 commit 7a9bdee
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions GPU/Software/Rasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,12 +1428,15 @@ void DrawPoint(const VertexData &v0)
DrawingCoords p = TransformUnit::ScreenToDrawing(pprime);
u16 z = pos.z;

u8 fog = ClampFogDepth(v0.fogdepth);
u8 fog = 255;
if (gstate.isFogEnabled() && !clearMode) {
fog = ClampFogDepth(v0.fogdepth);
}

if (clearMode) {
DrawSinglePixel<true>(p, z, v0.fogdepth, prim_color);
DrawSinglePixel<true>(p, z, fog, prim_color);
} else {
DrawSinglePixel<false>(p, z, v0.fogdepth, prim_color);
DrawSinglePixel<false>(p, z, fog, prim_color);
}
}

Expand Down Expand Up @@ -1509,7 +1512,10 @@ void DrawLine(const VertexData &v0, const VertexData &v1)
Vec2<float> tc = (v0.texturecoords * (float)(steps - i) + v1.texturecoords * (float)i) / steps1;
Vec4<int> prim_color = c0;

// TODO: Interpolate fog as well
u8 fog = 255;
if (gstate.isFogEnabled() && !clearMode) {
fog = ClampFogDepth((v0.fogdepth * (float)(steps - i) + v1.fogdepth * (float)i) / steps1);
}

float s = tc.s();
float t = tc.t();
Expand All @@ -1532,9 +1538,9 @@ void DrawLine(const VertexData &v0, const VertexData &v1)

DrawingCoords p = TransformUnit::ScreenToDrawing(pprime);
if (clearMode) {
DrawSinglePixel<true>(p, z, v0.fogdepth, prim_color);
DrawSinglePixel<true>(p, z, fog, prim_color);
} else {
DrawSinglePixel<false>(p, z, v0.fogdepth, prim_color);
DrawSinglePixel<false>(p, z, fog, prim_color);
}

x = x + xinc;
Expand Down

0 comments on commit 7a9bdee

Please sign in to comment.