From 751e1697ce91d3709b9ecaebb32e8261acd7d466 Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Fri, 21 May 2021 19:48:46 +0900 Subject: [PATCH] Add Tests --- .../UniGLTF/TextureColorSpaceSpecificationTests.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Assets/UniGLTF/Tests/UniGLTF/TextureColorSpaceSpecificationTests.cs b/Assets/UniGLTF/Tests/UniGLTF/TextureColorSpaceSpecificationTests.cs index da6bb20f7..c34ffb402 100644 --- a/Assets/UniGLTF/Tests/UniGLTF/TextureColorSpaceSpecificationTests.cs +++ b/Assets/UniGLTF/Tests/UniGLTF/TextureColorSpaceSpecificationTests.cs @@ -82,6 +82,11 @@ namespace UniGLTF Assert.AreEqual(SrgbGrayInLinear.g, GetFirstPixelInTexture2D(exportedTex).g); // B channel is different. Because it will be normalized as normal vector. UnityEngine.Object.DestroyImmediate(exportedTex); + + var exportedTex2 = AssignTextureToMaterialPropertyAndExportAndExtract(SrgbGrayTex, SrgbGrayImageName, "_OcclusionMap"); + // R channel is occlusion in glTF spec. + Assert.AreEqual(SrgbGrayInLinear.r, GetFirstPixelInTexture2D(exportedTex2).r); + UnityEngine.Object.DestroyImmediate(exportedTex2); } [Test] @@ -92,6 +97,11 @@ namespace UniGLTF Assert.AreEqual(LinearGrayInLinear.g, GetFirstPixelInTexture2D(exportedTex).g); // B channel is different. Because it will be normalized as normal vector. UnityEngine.Object.DestroyImmediate(exportedTex); + + var exportedTex2 = AssignTextureToMaterialPropertyAndExportAndExtract(LinearGrayTex, LinearGrayImageName, "_OcclusionMap"); + // R channel is occlusion in glTF spec. + Assert.AreEqual(LinearGrayInLinear.r, GetFirstPixelInTexture2D(exportedTex2).r); + UnityEngine.Object.DestroyImmediate(exportedTex2); } private static Texture2D AssignTextureToMaterialPropertyAndExportAndExtract(Texture2D srcTex, string srcImageName, string propertyName)