AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
AssetCache.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using UnityEngine;
4 
5 namespace UnityGLTF.Cache
6 {
10  public class AssetCache : IDisposable
11  {
15  public Texture2D[] ImageCache { get; private set; }
16 
20  public Texture[] TextureCache { get; private set; }
21 
25  public MaterialCacheData[] MaterialCache { get; private set; }
26 
30  public Dictionary<int, BufferCacheData> BufferCache { get; private set; }
31 
35  public List<MeshCacheData[]> MeshCache { get; private set; }
36 
45  public AssetCache(int imageCacheSize, int textureCacheSize, int materialCacheSize, int bufferCacheSize,
46  int meshCacheSize)
47  {
48  // todo: add optimization to set size to be the JSON size
49  ImageCache = new Texture2D[imageCacheSize];
50  TextureCache = new Texture[textureCacheSize];
51  MaterialCache = new MaterialCacheData[materialCacheSize];
52  BufferCache = new Dictionary<int, BufferCacheData>(bufferCacheSize);
53  MeshCache = new List<MeshCacheData[]>(meshCacheSize);
54  for (int i = 0; i < meshCacheSize; ++i)
55  {
56  MeshCache.Add(null);
57  }
58  }
59 
60  public void Dispose()
61  {
62  ImageCache = null;
63  TextureCache = null;
64  MaterialCache = null;
65  BufferCache.Clear();
66  MeshCache = null;
67  }
68  }
69 }
Caches data in order to construct a unity object
Definition: AssetCache.cs:10
AssetCache(int imageCacheSize, int textureCacheSize, int materialCacheSize, int bufferCacheSize, int meshCacheSize)
Creates an asset cache which caches objects used in scene
Definition: AssetCache.cs:45