< Summary

Class:DCL.Asset_Texture
Assembly:AssetPromiseKeeper
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Texture/Asset_Texture.cs
Covered lines:13
Uncovered lines:2
Coverable lines:15
Total lines:39
Line coverage:86.6% (13 of 15)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
ConfigureTexture(...)0%2.012085.71%
Cleanup()0%220100%
Dispose()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/AssetManager/Texture/Asset_Texture.cs

#LineLine coverage
 1using System;
 2using UnityEngine;
 3using UnityEngine.Experimental.Rendering;
 4using UnityGLTF.Cache;
 5using Object = UnityEngine.Object;
 6
 7namespace DCL
 8{
 9    public class Asset_Texture : Asset, ITexture
 10    {
 711        public Texture2D texture { get; set; }
 12        public Asset_Texture dependencyAsset; // to store the default tex asset and release it accordingly
 13
 14        public event System.Action OnCleanup;
 15
 16        public void ConfigureTexture(TextureWrapMode textureWrapMode, FilterMode textureFilterMode, bool makeNoLongerRea
 17        {
 4918            if (texture == null)
 019                return;
 20
 4921            texture.wrapMode = textureWrapMode;
 4922            texture.filterMode = textureFilterMode;
 4923            texture.Compress(false);
 4924            texture.Apply(textureFilterMode != FilterMode.Point, makeNoLongerReadable);
 4925        }
 26
 27        public override void Cleanup()
 28        {
 8029            OnCleanup?.Invoke();
 8030            PersistentAssetCache.RemoveImage(texture);
 8031            Object.Destroy(texture);
 8032        }
 33
 034        public void Dispose() { Cleanup(); }
 35
 1436        public int width => texture.width;
 1437        public int height => texture.height;
 38    }
 39}