public void Init(TextureStreaming streamer, int streamingIndex, RenderTextureFormat format, MStringBuilder msb) { this.msb = msb; this.streamer = streamer; this.streamingIndex = streamingIndex; rt = new RenderTexture(new RenderTextureDescriptor { width = streamer.fixedLoadSize, height = streamer.fixedLoadSize, volumeDepth = maximumPoolCapacity, dimension = TextureDimension.Tex2DArray, depthBufferBits = 0, colorFormat = format, msaaSamples = 1, enableRandomWrite = true }); rt.filterMode = FilterMode.Bilinear; rt.wrapMode = TextureWrapMode.Repeat; rt.Create(); indexPool = new NativeList <int>(maximumPoolCapacity, maximumPoolCapacity, Allocator.Persistent); for (int i = 0; i < maximumPoolCapacity; ++i) { indexPool[i] = i; } usageCount = new NativeArray <int>(maximumPoolCapacity, Allocator.Persistent, NativeArrayOptions.ClearMemory); guidToIndex = new Dictionary <string, int>(maximumPoolCapacity); }
public void Dispose() { UnityEngine.Object.DestroyImmediate(rt); usageCount.Dispose(); indexPool.Dispose(); guidToIndex = null; streamer = null; }