public SetDataFromCells ( TerrainEngine.Terrain cells, int xofs, int yofs, int stride ) : void | ||
cells | TerrainEngine.Terrain | |
xofs | int | |
yofs | int | |
stride | int | |
return | void |
// TODO: turn terrain into tiles public void LoadTiles() { // discard old tiles // TODO: do we need to unload resources here? this.Tiles.Clear(); for (int y = 0; y < NYTiles; y++) { for (int x = 0; x < NXTiles; x++) { //var tile = new TerrainTile(TileSize, TileSize, new Vector3((float)(x * TileSize), 0.0f, (float)(y * TileSize)),(float)TileSize); var tile = new TerrainTile(TileSize, TileSize, new Vector3((float)(x), 0.0f, (float)(y)), 1.0f); tile.SetDataFromCells(this.Data, x * TileSize, y * TileSize, this.Width); this.Tiles.Add(tile); } } }
// TODO: turn terrain into tiles public void LoadTiles() { // discard old tiles // TODO: do we need to unload resources here? this.Tiles.Clear(); for (int y = 0; y < NYTiles; y++) { for (int x = 0; x < NXTiles; x++) { //var tile = new TerrainTile(TileSize, TileSize, new Vector3((float)(x * TileSize), 0.0f, (float)(y * TileSize)),(float)TileSize); var tile = new TerrainTile(TileSize, TileSize, new Vector3((float)(x), 0.0f, (float)(y)), 1.0f); tile.SetDataFromCells(this.Data, x * TileSize, y * TileSize, this.Width); this.Tiles.Add(tile); } } }