From 4301d0f0755c294d5f226629727d33c0ea30eea8 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Wed, 20 Jun 2007 21:24:00 +0000 Subject: * Added support for "revert" and "bake" commands on terrain console * Implemented "IMG" load method for "terrain load" - supports PNG, BMP, TIFF, TGA and probably a handful of other formats. --- .../OpenSim.Terrain.BasicTerrain/TerrainEngine.cs | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs') diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs index c78af05..9cd8099 100644 --- a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs @@ -150,6 +150,24 @@ namespace OpenSim.Terrain } /// + /// Swaps the two heightmap buffers (the 'revert map' and the heightmap) + /// + public void swapRevertMaps() + { + Channel backup = heightmap.copy(); + heightmap = revertmap; + revertmap = backup; + } + + /// + /// Saves the current heightmap into the revertmap + /// + public void saveRevertMap() + { + revertmap = heightmap.copy(); + } + + /// /// Processes a terrain-specific command /// /// Commandline arguments (space seperated) @@ -175,8 +193,19 @@ namespace OpenSim.Terrain resultText += "terrain erode aerobic \n"; resultText += "terrain erode thermal \n"; resultText += "terrain multiply - multiplies a terrain by \n"; + resultText += "terrain revert - reverts the terrain to the stored original"; + resultText += "terrain bake - saves the current terrain into the revert map"; return false; + case "revert": + swapRevertMaps(); + saveRevertMap(); + break; + + case "bake": + saveRevertMap(); + break; + case "seed": setSeed(Convert.ToInt32(args[1])); break; @@ -222,7 +251,7 @@ namespace OpenSim.Terrain break; case "img": - resultText = "Error - IMG mode is presently unsupported."; + heightmap.loadImage(args[2]); return false; default: -- cgit v1.1