Ejemplo n.º 1
0
 public ChunkCache(IEnumerable <Pixel> pixels, Action <string, MessageGroup> logger)
 {
     interactiveMode = true;
     this.logger     = logger;
     chunks          = pixels.Select(p =>
     {
         PixelMap.ConvertToRelative(p.Item1, out byte chunkX, out _);
         PixelMap.ConvertToRelative(p.Item2, out byte chunkY, out _);
         return(chunkX, chunkY);
     }).Distinct().ToList();
 }
Ejemplo n.º 2
0
 public ChunkCache(short x1, short y1, short x2, short y2, Action <string, MessageGroup> logger)
 {
     interactiveMode = false;
     this.logger     = logger;
     PixelMap.ConvertToRelative(x1, out byte chunkX1, out _);
     PixelMap.ConvertToRelative(y1, out byte chunkY1, out _);
     PixelMap.ConvertToRelative(x2, out byte chunkX2, out _);
     PixelMap.ConvertToRelative(y2, out byte chunkY2, out _);
     chunks = new List <XY>();
     for (byte i = chunkX1; i <= chunkX2; i++)
     {
         for (byte j = chunkY1; j <= chunkY2; j++)
         {
             chunks.Add((i, j));
         }
     }
 }
Ejemplo n.º 3
0
 public PixelColor GetPixelColor(short x, short y)
 {
     PixelMap.ConvertToRelative(x, out byte chunkX, out byte relativeX);
     PixelMap.ConvertToRelative(y, out byte chunkY, out byte relativeY);
     PixelColor[,] chunkMap = CachedChunks[(chunkX, chunkY)];