Пример #1
0
        /// <summary>
        /// Serializes the object and writes it to the output.
        /// </summary>
        /// <param name="output">Savable Output</param>
        public override void Write(ISavableWriter output)
        {
            SurfaceFormat format   = _impl.Format;
            int           width    = _impl.Width;
            int           height   = _impl.Height;
            int           depth    = _impl.Depth;
            int           mipCount = _impl.MipCount;

            output.Write("Name", _impl.Name);
            output.WriteEnum <SurfaceFormat>("Format", format);
            output.Write("Width", width);
            output.Write("Height", height);
            output.Write("Depth", depth);
            output.Write("MipCount", mipCount);

            int width2  = width;
            int height2 = height;
            int depth2  = depth;

            for (int i = 0; i < mipCount; i++)
            {
                byte[] byteBuffer = new byte[MemoryHelper.CalculateMipSize(width, height, depth, i, format)];
                _impl.GetData <byte>(byteBuffer, i, 0, width2, 0, height2, 0, depth2, 0, byteBuffer.Length);
                width2  = System.Math.Max(width2 >> 1, 1);
                height2 = System.Math.Max(height2 >> 1, 1);
                depth2  = System.Math.Max(depth2 >> 1, 1);
                output.Write(String.Format("MipLevel{0}", i.ToString()), byteBuffer);
            }
        }
Пример #2
0
        /// <summary>
        /// Serializes the object and writes it to the output.
        /// </summary>
        /// <param name="output">Savable Output</param>
        public override void Write(ISavableWriter output)
        {
            SurfaceFormat format   = _impl.Format;
            int           width    = _impl.Width;
            int           mipCount = _impl.MipCount;

            output.Write("Name", _impl.Name);
            output.WriteEnum <SurfaceFormat>("Format", format);
            output.Write("Width", width);
            output.Write("MipCount", mipCount);

            for (int i = 0; i < mipCount; i++)
            {
                byte[] byteBuffer = new byte[MemoryHelper.CalculateMipSize(width, 1, 1, i, format)];
                _impl.GetData <byte>(byteBuffer, i, 0, width >> i, 0, byteBuffer.Length);
                output.Write(String.Format("MipLevel{0}", i.ToString()), byteBuffer);
            }
        }
Пример #3
0
        /// <summary>
        /// Serializes the object and writes it to the output.
        /// </summary>
        /// <param name="output">Savable Output</param>
        public override void Write(ISavableWriter output)
        {
            SurfaceFormat format   = _impl.Format;
            int           size     = _impl.Size;
            int           mipCount = _impl.MipCount;

            output.Write("Name", _impl.Name);
            output.WriteEnum <SurfaceFormat>("Format", format);
            output.Write("Size", size);
            output.Write("MipCount", mipCount);

            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < mipCount; j++)
                {
                    byte[] byteBuffer = new byte[MemoryHelper.CalculateMipSize(size, size, 1, j, format)];
                    _impl.GetData <byte>((CubeMapFace)i, byteBuffer, j, null, 0, byteBuffer.Length);
                    output.Write(String.Format("CubeMapFace: {0}, MipLevel{1}", ((CubeMapFace)i).ToString(), j), byteBuffer);
                }
            }
        }