| | 1 | | using GLTFast; |
| | 2 | | using System; |
| | 3 | | using UnityEngine; |
| | 4 | |
|
| | 5 | | namespace DCL.GLTFast.Wrappers |
| | 6 | | { |
| | 7 | | public class GLTFastDisposableDisposableTexturePromise : IDisposableTexture |
| | 8 | | { |
| | 9 | | private readonly AssetPromise_Texture promise; |
| | 10 | | private readonly AssetPromiseKeeper_Texture assetPromiseKeeper; |
| | 11 | |
|
| | 12 | | private bool isDisposed; |
| | 13 | |
|
| 34 | 14 | | public GLTFastDisposableDisposableTexturePromise(AssetPromise_Texture promise, AssetPromiseKeeper_Texture assetP |
| | 15 | | { |
| 34 | 16 | | this.promise = promise; |
| 34 | 17 | | this.assetPromiseKeeper = assetPromiseKeeper; |
| 34 | 18 | | } |
| 106 | 19 | | public Texture2D Texture => isDisposed ? throw new ObjectDisposedException(nameof(AssetPromise_Texture)) : promi |
| | 20 | |
|
| | 21 | | public void Dispose() |
| | 22 | | { |
| 102 | 23 | | if (isDisposed) return; |
| | 24 | |
|
| 34 | 25 | | assetPromiseKeeper.Forget(promise); |
| | 26 | |
|
| 34 | 27 | | isDisposed = true; |
| 34 | 28 | | } |
| | 29 | | } |
| | 30 | | } |