aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
diff options
context:
space:
mode:
authorMW2007-08-28 14:21:17 +0000
committerMW2007-08-28 14:21:17 +0000
commit8e3b2392d129d727bfd00a2d9faa08d9e5be92de (patch)
tree7e6b89ee495af1d5ea76c58fc0796a3bb38ecc5d /OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs
parentEnsure that UserProfileData doesn't pass down null values. (diff)
downloadopensim-SC_OLD-8e3b2392d129d727bfd00a2d9faa08d9e5be92de.zip
opensim-SC_OLD-8e3b2392d129d727bfd00a2d9faa08d9e5be92de.tar.gz
opensim-SC_OLD-8e3b2392d129d727bfd00a2d9faa08d9e5be92de.tar.bz2
opensim-SC_OLD-8e3b2392d129d727bfd00a2d9faa08d9e5be92de.tar.xz
Start of trying to make Region/Scene more modular.
Added preliminary IRegionModule interface. Also have a work in progress way of Modules registering optional API methods (kind of like Apache optional functions). But there must be a cleaner/nicer way in c# of doing these than the current way. Added three work in progress modules: ChatModule (simple handles in world chat, but by moving this to a module, we could support other types of chat modules, ie like a irc - opensim bridge module. ) , AvatarProfilesModule and XferModule. Moved most of the code from Scene.ModifyTerrain() into the BasicTerrain library, as the start of trying to make that more modular. Stopped Child agents showing up as part of the "show users" command.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Terrain.BasicTerrain/TerrainEngine.cs71
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;
32using System.IO; 32using System.IO;
33using libTerrain; 33using libTerrain;
34using OpenJPEGNet; 34using OpenJPEGNet;
35using OpenSim.Framework.Interfaces;
35 36
36namespace OpenSim.Region.Terrain 37namespace 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>