protected virtual void MakeTileset()
        {
            RequestManager rm = new RequestManager(MaxConcurrentRequests);

            Tileset = new Unity3DTileset(TilesetOptions, this, rm);
            Stats   = Tileset.Statistics;
        }
Exemple #2
0
        public bool AddTileset(Unity3DTilesetOptions options)
        {
            if (string.IsNullOrEmpty(options.Name))
            {
                options.Name = options.Url;
            }
            if (string.IsNullOrEmpty(options.Name) || string.IsNullOrEmpty(options.Url))
            {
                Debug.LogWarning("Attempt to add tileset with null or empty name or url failed.");
                return(false);
            }
            options.Url = MakeAbsoluteUrl(options.Url);
            if (nameToTileset.ContainsKey(options.Name))
            {
                Debug.LogWarning(String.Format("Attempt to add tileset with duplicate name {0} failed.", options.Name));
                return(false);
            }
            if (SceneOptions.GLTFShaderOverride != null && options.GLTFShaderOverride == null)
            {
                options.GLTFShaderOverride = SceneOptions.GLTFShaderOverride;
            }
            var tileset = new Unity3DTileset(options, this);

            tilesets.Add(tileset);
            nameToTileset[options.Name] = tileset;
            if (!TilesetOptions.Contains(options))
            {
                TilesetOptions.Add(options);
            }
            UpdateStats();
            return(true);
        }
Exemple #3
0
        public Unity3DTile(Unity3DTileset tileset, string basePath, Schema.Tile tile, Unity3DTile parent)
        {
            this.hashCode   = (int)Random.Range(0, int.MaxValue);
            this.tileset    = tileset;
            this.tile       = tile;
            this.FrameState = new TileFrameState();
            if (tile.Content != null)
            {
                this.Id = Path.GetFileNameWithoutExtension(tile.Content.Url);
            }
            if (parent != null)
            {
                parent.Children.Add(this);
                this.Depth = parent.Depth + 1;
            }

            // TODO: Consider using a double percision Matrix library for doing 3d tiles root transform calculations
            // Set the local transform for this tile, default to identity matrix
            this.transform = this.tile.UnityTransform();

            var parentTransform = (parent != null) ? parent.computedTransform : Matrix4x4.identity;

            this.computedTransform = parentTransform * this.transform;
            this.BoundingVolume    = CreateBoundingVolume(tile.BoundingVolume, this.computedTransform);
            // TODO: Add 2D bounding volumes

            if (tile.Content != null && tile.Content.BoundingVolume.IsDefined())
            {
                // Non-leaf tiles may have a content bounding-volume, which is a tight-fit bounding volume
                // around only the features in the tile.  This box is useful for culling for rendering,
                // but not for culling for traversing the tree since it does not guarantee spatial coherence, i.e.,
                // since it only bounds features in the tile, not the entire tile, children may be
                // outside of this box.
                this.ContentBoundingVolume = CreateBoundingVolume(tile.Content.BoundingVolume, this.computedTransform);
            }
            else
            {
                // Default to tile bounding volume
                this.ContentBoundingVolume = CreateBoundingVolume(tile.BoundingVolume, this.computedTransform);
            }
            // TODO: Add viewer request volume support
            //if(tile.ViewerRequestVolume != null && tile.ViewerRequestVolume.IsDefined())
            //{
            //    this.viewerRequestVolume = CreateBoundingVolume(tile.ViewerRequestVolume, transform);
            //}

            if (!tile.Refine.HasValue)
            {
                tile.Refine = (parent == null) ? Schema.TileRefine.REPLACE : parent.tile.Refine.Value;
            }

            this.Parent = parent;

            if (this.HasEmptyContent)
            {
                this.ContentState = Unity3DTileContentState.READY;
            }
            else
            {
                ContentState    = Unity3DTileContentState.UNLOADED;
                this.ContentUrl = UriHelper.JoinUrls(basePath, tile.Content.Url);
            }

            this.HasRenderableContent = false;
            this.HasTilesetContent    = false;
        }
 public SSECalculator(Unity3DTileset tileset)
 {
     this.tileset = tileset;
 }
 public Unity3DTilesetTraversal(Unity3DTileset tileset, Unity3DTilesetSceneOptions sceneOptions)
 {
     this.tileset      = tileset;
     this.sceneOptions = sceneOptions;
 }
Exemple #6
0
 public virtual void MakeTileset()
 {
     this.requestManager = new RequestManager(MaxConcurrentRequests);
     Tileset             = new Unity3DTileset(TilesetOptions, this, this.requestManager, this.postDownloadQueue, this.LRUCache);
     Stats = Tileset.Statistics;
 }
 public Unity3DTilesetTraversal(Unity3DTileset tileset)
 {
     this.tileset = tileset;
 }
Exemple #8
0
 public virtual void MakeTileset()
 {
     Tileset = new Unity3DTileset(TilesetOptions, this);
     Stats   = Tileset.Statistics;
 }