Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid full-rendering sprites a second time in the mouse map #2189

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions OpenDreamClient/Rendering/DreamPlane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ public void Draw(DreamViewOverlay overlay, DrawingHandleWorld handle, Box2 world
public void DrawMouseMap(DrawingHandleWorld handle, DreamViewOverlay overlay, Vector2i renderTargetSize, Box2 worldAABB) {
if (Master?.MouseOpacity == MouseOpacity.Transparent)
return;

handle.UseShader(overlay.BlockColorInstance);
foreach (var sprite in Sprites) {
if (sprite.MouseOpacity == MouseOpacity.Transparent || sprite.ShouldPassMouse)
continue;

var texture = sprite.GetTexture(overlay, handle);
var texture = sprite.MainIcon?.LastRenderedTexture;
if (texture == null)
continue;

Expand All @@ -90,7 +92,6 @@ public void DrawMouseMap(DrawingHandleWorld handle, DreamViewOverlay overlay, Ve
var colorB = (byte)((hash >> 16) & 0xFF);
Color targetColor = new Color(colorR, colorG, colorB); //TODO - this could result in mis-clicks due to hash-collision since we ditch a whole byte.
overlay.MouseMapLookup[targetColor] = sprite;
handle.UseShader(overlay.BlockColorInstance); //it seems like you could put this outside the loop, but you can't without breakng the mousemap
handle.SetTransform(DreamViewOverlay.CalculateDrawingMatrix(sprite.TransformToApply, pos, texture.Size, renderTargetSize));
handle.DrawTextureRect(texture, new Box2(Vector2.Zero, texture.Size), targetColor);
}
Expand Down
Loading