Skip to content

Commit

Permalink
Skip rendering base nodes that are outside of the view
Browse files Browse the repository at this point in the history
  • Loading branch information
Rampastring committed Oct 6, 2024
1 parent 200610d commit 05437f0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/TSMapEditor/Rendering/MapView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,14 @@ private void DrawBaseNode(GraphicalBaseNode graphicalBaseNode, bool drawGraphics

Point2D drawPoint = CellMath.CellTopLeftPointFromCellCoords_3D(graphicalBaseNode.BaseNode.Position, Map);

// Base nodes can be large, let's increase the level of padding for them.
int padding = Constants.RenderPixelPadding * 2;
if (Camera.TopLeftPoint.X > drawPoint.X + padding || Camera.TopLeftPoint.Y > drawPoint.Y + padding ||
GetCameraRightXCoord() < drawPoint.X - padding || GetCameraBottomYCoord() < drawPoint.Y - padding)
{
return;
}

ShapeImage bibGraphics = TheaterGraphics.BuildingBibTextures[graphicalBaseNode.BuildingType.Index];
ShapeImage graphics = TheaterGraphics.BuildingTextures[graphicalBaseNode.BuildingType.Index];
Color replacementColor = Color.DarkBlue;
Expand Down

0 comments on commit 05437f0

Please sign in to comment.