Ejemplo n.º 1
0
        private TexImage LoadInput(string file)
        {
            var image = TestTools.Load(paraLib, file);

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

            TexLibraryTest.CorrectGammaTest(image, library);

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

            TexLibraryTest.CompressTest(image, library, format);

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

            TexLibraryTest.FlipTest(image, library, orientation);

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

            TexLibraryTest.FactorRescaleTest(image, library, filter);

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

            TexLibraryTest.SwitchChannelsTest(image, library);

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

            library.EndLibrary(image);

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

            TexLibraryTest.PreMultiplyAlphaTest(image, library);

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

            TexLibraryTest.DecompressTest(image, library);

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

            TexLibraryTest.ExportTest(image, library, file);

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

            TexLibraryTest.ExportMinMipMapTest(image, library, mipMipMapSize);

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

            TexLibraryTest.GenerateMipMapTest(image, library, filter);

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

            TexLibraryTest.GenerateNormalMapTest(image, library);

            image.Dispose();
        }
Ejemplo n.º 14
0
        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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }