cosmetics on terrain patchs
parent
3bfa278984
commit
0c38d52538
|
@ -103,8 +103,8 @@ namespace OpenSim.Framework
|
|||
/// <summary>Finished, Same Sim</summary>
|
||||
FinishedViaSameSim = 1 << 29,
|
||||
/// <summary>Agent coming into the grid from another grid</summary>
|
||||
ViaHGLogin = 1 << 30
|
||||
ViaHGLogin = 1 << 30,
|
||||
notViaHGLogin = 0xbffffff
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1146,8 +1146,8 @@ namespace OpenSim.Framework
|
|||
|
||||
bool CanSendLayerData();
|
||||
|
||||
void SendLayerData(float[] map);
|
||||
void SendLayerData(int px, int py, float[] map);
|
||||
void SendLayerData();
|
||||
void SendLayerData(int[] map);
|
||||
|
||||
void SendWindData(int version, Vector2[] windSpeeds);
|
||||
void SendCloudData(int version, float[] cloudCover);
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace OpenSim.Framework
|
|||
public abstract double[,] GetDoubles();
|
||||
|
||||
public abstract void GetPatchMinMax(int px, int py, out float zmin, out float zmax);
|
||||
public abstract void GetPatchBlock(ref float[] block, int px, int py, float sub, float premult);
|
||||
public abstract void GetPatchBlock(float[] block, int px, int py, float sub, float premult);
|
||||
|
||||
public abstract TerrainData Clone();
|
||||
}
|
||||
|
@ -279,34 +279,47 @@ namespace OpenSim.Framework
|
|||
return ret;
|
||||
}
|
||||
|
||||
public override void GetPatchMinMax(int px, int py, out float zmin, out float zmax)
|
||||
public override unsafe void GetPatchMinMax(int px, int py, out float zmin, out float zmax)
|
||||
{
|
||||
zmax = float.MinValue;
|
||||
zmin = float.MaxValue;
|
||||
|
||||
int startx = px * 16;
|
||||
int stride = m_heightmap.GetLength(1);
|
||||
|
||||
int startx = px * 16 * stride;
|
||||
int endx = (px + 1) * 16 * stride;
|
||||
int starty = py * 16;
|
||||
for (int i = startx; i < startx + 16; i++)
|
||||
fixed (float* map = m_heightmap)
|
||||
{
|
||||
for (int j = starty; j < starty + 16; j++)
|
||||
for (int i = startx; i < endx; i += stride)
|
||||
{
|
||||
float val = m_heightmap[i, j];
|
||||
if (val > zmax) zmax = val;
|
||||
if (val < zmin) zmin = val;
|
||||
float* p = &map[i];
|
||||
for (int j = starty; j < starty + 16; j++)
|
||||
{
|
||||
float val = p[j];
|
||||
if (val > zmax) zmax = val;
|
||||
if (val < zmin) zmin = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetPatchBlock(ref float[] block, int px, int py, float sub, float premult)
|
||||
public override unsafe void GetPatchBlock(float[] _block, int px, int py, float sub, float premult)
|
||||
{
|
||||
int k = 0;
|
||||
int startX = px * 16;
|
||||
int stride = m_heightmap.GetLength(1);
|
||||
|
||||
int startX = px * 16 * stride;
|
||||
int endX = (px + 1) * 16 * stride;
|
||||
int startY = py * 16;
|
||||
for (int y = startY; y < startY + 16; y++)
|
||||
fixed(float* block = _block, map = m_heightmap)
|
||||
{
|
||||
for (int x = startX; x < startX + 16; x++)
|
||||
for (int y = startY; y < startY + 16; y++)
|
||||
{
|
||||
block[k++] = (m_heightmap[x, y] - sub) * premult;
|
||||
for (int x = startX; x < endX; x += stride)
|
||||
{
|
||||
block[k++] = (map[x + y] - sub) * premult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1185,13 +1185,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// region's patches to the client.
|
||||
/// </summary>
|
||||
/// <param name="map">heightmap</param>
|
||||
public virtual void SendLayerData(float[] map)
|
||||
public virtual void SendLayerData()
|
||||
{
|
||||
Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData");
|
||||
|
||||
// Send it sync, and async. It's not that much data
|
||||
// and it improves user experience just so much!
|
||||
// DoSendLayerData(map);
|
||||
Util.FireAndForget(DoSendLayerData, null, "LLClientView.DoSendLayerData");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1200,21 +1196,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <param name="o"></param>
|
||||
private void DoSendLayerData(object o)
|
||||
{
|
||||
TerrainData map = (TerrainData)o;
|
||||
|
||||
TerrainData map = m_scene.Heightmap.GetTerrainData();
|
||||
try
|
||||
{
|
||||
// Send LayerData in typerwriter pattern
|
||||
//for (int y = 0; y < 16; y++)
|
||||
//{
|
||||
// for (int x = 0; x < 16; x++)
|
||||
// {
|
||||
// SendLayerData(x, y, map);
|
||||
// }
|
||||
//}
|
||||
|
||||
// Send LayerData in a spiral pattern. Fun!
|
||||
SendLayerTopRight(map, 0, 0, map.SizeX / Constants.TerrainPatchSize - 1, map.SizeY / Constants.TerrainPatchSize - 1);
|
||||
SendLayerTopRight(0, 0, map.SizeX / Constants.TerrainPatchSize - 1, map.SizeY / Constants.TerrainPatchSize - 1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1222,63 +1208,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
}
|
||||
|
||||
private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2)
|
||||
private void SendLayerTopRight(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int[] p = new int[2];
|
||||
|
||||
// Row
|
||||
for (int i = x1; i <= x2; i++)
|
||||
SendLayerData(i, y1, map);
|
||||
p[1] = y1;
|
||||
for (int i = x1; i <= x2; ++i)
|
||||
{
|
||||
p[0] = i;
|
||||
SendLayerData(p);
|
||||
}
|
||||
|
||||
// Column
|
||||
for (int j = y1 + 1; j <= y2; j++)
|
||||
SendLayerData(x2, j, map);
|
||||
p[0] = x2;
|
||||
for (int j = y1 + 1; j <= y2; ++j)
|
||||
{
|
||||
p[1] = j;
|
||||
SendLayerData(p);
|
||||
}
|
||||
|
||||
if (x2 - x1 > 0 && y2 - y1 > 0)
|
||||
SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
|
||||
SendLayerBottomLeft(x1, y1 + 1, x2 - 1, y2);
|
||||
}
|
||||
|
||||
void SendLayerBottomLeft(TerrainData map, int x1, int y1, int x2, int y2)
|
||||
void SendLayerBottomLeft(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int[] p = new int[2];
|
||||
|
||||
// Row in reverse
|
||||
for (int i = x2; i >= x1; i--)
|
||||
SendLayerData(i, y2, map);
|
||||
p[1] = y2;
|
||||
for (int i = x2; i >= x1; --i)
|
||||
{
|
||||
p[0] = i;
|
||||
SendLayerData(p);
|
||||
}
|
||||
|
||||
// Column in reverse
|
||||
for (int j = y2 - 1; j >= y1; j--)
|
||||
SendLayerData(x1, j, map);
|
||||
p[0] = x1;
|
||||
for (int j = y2 - 1; j >= y1; --j)
|
||||
{
|
||||
p[1] = j;
|
||||
SendLayerData(p);
|
||||
}
|
||||
|
||||
if (x2 - x1 > 0 && y2 - y1 > 0)
|
||||
SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
|
||||
SendLayerTopRight(x1 + 1, y1, x2, y2 - 1);
|
||||
}
|
||||
|
||||
|
||||
// Legacy form of invocation that passes around a bare data array.
|
||||
// Just ignore what was passed and use the real terrain info that is part of the scene.
|
||||
// As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI,
|
||||
// there is a special form for specifying multiple terrain patches to send.
|
||||
// The form is to pass 'px' as negative the number of patches to send and to
|
||||
// pass the float array as pairs of patch X and Y coordinates. So, passing 'px'
|
||||
// as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches
|
||||
// and the patches to send are <3,5> and <8,4>.
|
||||
public void SendLayerData(int px, int py, float[] map)
|
||||
public void SendLayerData(int[] map)
|
||||
{
|
||||
if (px >= 0)
|
||||
if(map == null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
SendLayerData(px, py, m_scene.Heightmap.GetTerrainData());
|
||||
List<LayerDataPacket> packets = OpenSimTerrainCompressor.CreateLayerDataPackets(m_scene.Heightmap.GetTerrainData(), map);
|
||||
foreach (LayerDataPacket pkt in packets)
|
||||
OutPacket(pkt, ThrottleOutPacketType.Land);
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
int numPatches = -px;
|
||||
int[] xPatches = new int[numPatches];
|
||||
int[] yPatches = new int[numPatches];
|
||||
for (int pp = 0; pp < numPatches; pp++)
|
||||
{
|
||||
xPatches[pp] = (int)map[pp * 2];
|
||||
yPatches[pp] = (int)map[pp * 2 + 1];
|
||||
}
|
||||
|
||||
// DebugSendingPatches("SendLayerData", xPatches, yPatches);
|
||||
|
||||
SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData());
|
||||
m_log.Error("[CLIENT]: SendLayerData() Failed with exception: " + e.Message, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1298,43 +1289,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// Sends a terrain packet for the point specified.
|
||||
/// This is a legacy call that has refarbed the terrain into a flat map of floats.
|
||||
/// We just use the terrain from the region we know about.
|
||||
/// </summary>
|
||||
/// <param name="px">Patch coordinate (x) 0..15</param>
|
||||
/// <param name="py">Patch coordinate (y) 0..15</param>
|
||||
/// <param name="map">heightmap</param>
|
||||
public void SendLayerData(int px, int py, TerrainData terrData)
|
||||
{
|
||||
int[] xPatches = new[] { px };
|
||||
int[] yPatches = new[] { py };
|
||||
SendLayerData(xPatches, yPatches, terrData);
|
||||
}
|
||||
|
||||
private void SendLayerData(int[] px, int[] py, TerrainData terrData)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte landPacketType;
|
||||
if (terrData.SizeX > Constants.RegionSize || terrData.SizeY > Constants.RegionSize)
|
||||
landPacketType = (byte)TerrainPatch.LayerType.LandExtended;
|
||||
else
|
||||
landPacketType = (byte)TerrainPatch.LayerType.Land;
|
||||
|
||||
List<LayerDataPacket> packets = OpenSimTerrainCompressor.CreateLayerDataPackets(terrData, px, py, landPacketType);
|
||||
foreach(LayerDataPacket pkt in packets)
|
||||
OutPacket(pkt, ThrottleOutPacketType.Land);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[CLIENT]: SendLayerData() Failed with exception: " + e.Message, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// wind caching
|
||||
private static Dictionary<ulong,int> lastWindVersion = new Dictionary<ulong,int>();
|
||||
private static Dictionary<ulong,List<LayerDataPacket>> lastWindPackets =
|
||||
|
|
|
@ -866,21 +866,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length);
|
||||
|
||||
for (int i = 0; i < packetCount; i++)
|
||||
{
|
||||
byte[] data = datas[i];
|
||||
// if (!SendPacketData(udpClient, data, packet.Type, category, method))
|
||||
// packetQueued = true;
|
||||
SendPacketData(udpClient, data, packet.Type, category, method);
|
||||
}
|
||||
SendPacketData(udpClient, datas[i], packet.Type, category, method);
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] data = packet.ToBytes();
|
||||
// if (!SendPacketData(udpClient, data, packet.Type, category, method))
|
||||
// packetQueued = true;
|
||||
SendPacketData(udpClient, data, packet.Type, category, method);
|
||||
}
|
||||
|
||||
PacketPool.Instance.ReturnPacket(packet);
|
||||
}
|
||||
|
||||
|
@ -908,7 +900,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (zerocount != 0)
|
||||
{
|
||||
dest[zerolen++] = 0x00;
|
||||
dest[zerolen++] = (byte)zerocount;
|
||||
dest[zerolen++] = zerocount;
|
||||
zerocount = 0;
|
||||
}
|
||||
|
||||
|
@ -919,10 +911,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
if (zerocount != 0)
|
||||
{
|
||||
dest[zerolen++] = 0x00;
|
||||
dest[zerolen++] = (byte)zerocount;
|
||||
dest[zerolen++] = zerocount;
|
||||
}
|
||||
|
||||
return (int)zerolen;
|
||||
return zerolen;
|
||||
}
|
||||
/// <summary>
|
||||
/// Start the process of sending a packet to the client.
|
||||
|
|
|
@ -592,7 +592,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
else
|
||||
{
|
||||
// The traditional way is to call into the protocol stack to send them all.
|
||||
pClient.SendLayerData(new float[10]);
|
||||
pClient.SendLayerData();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1066,13 +1066,11 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
// Legacy update sending where the update is sent out as soon as noticed
|
||||
// We know the actual terrain data that is passed is ignored so this passes a dummy heightmap.
|
||||
//float[] heightMap = terrData.GetFloatsSerialized();
|
||||
float[] heightMap = new float[10];
|
||||
int[] map = new int[]{ x / Constants.TerrainPatchSize, y / Constants.TerrainPatchSize };
|
||||
m_scene.ForEachClient(
|
||||
delegate (IClientAPI controller)
|
||||
{
|
||||
controller.SendLayerData(x / Constants.TerrainPatchSize,
|
||||
y / Constants.TerrainPatchSize,
|
||||
heightMap);
|
||||
controller.SendLayerData(map);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -1131,14 +1129,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
}
|
||||
*/
|
||||
|
||||
float[] patchPieces = new float[toSend.Count * 2];
|
||||
int[] patchPieces = new int[toSend.Count * 2];
|
||||
int pieceIndex = 0;
|
||||
foreach (PatchesToSend pts in toSend)
|
||||
{
|
||||
patchPieces[pieceIndex++] = pts.PatchX;
|
||||
patchPieces[pieceIndex++] = pts.PatchY;
|
||||
}
|
||||
pups.Presence.ControllingClient.SendLayerData(-toSend.Count, 0, patchPieces);
|
||||
pups.Presence.ControllingClient.SendLayerData(patchPieces);
|
||||
}
|
||||
if (pups.sendAll && toSend.Count < 1024)
|
||||
SendAllModifiedPatchs(pups);
|
||||
|
@ -1206,16 +1204,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
npatchs = patchs.Count;
|
||||
if (npatchs > 0)
|
||||
{
|
||||
int[] xPieces = new int[npatchs];
|
||||
int[] yPieces = new int[npatchs];
|
||||
float[] patchPieces = new float[npatchs * 2];
|
||||
int[] patchPieces = new int[npatchs * 2];
|
||||
int pieceIndex = 0;
|
||||
foreach (PatchesToSend pts in patchs)
|
||||
{
|
||||
patchPieces[pieceIndex++] = pts.PatchX;
|
||||
patchPieces[pieceIndex++] = pts.PatchY;
|
||||
}
|
||||
pups.Presence.ControllingClient.SendLayerData(-npatchs, 0, patchPieces);
|
||||
pups.Presence.ControllingClient.SendLayerData(patchPieces);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1457,8 +1453,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
|
|||
{
|
||||
//m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY);
|
||||
// SendLayerData does not use the heightmap parameter. This kludge is so as to not change IClientAPI.
|
||||
float[] heightMap = new float[10];
|
||||
client.SendLayerData(patchX, patchY, heightMap);
|
||||
client.SendLayerData(new int[]{patchX, patchY});
|
||||
}
|
||||
|
||||
private void StoreUndoState()
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -62,17 +62,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
double h10 = map[(int) x + stepSize, (int) y];
|
||||
double h01 = map[(int) x, (int) y + stepSize];
|
||||
double h11 = map[(int) x + stepSize, (int) y + stepSize];
|
||||
double h1 = h00;
|
||||
double h2 = h10;
|
||||
double h3 = h01;
|
||||
double h4 = h11;
|
||||
double a00 = h1;
|
||||
double a10 = h2 - h1;
|
||||
double a01 = h3 - h1;
|
||||
double a11 = h1 - h2 - h3 + h4;
|
||||
double a00 = h00;
|
||||
double a10 = h10 - h00;
|
||||
double a01 = h01 - h00;
|
||||
double a11 = h11 - h10 - h01 + h00;
|
||||
double partialx = x - (int) x;
|
||||
double partialz = y - (int) y;
|
||||
double hi = a00 + (a10 * partialx) + (a01 * partialz) + (a11 * partialx * partialz);
|
||||
double partialy = y - (int) y;
|
||||
double hi = a00 + (a10 * partialx) + (a01 * partialy) + (a11 * partialx * partialy);
|
||||
return hi;
|
||||
}
|
||||
|
||||
|
|
|
@ -1014,19 +1014,16 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
|
|||
return false;
|
||||
}
|
||||
|
||||
public void SendLayerData(float[] map)
|
||||
public void SendLayerData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SendLayerData(int px, int py, float[] map)
|
||||
public void SendLayerData(int[] map)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SendWindData(int version, Vector2[] windSpeeds)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SendCloudData(int version, float[] cloudCover)
|
||||
|
|
|
@ -630,9 +630,7 @@ namespace OpenSim.Region.OptionalModules.Materials
|
|||
if (faceEntry != null)
|
||||
{
|
||||
faceEntry.MaterialID = id;
|
||||
|
||||
//m_log.DebugFormat("[Materials]: in \"{0}\" {1}, setting material ID for face {2} to {3}", sop.Name, sop.UUID, face, id);
|
||||
|
||||
// We can't use sop.UpdateTextureEntry(te) because it filters, so do it manually
|
||||
sop.Shape.TextureEntry = te.GetBytes();
|
||||
}
|
||||
|
|
|
@ -742,14 +742,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
|||
return false;
|
||||
}
|
||||
|
||||
public virtual void SendLayerData(float[] map)
|
||||
public virtual void SendLayerData()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void SendLayerData(int px, int py, float[] map)
|
||||
{
|
||||
}
|
||||
public virtual void SendLayerData(int px, int py, float[] map, bool track)
|
||||
public void SendLayerData(int[] map)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -653,14 +653,11 @@ namespace OpenSim.Tests.Common
|
|||
return false;
|
||||
}
|
||||
|
||||
public virtual void SendLayerData(float[] map)
|
||||
public virtual void SendLayerData()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void SendLayerData(int px, int py, float[] map)
|
||||
{
|
||||
}
|
||||
public virtual void SendLayerData(int px, int py, float[] map, bool track)
|
||||
public void SendLayerData(int[] map)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue