Exemplo n.º 1
0
        public Unity3DTileset(Unity3DTilesetOptions options, MonoBehaviour behaviour, RequestManager requestManager)
        {
            this.Options        = options;
            this.Behaviour      = behaviour;
            this.RequestManager = requestManager;
            this.traversal      = new Unity3DTilesetTraversal(this);
            this.LRUContent     = new LRUCache <Unity3DTile>();
            this.DeepestDepth   = 0;

            // TODO: Detect data Uri?
            if (Path.GetExtension(options.Url) == ".json")
            {
                this.tilesetUrl = this.Options.Url;
                this.basePath   = UriHelper.GetBaseUri(this.Options.Url, true);
            }
            else
            {
                this.basePath   = this.Options.Url;
                this.tilesetUrl = UriHelper.JoinUrls(this.Options.Url, "tileset.json", true);
            }
            LoadTilesetJson(this.tilesetUrl).Then(json =>
            {
                // Load Tileset (main tileset or a reference tileset)
                this.tileset = Schema.Tileset.FromJson(json);
                this.Root    = LoadTileset(this.tilesetUrl, this.tileset, null);
                this.readyPromise.Resolve(this);
            }).Catch(error =>
            {
                Debug.LogError(error.Message + "\n" + error.StackTrace);
            });
        }