mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
a few more changes on terrain
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user