Ejemplo n.º 1
0
        public void NonReadableDds()
        {
            var readonlyTexture = AssetDatabase.LoadAssetAtPath <Texture2D>($"{AssetPath}/4x4_non_readable_compressed.dds");

            Assert.False(readonlyTexture.isReadable);
            var(bytes, mime) = new EditorTextureSerializer().ExportBytesWithMime(readonlyTexture, ColorSpace.sRGB);
            Assert.NotNull(bytes);
        }
Ejemplo n.º 2
0
        public void NonReadablePng()
        {
            var nonReadableTex = AssetDatabase.LoadAssetAtPath <Texture2D>($"{AssetPath}/4x4_non_readable.png");

            Assert.False(nonReadableTex.isReadable);
            var(bytes, mime) = new EditorTextureSerializer().ExportBytesWithMime(nonReadableTex, ColorSpace.sRGB);
            Assert.NotNull(bytes);
        }
Ejemplo n.º 3
0
        public void ExportMetallicSmoothnessOcclusion_Test()
        {
            var textureSerializer = new EditorTextureSerializer();
            var metallic          = new Texture2D(4, 4, TextureFormat.ARGB32, false, true);
            var occlusion         = new Texture2D(4, 4, TextureFormat.ARGB32, false, true);

            {
                var exporter = new TextureExporter(new EditorTextureSerializer());
                Assert.AreEqual(-1, exporter.ExportAsGltfMetallicSmoothnessOcclusionCombined(null, 0, null));
            }
            {
                var exporter = new TextureExporter(new EditorTextureSerializer());
                Assert.AreEqual(0, exporter.ExportAsGltfMetallicSmoothnessOcclusionCombined(null, 0, occlusion));
                Assert.AreEqual(1, exporter.ExportAsGltfMetallicSmoothnessOcclusionCombined(metallic, 0, null));
            }
            {
                var exporter = new TextureExporter(new EditorTextureSerializer());
                Assert.AreEqual(0, exporter.ExportAsGltfMetallicSmoothnessOcclusionCombined(metallic, 0, occlusion));
                Assert.AreEqual(0, exporter.ExportAsGltfMetallicSmoothnessOcclusionCombined(null, 0, occlusion));
                Assert.AreEqual(0, exporter.ExportAsGltfMetallicSmoothnessOcclusionCombined(metallic, 0, null));
            }
        }
Ejemplo n.º 4
0
        public void ExportMetallicSmoothnessOcclusion_Test()
        {
            var textureSerializer = new EditorTextureSerializer();
            var metallic          = new Texture2D(4, 4, TextureFormat.ARGB32, false, true);
            var occlusion         = new Texture2D(4, 4, TextureFormat.ARGB32, false, true);

            {
                var exporter = new TextureExporter(new EditorTextureSerializer());
                Assert.AreEqual(-1, exporter.RegisterExportingAsCombinedGltfPbrParameterTextureFromUnityStandardTextures(null, 0, null));
            }
            {
                var exporter = new TextureExporter(new EditorTextureSerializer());
                Assert.AreEqual(0, exporter.RegisterExportingAsCombinedGltfPbrParameterTextureFromUnityStandardTextures(null, 0, occlusion));
                Assert.AreEqual(1, exporter.RegisterExportingAsCombinedGltfPbrParameterTextureFromUnityStandardTextures(metallic, 0, null));
            }
            {
                var exporter = new TextureExporter(new EditorTextureSerializer());
                Assert.AreEqual(0, exporter.RegisterExportingAsCombinedGltfPbrParameterTextureFromUnityStandardTextures(metallic, 0, occlusion));
                Assert.AreEqual(0, exporter.RegisterExportingAsCombinedGltfPbrParameterTextureFromUnityStandardTextures(null, 0, occlusion));
                Assert.AreEqual(0, exporter.RegisterExportingAsCombinedGltfPbrParameterTextureFromUnityStandardTextures(metallic, 0, null));
            }
        }