/** * The filling process involves iterating over the whole map, clearing or setting the block mask, and painting the specified texture * (using the specified rect!), or an alternative if the odds were in favor. */ public override void Process(Action <uint, uint, Texture2D, Rect> painter, Bitmask currentBlockMask) { currentBlockMask.Fill(Blocking); for (uint y = 0; y < Height; y++) { for (uint x = 0; x < Width; x++) { Rect?picked = (OtherTilesPicker != null) ? OtherTilesPicker.Pick() : null; painter(x, y, picked != null ? OtherTilesPicker.Source : Source, picked != null ? picked.Value : SourceRect); } } }
/** * The biome-making process involves iterating over the whole map, computing the tile index based on its tile mask, * computing the block mask, and generating the texture (perhaps using random tiles for central tile). */ public override void Process(Action <uint, uint, Texture2D, Rect> painter, Bitmask currentBlockMask) { for (uint y = 0; y < Height; y++) { for (uint x = 0; x < Width; x++) { // Right now this does not mess with biomatic markers. // Just the block mask and the texture. int presenceIndex = 0; if (ParsedPresenceData[x, y]) { presenceIndex += 8; } if (ParsedPresenceData[x + 1, y]) { presenceIndex += 4; } if (ParsedPresenceData[x, y + 1]) { presenceIndex += 2; } if (ParsedPresenceData[x + 1, y + 1]) { presenceIndex += 1; } Rect?picked = (presenceIndex == 15 && OtherTilesPicker != null) ? OtherTilesPicker.Pick() : null; Rect section = picked != null ? picked.Value : SourceRects[presenceIndex]; painter(x, y, picked != null ? OtherTilesPicker.Source : Source, section); if ((PresenceBlockingMode != null) && (ExtendedPresence ? (presenceIndex != 0) : (presenceIndex == 15))) { currentBlockMask[x, y] = PresenceBlockingMode.Value; } } } }