void TileGenerate(int tileX, int tileY, TerrainTileData tileData) { for (var y = 0; y < TerrainTileData.Height; y++) { for (var x = 0; x < TerrainTileData.Width; x++) { // TODO tileData[x, y] = new TerrainCell(TerrainMaterial.Air, (byte)(x & 0x3F), (byte)(y & 0x3F), 0); } } }
void TileDataFromMaterialImage(Image materialImage, TerrainTileData tileData) { materialImage.Lock(); for (var y = 0; y < TerrainTileData.Height; y++) { for (var x = 0; x < TerrainTileData.Width; x++) { var pixel = materialImage.GetPixel(x, y); var material = pixel.AsTerrainMaterial(); tileData[x, y] = new TerrainCell(material, (byte)(x & 0x3F), (byte)(y & 0x3F), 0); } } materialImage.Unlock(); }