public void Dispose() { Albedo?.Dispose(); NormalMap?.Dispose(); HeightMap?.Dispose(); Occlusion?.Dispose(); }
/// <summary> /// Dispose resources /// </summary> public void Dispose() { if (Mesh != null) { Mesh.Dispose(); } Mesh = null; if (SpecularMap != null) { SpecularMap.Dispose(); } SpecularMap = null; if (HeightMap != null) { HeightMap.Dispose(); } HeightMap = null; if (BumpMap != null) { BumpMap.Dispose(); } BumpMap = null; if (DiffuseMap != null) { DiffuseMap.Dispose(); } DiffuseMap = null; }
public void CanReadHeightValues() { GameObject obj = new GameObject(); HeightMap map = obj.AddComponent <HeightMap>(); map.size = Vector3Int.one; map.Initialize(); ushort max = ushort.MaxValue; Assert.AreEqual(0, map.Read(0, 0)); Assert.AreEqual(max, map.Read(1, 1)); map.Dispose(); }
public void CanRefreshTheHeightMap() { GameObject obj = new GameObject(); HeightMap map = obj.AddComponent <HeightMap>(); NativeArray <byte> voxels = new NativeArray <byte>(1, Allocator.Persistent); NativeArray <Block> blocks = new NativeArray <Block>(1, Allocator.Persistent); map.voxels = voxels; map.blocks = blocks; map.size = Vector3Int.one; map.Initialize(); JobHandle handle = map.Refresh(); Assert.AreEqual(false, handle.IsCompleted); handle.Complete(); Assert.AreEqual(true, handle.IsCompleted); voxels.Dispose(); blocks.Dispose(); map.Dispose(); }