Exemple #1
0
        private TexImage LoadInput(string file)
        {
            var image = TestTools.Load(paraLib, file);

            library.StartLibrary(image);
            return(image);
        }
Exemple #2
0
        public void CorrectGammaTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.CorrectGammaTest(image, library);

            image.Dispose();
        }
Exemple #3
0
        public void CompressTest(string file, Xenko.Graphics.PixelFormat format)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.CompressTest(image, library, format);

            image.Dispose();
        }
Exemple #4
0
        public void FlipTest(String file, Orientation orientation)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.FlipTest(image, library, orientation);

            image.Dispose();
        }
Exemple #5
0
        public void FactorRescaleTest(string file, Filter.Rescaling filter)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.FactorRescaleTest(image, library, filter);

            image.Dispose();
        }
Exemple #6
0
        public void SwitchChannelsTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.SwitchChannelsTest(image, library);

            image.Dispose();
        }
Exemple #7
0
        public void EndLibraryTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            library.EndLibrary(image);

            image.Dispose();
        }
Exemple #8
0
        public void PreMultiplyAlphaTest(String file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.PreMultiplyAlphaTest(image, library);

            image.Dispose();
        }
Exemple #9
0
        public void DecompressTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.DecompressTest(image, library);

            image.Dispose();
        }
Exemple #10
0
        public void ExportTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.ExportTest(image, library, file);

            image.Dispose();
        }
Exemple #11
0
        public void ExportTest(string file, int mipMipMapSize)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.ExportMinMipMapTest(image, library, mipMipMapSize);

            image.Dispose();
        }
Exemple #12
0
        public void GenerateMipMapTest(string file, Filter.MipMapGeneration filter)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.GenerateMipMapTest(image, library, filter);

            image.Dispose();
        }
Exemple #13
0
        public void GenerateNormalMapTest(string file, string outFile)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.GenerateNormalMapTest(image, library);

            image.Dispose();
        }
        public void CanHandleRequestTest()
        {
            TexImage image = TestTools.Load(library, "Texture3D_WMipMaps_ATC_RGBA_Explicit.pdx");

            Assert.IsFalse(library.CanHandleRequest(image, new DecompressingRequest()));
            Assert.IsFalse(library.CanHandleRequest(image, new LoadingRequest(new TexImage())));
            Assert.IsTrue(library.CanHandleRequest(image, new LoadingRequest(SiliconStudio.Paradox.Graphics.Image.New1D(5, 0, SiliconStudio.Paradox.Graphics.PixelFormat.ATC_RGBA_Explicit))));
            Assert.IsTrue(library.CanHandleRequest(image, new LoadingRequest("TextureArray_WMipMaps_BC3.dds")));
            Assert.IsTrue(library.CanHandleRequest(image, new ExportRequest("TextureArray_WMipMaps_BC3.pdx", 0)));
            Assert.IsTrue(library.CanHandleRequest(image, new ExportToParadoxRequest()));
            image.Dispose();
        }
Exemple #15
0
        public void CanHandleRequestTest()
        {
            TexImage image = TestTools.Load(library, "Texture3D_WMipMaps_ATC_RGBA_Explicit.xk");

            Assert.IsFalse(library.CanHandleRequest(image, new DecompressingRequest(false)));
            Assert.IsFalse(library.CanHandleRequest(image, new LoadingRequest(new TexImage(), false)));
            Assert.IsTrue(library.CanHandleRequest(image, new LoadingRequest(Xenko.Graphics.Image.New1D(5, 0, Xenko.Graphics.PixelFormat.ATC_RGBA_Explicit), false)));
            Assert.IsTrue(library.CanHandleRequest(image, new LoadingRequest("TextureArray_WMipMaps_BC3.dds", false)));
            Assert.IsTrue(library.CanHandleRequest(image, new ExportRequest("TextureArray_WMipMaps_BC3.xk", 0)));
            Assert.IsTrue(library.CanHandleRequest(image, new ExportToXenkoRequest()));
            image.Dispose();
        }
Exemple #16
0
        public void CanHandleRequestTest()
        {
            TexImage image = TestTools.Load(dxtLib, "array_WMipMaps.dds");

            Assert.IsFalse(library.CanHandleRequest(image, new DecompressingRequest(false)));
            Assert.IsTrue(library.CanHandleRequest(image, new ArrayCreationRequest(new List <TexImage>())));
            Assert.IsTrue(library.CanHandleRequest(image, new ArrayExtractionRequest(0)));
            Assert.IsTrue(library.CanHandleRequest(image, new ArrayUpdateRequest(new TexImage(), 0)));
            Assert.IsTrue(library.CanHandleRequest(image, new ArrayElementRemovalRequest(0)));
            Assert.IsTrue(library.CanHandleRequest(image, new ArrayInsertionRequest(new TexImage(), 0)));
            Assert.IsTrue(library.CanHandleRequest(image, new CubeCreationRequest(new List <TexImage>())));
            image.Dispose();
        }
Exemple #17
0
        public void CanHandleRequestTest()
        {
            TexImage image = TestTools.Load(library, "stones.png");

            Assert.IsFalse(library.CanHandleRequest(image, new DecompressingRequest(false)));
            Assert.IsTrue(library.CanHandleRequest(image, new FixedRescalingRequest(0, 0, Filter.Rescaling.Bilinear)));
            Assert.IsTrue(library.CanHandleRequest(image, new SwitchingBRChannelsRequest()));
            Assert.IsTrue(library.CanHandleRequest(image, new FlippingRequest(Orientation.Vertical)));
            Assert.IsTrue(library.CanHandleRequest(image, new LoadingRequest("TextureArray_WMipMaps_BC3.png", false)));
            Assert.IsTrue(library.CanHandleRequest(image, new ExportRequest("TextureArray_WMipMaps_BC3.png", 0)));
            Assert.IsTrue(library.CanHandleRequest(image, new GammaCorrectionRequest(0)));
            image.Dispose();
        }
Exemple #18
0
        public void UpdateTest(string atlasFile, string textureNameToUpdate, string newTexture)
        {
            TexAtlas atlas = new TexAtlas(TexAtlas.TexLayout.Import(Module.PathToInputImages + Path.GetFileNameWithoutExtension(atlasFile) + TexAtlas.TexLayout.Extension), TestTools.Load(fiLib, atlasFile));

            var updateTexture = TestTools.Load(fiLib, newTexture);

            library.Execute(atlas, new AtlasUpdateRequest(updateTexture, textureNameToUpdate));
            library.EndLibrary(atlas);

            //Console.WriteLine("AtlasTexLibrary_Update_" + textureNameToUpdate + "_" + atlasFile + "." + TestTools.ComputeSHA1(atlas.Data, atlas.DataSize));
            Assert.IsTrue(TestTools.ComputeSHA1(atlas.Data, atlas.DataSize).Equals(TestTools.GetInstance().Checksum["AtlasTexLibrary_Update_" + textureNameToUpdate + "_" + atlasFile]));

            updateTexture.Dispose();
            atlas.Dispose();
        }
Exemple #19
0
        public void CanHandleRequestTest()
        {
            TexImage image = TestTools.Load(library, "TextureArray_WMipMaps_BC3.dds");

            Assert.IsTrue(library.CanHandleRequest(image, new DecompressingRequest(false)));
            Assert.IsTrue(library.CanHandleRequest(image, new FixedRescalingRequest(0, 0, Filter.Rescaling.Nearest)));
            Assert.IsTrue(library.CanHandleRequest(image, new MipMapsGenerationRequest(Filter.MipMapGeneration.Nearest)));
            Assert.IsTrue(library.CanHandleRequest(image, new NormalMapGenerationRequest(1)));
            Assert.IsTrue(library.CanHandleRequest(image, new LoadingRequest("TextureArray_WMipMaps_BC3.dds", false)));
            Assert.IsTrue(library.CanHandleRequest(image, new ExportRequest("TextureArray_WMipMaps_BC3.dds", 0)));
            Assert.IsTrue(library.CanHandleRequest(image, new CompressingRequest(Xenko.Graphics.PixelFormat.BC3_UNorm)));
            Assert.IsFalse(library.CanHandleRequest(image, new CompressingRequest(Xenko.Graphics.PixelFormat.ATC_RGBA_Explicit)));
            Assert.IsFalse(library.CanHandleRequest(image, new GammaCorrectionRequest(0)));
            image.Dispose();
        }
Exemple #20
0
        public void CanHandleRequestTest()
        {
            TexImage image = TestTools.Load(library, "TextureArray_WMipMaps_PVRTC2_4bpp.pvr");

            Assert.IsTrue(library.CanHandleRequest(image, new CompressingRequest(Paradox.Graphics.PixelFormat.PVRTC_II_4bpp)));
            Assert.IsTrue(library.CanHandleRequest(image, new DecompressingRequest(false)));
            Assert.IsTrue(library.CanHandleRequest(image, new LoadingRequest("TextureArray_WMipMaps_PVRTC2_4bpp.pvr", false)));
            Assert.IsTrue(library.CanHandleRequest(image, new MipMapsGenerationRequest(Filter.MipMapGeneration.Linear)));
            Assert.IsTrue(library.CanHandleRequest(image, new NormalMapGenerationRequest(0.5f)));
            Assert.IsTrue(library.CanHandleRequest(image, new SwitchingBRChannelsRequest()));
            Assert.IsTrue(library.CanHandleRequest(image, new FlippingRequest(Orientation.Horizontal)));
            Assert.IsTrue(library.CanHandleRequest(image, new FixedRescalingRequest(512, 512, Filter.Rescaling.Nearest)));
            Assert.IsTrue(library.CanHandleRequest(image, new ExportRequest("TextureArray_WMipMaps_PVRTC2_4bpp.pvr", 0)));
            Assert.IsFalse(library.CanHandleRequest(image, new GammaCorrectionRequest(1)));
            image.Dispose();
        }
Exemple #21
0
        public void ExportToXenkoTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            ExportToXenkoRequest request = new ExportToXenkoRequest();

            library.Execute(image, request);

            var xk = request.XkImage;

            Assert.IsTrue(xk.TotalSizeInBytes == image.DataSize);
            Assert.IsTrue(xk.Description.MipLevels == image.MipmapCount);
            Assert.IsTrue(xk.Description.Width == image.Width);
            Assert.IsTrue(xk.Description.Height == image.Height);

            image.Dispose();
        }
Exemple #22
0
        public void UpdateTest(string arrayFile, int indice, string newTexture)
        {
            TexImage array = TestTools.Load(dxtLib, arrayFile);

            dxtLib.EndLibrary(array);

            var updateTexture = TestTools.Load(fiLib, newTexture);

            library.Execute(array, new ArrayUpdateRequest(updateTexture, indice));
            library.EndLibrary(array);

            //Console.WriteLine("ArrayTexLibrary_Update_" + indice + "_" + arrayFile + "." + TestTools.ComputeSHA1(array.Data, array.DataSize));
            Assert.IsTrue(TestTools.ComputeSHA1(array.Data, array.DataSize).Equals(TestTools.GetInstance().Checksum["ArrayTexLibrary_Update_" + indice + "_" + arrayFile]));

            updateTexture.Dispose();
            array.Dispose();
        }
Exemple #23
0
        public void DecompressFailTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            Assert.IsTrue(image.Format == Xenko.Graphics.PixelFormat.B8G8R8A8_UNorm);

            try
            {
                library.Execute(image, new DecompressingRequest(false));
                Assert.IsTrue(false);
            }
            catch (TextureToolsException)
            {
                Assert.IsTrue(true);
            }

            image.Dispose();
        }
Exemple #24
0
        public void StartLibraryTest(string file)
        {
            TexImage image = TestTools.Load(library, file);

            TexLibraryTest.StartLibraryTest(image, library);

            DxtTextureLibraryData libraryData = (DxtTextureLibraryData)image.LibraryData[library];

            Assert.IsTrue(libraryData.DxtImages.Length == image.SubImageArray.Length);
            for (int i = 0; i < libraryData.DxtImages.Length; ++i) // Checking on features
            {
                Assert.IsTrue(libraryData.DxtImages[i].RowPitch == image.SubImageArray[i].RowPitch);
            }

            image.CurrentLibrary = null; // If we don't set the CurrentLibrary to null, the Dispose() method of TexImage will try calling the EndMethod, which won't work if no operation has been made on the image since the StartLibrary call. This case can't happen.

            image.Dispose();
        }
Exemple #25
0
        public void ExtractTest(string arrayFile, int indice)
        {
            TexImage array = TestTools.Load(dxtLib, arrayFile);

            var request = new ArrayExtractionRequest(indice, 16);

            library.Execute(array, request);
            array.CurrentLibrary = library;

            var extracted = request.Texture;

            //Console.WriteLine("ArrayTexLibrary_Extract_" + arrayFile + "." + TestTools.ComputeSHA1(extracted.Data, extracted.DataSize));
            Assert.IsTrue(TestTools.ComputeSHA1(extracted.Data, extracted.DataSize).Equals(TestTools.GetInstance().Checksum["ArrayTexLibrary_Extract_" + arrayFile]));

            extracted.Dispose();

            array.Dispose();
        }
Exemple #26
0
        public void RemoveTest(string arrayFile, int indice)
        {
            TexImage array = TestTools.Load(dxtLib, arrayFile);

            int arraySize = array.ArraySize;

            dxtLib.EndLibrary(array);
            library.StartLibrary(array); // for fun cause it's empty
            library.Execute(array, new ArrayElementRemovalRequest(indice));
            array.CurrentLibrary = library;
            array.Update();

            Assert.IsTrue(arraySize == array.ArraySize + 1);

            //Console.WriteLine("ArrayTexLibrary_Remove_" + indice + "_" + arrayFile + "." + TestTools.ComputeSHA1(array.Data, array.DataSize));
            Assert.IsTrue(TestTools.ComputeSHA1(array.Data, array.DataSize).Equals(TestTools.GetInstance().Checksum["ArrayTexLibrary_Remove_" + indice + "_" + arrayFile]));

            array.Dispose();
        }
Exemple #27
0
        public void InsertTest(string arrayFile, string newTexture, int indice)
        {
            TexImage array = TestTools.Load(dxtLib, arrayFile);

            int arraySize = array.ArraySize;

            var texture = TestTools.Load(fiLib, newTexture);

            dxtLib.EndLibrary(array);
            library.StartLibrary(array); // for fun cause it's empty
            library.Execute(array, new ArrayInsertionRequest(texture, indice));
            array.CurrentLibrary = library;
            array.Update();

            Assert.IsTrue(arraySize == array.ArraySize - 1);

            //Console.WriteLine("ArrayTexLibrary_Insert_" + Path.GetFileName(newTexture) + "_" + indice + "_" + arrayFile + "." + TestTools.ComputeSHA1(array.Data, array.DataSize));
            Assert.IsTrue(TestTools.ComputeSHA1(array.Data, array.DataSize).Equals(TestTools.GetInstance().Checksum["ArrayTexLibrary_Insert_" + Path.GetFileName(newTexture) + "_" + indice + "_" + arrayFile]));

            array.Dispose();
        }
Exemple #28
0
        public void ExtractTest(string atlasFile, string extractedName)
        {
            TexAtlas atlas = new TexAtlas(TexAtlas.TexLayout.Import(Module.PathToInputImages + Path.GetFileNameWithoutExtension(atlasFile) + TexAtlas.TexLayout.Extension), TestTools.Load(dxtLib, atlasFile));

            var request = new AtlasExtractionRequest(extractedName, 16);

            library.Execute(atlas, request);
            atlas.CurrentLibrary = library;

            var extracted = request.Texture;

            string nameWOExtension = Path.GetFileNameWithoutExtension(extractedName);

            //Console.WriteLine("AtlasTexLibrary_Extract_" + nameWOExtension + ".dds." + TestTools.ComputeSHA1(extracted.Data, extracted.DataSize));
            Assert.IsTrue(TestTools.ComputeSHA1(extracted.Data, extracted.DataSize).Equals(TestTools.GetInstance().Checksum["AtlasTexLibrary_Extract_" + nameWOExtension + ".dds"]));

            extracted.Dispose();

            atlas.Dispose();
        }
Exemple #29
0
        public void CanHandleRequestTest()
        {
            TexAtlas atlas = new TexAtlas(TexAtlas.TexLayout.Import(Module.PathToInputImages + Path.GetFileNameWithoutExtension("atlas_WMipMaps.dds") + TexAtlas.TexLayout.Extension), TestTools.Load(dxtLib, "atlas_WMipMaps.dds"));

            Assert.IsFalse(library.CanHandleRequest(atlas, new DecompressingRequest(false)));
            Assert.IsTrue(library.CanHandleRequest(atlas, new AtlasCreationRequest(new List <TexImage>())));
            Assert.IsTrue(library.CanHandleRequest(atlas, new AtlasExtractionRequest(0)));
            Assert.IsTrue(library.CanHandleRequest(atlas, new AtlasUpdateRequest(new TexImage(), "")));
            atlas.Dispose();
        }