diff options
author | Teravus Ovares | 2007-12-15 23:44:57 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-12-15 23:44:57 +0000 |
commit | e4276f566d55232cf15908ae06b6256378dbc4de (patch) | |
tree | 7f20a374946f263f21ea091479adb03f7d93361f /OpenSim/Region | |
parent | Moved mssql_connection.ini to an .example file as well. (diff) | |
download | opensim-SC-e4276f566d55232cf15908ae06b6256378dbc4de.zip opensim-SC-e4276f566d55232cf15908ae06b6256378dbc4de.tar.gz opensim-SC-e4276f566d55232cf15908ae06b6256378dbc4de.tar.bz2 opensim-SC-e4276f566d55232cf15908ae06b6256378dbc4de.tar.xz |
* Beating on the head that is terrain editing.
* SelectAABB + Radio Button Action + 'brush size' + Apply works now.
* There's something wrong with the byte for brush size that causes it to be unpredictable sometimes causing massive spikes. This appears to have always been this way, however it's more noticeable now that you can apply the effect to a selection of terrain.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | 88 |
2 files changed, 80 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index ce77527..aa7c7b4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
55 | return; | 55 | return; |
56 | 56 | ||
57 | //if it wasn't for the permission checking we could have the terrain module directly subscribe to the OnModifyTerrain event | 57 | //if it wasn't for the permission checking we could have the terrain module directly subscribe to the OnModifyTerrain event |
58 | Terrain.ModifyTerrain(height, seconds, brushsize, action, north, west, remoteUser); | 58 | Terrain.ModifyTerrain(height, seconds, brushsize, action, north, west, south, east, remoteUser); |
59 | } | 59 | } |
60 | 60 | ||
61 | /// <summary> | 61 | /// <summary> |
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index a9c6137..d78f162 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | |||
@@ -132,7 +132,7 @@ namespace OpenSim.Region.Terrain | |||
132 | { | 132 | { |
133 | TimeSpan gap = DateTime.Now - lastEdit; | 133 | TimeSpan gap = DateTime.Now - lastEdit; |
134 | 134 | ||
135 | if (gap.TotalSeconds <= 2.0) | 135 | if (gap.TotalSeconds <= 4.0) |
136 | return true; | 136 | return true; |
137 | 137 | ||
138 | return false; | 138 | return false; |
@@ -159,37 +159,107 @@ namespace OpenSim.Region.Terrain | |||
159 | /// <param name="action">The action to be performed</param> | 159 | /// <param name="action">The action to be performed</param> |
160 | /// <param name="north">Distance from the north border where the cursor is located</param> | 160 | /// <param name="north">Distance from the north border where the cursor is located</param> |
161 | /// <param name="west">Distance from the west border where the cursor is located</param> | 161 | /// <param name="west">Distance from the west border where the cursor is located</param> |
162 | public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, | 162 | public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, float south, float east, |
163 | IClientAPI remoteUser) | 163 | IClientAPI remoteUser) |
164 | { | 164 | { |
165 | // Shiny. | 165 | // Shiny. |
166 | double size = (double) (1 << brushsize); | 166 | double size = (double) (1 << brushsize); |
167 | 167 | ||
168 | /* Okay, so here's the deal | ||
169 | * This has to handle both when a user draws on the terrain *and* when a user selects | ||
170 | * a selection of AABB on terrain and applies whatever routine the client requests | ||
171 | * There's something currently wrong with the brushsize --> size conversion.. however | ||
172 | * it's workable.. just unpredictable. | ||
173 | * | ||
174 | * North is always higher and East is always higher | ||
175 | * in the AABB representation | ||
176 | * | ||
177 | * Therefore what we're doing is looping from south to north and west to east | ||
178 | * and applying the associated algorithm with the brush. | ||
179 | * | ||
180 | * This works good on the fast ones, but things like smooth take 12 seconds a single click.. | ||
181 | * for now, smooth won't be 'selectionated' | ||
182 | * | ||
183 | * If the user draws instead of selects, north will = south, and east will = west. | ||
184 | * if the user selects, then the selection is inclusive | ||
185 | * it'll always affect at least one point on the heightmap. | ||
186 | * | ||
187 | * that means we use the <= operator | ||
188 | * | ||
189 | * Again, libTerrain is yx instead of xy.. so, it's reflected in the function calls | ||
190 | * | ||
191 | */ | ||
192 | |||
193 | |||
168 | switch (action) | 194 | switch (action) |
169 | { | 195 | { |
170 | case 0: | 196 | case 0: |
171 | // flatten terrain | 197 | // flatten terrain |
172 | FlattenTerrain(west, north, size, (double) seconds/5.0); | 198 | for (float x = south; x <= north; x++) |
199 | { | ||
200 | for (float y = west; y <= east; y++) | ||
201 | { | ||
202 | FlattenTerrain(y, x, size, (double)seconds / 5.0); | ||
203 | } | ||
204 | } | ||
173 | break; | 205 | break; |
174 | case 1: | 206 | case 1: |
175 | // raise terrain | 207 | // raise terrain |
176 | RaiseTerrain(west, north, size, (double) seconds/5.0); | 208 | for (float x = south; x <= north; x++) |
209 | { | ||
210 | for (float y = west; y <= east; y++) | ||
211 | { | ||
212 | RaiseTerrain(y, x, size, (double)seconds / 5.0); | ||
213 | } | ||
214 | } | ||
177 | break; | 215 | break; |
178 | case 2: | 216 | case 2: |
179 | //lower terrain | 217 | //lower terrain |
180 | LowerTerrain(west, north, size, (double) seconds/5.0); | 218 | for (float x = south; x <= north; x++) |
219 | { | ||
220 | for (float y = west; y <= east; y++) | ||
221 | { | ||
222 | LowerTerrain(y, x, size, (double)seconds / 5.0); | ||
223 | } | ||
224 | } | ||
181 | break; | 225 | break; |
182 | case 3: | 226 | case 3: |
183 | // smooth terrain | 227 | // smooth terrain |
184 | SmoothTerrain(west, north, size, (double) seconds/5.0); | 228 | // |
229 | // We're leaving this out of the parcel calculations for now | ||
230 | // because just a single one of these will stall your sim for | ||
231 | // 12 seconds. Looping over the parcel on this one is just stupid | ||
232 | // | ||
233 | //for (float x = south; x <= north; x++) | ||
234 | //{ | ||
235 | //for (float y = west; y <= east; y++) | ||
236 | //{ | ||
237 | //SmoothTerrain(y, x , size, (double)seconds / 5.0); | ||
238 | //} | ||
239 | //} | ||
240 | |||
241 | SmoothTerrain(west, north, size, (double)seconds / 5.0); | ||
242 | |||
185 | break; | 243 | break; |
186 | case 4: | 244 | case 4: |
187 | // noise | 245 | // noise |
188 | NoiseTerrain(west, north, size, (double) seconds/5.0); | 246 | for (float x = south; x <= north; x++) |
247 | { | ||
248 | for (float y = west; y <= east; y++) | ||
249 | { | ||
250 | NoiseTerrain(y, x, size, (double)seconds / 5.0); | ||
251 | } | ||
252 | } | ||
189 | break; | 253 | break; |
190 | case 5: | 254 | case 5: |
191 | // revert | 255 | // revert |
192 | RevertTerrain(west, north, size, (double) seconds/5.0); | 256 | for (float x = south; x <= north; x++) |
257 | { | ||
258 | for (float y = west; y <= east; y++) | ||
259 | { | ||
260 | RevertTerrain(y, x, size, (double)seconds / 5.0); | ||
261 | } | ||
262 | } | ||
193 | break; | 263 | break; |
194 | 264 | ||
195 | // CLIENT EXTENSIONS GO HERE | 265 | // CLIENT EXTENSIONS GO HERE |