Beispiel #1
0
        //FIXME [HS:6411] [Test]
        public void VegetationTest()
        {
            // Create a decoration model to paint with
            DecorationModelResource model = TerrainEditor.CurrentTerrain.CreateDecorationModelResource();

            model.Filename = "Models\\MissingModel.model";
            model.Name     = System.IO.Path.GetFileNameWithoutExtension(model.Filename);
            EditorManager.Actions.Add(new Actions.AddDecorationModelAction(TerrainEditor.CurrentTerrain, model));

            // Configure the model
            TerrainEditor.CurrentDecorationModel          = model;
            TerrainEditor.EditorPanel.PaintDecorationMode = true;
            model.FarClipDistance = 10000.0f;
            model.Density         = 0.4f;

            float oldAverageScale  = model.AverageScale;
            float oldDensity       = model.Density;
            float oldSizeVariation = model.SizeVariation;

            // Test painting vegetation
            TerrainEditor.Cursor3DProperties.Radius = 1000.0f;
            PaintVegetation(200, 200);

            int numVegetationAfterFirstPainting = TerrainEditor.CurrentTerrain.DecorationObjectCount;

            // Test painting vegetation
            TerrainEditor.Cursor3DProperties.Radius = 500.0f;
            PaintVegetation(400, 400);

            int numVegetationAfterSecondPainting = TerrainEditor.CurrentTerrain.DecorationObjectCount;

            // Change the painting parameters and verify that the number of decoration object changes as well
            model.Density = 0.8f;
            EditorManager.ActiveView.UpdateView(true);
            int numVegetationAfterDensityChange = TerrainEditor.CurrentTerrain.DecorationObjectCount;

            Assert.IsTrue(TerrainEditor.CurrentTerrain.DecorationObjectCount > numVegetationAfterSecondPainting);

            //Test undo/redo
            model.Density       = oldDensity;
            model.AverageScale  = oldAverageScale;
            model.SizeVariation = oldSizeVariation;

            EditorManager.Actions.Undo();
            Assert.IsTrue(TerrainEditor.CurrentTerrain.DecorationObjectCount == numVegetationAfterFirstPainting);

            EditorManager.Actions.Undo();
            Assert.IsTrue(TerrainEditor.CurrentTerrain.DecorationObjectCount == 0);

            EditorManager.Actions.Redo();
            Assert.IsTrue(TerrainEditor.CurrentTerrain.DecorationObjectCount == numVegetationAfterFirstPainting);

            EditorManager.Actions.Redo();
            Assert.IsTrue(TerrainEditor.CurrentTerrain.DecorationObjectCount == numVegetationAfterSecondPainting);
        }
Beispiel #2
0
 protected PaintDecorationAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _model = (DecorationModelResource)info.GetValue("_model", typeof(DecorationModelResource));
 }
Beispiel #3
0
 public PaintDecorationAction(TerrainShape terrain, DecorationModelResource model)
     : base(terrain.EngineTerrain, "Edit decoration")
 {
     _model = model;
 }
 public IDecorationResourcePGView_LOD(DecorationModelResource owner)
     : base(owner)
 {
 }
 public IDecorationResourcePGView_Billboards(DecorationModelResource owner)
     : base(owner)
 {
 }
 public IDecorationResourcePGView(DecorationModelResource owner)
 {
     _owner = owner;
 }
 public IDecorationResourcePGView_Speedtree(DecorationModelResource owner)
     : base(owner)
 {
 }
 public DeleteDecorationModelAction(TerrainShape terrain, DecorationModelResource model)
 {
     _model   = model;
     _terrain = terrain;
 }
 protected AddDecorationModelAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _terrain = (TerrainShape)info.GetValue("_terrain", typeof(TerrainShape));
     _model   = (DecorationModelResource)info.GetValue("_model", typeof(DecorationModelResource));
 }