public TerrainShape(string name) : base(name) { AddHint(HintFlags_e.NoRotation | HintFlags_e.NoScale | HintFlags_e.RetainPositionAtCreation); _terrainConfig.TerrainFolder = System.IO.Path.GetFileNameWithoutExtension(EditorManager.Scene.FileName); // start with the defaults ShaderConfig = new ShaderEffectConfig(this); _terrainShaderProperties = new TerrainShaderProperties(this); _shaderFX._libFilename = @"\Shaders\Terrain.ShaderLib"; _shaderFX._effectName = "Terrain"; _shaderFX._shadermode = ISurface.SHADERMODE.AUTO; }
public override void OnDeserialization() { base.OnDeserialization(); AddHint(HintFlags_e.NoRotation | HintFlags_e.NoScale); if (string.IsNullOrEmpty(_terrainConfig.TerrainFolder)) _terrainConfig.TerrainFolder = this.ShapeName; foreach (DecorationModelResource model in _decorationModels) { if (model.ID == 0) model.ID = GetNewDecorationID(); //OLD scene file fix model._ownerTerrain = this; } bool bFirst = true; foreach (DetailTextureResource tex in _detailTextures) { tex._ownerTerrain = this; tex._bIsBaseTexture = bFirst; bFirst = false; } EnumDetailTextures(); if (_pendingConfig == null) { _pendingConfig = new ShaderEffectConfig(this); _pendingConfig._libFilename = @"\Shaders\Terrain.ShaderLib"; _pendingConfig._effectName = "Terrain"; _pendingConfig._shadermode = ISurface.SHADERMODE.AUTO; } ShaderConfig = _pendingConfig; // register callbacks etc. _terrainShaderProperties = new TerrainShaderProperties(this); // force update the minimap: string _tex = _minimapTexture; _minimapTexture = null; this.MinimapTexture = _tex; if (HasChildren()) { //foreach (ShapeBase shape in ChildCollection) } //if (_materialProvider==null) //_materialProvider = new TerrainMaterialProvider(this); if (_meshExportSettings != null) _meshExportSettings.Owner = this; if (_bIsReference) _bBakeMode = true; TerrainEditor.TextureBakedView = _bBakeMode; // dir light shape saved with the file? foreach (ShapeBase child in ChildCollection) if (child is TerrainDirectionalLight) { _dirLightShape = (TerrainDirectionalLight)child; _dirLightShape.OwnerTerrain = this; break; } }