aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/Terrain
diff options
context:
space:
mode:
authorTeravus Ovares2008-12-19 00:06:19 +0000
committerTeravus Ovares2008-12-19 00:06:19 +0000
commit7bbda6651ef42c798ca2b3acd0b801fddcaa31e6 (patch)
tree252414ef96197a0ceeb9fde91fe83fa003f5ffa6 /OpenSim/Region/Environment/Modules/World/Terrain
parentMake llSetAlpha and llSetTexture properly queue full updates, so changes (diff)
downloadopensim-SC-7bbda6651ef42c798ca2b3acd0b801fddcaa31e6.zip
opensim-SC-7bbda6651ef42c798ca2b3acd0b801fddcaa31e6.tar.gz
opensim-SC-7bbda6651ef42c798ca2b3acd0b801fddcaa31e6.tar.bz2
opensim-SC-7bbda6651ef42c798ca2b3acd0b801fddcaa31e6.tar.xz
* Commit patch from cmickeyb. #2871. Optimized float array for the terrain heightfield to reduce cpu usage on new client significantly.
Thanks cmickeyb!
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/Terrain')
-rw-r--r--OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs18
1 files changed, 13 insertions, 5 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs
index 5c3eb7d..1534c4b 100644
--- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs
+++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainChannel.cs
@@ -108,12 +108,20 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain
108 108
109 public float[] GetFloatsSerialised() 109 public float[] GetFloatsSerialised()
110 { 110 {
111 float[] heights = new float[Width * Height]; 111 // Move the member variables into local variables, calling
112 int i; 112 // member variables 256*256 times gets expensive
113 113 int w = Width;
114 for (i = 0; i < Width * Height; i++) 114 int h = Height;
115 float[] heights = new float[w * h];
116
117 int i, j; // map coordinates
118 int idx = 0; // index into serialized array
119 for (i = 0; i < h; i++)
115 { 120 {
116 heights[i] = (float) map[i % Width, i / Width]; 121 for (j = 0; j < w; j++)
122 {
123 heights[idx++] = (float)map[j, i];
124 }
117 } 125 }
118 126
119 return heights; 127 return heights;