Skip to content

Commit

Permalink
LibSoftGPU: Prevent fog from overwriting the alpha channel
Browse files Browse the repository at this point in the history
Fog only affects the RGB channels according to the spec.
  • Loading branch information
gmta authored and awesomekling committed Dec 30, 2021
1 parent f2d8fcb commit 9d90bab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Userland/Libraries/LibSoftGPU/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,10 @@ void Device::submit_triangle(const Triangle& triangle, Vector<size_t> const& ena
break;
}

// Mix texel with fog
fragment = mix(m_options.fog_color, fragment, factor);
// Mix texel's RGB with fog's RBG - leave alpha alone
fragment.set_x(mix(m_options.fog_color.x(), fragment.x(), factor));
fragment.set_y(mix(m_options.fog_color.y(), fragment.y(), factor));
fragment.set_z(mix(m_options.fog_color.z(), fragment.z(), factor));
}

return fragment;
Expand Down

0 comments on commit 9d90bab

Please sign in to comment.