a few more changes on terrain

This commit is contained in:
UbitUmarov
2025-03-29 23:29:42 +00:00
parent 207a318f86
commit 9a02b55bf2
7 changed files with 79 additions and 54 deletions

View File

@@ -31,8 +31,6 @@ using System.IO;
using System.IO.Compression;
using System.Reflection;
using OpenMetaverse;
using log4net;
namespace OpenSim.Framework
@@ -361,30 +359,35 @@ namespace OpenSim.Framework
public unsafe void GetPatchMinMax(int px, int py, out float zmin, out float zmax)
{
zmax = float.MinValue;
zmin = float.MaxValue;
int mpy = Constants.TerrainPatchSize * py;
float min, max;
fixed (float* map = m_heightmap)
{
float* p = map + px * m_mapPatchsStride;
float* pend = p + m_mapPatchsStride;
while (p < pend)
float* p = map + px * m_mapPatchsStride + Constants.TerrainPatchSize * py;
float* endp = p + m_mapPatchsStride;
min = max = *p;
float* y = p;
int j = Constants.TerrainPatchSize - 1;
do
{
float* yt = p + mpy;
float* ytend = yt + 16;
while(yt < ytend)
do
{
float val = *yt;
if (val > zmax)
zmax = val;
if (val < zmin)
zmin = val;
yt++;
float val = *y++;
if (val > max)
max = val;
else if (val < min)
min = val;
}
while(--j > 0);
p += m_mapStride;
y = p;
j = Constants.TerrainPatchSize;
}
while (p < endp);
}
zmin = min;
zmax = max;
}
public unsafe void GetPatchBlock(float* block, int px, int py, float sub, float premult)