Пример #1
0
        /// <summary>
        /// Helper function
        /// </summary>
        /// <param name="_terrain"></param>
        /// <param name="_texture"></param>
        /// <param name="iMoveDelta"></param>
        /// <returns></returns>
        public static bool CanMove(TerrainShape _terrain, DetailTextureResource _texture, int iMoveDelta)
        {
            if (_terrain == null || !_terrain.Modifiable || _terrain.EngineTerrain == null || _texture == null)
            {
                return(false);
            }

            int iOldIndex = _terrain.DetailTextures.IndexOf(_texture);
            int iNewIndex = iOldIndex + iMoveDelta;

            if (_texture._bIsBaseTexture)
            {
                return(false);
            }

            if (iOldIndex < 0 || iOldIndex >= _terrain.DetailTextures.Count)
            {
                return(false);
            }
            if (iNewIndex < 1 || iNewIndex >= _terrain.DetailTextures.Count)
            {
                return(false);
            }
            return(true);
        }
Пример #2
0
 protected MoveDetailTextureAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _terrain  = (TerrainShape)info.GetValue("_terrain", typeof(TerrainShape));
     _texture  = (DetailTextureResource)info.GetValue("_texture", typeof(DetailTextureResource));
     iOldIndex = info.GetInt32("iOldIndex");
     iNewIndex = info.GetInt32("iNewIndex");
 }
Пример #3
0
 public MoveDetailTextureAction(TerrainShape terrain, DetailTextureResource texture, int iMoveDelta)
 {
     _texture    = texture;
     _terrain    = terrain;
     _iMoveDelta = iMoveDelta;
     iOldIndex   = _terrain.DetailTextures.IndexOf(_texture);
     iNewIndex   = iOldIndex + iMoveDelta;
 }
Пример #4
0
        public void TextureTest()
        {
            TerrainEditor.EditorPanel.PaintDetailTextureMode = true;

            //Create a detail texture to paint with
            DetailTextureResource texture = TerrainEditor.CurrentTerrain.CreateDetailTexture();

            texture.DiffuseFilename = "Textures/sand.dds";
            texture.Name            = System.IO.Path.GetFileNameWithoutExtension(texture.DiffuseFilename);
            EditorManager.Actions.Add(new Actions.AddDetailTextureAction(TerrainEditor.CurrentTerrain, texture));

            TerrainEditor.CurrentDetailTexture = texture;
            TestManager.Helpers.ProcessEvents();

            //Create another detail texture to paint with
            texture = TerrainEditor.CurrentTerrain.CreateDetailTexture();
            texture.DiffuseFilename = "Textures/foam.dds";
            texture.Name            = System.IO.Path.GetFileNameWithoutExtension(texture.DiffuseFilename);
            EditorManager.Actions.Add(new Actions.AddDetailTextureAction(TerrainEditor.CurrentTerrain, texture));

            TerrainEditor.CurrentDetailTexture = texture;
            TestManager.Helpers.ProcessEvents();

            //Paint detail texture
            PaintDetailTexture(200, 200);
            TestManager.Helpers.ProcessEvents();

            //Create a third detail texture to paint with
            texture = TerrainEditor.CurrentTerrain.CreateDetailTexture();
            texture.DiffuseFilename = "Textures/Havok_Logo_128x64.dds";
            texture.Name            = System.IO.Path.GetFileNameWithoutExtension(texture.DiffuseFilename);
            EditorManager.Actions.Add(new Actions.AddDetailTextureAction(TerrainEditor.CurrentTerrain, texture));

            TerrainEditor.CurrentDetailTexture = texture;
            TestManager.Helpers.ProcessEvents();

            //Paint some more
            PaintDetailTexture(200, 500);
            TestManager.Helpers.ProcessEvents();

            //Undo/redo test (everything)
            while (EditorManager.Actions.Undo())
            {
            }
            while (EditorManager.Actions.Redo())
            {
            }

            //Verify redone state (e.g. at least that the terrain exists)
            Assert.IsTrue(IsTerrainInScene());
        }
 protected PaintDetailTextureAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _texture = (DetailTextureResource)info.GetValue("_texture", typeof(DetailTextureResource));
 }
 public PaintDetailTextureAction(TerrainShape terrain, DetailTextureResource texture)
     : base(terrain.EngineTerrain, "Edit detail texture")
 {
     _texture = texture;
 }
Пример #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="component"></param>
 /// <param name="propertyName"></param>
 public DetailTextureListChangedArgs(Action action, DetailTextureResource textureElement)
 {
     _textureElement = textureElement;
     _action         = action;
 }
Пример #8
0
 public DeleteDetailTextureAction(TerrainShape terrain, DetailTextureResource texture)
 {
     _texture = texture;
     _terrain = terrain;
 }
Пример #9
0
 protected AddDetailTextureAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _terrain = (TerrainShape)info.GetValue("_terrain", typeof(TerrainShape));
     _texture = (DetailTextureResource)info.GetValue("_texture", typeof(DetailTextureResource));
 }