/// <summary>
        /// Creates an asset cache which caches objects used in scene
        /// </summary>
        /// <param name="root">A glTF root whose assets will eventually be cached here</param>
        public AssetCache(GLTFRoot root)
        {
            ImageCache       = new Texture2D[root.Images?.Count ?? 0];
            ImageStreamCache = new Stream[ImageCache.Length];
            TextureCache     = new TextureCacheData[root.Textures?.Count ?? 0];
            MaterialCache    = new MaterialCacheData[root.Materials?.Count ?? 0];
            BufferCache      = new BufferCacheData[root.Buffers?.Count ?? 0];
            MeshCache        = new MeshCacheData[root.Meshes?.Count ?? 0];

            NodeCache      = new GameObject[root.Nodes?.Count ?? 0];
            AnimationCache = new AnimationCacheData[root.Animations?.Count ?? 0];
        }
Example #2
0
        /// <summary>
        /// Creates an asset cache which caches objects used in scene
        /// </summary>
        /// <param name="root">A glTF root whose assets will eventually be cached here</param>
        public AssetCache(GLTFRoot root)
        {
            ImageCache       = new Texture2D[root.Images?.Count ?? 0];
            ImageStreamCache = new Stream[ImageCache.Length];
            TextureCache     = new TextureCacheData[root.Textures?.Count ?? 0];
            MaterialCache    = new MaterialCacheData[root.Materials?.Count ?? 0];
            BufferCache      = new BufferCacheData[root.Buffers?.Count ?? 0];
            MeshCache        = new MeshCacheData[root.Meshes?.Count ?? 0][];
            for (int i = 0; i < MeshCache.Length; ++i)
            {
                MeshCache[i] = new MeshCacheData[root.Meshes?[i].Primitives.Count ?? 0];
            }

            NodeCache      = new GameObject[root.Nodes?.Count ?? 0];
            AnimationCache = new AnimationCacheData[root.Animations?.Count ?? 0];
        }
Example #3
0
        /// <summary>
        /// Creates an asset cache which caches objects used in scene
        /// </summary>
        /// <param name="imageCacheSize"></param>
        /// <param name="textureCacheSize"></param>
        /// <param name="materialCacheSize"></param>
        /// <param name="bufferCacheSize"></param>
        /// <param name="meshCacheSize"></param>
        /// <param name="nodeCacheSize"></param>
        public AssetCache(int imageCacheSize, int textureCacheSize, int materialCacheSize, int bufferCacheSize,
                          int meshCacheSize, int nodeCacheSize, int animationCacheSize)
        {
            ImageCache       = new Texture2D[imageCacheSize];
            ImageStreamCache = new Stream[imageCacheSize];
            TextureCache     = new TextureCacheData[textureCacheSize];
            MaterialCache    = new MaterialCacheData[materialCacheSize];
            BufferCache      = new BufferCacheData[bufferCacheSize];
            MeshCache        = new List <MeshCacheData[]>(meshCacheSize);
            for (int i = 0; i < meshCacheSize; ++i)
            {
                MeshCache.Add(null);
            }

            NodeCache      = new GameObject[nodeCacheSize];
            AnimationCache = new AnimationCacheData[animationCacheSize];
        }