aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorRobert Adams2014-03-10 22:01:55 -0700
committerRobert Adams2014-03-10 22:05:18 -0700
commit742f5054408bbd928ea2422dd9abc04ee57c80dc (patch)
tree03cba6e526914ac7bfefc210afd7179834045c6c /OpenSim/Framework
parentDon't start KeyframeMotion timers until all the regions are ready. This preve... (diff)
downloadopensim-SC_OLD-742f5054408bbd928ea2422dd9abc04ee57c80dc.zip
opensim-SC_OLD-742f5054408bbd928ea2422dd9abc04ee57c80dc.tar.gz
opensim-SC_OLD-742f5054408bbd928ea2422dd9abc04ee57c80dc.tar.bz2
opensim-SC_OLD-742f5054408bbd928ea2422dd9abc04ee57c80dc.tar.xz
Change terrain update sending to be triggered by frame tick rather
than everytime terrain is changed. The TerrainModule now hooks the frame event and, if terrain has changed, sends terrain updates to the clients. This polling pattern replaces the previous push on change pattern and will make it easier to do per client throttling and per scene presence terrain update ordering.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/TerrainData.cs51
1 files changed, 46 insertions, 5 deletions
diff --git a/OpenSim/Framework/TerrainData.cs b/OpenSim/Framework/TerrainData.cs
index 9325df2..25f9ca6 100644
--- a/OpenSim/Framework/TerrainData.cs
+++ b/OpenSim/Framework/TerrainData.cs
@@ -50,8 +50,9 @@ namespace OpenSim.Framework
50 // Someday terrain will have caves 50 // Someday terrain will have caves
51 public abstract float this[int x, int y, int z] { get; set; } 51 public abstract float this[int x, int y, int z] { get; set; }
52 52
53 public bool IsTainted { get; protected set; }
54 public abstract bool IsTaintedAt(int xx, int yy); 53 public abstract bool IsTaintedAt(int xx, int yy);
54 public abstract bool IsTaintedAt(int xx, int yy, bool clearOnTest);
55 public abstract void TaintAllTerrain();
55 public abstract void ClearTaint(); 56 public abstract void ClearTaint();
56 57
57 public abstract void ClearLand(); 58 public abstract void ClearLand();
@@ -75,6 +76,7 @@ namespace OpenSim.Framework
75 public abstract short[] GetCompressedMap(); 76 public abstract short[] GetCompressedMap();
76 public abstract float CompressionFactor { get; } 77 public abstract float CompressionFactor { get; }
77 78
79 public abstract float[] GetFloatsSerialized();
78 public abstract double[,] GetDoubles(); 80 public abstract double[,] GetDoubles();
79 public abstract TerrainData Clone(); 81 public abstract TerrainData Clone();
80 } 82 }
@@ -138,10 +140,20 @@ namespace OpenSim.Framework
138 // TerrainData.ClearTaint 140 // TerrainData.ClearTaint
139 public override void ClearTaint() 141 public override void ClearTaint()
140 { 142 {
141 IsTainted = false; 143 SetAllTaint(false);
144 }
145
146 // TerrainData.TaintAllTerrain
147 public override void TaintAllTerrain()
148 {
149 SetAllTaint(true);
150 }
151
152 private void SetAllTaint(bool setting)
153 {
142 for (int ii = 0; ii < m_taint.GetLength(0); ii++) 154 for (int ii = 0; ii < m_taint.GetLength(0); ii++)
143 for (int jj = 0; jj < m_taint.GetLength(1); jj++) 155 for (int jj = 0; jj < m_taint.GetLength(1); jj++)
144 m_taint[ii, jj] = false; 156 m_taint[ii, jj] = setting;
145 } 157 }
146 158
147 // TerrainData.ClearLand 159 // TerrainData.ClearLand
@@ -158,15 +170,25 @@ namespace OpenSim.Framework
158 m_heightmap[xx, yy] = flatHeight; 170 m_heightmap[xx, yy] = flatHeight;
159 } 171 }
160 172
161 public override bool IsTaintedAt(int xx, int yy) 173 // Return 'true' of the patch that contains these region coordinates has been modified.
174 // Note that checking the taint clears it.
175 // There is existing code that relies on this feature.
176 public override bool IsTaintedAt(int xx, int yy, bool clearOnTest)
162 { 177 {
163 int tx = xx / Constants.TerrainPatchSize; 178 int tx = xx / Constants.TerrainPatchSize;
164 int ty = yy / Constants.TerrainPatchSize; 179 int ty = yy / Constants.TerrainPatchSize;
165 bool ret = m_taint[tx, ty]; 180 bool ret = m_taint[tx, ty];
166 m_taint[tx, ty] = false; 181 if (ret && clearOnTest)
182 m_taint[tx, ty] = false;
167 return ret; 183 return ret;
168 } 184 }
169 185
186 // Old form that clears the taint flag when we check it.
187 public override bool IsTaintedAt(int xx, int yy)
188 {
189 return IsTaintedAt(xx, yy, true /* clearOnTest */);
190 }
191
170 // TerrainData.GetDatabaseBlob 192 // TerrainData.GetDatabaseBlob
171 // The user wants something to store in the database. 193 // The user wants something to store in the database.
172 public override bool GetDatabaseBlob(out int DBRevisionCode, out Array blob) 194 public override bool GetDatabaseBlob(out int DBRevisionCode, out Array blob)
@@ -212,6 +234,25 @@ namespace OpenSim.Framework
212 return ret; 234 return ret;
213 } 235 }
214 236
237 // TerrainData.GetFloatsSerialized
238 // This one dimensional version is ordered so height = map[y*sizeX+x];
239 // DEPRECATED: don't use this function as it does not retain the dimensions of the terrain
240 // and the caller will probably do the wrong thing if the terrain is not the legacy 256x256.
241 public override float[] GetFloatsSerialized()
242 {
243 int points = SizeX * SizeY;
244 float[] heights = new float[points];
245
246 int idx = 0;
247 for (int jj = 0; jj < SizeY; jj++)
248 for (int ii = 0; ii < SizeX; ii++)
249 {
250 heights[idx++] = FromCompressedHeight(m_heightmap[ii, jj]);
251 }
252
253 return heights;
254 }
255
215 // TerrainData.GetDoubles 256 // TerrainData.GetDoubles
216 public override double[,] GetDoubles() 257 public override double[,] GetDoubles()
217 { 258 {