aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
diff options
context:
space:
mode:
authorAdam Frisby2007-06-26 04:45:24 +0000
committerAdam Frisby2007-06-26 04:45:24 +0000
commit34c7a0e43a55e60466ce5527722cbdc5c946cd34 (patch)
tree3713623e7f4cf7fafdd1ca77a6c2cc74e8149c48 /OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
parent* Committing terrain filter demo (diff)
downloadopensim-SC-34c7a0e43a55e60466ce5527722cbdc5c946cd34.zip
opensim-SC-34c7a0e43a55e60466ce5527722cbdc5c946cd34.tar.gz
opensim-SC-34c7a0e43a55e60466ce5527722cbdc5c946cd34.tar.bz2
opensim-SC-34c7a0e43a55e60466ce5527722cbdc5c946cd34.tar.xz
* Terrain filters! - Think photoshop-style filters for terrain.
* Terrain filters may be written in either C# or JavaScript and loaded at runtime Use: terrain csfilter somefile.cs -- Loads a C# filter terrain jsfilter somefile.js -- Loads a JavaScript filter Once a terrain filter has been loaded, you can use the command as normal, eg terrain demofilter
Diffstat (limited to '')
-rw-r--r--OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs31
1 files changed, 27 insertions, 4 deletions
diff --git a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
index d1d54ad..2bda5ba 100644
--- a/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
+++ b/OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
@@ -48,6 +48,11 @@ namespace OpenSim.Terrain
48 public class TerrainEngine 48 public class TerrainEngine
49 { 49 {
50 /// <summary> 50 /// <summary>
51 /// Plugin library for scripts
52 /// </summary>
53 public FilterHost customFilters = new FilterHost();
54
55 /// <summary>
51 /// A [normally] 256x256 heightmap 56 /// A [normally] 256x256 heightmap
52 /// </summary> 57 /// </summary>
53 public Channel heightmap; 58 public Channel heightmap;
@@ -193,8 +198,10 @@ namespace OpenSim.Terrain
193 resultText += "terrain erode aerobic <windspeed> <pickupmin> <dropmin> <carry> <rounds> <lowest>\n"; 198 resultText += "terrain erode aerobic <windspeed> <pickupmin> <dropmin> <carry> <rounds> <lowest>\n";
194 resultText += "terrain erode thermal <talus> <rounds> <carry>\n"; 199 resultText += "terrain erode thermal <talus> <rounds> <carry>\n";
195 resultText += "terrain multiply <val> - multiplies a terrain by <val>\n"; 200 resultText += "terrain multiply <val> - multiplies a terrain by <val>\n";
196 resultText += "terrain revert - reverts the terrain to the stored original"; 201 resultText += "terrain revert - reverts the terrain to the stored original\n";
197 resultText += "terrain bake - saves the current terrain into the revert map"; 202 resultText += "terrain bake - saves the current terrain into the revert map\n";
203 resultText += "terrain csfilter <filename.cs> - loads a new filter from the specified .cs file\n";
204 resultText += "terrain jsfilter <filename.js> - loads a new filter from the specified .js file\n";
198 return false; 205 return false;
199 206
200 case "revert": 207 case "revert":
@@ -285,9 +292,25 @@ namespace OpenSim.Terrain
285 } 292 }
286 break; 293 break;
287 294
295 case "csfilter":
296 customFilters.LoadFilterCSharp(args[1]);
297 break;
298 case "jsfilter":
299 customFilters.LoadFilterJScript(args[1]);
300 break;
301
288 default: 302 default:
289 resultText = "Unknown terrain command"; 303 // Run any custom registered filters
290 return false; 304 if (customFilters.filters.ContainsKey(command))
305 {
306 customFilters.filters[command].Filter(heightmap, args);
307 break;
308 }
309 else
310 {
311 resultText = "Unknown terrain command";
312 return false;
313 }
291 } 314 }
292 return true; 315 return true;
293 } 316 }