* 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 patchx, patchy;
patchx = px / 16;
patchy = py / 16;
patchx = px;
patchy = py;
patches[0] = patchx + 0 + patchy * 16;

View File

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

View File

@ -61,6 +61,7 @@ namespace OpenSim.Region.Environment.Scenes
private uint _primCount = 702000;
private Mutex _primAllocateMutex = new Mutex(false);
private int storageCount;
private int terrainCheckCount;
private int landPrimCheckCount;
private Mutex updateLock;
@ -235,39 +236,45 @@ namespace OpenSim.Region.Environment.Scenes
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)
{
for (int x = 0; x < 16; x++)
ForEachScenePresence(delegate(ScenePresence presence)
{
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)
{
Entities[UUID].LandRenegerated();
foreach (LLUUID UUID in Entities.Keys)
{
Entities[UUID].LandRenegerated();
}
Terrain.ResetTaint();
}
Terrain.ResetTaint();
}
}