/** * Create mesh by tile map data */ private IEnumerator CreateMeshByTileMapFile() { string sampleURL = GetURL(); // Start a download of the given URL WWW www = CacheFile.LoadOrDownLoad(sampleURL, new TileMapUrlParse(Settings.TILE_MAP_FILE_FOLDER), this); // Wait for download to complete yield return(www); if (www.error == null) { //Get HeigtMap int multiplier = 1; IHeightMapReader heightMapReader; if (!IsUseToggle) { heightMapReader = new TextHeightMapReader(www.text); multiplier = 10; } else { Texture2D texture2D = new Texture2D(www.texture.width, www.texture.height); www.LoadImageIntoTexture(texture2D); heightMapReader = new TextureHeightMapReader(texture2D); } //Get height map HeightMap = heightMapReader.Read(multiplier, ZoomLevel); //Create mesh action CreateMeshByHeightMap(); } }
public IEnumerator test() { string url = "http://cyberjapandata.gsi.go.jp/xyz/dem/14/14535/6452.txt"; IUrlToPathParse urlParse = new TileMapUrlParse(Settings.TILE_MAP_FILE_FOLDER); WWW www = CacheFile.LoadOrDownLoad(url, urlParse, this); yield return(www); if (www.error == null) { Debug.Log(www.text); } }