diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim.Terrain.BasicTerrain/TerrainEngine.cs | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs index 38c4d0f..73b4378 100644 --- a/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs | |||
@@ -100,6 +100,86 @@ namespace OpenSim.Terrain | |||
100 | } | 100 | } |
101 | 101 | ||
102 | /// <summary> | 102 | /// <summary> |
103 | /// Processes a terrain-specific command | ||
104 | /// </summary> | ||
105 | /// <remarks>TODO: Move this into BasicTerrain directly (no need to hard limit what each terrain engine can support)</remarks> | ||
106 | /// <param name="args"></param> | ||
107 | public bool RunTerrainCmd(string[] args, ref string resultText) | ||
108 | { | ||
109 | string command = args[0]; | ||
110 | switch (command) | ||
111 | { | ||
112 | case "help": | ||
113 | resultText += "terrain regenerate - rebuilds the sims terrain using a default algorithm\n"; | ||
114 | resultText += "terrain seed <seed> - sets the random seed value to <seed>\n"; | ||
115 | resultText += "terrain load <type> <filename> - loads a terrain from disk, type can be 'F32', 'F64' or 'IMG'\n"; | ||
116 | resultText += "terrain save <type> <filename> - saves a terrain to disk, type can be 'F32' or 'F64'\n"; | ||
117 | resultText += "terrain rescale <min> <max> - rescales a terrain to be between <min> and <max> meters high\n"; | ||
118 | resultText += "terrain multiply <val> - multiplies a terrain by <val>\n"; | ||
119 | return false; | ||
120 | |||
121 | case "seed": | ||
122 | setSeed(Convert.ToInt32(args[1])); | ||
123 | break; | ||
124 | |||
125 | case "regenerate": | ||
126 | hills(); | ||
127 | break; | ||
128 | |||
129 | case "rescale": | ||
130 | setRange(Convert.ToSingle(args[1]), Convert.ToSingle(args[2])); | ||
131 | break; | ||
132 | |||
133 | case "multiply": | ||
134 | heightmap *= Convert.ToDouble(args[1]); | ||
135 | break; | ||
136 | |||
137 | case "load": | ||
138 | switch (args[1].ToLower()) | ||
139 | { | ||
140 | case "f32": | ||
141 | loadFromFileF32(args[2]); | ||
142 | break; | ||
143 | |||
144 | case "f64": | ||
145 | loadFromFileF64(args[2]); | ||
146 | break; | ||
147 | |||
148 | case "img": | ||
149 | resultText = "Error - IMG mode is presently unsupported."; | ||
150 | return false; | ||
151 | |||
152 | default: | ||
153 | resultText = "Unknown image or data format"; | ||
154 | return false; | ||
155 | } | ||
156 | break; | ||
157 | |||
158 | case "save": | ||
159 | switch (args[1].ToLower()) | ||
160 | { | ||
161 | case "f32": | ||
162 | writeToFileF32(args[2]); | ||
163 | break; | ||
164 | |||
165 | case "f64": | ||
166 | writeToFileF64(args[2]); | ||
167 | break; | ||
168 | |||
169 | default: | ||
170 | resultText = "Unknown image or data format"; | ||
171 | return false; | ||
172 | } | ||
173 | break; | ||
174 | |||
175 | default: | ||
176 | resultText = "Unknown terrain command"; | ||
177 | return false; | ||
178 | } | ||
179 | return true; | ||
180 | } | ||
181 | |||
182 | /// <summary> | ||
103 | /// Renormalises the array between min and max | 183 | /// Renormalises the array between min and max |
104 | /// </summary> | 184 | /// </summary> |
105 | /// <param name="min">Minimum value of the new array</param> | 185 | /// <param name="min">Minimum value of the new array</param> |