cosmetics

0.9.1.0-post-fixes
UbitUmarov 2019-01-20 02:02:24 +00:00
parent 881cdc34b3
commit 3bfa278984
2 changed files with 41 additions and 33 deletions

View File

@ -80,6 +80,10 @@ namespace OpenSim.Framework
public abstract float[] GetFloatsSerialized();
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 TerrainData Clone();
}
@ -275,6 +279,37 @@ namespace OpenSim.Framework
return ret;
}
public override void GetPatchMinMax(int px, int py, out float zmin, out float zmax)
{
zmax = float.MinValue;
zmin = float.MaxValue;
int startx = px * 16;
int starty = py * 16;
for (int i = startx; i < startx + 16; i++)
{
for (int j = starty; j < starty + 16; j++)
{
float val = m_heightmap[i, 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)
{
int k = 0;
int startX = px * 16;
int startY = py * 16;
for (int y = startY; y < startY + 16; y++)
{
for (int x = startX; x < startX + 16; x++)
{
block[k++] = (m_heightmap[x, y] - sub) * premult;
}
}
}
// =============================================================
@ -476,13 +511,9 @@ namespace OpenSim.Framework
ret = str.ToArray();
}
}
catch
{
catch {}
}
m_log.DebugFormat("{0} V2D {1} bytes",
LogHeader, ret.Length);
m_log.DebugFormat("{0} V2D {1} bytes", LogHeader, ret.Length);
return ret;
}
@ -520,12 +551,9 @@ namespace OpenSim.Framework
}
}
}
catch
{
catch {}
}
m_log.DebugFormat("{0} V2DGzip {1} bytes",
LogHeader, ret.Length);
m_log.DebugFormat("{0} V2DGzip {1} bytes", LogHeader, ret.Length);
return ret;
}

View File

@ -256,18 +256,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
float zmax = float.MinValue;
float zmin = float.MaxValue;
int startx = patchX * 16;
int starty = patchY * 16;
for (int i = startx; i < startx + 16; i++)
{
for (int j = starty; j < starty + 16; j++)
{
float val = terrData[i, j];
if (val > zmax) zmax = val;
if (val < zmin) zmin = val;
}
}
terrData.GetPatchMinMax(patchX, patchY, out zmin, out zmax);
header.DCOffset = zmin;
frange = ((zmax - zmin) + 1.0f);
@ -380,16 +369,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
header.QuantWBits = wordsize;
header.QuantWBits |= wordsize << 4;
int k = 0;
int startX = patchX * 16;
int startY = patchY * 16;
for (int y = startY; y < startY + 16; y++)
{
for (int x = startX; x < startX + 16; x++)
{
block[k++] = (terrData[x, y] - sub) * premult;
}
}
terrData.GetPatchBlock(ref block, patchX, patchY, sub, premult);
wbits = (prequant >> 1);