/// <summary>
        /// Called when deserializing
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected TerrainShape(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _terrainConfig = (TerrainConfig)info.GetValue("_terrainConfig", typeof(TerrainConfig));
              _decorationModels = (ArrayList)info.GetValue("_decorationModels",typeof(ArrayList));
              _iDecorationID = info.GetInt32("_iDecorationID");
              if (SerializationHelper.HasElement(info, "_iVisibleBitmask"))
            _iVisibleBitmask = info.GetUInt32("_iVisibleBitmask");
              if (SerializationHelper.HasElement(info, "_bVisibleInsideVisZones"))
            _bVisibleInsideVisZones = info.GetBoolean("_bVisibleInsideVisZones");
              if (SerializationHelper.HasElement(info, "_fLODScaling"))
            _fLODScaling = info.GetSingle("_fLODScaling");
              if (SerializationHelper.HasElement(info, "_fMirrorLODBias"))
            _fMirrorLODBias = info.GetSingle("_fMirrorLODBias");
              if (SerializationHelper.HasElement(info, "_lodMetric"))
            _lodMetric = (TerrainLODMetric_e)info.GetValue("_lodMetric", typeof(TerrainLODMetric_e));

              if (SerializationHelper.HasElement(info,"_iDetailTextureID"))
            _iDetailTextureID = info.GetInt32("_iDetailTextureID");
              if (SerializationHelper.HasElement(info, "_detailTextures"))
            _detailTextures = (ArrayList)info.GetValue("_detailTextures", typeof(ArrayList));
              if (SerializationHelper.HasElement(info, "_eLightmapSize"))
            _eLightmapSize = (LightmapSize_e)info.GetValue("_eLightmapSize", typeof(LightmapSize_e));
              if (SerializationHelper.HasElement(info, "_bCastStaticShadows"))
            _bCastStaticShadows = info.GetBoolean("_bCastStaticShadows");
              if (SerializationHelper.HasElement(info, "_iLightInfluenceBitmask"))
            _iLightInfluenceBitmask = info.GetUInt16("_iLightInfluenceBitmask");
              if (SerializationHelper.HasElement(info, "_shaderFX"))
            _pendingConfig = (ShaderEffectConfig)info.GetValue("_shaderFX", typeof(ShaderEffectConfig));
              if (SerializationHelper.HasElement(info, "_minimapTexture"))
            _minimapTexture = info.GetString("_minimapTexture");
              if (SerializationHelper.HasElement(info, "_heightmapExport"))
            _heightmapExport = info.GetString("_heightmapExport");
              if (SerializationHelper.HasElement(info, "_bNormalizeHeightmapExport"))
            _bNormalizeHeightmapExport = info.GetBoolean("_bNormalizeHeightmapExport");
              if (SerializationHelper.HasElement(info, "_bExportAsEditable"))
            _bExportAsEditable = info.GetBoolean("_bExportAsEditable");
              if (SerializationHelper.HasElement(info, "_bFastUpdate"))
            _bFastUpdate = info.GetBoolean("_bFastUpdate");

              if (SerializationHelper.HasElement(info, "_cachedDectorIDs"))
            _cachedSectorIDs = (uint[])info.GetValue("_cachedDectorIDs", typeof(uint[]));
              else
            _cachedSectorIDs = null;
              if (SerializationHelper.HasElement(info, "_savedZoneBoxes"))
            _savedZoneBoxes = (BoundingBox[])info.GetValue("_savedZoneBoxes", typeof(BoundingBox[]));
              else
            _savedZoneBoxes = null;

              if (SerializationHelper.HasElement(info, "_bSortDetailTextures"))
            _bSortDetailTextures = info.GetBoolean("_bSortDetailTextures");

              if (SerializationHelper.HasElement(info, "_meshExportSettings"))
            _meshExportSettings = (TerrainMeshExport)info.GetValue("_meshExportSettings", typeof(TerrainMeshExport));

              _bBakeMode = TerrainEditor.TextureBakedView; // fall back to editor setting
              if (SerializationHelper.HasElement(info, "_bBakeMode"))
            _bBakeMode = info.GetBoolean("_bBakeMode");
              if (SerializationHelper.HasElement(info, "_bIsReference"))
            _bIsReference = info.GetBoolean("_bIsReference");
              if (SerializationHelper.HasElement(info, "_bSceneSpecificLightmaps"))
            _bSceneSpecificLightmaps = info.GetBoolean("_bSceneSpecificLightmaps");

              // Make sure detail texture resources contain valid sector index information
              // (just in case an older vForge version wrote out wrong values after the terrain was resized)
              this.ClampDetailTextureSectorsToValidRange();
        }
Example #2
0
        public object Clone()
        {
            TerrainMeshExport copy = (TerrainMeshExport)this.MemberwiseClone();

            return(copy);
        }