Example #1
0
        public void LevelDimensionsCorrect()
        {
            int width  = 32;
            int height = 32;

            Mipmap2D mipmap = new Mipmap2D(width, height, 1, 32);

            mipmap.GenerateMipmaps();

            Assert.AreEqual(6, mipmap.Levels);

            for (int i = 0; i < mipmap.Levels; i++)
            {
                TextureData2D data = mipmap.GetData(i);

                Assert.IsNotNull(data);
                Assert.AreEqual(mipmap.Channels, data.Channels);
                Assert.AreEqual(mipmap.BitDepth, data.BitDepth);
                Assert.AreEqual(width, data.GetWidth());
                Assert.AreEqual(height, data.GetHeight());

                width  /= 2;
                height /= 2;
            }
        }
Example #2
0
        private void CreateData(int width, int height, int channels, int bitDepth, TEXTURE_MIPMAP mode)
        {
            Data = null;

            if (mode != TEXTURE_MIPMAP.NONE)
            {
                Data = new Mipmap2D(width, height, channels, bitDepth, mode);
            }
            else
            {
                Data = TextureData2D.CreateData(width, height, channels, bitDepth);
            }
        }
Example #3
0
        public void DataTypeCorrect()
        {
            int      width    = 64;
            int      height   = 128;
            int      channels = 3;
            Mipmap2D mipmap   = null;

            mipmap = new Mipmap2D(width, height, channels, 8);
            Assert.IsInstanceOfType(mipmap.GetData(0), typeof(TextureData2D8));

            mipmap = new Mipmap2D(width, height, channels, 16);
            Assert.IsInstanceOfType(mipmap.GetData(0), typeof(TextureData2D16));

            mipmap = new Mipmap2D(width, height, channels, 32);
            Assert.IsInstanceOfType(mipmap.GetData(0), typeof(TextureData2D32));
        }
Example #4
0
        public void DimensionsCorrect()
        {
            int            width    = 64;
            int            height   = 128;
            int            channels = 3;
            int            bitDepth = 8;
            TEXTURE_MIPMAP mode     = TEXTURE_MIPMAP.BOX;

            Mipmap2D mipmap = new Mipmap2D(width, height, channels, bitDepth, mode);

            Assert.AreEqual(width, mipmap.GetWidth());
            Assert.AreEqual(height, mipmap.GetHeight());
            Assert.AreEqual(channels, mipmap.Channels);
            Assert.AreEqual(bitDepth, mipmap.BitDepth);
            Assert.AreEqual(mode, mipmap.MipmapMode);
            Assert.IsInstanceOfType(mipmap.GetData(0), typeof(TextureData2D8));
        }