void IMyStorageDataProvider.ReadFrom(ref MyOctreeStorage.ChunkHeader header, Stream stream, ref bool isOldFormat)
        {
            m_state.Version = stream.ReadUInt32();
            if (m_state.Version != CURRENT_VERSION)
            {
                // Making sure this gets saved in new format and serialized cache holding old format is discarded.
                isOldFormat = true;
            }

            m_state.Generator = stream.ReadInt32();
            m_state.Seed      = stream.ReadInt32();
            m_state.Size      = stream.ReadFloat();

            if (m_state.Version == VERSION_WITHOUT_PLANETS)
            {
                m_state.IsPlanet = 0;
            }
            else
            {
                m_state.IsPlanet = stream.ReadUInt32();
            }

            if (m_state.IsPlanet != 0)
            {
                m_materialAttributes.ReadFrom(stream);
                m_shapeAttributes.ReadFrom(stream);
                m_hillAttributes.ReadFrom(stream);
                m_canyonAttributes.ReadFrom(stream);

                MyCompositeShapes.PlanetGenerators[m_state.Generator](ref m_shapeAttributes, ref m_hillAttributes, ref m_canyonAttributes, ref m_materialAttributes, out m_data);
            }
            else
            {
                MyCompositeShapes.AsteroidGenerators[m_state.Generator](m_state.Seed, m_state.Size, out m_data);
            }

            m_state.Version = CURRENT_VERSION;
        }