* SendLayerData overload including coords now uses patch number rather than coords directly.

afrisby
Adam Frisby 2007-07-24 05:38:21 +00:00
parent 402aa1b0d2
commit b9af2fe393
3 changed files with 32 additions and 28 deletions

View File

@ -323,8 +323,8 @@ namespace OpenSim.Region.ClientStack
{ {
int[] patches = new int[1]; int[] patches = new int[1];
int patchx, patchy; int patchx, patchy;
patchx = px / 16; patchx = px;
patchy = py / 16; patchy = py;
patches[0] = patchx + 0 + patchy * 16; patches[0] = patchx + 0 + patchy * 16;

View File

@ -58,32 +58,26 @@ namespace OpenSim.Region.Environment.Scenes
case 0: case 0:
// flatten terrain // flatten terrain
Terrain.FlattenTerrain(north, west, size, (double)seconds / 5.0); Terrain.FlattenTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west);
break; break;
case 1: case 1:
// raise terrain // raise terrain
Terrain.RaiseTerrain(north, west, size, (double)seconds / 5.0); Terrain.RaiseTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west);
break; break;
case 2: case 2:
//lower terrain //lower terrain
Terrain.LowerTerrain(north, west, size, (double)seconds / 5.0); Terrain.LowerTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west);
break; break;
case 3: case 3:
// smooth terrain // smooth terrain
Terrain.SmoothTerrain(north, west, size, (double)seconds / 5.0); Terrain.SmoothTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west);
break; break;
case 4: case 4:
// noise // noise
Terrain.NoiseTerrain(north, west, size, (double)seconds / 5.0); Terrain.NoiseTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west);
break; break;
case 5: case 5:
// revert // revert
Terrain.RevertTerrain(north, west, size, (double)seconds / 5.0); Terrain.RevertTerrain(north, west, size, (double)seconds / 5.0);
RegenerateTerrain(true, (int)north, (int)west);
break; break;
// CLIENT EXTENSIONS GO HERE // CLIENT EXTENSIONS GO HERE
@ -97,6 +91,9 @@ namespace OpenSim.Region.Environment.Scenes
// erode-hydraulic // erode-hydraulic
break; break;
} }
RegenerateTerrain(true, (int)(north / 16.0f), (int)(west / 16.0f));
return; return;
} }

View File

@ -61,6 +61,7 @@ namespace OpenSim.Region.Environment.Scenes
private uint _primCount = 702000; private uint _primCount = 702000;
private Mutex _primAllocateMutex = new Mutex(false); private Mutex _primAllocateMutex = new Mutex(false);
private int storageCount; private int storageCount;
private int terrainCheckCount;
private int landPrimCheckCount; private int landPrimCheckCount;
private Mutex updateLock; private Mutex updateLock;
@ -235,39 +236,45 @@ namespace OpenSim.Region.Environment.Scenes
storageCount = 0; storageCount = 0;
} }
if (Terrain.Tainted()) terrainCheckCount++;
if (terrainCheckCount >= 5)
{ {
lock (Terrain.heightmap) terrainCheckCount = 0;
if (Terrain.Tainted())
{ {
lock (m_syncRoot) lock (Terrain.heightmap)
{ {
phyScene.SetTerrain(Terrain.GetHeights1D()); lock (m_syncRoot)
} {
phyScene.SetTerrain(Terrain.GetHeights1D());
}
storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD()); storageManager.DataStore.StoreTerrain(Terrain.GetHeights2DD());
float[] terData = Terrain.GetHeights1D(); float[] terData = Terrain.GetHeights1D();
ForEachScenePresence(delegate(ScenePresence presence) ForEachScenePresence(delegate(ScenePresence presence)
{
for (int x = 0; x < 16; x++)
{ {
for (int y = 0; y < 16; y++) for (int x = 0; x < 16; x++)
{ {
if (Terrain.Tainted(x * 16, y * 16)) for (int y = 0; y < 16; y++)
{ {
SendLayerData(x, y, presence.ControllingClient, terData); if (Terrain.Tainted(x * 16, y * 16))
{
SendLayerData(x, y, presence.ControllingClient, terData);
}
} }
} }
} });
});
foreach (LLUUID UUID in Entities.Keys) foreach (LLUUID UUID in Entities.Keys)
{ {
Entities[UUID].LandRenegerated(); Entities[UUID].LandRenegerated();
}
Terrain.ResetTaint();
} }
Terrain.ResetTaint();
} }
} }