cosmetics on terrain patchs

0.9.1.0-post-fixes
UbitUmarov 2019-01-20 20:58:27 +00:00
parent 3bfa278984
commit 0c38d52538
12 changed files with 598 additions and 635 deletions

View File

@ -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
}
}
}

View File

@ -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);

View File

@ -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 i = startx; i < endx; i += stride)
{
float* p = &map[i];
for (int j = starty; j < starty + 16; j++)
{
float val = m_heightmap[i, 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;
fixed(float* block = _block, map = m_heightmap)
{
for (int y = startY; y < startY + 16; y++)
{
for (int x = startX; x < startX + 16; x++)
for (int x = startX; x < endX; x += stride)
{
block[k++] = (m_heightmap[x, y] - sub) * premult;
block[k++] = (map[x + y] - sub) * premult;
}
}
}
}

View File

@ -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);
if (x2 - x1 > 0 && y2 - y1 > 0)
SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
p[0] = x2;
for (int j = y1 + 1; j <= y2; ++j)
{
p[1] = j;
SendLayerData(p);
}
void SendLayerBottomLeft(TerrainData map, int x1, int y1, int x2, int y2)
if (x2 - x1 > 0 && y2 - y1 > 0)
SendLayerBottomLeft(x1, y1 + 1, x2 - 1, 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);
}
public void SendLayerData(int[] map)
{
if(map == null)
return;
// 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)
try
{
if (px >= 0)
{
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 =

View File

@ -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.

View File

@ -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()

View File

@ -155,16 +155,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return iout;
}
static double tt;
// new using terrain data and patchs indexes
public static List<LayerDataPacket> CreateLayerDataPackets(TerrainData terrData, int[] x, int[] y, byte landPacketType)
public static List<LayerDataPacket> CreateLayerDataPackets(TerrainData terrData, int[] map)
{
List<LayerDataPacket> ret = new List<LayerDataPacket>();
byte[] data = new byte[x.Length * 256 * 2];
int numberPatchs = map.Length / 2;
byte[] data = new byte[numberPatchs * 256 * 2];
//create packet and global header
LayerDataPacket layer = new LayerDataPacket();
byte landPacketType;
if (terrData.SizeX > Constants.RegionSize || terrData.SizeY > Constants.RegionSize)
landPacketType = (byte)TerrainPatch.LayerType.LandExtended;
else
landPacketType = (byte)TerrainPatch.LayerType.Land;
layer.LayerID.Type = landPacketType;
BitPack bitpack = new BitPack(data, 0);
@ -172,11 +180,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
bitpack.PackBitsFromByte(16);
bitpack.PackBitsFromByte(landPacketType);
for (int i = 0; i < x.Length; i++)
{
CreatePatchFromTerrainData(bitpack, terrData, x[i], y[i]);
tt = 0;
if (bitpack.BytePos > 980 && i != x.Length - 1)
int s;
for (int i = 0; i < numberPatchs; i++)
{
s = 2 * i;
tt -= Util.GetTimeStampMS();
CreatePatchFromTerrainData(bitpack, terrData, map[s], map[s + 1]);
tt += Util.GetTimeStampMS();
if (bitpack.BytePos > 980 && i != numberPatchs - 1)
{
//finish this packet
bitpack.PackBitsFromByte(END_OF_PATCHES);
@ -284,7 +298,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
output.PackBits(header.PatchIDs, 10);
}
private static void EncodePatch(BitPack output, int[] patch, int postquant, int wbits)
private unsafe static void EncodePatch(BitPack output, int[] _patch, int postquant, int wbits)
{
int maxwbitssize = (1 << wbits) - 1;
@ -296,6 +310,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int lastZeroindx = 256 - postquant;
fixed(int * patch = _patch)
{
if (lastZeroindx != 256)
patch[lastZeroindx] = 0;
@ -352,6 +368,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
++i;
}
}
}
private static int[] CompressPatch(TerrainData terrData, int patchX, int patchY, TerrainPatch.Header header,
int prequant, out int wbits)
@ -369,7 +386,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
header.QuantWBits = wordsize;
header.QuantWBits |= wordsize << 4;
terrData.GetPatchBlock(ref block, patchX, patchY, sub, premult);
terrData.GetPatchBlock(block, patchX, patchY, sub, premult);
wbits = (prequant >> 1);
@ -391,20 +408,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
private static void BuildQuantizeTable16()
private unsafe static void BuildQuantizeTable16()
{
const float oosob = 2.0f / 16;
fixed(float* fQuantizeTable16 = QuantizeTable16)
{
for (int j = 0; j < 16; j++)
{
int c = j * 16;
for (int i = 0; i < 16; i++)
{
QuantizeTable16[c + i] = oosob / (1.0f + 2.0f * (i + j));
fQuantizeTable16[c + i] = oosob / (1.0f + 2.0f * (i + j));
}
}
}
}
private static void BuildCopyMatrix16()
private unsafe static void BuildCopyMatrix16()
{
bool diag = false;
bool right = true;
@ -412,9 +432,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int j = 0;
int count = 0;
fixed (int* fCopyMatrix16 = CopyMatrix16)
{
while (i < 16 && j < 16)
{
CopyMatrix16[j * 16 + i] = count++;
fCopyMatrix16[j * 16 + i] = count++;
if (!diag)
{
@ -452,12 +474,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
}
}
#endregion Initialization
#region DCT
/* DCT (Discrete Cosine Transform)
@ -506,9 +526,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
const float W16_8R = 0.70710678118654752440f;
static void dct16x16(float[] a, int[] iout, ref int wbits)
unsafe static void dct16x16(float[] _a, int[] _iout, ref int wbits)
{
float[] tmp = new float[256];
float[] _tmp = new float[256];
float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
float x4r, x4i, x5r, x5i, x6r, x6i, x7r, x7i;
@ -523,6 +543,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int wbitsMaxValue = 1 << wbits;
bool dowbits = wbits < 17;
fixed (float* a = _a, tmp = _tmp, fQuantizeTable16 = QuantizeTable16)
fixed (int* iout = _iout, fCopyMatrix16 = CopyMatrix16)
{
for (j = 0, k = 0; j < 256; j += 16, k++)
{
x4r = a[0 + j] - a[15 + j];
@ -630,8 +653,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[0 + k] = C16_8R * (xr + xi); //
ftmp = C16_8R * (xr + xi);
itmp = (int)(ftmp * QuantizeTable16[k]);
iout[CopyMatrix16[k]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[k]);
iout[fCopyMatrix16[k]] = itmp;
if (dowbits)
{
@ -651,8 +674,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[8 * Constants.TerrainPatchSize + k] = C16_8R * (xr - xi); //
ftmp = C16_8R * (xr - xi);
indx = 8 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -675,8 +698,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[4 * Constants.TerrainPatchSize + k] = C16_4R * xr - C16_4I * xi; //
ftmp = C16_4R * xr - C16_4I * xi;
indx = 4 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -696,8 +719,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[12 * Constants.TerrainPatchSize + k] = C16_4R * xi + C16_4I * xr; //
ftmp = C16_4R * xi + C16_4I * xr;
indx = 12 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -722,8 +745,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[2 * Constants.TerrainPatchSize + k] = C16_2R * xr - C16_2I * xi; //
ftmp = C16_2R * xr - C16_2I * xi;
indx = 2 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -743,8 +766,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[14 * Constants.TerrainPatchSize + k] = C16_2R * xi + C16_2I * xr; //
ftmp = C16_2R * xi + C16_2I * xr;
indx = 14 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -767,8 +790,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[6 * Constants.TerrainPatchSize + k] = C16_6R * xr - C16_6I * xi; //
ftmp = C16_6R * xr - C16_6I * xi;
indx = 6 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -788,8 +811,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[10 * Constants.TerrainPatchSize + k] = C16_6R * xi + C16_6I * xr; //
ftmp = C16_6R * xi + C16_6I * xr;
indx = 10 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -826,8 +849,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[1 * Constants.TerrainPatchSize + k] = C16_1R * xr - C16_1I * xi; //
ftmp = C16_1R * xr - C16_1I * xi;
indx = 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -847,8 +870,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[15 * Constants.TerrainPatchSize + k] = C16_1R * xi + C16_1I * xr; //
ftmp = C16_1R * xi + C16_1I * xr;
indx = 15 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -871,8 +894,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[7 * Constants.TerrainPatchSize + k] = C16_7R * xr - C16_7I * xi; //
ftmp = C16_7R * xr - C16_7I * xi;
indx = 7 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -892,8 +915,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[9 * Constants.TerrainPatchSize + k] = C16_7R * xi + C16_7I * xr; //
ftmp = C16_7R * xi + C16_7I * xr;
indx = 9 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -916,8 +939,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[5 * Constants.TerrainPatchSize + k] = C16_5R * xr - C16_5I * xi; //
ftmp = C16_5R * xr - C16_5I * xi;
indx = 5 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -937,8 +960,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[11 * Constants.TerrainPatchSize + k] = C16_5R * xi + C16_5I * xr; //
ftmp = C16_5R * xi + C16_5I * xr;
indx = 11 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -961,8 +984,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[3 * Constants.TerrainPatchSize + k] = C16_3R * xr - C16_3I * xi; //
ftmp = C16_3R * xr - C16_3I * xi;
indx = 3 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -982,8 +1005,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//tmp[13 * Constants.TerrainPatchSize + k] = C16_3R * xi + C16_3I * xr; //
ftmp = C16_3R * xi + C16_3I * xr;
indx = 13 * 16 + k;
itmp = (int)(ftmp * QuantizeTable16[indx]);
iout[CopyMatrix16[indx]] = itmp;
itmp = (int)(ftmp * fQuantizeTable16[indx]);
iout[fCopyMatrix16[indx]] = itmp;
if (dowbits)
{
@ -1001,6 +1024,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
}
}
#endregion DCT

View File

@ -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;
}

View File

@ -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)

View File

@ -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();
}

View File

@ -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)
{
}

View File

@ -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)
{
}