public void Draw(IPlotOperation plotOperation) { var area = viewport.RenderedArea; var insets = viewport.RenderInsets; var renderType = viewport.RenderType; var screenOrigin = new MapCoordinate(0, 0); screenNavigator.NavigateTo(GridDirection.North, screenOrigin, out MapCoordinate northWest, insets.Top); screenNavigator.NavigateTo(GridDirection.West, northWest, out northWest, insets.Left); screenNavigator.NavigateTo(GridDirection.South, screenOrigin, out MapCoordinate southWest, insets.Bottom); screenNavigator.NavigateTo(GridDirection.West, southWest, out southWest, insets.Left); var valid = true; var mapOrigin = viewport.CenterPointInMapCoordinates; valid &= mapAccessNavigator.NavigateTo(GridDirection.North, mapOrigin, out MapCoordinate mapRowStart, insets.Top); valid &= mapAccessNavigator.NavigateTo(GridDirection.West, mapRowStart, out mapRowStart, insets.Left); var rowStart = northWest; if (logger.IsTraceEnabled) { logger.Trace( "Rendering frame lines from {0} -> {1} in area {2} (Insets: {3}, ScreenOrigin: {4}, MapOrigin: {5})", northWest, southWest, area, insets, screenOrigin, mapOrigin); } plotOperation.StartDrawing(); for (var y = 0; y < area.Height; y += 1) { if (renderType == RenderType.Grid) { RenderLine(plotOperation, mapRowStart, rowStart, area.Width, valid, y); screenNavigator.NavigateTo(GridDirection.South, rowStart, out rowStart); valid = mapAccessNavigator.NavigateTo(GridDirection.South, mapRowStart, out mapRowStart); } else { // In any of the two isometric modes the renderer cannot just move straight downwards. // Rows are offset against each other, so the renderer has to alternate between the // south-east and south-west direction. // // On the first line, the start and end position are outwards from the screen so // the line is actually two elements longer. RenderLine(plotOperation, mapRowStart, rowStart, area.Width, valid, y); // was area.Width screenNavigator.NavigateTo(GridDirection.SouthEast, rowStart, out rowStart); valid = mapAccessNavigator.NavigateTo(GridDirection.SouthEast, mapRowStart, out mapRowStart); RenderLine(plotOperation, mapRowStart, rowStart, area.Width, valid, y); // was area.Width screenNavigator.NavigateTo(GridDirection.SouthWest, rowStart, out rowStart); valid = mapAccessNavigator.NavigateTo(GridDirection.SouthWest, mapRowStart, out mapRowStart); } } plotOperation.FinishedDrawing(); }
void RotationCacheControl(IPlotOperation c) { const string pn = nameof(GameRenderingConfig.RotationSteps); RenderingConfig.PropertyChanged += (_, a) => { if (a.PropertyName == pn) { c.InvalidateAll(); } }; }
public RenderLayer(IRenderCallback <TRenderTile, TContext> renderer, IPlotOperation plotOperation) { Renderer = renderer ?? throw new ArgumentNullException(nameof(renderer)); PlotOperation = plotOperation ?? throw new ArgumentNullException(nameof(plotOperation)); }
void RenderLine(IPlotOperation plotOperation, in MapCoordinate rowStart,
public static void CacheControlNoOp(IPlotOperation op) { }