/// <summary>
 /// Initializes a new instance of the <see cref="VertexCompressor"/> class.
 /// </summary>
 /// <param name="info">The compression info to use.</param>
 public VertexCompressor(RenderModel.CompressionInfo info)
 {
     _info = info;
     _xScale = info.PositionMaxX - info.PositionMinX;
     _yScale = info.PositionMaxY - info.PositionMinY;
     _zScale = info.PositionMaxZ - info.PositionMinZ;
     _uScale = info.TextureMaxU - info.TextureMinU;
     _vScale = info.TextureMaxV - info.TextureMinV;
 }
        private RenderModel.CompressionInfo BuildCompressionInfo()
        {
            var result = new RenderModel.CompressionInfo();
            foreach (var mesh in _meshes)
            {
                // TODO: Refactor how vertices work, this is just ugly

                IEnumerable<Vector4> positions = null;
                IEnumerable<Vector2> texCoords = null;
                if (mesh.RigidVertices != null)
                {
                    positions = mesh.RigidVertices.Select(v => v.Position);
                    texCoords = mesh.RigidVertices.Select(v => v.Texcoord);
                }
                else if (mesh.SkinnedVertices != null)
                {
                    positions = mesh.SkinnedVertices.Select(v => v.Position);
                    texCoords = mesh.SkinnedVertices.Select(v => v.Texcoord);
                }

                if (positions != null)
                {
                    result.PositionMinX = Math.Min(result.PositionMinX, positions.Min(v => v.X));
                    result.PositionMinY = Math.Min(result.PositionMinY, positions.Min(v => v.Y));
                    result.PositionMinZ = Math.Min(result.PositionMinZ, positions.Min(v => v.Z));
                    result.PositionMaxX = Math.Max(result.PositionMaxX, positions.Max(v => v.X));
                    result.PositionMaxY = Math.Max(result.PositionMaxY, positions.Max(v => v.Y));
                    result.PositionMaxZ = Math.Max(result.PositionMaxZ, positions.Max(v => v.Z));
                }
                if (texCoords != null)
                {
                    result.TextureMinU = Math.Min(result.TextureMinU, texCoords.Min(v => v.X));
                    result.TextureMinV = Math.Min(result.TextureMinV, texCoords.Min(v => v.Y));
                    result.TextureMaxU = Math.Max(result.TextureMaxU, texCoords.Max(v => v.X));
                    result.TextureMaxV = Math.Max(result.TextureMaxV, texCoords.Max(v => v.Y));
                }
            }
            _model.Compression = new List<RenderModel.CompressionInfo> { result };
            return result;
        }