diff options
Diffstat (limited to 'OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs')
-rw-r--r-- | OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs index af92fe7..d5cfb69 100644 --- a/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs +++ b/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs | |||
@@ -32,6 +32,7 @@ using System.Drawing.Imaging; | |||
32 | using System.IO; | 32 | using System.IO; |
33 | using libTerrain; | 33 | using libTerrain; |
34 | using OpenJPEGNet; | 34 | using OpenJPEGNet; |
35 | using OpenSim.Framework.Interfaces; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.Terrain | 37 | namespace OpenSim.Region.Terrain |
37 | { | 38 | { |
@@ -128,6 +129,76 @@ namespace OpenSim.Region.Terrain | |||
128 | heightmap.diff = new int[w / 16, h / 16]; | 129 | heightmap.diff = new int[w / 16, h / 16]; |
129 | } | 130 | } |
130 | 131 | ||
132 | //Testing to see if moving the TerraForming packet handling code into here works well | ||
133 | /// <summary> | ||
134 | /// Modifies terrain using the specified information | ||
135 | /// </summary> | ||
136 | /// <param name="height">The height at which the user started modifying the terrain</param> | ||
137 | /// <param name="seconds">The number of seconds the modify button was pressed</param> | ||
138 | /// <param name="brushsize">The size of the brush used</param> | ||
139 | /// <param name="action">The action to be performed</param> | ||
140 | /// <param name="north">Distance from the north border where the cursor is located</param> | ||
141 | /// <param name="west">Distance from the west border where the cursor is located</param> | ||
142 | public void ModifyTerrain(float height, float seconds, byte brushsize, byte action, float north, float west, IClientAPI remoteUser) | ||
143 | { | ||
144 | |||
145 | // Shiny. | ||
146 | double size = (double)(1 << brushsize); | ||
147 | |||
148 | switch (action) | ||
149 | { | ||
150 | case 0: | ||
151 | // flatten terrain | ||
152 | this.FlattenTerrain(west, north, size, (double)seconds / 5.0); | ||
153 | break; | ||
154 | case 1: | ||
155 | // raise terrain | ||
156 | this.RaiseTerrain(west, north, size, (double)seconds / 5.0); | ||
157 | break; | ||
158 | case 2: | ||
159 | //lower terrain | ||
160 | this.LowerTerrain(west, north, size, (double)seconds / 5.0); | ||
161 | break; | ||
162 | case 3: | ||
163 | // smooth terrain | ||
164 | this.SmoothTerrain(west, north, size, (double)seconds / 5.0); | ||
165 | break; | ||
166 | case 4: | ||
167 | // noise | ||
168 | this.NoiseTerrain(west, north, size, (double)seconds / 5.0); | ||
169 | break; | ||
170 | case 5: | ||
171 | // revert | ||
172 | this.RevertTerrain(west, north, size, (double)seconds / 5.0); | ||
173 | break; | ||
174 | |||
175 | // CLIENT EXTENSIONS GO HERE | ||
176 | case 128: | ||
177 | // erode-thermal | ||
178 | break; | ||
179 | case 129: | ||
180 | // erode-aerobic | ||
181 | break; | ||
182 | case 130: | ||
183 | // erode-hydraulic | ||
184 | break; | ||
185 | } | ||
186 | |||
187 | for (int x = 0; x < 16; x++) | ||
188 | { | ||
189 | for (int y = 0; y < 16; y++) | ||
190 | { | ||
191 | if (this.Tainted(x * 16, y * 16)) | ||
192 | { | ||
193 | remoteUser.SendLayerData(x, y, this.GetHeights1D()); | ||
194 | } | ||
195 | } | ||
196 | } | ||
197 | |||
198 | return; | ||
199 | } | ||
200 | |||
201 | |||
131 | /// <summary> | 202 | /// <summary> |
132 | /// Checks to make sure the terrain is within baked values +/- maxRaise/minLower | 203 | /// Checks to make sure the terrain is within baked values +/- maxRaise/minLower |
133 | /// </summary> | 204 | /// </summary> |