Skip to content

Commit

Permalink
blends color alpha into icon alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruzihm committed Feb 20, 2025
1 parent b1134c3 commit cd34bcb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion OpenDreamClient/Rendering/DreamIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ private IRenderTexture FullRenderTexture(DreamViewOverlay viewOverlay, DrawingHa
//we can use the color matrix shader here, since we don't need to blend
//also because blend mode is none, we don't need to clear
var colorMatrix = iconMetaData.ColorMatrixToApply.Equals(ColorMatrix.Identity)
? new ColorMatrix(iconMetaData.ColorToApply.WithAlpha(iconMetaData.AlphaToApply))
? new ColorMatrix(iconMetaData.ColorToApply.WithAlpha(iconMetaData.ColorToApply.A * iconMetaData.AlphaToApply))
: iconMetaData.ColorMatrixToApply;

ShaderInstance colorShader = DreamViewOverlay.ColorInstance.Duplicate();
Expand Down
7 changes: 4 additions & 3 deletions OpenDreamClient/Rendering/DreamViewOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,10 @@ private void ClearRenderTarget(IRenderTexture target, DrawingHandleWorld handle,
ColorMatrix colorMatrix;
if (ignoreColor)
colorMatrix = ColorMatrix.Identity;
else if (iconMetaData.ColorMatrixToApply.Equals(ColorMatrix.Identity))
colorMatrix = new ColorMatrix(iconMetaData.ColorToApply.WithAlpha(iconMetaData.AlphaToApply));
else
else if (iconMetaData.ColorMatrixToApply.Equals(ColorMatrix.Identity)) {
float blendedAlpha = iconMetaData.ColorToApply.A * iconMetaData.AlphaToApply;
colorMatrix = new ColorMatrix(iconMetaData.ColorToApply.WithAlpha(blendedAlpha));
} else
colorMatrix = iconMetaData.ColorMatrixToApply;

// We can use no shader if everything is default
Expand Down

0 comments on commit cd34bcb

Please sign in to comment.