remove terraindata abstraction layer, since we only have heightmap type
parent
a287a8e121
commit
33a062612f
|
@ -598,7 +598,7 @@ namespace OpenSim.Data.MySQL
|
|||
// Legacy entry point for when terrain was always a 256x256 hieghtmap
|
||||
public void StoreTerrain(double[,] ter, UUID regionID)
|
||||
{
|
||||
StoreTerrain(new HeightmapTerrainData(ter), regionID);
|
||||
StoreTerrain(new TerrainData(ter), regionID);
|
||||
}
|
||||
|
||||
public void StoreTerrain(TerrainData terrData, UUID regionID)
|
||||
|
@ -1463,7 +1463,7 @@ namespace OpenSim.Data.MySQL
|
|||
if (!(row["DynAttrs"] is System.DBNull))
|
||||
prim.DynAttrs = DAMap.FromXml((string)row["DynAttrs"]);
|
||||
else
|
||||
prim.DynAttrs = new DAMap();
|
||||
prim.DynAttrs = null;
|
||||
|
||||
if (!(row["KeyframeMotion"] is DBNull))
|
||||
{
|
||||
|
@ -1880,7 +1880,7 @@ namespace OpenSim.Data.MySQL
|
|||
else
|
||||
cmd.Parameters.AddWithValue("Vehicle", String.Empty);
|
||||
|
||||
if (prim.DynAttrs.CountNamespaces > 0)
|
||||
if (prim.DynAttrs != null && prim.DynAttrs.CountNamespaces > 0)
|
||||
cmd.Parameters.AddWithValue("DynAttrs", prim.DynAttrs.ToXml());
|
||||
else
|
||||
cmd.Parameters.AddWithValue("DynAttrs", null);
|
||||
|
|
|
@ -151,7 +151,7 @@ namespace OpenSim.Data.Null
|
|||
// Legacy. Just don't do this.
|
||||
public void StoreTerrain(double[,] ter, UUID regionID)
|
||||
{
|
||||
TerrainData terrData = new HeightmapTerrainData(ter);
|
||||
TerrainData terrData = new TerrainData(ter);
|
||||
StoreTerrain(terrData, regionID);
|
||||
}
|
||||
|
||||
|
|
|
@ -610,7 +610,7 @@ namespace OpenSim.Data.PGSQL
|
|||
// Legacy entry point for when terrain was always a 256x256 heightmap
|
||||
public void StoreTerrain(double[,] terrain, UUID regionID)
|
||||
{
|
||||
StoreTerrain(new HeightmapTerrainData(terrain), regionID);
|
||||
StoreTerrain(new TerrainData(terrain), regionID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1797,7 +1797,7 @@ namespace OpenSim.Data.PGSQL
|
|||
if (!(primRow["DynAttrs"] is System.DBNull) && (string)primRow["DynAttrs"] != "")
|
||||
prim.DynAttrs = DAMap.FromXml((string)primRow["DynAttrs"]);
|
||||
else
|
||||
prim.DynAttrs = new DAMap();
|
||||
prim.DynAttrs = null;
|
||||
|
||||
prim.PhysicsShapeType = Convert.ToByte(primRow["PhysicsShapeType"]);
|
||||
prim.Density = Convert.ToSingle(primRow["Density"]);
|
||||
|
@ -2245,7 +2245,7 @@ namespace OpenSim.Data.PGSQL
|
|||
else
|
||||
parameters.Add(_Database.CreateParameter("PhysInertia", String.Empty));
|
||||
|
||||
if (prim.DynAttrs.CountNamespaces > 0)
|
||||
if (prim.DynAttrs != null && prim.DynAttrs.CountNamespaces > 0)
|
||||
parameters.Add(_Database.CreateParameter("DynAttrs", prim.DynAttrs.ToXml()));
|
||||
else
|
||||
parameters.Add(_Database.CreateParameter("DynAttrs", null));
|
||||
|
|
|
@ -37,56 +37,6 @@ using log4net;
|
|||
|
||||
namespace OpenSim.Framework
|
||||
{
|
||||
public abstract class TerrainData
|
||||
{
|
||||
// Terrain always is a square
|
||||
public int SizeX { get; protected set; }
|
||||
public int SizeY { get; protected set; }
|
||||
public int SizeZ { get; protected set; }
|
||||
|
||||
// A height used when the user doesn't specify anything
|
||||
public const float DefaultTerrainHeight = 21f;
|
||||
|
||||
public abstract float this[int x, int y] { get; set; }
|
||||
// Someday terrain will have caves
|
||||
// at most holes :p
|
||||
public abstract float this[int x, int y, int z] { get; set; }
|
||||
|
||||
public abstract bool IsTaintedAt(int xx, int yy);
|
||||
public abstract bool IsTaintedAt(int xx, int yy, bool clearOnTest);
|
||||
public abstract void TaintAllTerrain();
|
||||
public abstract void ClearTaint();
|
||||
|
||||
public abstract void ClearLand();
|
||||
public abstract void ClearLand(float height);
|
||||
|
||||
// Return a representation of this terrain for storing as a blob in the database.
|
||||
// Returns 'true' to say blob was stored in the 'out' locations.
|
||||
public abstract bool GetDatabaseBlob(out int DBFormatRevisionCode, out Array blob);
|
||||
|
||||
// Given a revision code and a blob from the database, create and return the right type of TerrainData.
|
||||
// The sizes passed are the expected size of the region. The database info will be used to
|
||||
// initialize the heightmap of that sized region with as much data is in the blob.
|
||||
// Return created TerrainData or 'null' if unsuccessful.
|
||||
public static TerrainData CreateFromDatabaseBlobFactory(int pSizeX, int pSizeY, int pSizeZ, int pFormatCode, byte[] pBlob)
|
||||
{
|
||||
// For the moment, there is only one implementation class
|
||||
return new HeightmapTerrainData(pSizeX, pSizeY, pSizeZ, pFormatCode, pBlob);
|
||||
}
|
||||
|
||||
// return a special compressed representation of the heightmap in ushort
|
||||
public abstract float[] GetCompressedMap();
|
||||
public abstract float CompressionFactor { get; }
|
||||
|
||||
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(float[] block, int px, int py, float sub, float premult);
|
||||
|
||||
public abstract TerrainData Clone();
|
||||
}
|
||||
|
||||
// The terrain is stored in the database as a blob with a 'revision' field.
|
||||
// Some implementations of terrain storage would fill the revision field with
|
||||
// the time the terrain was stored. When real revisions were added and this
|
||||
|
@ -116,18 +66,37 @@ namespace OpenSim.Framework
|
|||
RevisionHigh = 1234
|
||||
}
|
||||
|
||||
// Version of terrain that is a heightmap.
|
||||
// This should really be 'LLOptimizedHeightmapTerrainData' as it includes knowledge
|
||||
// of 'patches' which are 16x16 terrain areas which can be sent separately to the viewer.
|
||||
// The heighmap is kept as an array of ushorts. The ushort values are converted to
|
||||
// and from floats by TerrainCompressionFactor.
|
||||
public class HeightmapTerrainData : TerrainData
|
||||
public class TerrainData
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static string LogHeader = "[HEIGHTMAP TERRAIN DATA]";
|
||||
private static string LogHeader = "[TERRAIN DATA]";
|
||||
|
||||
// TerrainData.this[x, y]
|
||||
public override float this[int x, int y]
|
||||
private float[,] m_heightmap;
|
||||
// Remember subregions of the heightmap that has changed.
|
||||
private bool[,] m_taint;
|
||||
|
||||
// legacy CompressionFactor
|
||||
public float CompressionFactor { get; private set; }
|
||||
|
||||
// Terrain always is a square
|
||||
public int SizeX { get; protected set; }
|
||||
public int SizeY { get; protected set; }
|
||||
public int SizeZ { get; protected set; }
|
||||
|
||||
// A height used when the user doesn't specify anything
|
||||
public const float DefaultTerrainHeight = 21f;
|
||||
|
||||
// Given a revision code and a blob from the database, create and return the right type of TerrainData.
|
||||
// The sizes passed are the expected size of the region. The database info will be used to
|
||||
// initialize the heightmap of that sized region with as much data is in the blob.
|
||||
// Return created TerrainData or 'null' if unsuccessful.
|
||||
public static TerrainData CreateFromDatabaseBlobFactory(int pSizeX, int pSizeY, int pSizeZ, int pFormatCode, byte[] pBlob)
|
||||
{
|
||||
// For the moment, there is only one implementation class
|
||||
return new TerrainData(pSizeX, pSizeY, pSizeZ, pFormatCode, pBlob);
|
||||
}
|
||||
|
||||
public float this[int x, int y]
|
||||
{
|
||||
get { return m_heightmap[x, y]; }
|
||||
set
|
||||
|
@ -140,21 +109,18 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
// TerrainData.this[x, y, z]
|
||||
public override float this[int x, int y, int z]
|
||||
public float this[int x, int y, int z]
|
||||
{
|
||||
get { return this[x, y]; }
|
||||
set { this[x, y] = value; }
|
||||
}
|
||||
|
||||
// TerrainData.ClearTaint
|
||||
public override void ClearTaint()
|
||||
public void ClearTaint()
|
||||
{
|
||||
SetAllTaint(false);
|
||||
}
|
||||
|
||||
// TerrainData.TaintAllTerrain
|
||||
public override void TaintAllTerrain()
|
||||
public void TaintAllTerrain()
|
||||
{
|
||||
SetAllTaint(true);
|
||||
}
|
||||
|
@ -166,13 +132,12 @@ namespace OpenSim.Framework
|
|||
m_taint[ii, jj] = setting;
|
||||
}
|
||||
|
||||
// TerrainData.ClearLand
|
||||
public override void ClearLand()
|
||||
public void ClearLand()
|
||||
{
|
||||
ClearLand(DefaultTerrainHeight);
|
||||
}
|
||||
// TerrainData.ClearLand(float)
|
||||
public override void ClearLand(float pHeight)
|
||||
|
||||
public void ClearLand(float pHeight)
|
||||
{
|
||||
for (int xx = 0; xx < SizeX; xx++)
|
||||
for (int yy = 0; yy < SizeY; yy++)
|
||||
|
@ -182,7 +147,7 @@ namespace OpenSim.Framework
|
|||
// Return 'true' of the patch that contains these region coordinates has been modified.
|
||||
// Note that checking the taint clears it.
|
||||
// There is existing code that relies on this feature.
|
||||
public override bool IsTaintedAt(int xx, int yy, bool clearOnTest)
|
||||
public bool IsTaintedAt(int xx, int yy, bool clearOnTest)
|
||||
{
|
||||
int tx = xx / Constants.TerrainPatchSize;
|
||||
int ty = yy / Constants.TerrainPatchSize;
|
||||
|
@ -195,41 +160,22 @@ namespace OpenSim.Framework
|
|||
// Old form that clears the taint flag when we check it.
|
||||
// ubit: this dangerus naming should be only check without clear
|
||||
// keeping for old modules outthere
|
||||
public override bool IsTaintedAt(int xx, int yy)
|
||||
public bool IsTaintedAt(int xx, int yy)
|
||||
{
|
||||
return IsTaintedAt(xx, yy, true /* clearOnTest */);
|
||||
}
|
||||
|
||||
// TerrainData.GetDatabaseBlob
|
||||
// The user wants something to store in the database.
|
||||
public override bool GetDatabaseBlob(out int DBRevisionCode, out Array blob)
|
||||
public bool GetDatabaseBlob(out int DBRevisionCode, out Array blob)
|
||||
{
|
||||
bool ret = false;
|
||||
/* save all as Variable2DGzip
|
||||
if (SizeX == Constants.RegionSize && SizeY == Constants.RegionSize)
|
||||
{
|
||||
DBRevisionCode = (int)DBTerrainRevision.Legacy256;
|
||||
blob = ToLegacyTerrainSerialization();
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
*/
|
||||
DBRevisionCode = (int)DBTerrainRevision.Variable2DGzip;
|
||||
// DBRevisionCode = (int)DBTerrainRevision.Variable2D;
|
||||
blob = ToCompressedTerrainSerializationV2DGzip();
|
||||
// blob = ToCompressedTerrainSerializationV2D();
|
||||
ret = true;
|
||||
// }
|
||||
return ret;
|
||||
DBRevisionCode = (int)DBTerrainRevision.Variable2DGzip;
|
||||
blob = ToCompressedTerrainSerializationV2DGzip();
|
||||
return true;
|
||||
}
|
||||
|
||||
// TerrainData.CompressionFactor
|
||||
private float m_compressionFactor = 100.0f;
|
||||
public override float CompressionFactor { get { return m_compressionFactor; } }
|
||||
|
||||
// TerrainData.GetCompressedMap
|
||||
public override float[] GetCompressedMap()
|
||||
public float[] GetCompressedMap()
|
||||
{
|
||||
float[] newMap = new float[SizeX * SizeY];
|
||||
|
||||
|
@ -241,19 +187,18 @@ namespace OpenSim.Framework
|
|||
return newMap;
|
||||
|
||||
}
|
||||
// TerrainData.Clone
|
||||
public override TerrainData Clone()
|
||||
|
||||
public TerrainData Clone()
|
||||
{
|
||||
HeightmapTerrainData ret = new HeightmapTerrainData(SizeX, SizeY, SizeZ);
|
||||
TerrainData ret = new TerrainData(SizeX, SizeY, SizeZ);
|
||||
ret.m_heightmap = (float[,])this.m_heightmap.Clone();
|
||||
return ret;
|
||||
}
|
||||
|
||||
// TerrainData.GetFloatsSerialized
|
||||
// This one dimensional version is ordered so height = map[y*sizeX+x];
|
||||
// DEPRECATED: don't use this function as it does not retain the dimensions of the terrain
|
||||
// and the caller will probably do the wrong thing if the terrain is not the legacy 256x256.
|
||||
public override float[] GetFloatsSerialized()
|
||||
public float[] GetFloatsSerialized()
|
||||
{
|
||||
int points = SizeX * SizeY;
|
||||
float[] heights = new float[points];
|
||||
|
@ -269,7 +214,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
// TerrainData.GetDoubles
|
||||
public override double[,] GetDoubles()
|
||||
public double[,] GetDoubles()
|
||||
{
|
||||
double[,] ret = new double[SizeX, SizeY];
|
||||
for (int xx = 0; xx < SizeX; xx++)
|
||||
|
@ -279,7 +224,7 @@ namespace OpenSim.Framework
|
|||
return ret;
|
||||
}
|
||||
|
||||
public override unsafe void GetPatchMinMax(int px, int py, out float zmin, out float zmax)
|
||||
public unsafe void GetPatchMinMax(int px, int py, out float zmin, out float zmax)
|
||||
{
|
||||
zmax = float.MinValue;
|
||||
zmin = float.MaxValue;
|
||||
|
@ -304,7 +249,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
public override unsafe void GetPatchBlock(float[] _block, int px, int py, float sub, float premult)
|
||||
public unsafe void GetPatchBlock(float[] _block, int px, int py, float sub, float premult)
|
||||
{
|
||||
int k = 0;
|
||||
int stride = m_heightmap.GetLength(1);
|
||||
|
@ -324,13 +269,8 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
// =============================================================
|
||||
|
||||
private float[,] m_heightmap;
|
||||
// Remember subregions of the heightmap that has changed.
|
||||
private bool[,] m_taint;
|
||||
|
||||
// that is coded as the float height times the compression factor (usually '100'
|
||||
/*
|
||||
// that is coded as the float height times the compression factor (usually '100'
|
||||
// to make for two decimal points).
|
||||
public short ToCompressedHeightshort(float pHeight)
|
||||
{
|
||||
|
@ -353,6 +293,7 @@ namespace OpenSim.Framework
|
|||
return ushort.MaxValue;
|
||||
return (ushort)pHeight;
|
||||
}
|
||||
*/
|
||||
|
||||
public float FromCompressedHeight(short pHeight)
|
||||
{
|
||||
|
@ -366,12 +307,12 @@ namespace OpenSim.Framework
|
|||
|
||||
// To keep with the legacy theme, create an instance of this class based on the
|
||||
// way terrain used to be passed around.
|
||||
public HeightmapTerrainData(double[,] pTerrain)
|
||||
public TerrainData(double[,] pTerrain)
|
||||
{
|
||||
SizeX = pTerrain.GetLength(0);
|
||||
SizeY = pTerrain.GetLength(1);
|
||||
SizeZ = (int)Constants.RegionHeight;
|
||||
m_compressionFactor = 100.0f;
|
||||
CompressionFactor = 100.0f;
|
||||
|
||||
m_heightmap = new float[SizeX, SizeY];
|
||||
for (int ii = 0; ii < SizeX; ii++)
|
||||
|
@ -389,12 +330,12 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
// Create underlying structures but don't initialize the heightmap assuming the caller will immediately do that
|
||||
public HeightmapTerrainData(int pX, int pY, int pZ)
|
||||
public TerrainData(int pX, int pY, int pZ)
|
||||
{
|
||||
SizeX = pX;
|
||||
SizeY = pY;
|
||||
SizeZ = pZ;
|
||||
m_compressionFactor = 100.0f;
|
||||
CompressionFactor = 100.0f;
|
||||
m_heightmap = new float[SizeX, SizeY];
|
||||
m_taint = new bool[SizeX / Constants.TerrainPatchSize, SizeY / Constants.TerrainPatchSize];
|
||||
// m_log.DebugFormat("{0} new by dimensions. sizeX={1}, sizeY={2}, sizeZ={3}", LogHeader, SizeX, SizeY, SizeZ);
|
||||
|
@ -402,10 +343,10 @@ namespace OpenSim.Framework
|
|||
ClearLand(0f);
|
||||
}
|
||||
|
||||
public HeightmapTerrainData(float[] cmap, float pCompressionFactor, int pX, int pY, int pZ)
|
||||
public TerrainData(float[] cmap, float pCompressionFactor, int pX, int pY, int pZ)
|
||||
: this(pX, pY, pZ)
|
||||
{
|
||||
m_compressionFactor = pCompressionFactor;
|
||||
CompressionFactor = pCompressionFactor;
|
||||
int ind = 0;
|
||||
for (int xx = 0; xx < SizeX; xx++)
|
||||
for (int yy = 0; yy < SizeY; yy++)
|
||||
|
@ -414,7 +355,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
// Create a heighmap from a database blob
|
||||
public HeightmapTerrainData(int pSizeX, int pSizeY, int pSizeZ, int pFormatCode, byte[] pBlob)
|
||||
public TerrainData(int pSizeX, int pSizeY, int pSizeZ, int pFormatCode, byte[] pBlob)
|
||||
: this(pSizeX, pSizeY, pSizeZ)
|
||||
{
|
||||
switch ((DBTerrainRevision)pFormatCode)
|
||||
|
@ -589,7 +530,7 @@ namespace OpenSim.Framework
|
|||
hmSizeY = br.ReadInt32();
|
||||
hmCompressionFactor = br.ReadInt32();
|
||||
|
||||
m_compressionFactor = hmCompressionFactor;
|
||||
CompressionFactor = hmCompressionFactor;
|
||||
|
||||
// In case database info doesn't match real terrain size, initialize the whole terrain.
|
||||
ClearLand();
|
||||
|
|
|
@ -176,7 +176,7 @@ namespace OpenSim.Framework
|
|||
LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), input);
|
||||
}
|
||||
|
||||
public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc)
|
||||
public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc, bool keepalive = false)
|
||||
{
|
||||
int reqnum = RequestNumber++;
|
||||
|
||||
|
@ -197,7 +197,7 @@ namespace OpenSim.Framework
|
|||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.Method = method;
|
||||
request.Timeout = timeout;
|
||||
request.KeepAlive = false;
|
||||
request.KeepAlive = keepalive;
|
||||
request.MaximumAutomaticRedirections = 10;
|
||||
request.ReadWriteTimeout = timeout / 2;
|
||||
request.Headers[OSHeaderRequestID] = reqnum.ToString();
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Framework.DynamicAttributes.DAExampleModule
|
|||
OSDMap attrs = null;
|
||||
SceneObjectPart sop = m_scene.GetSceneObjectPart(groupId);
|
||||
|
||||
if (sop == null)
|
||||
if (sop == null || sop.DynAttrs == null)
|
||||
return true;
|
||||
|
||||
if (!sop.DynAttrs.TryGetStore(Namespace, StoreName, out attrs))
|
||||
|
|
|
@ -99,6 +99,8 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DOExampleModule
|
|||
private void OnObjectAddedToScene(SceneObjectGroup so)
|
||||
{
|
||||
SceneObjectPart rootPart = so.RootPart;
|
||||
if(rootPart.DynAttrs == null)
|
||||
return;
|
||||
|
||||
OSDMap attrs;
|
||||
|
||||
|
|
|
@ -410,7 +410,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_particleSystem = Utils.EmptyBytes;
|
||||
Rezzed = DateTime.UtcNow;
|
||||
Description = String.Empty;
|
||||
DynAttrs = new DAMap();
|
||||
|
||||
// Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
|
||||
// this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
|
||||
|
@ -3476,6 +3475,28 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
|
||||
private const double TIME_MS_TOLERANCE = 200.0; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
|
||||
|
||||
private Vector3 ClampVectorForTerseUpdate(Vector3 v, float max)
|
||||
{
|
||||
float a, b;
|
||||
|
||||
a = Math.Abs(v.X);
|
||||
b = Math.Abs(v.Y);
|
||||
if (b > a)
|
||||
a = b;
|
||||
b = Math.Abs(v.Z);
|
||||
if (b > a)
|
||||
a = b;
|
||||
|
||||
if (a > max)
|
||||
{
|
||||
a = max / a;
|
||||
v.X *= a;
|
||||
v.Y *= a;
|
||||
v.Z *= a;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tell all the prims which have had updates scheduled
|
||||
/// </summary>
|
||||
|
@ -3491,73 +3512,43 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if(current == PrimUpdateFlags.TerseUpdate)
|
||||
{
|
||||
Vector3 curvel = Velocity;
|
||||
Vector3 curacc = Acceleration;
|
||||
Vector3 angvel = AngularVelocity;
|
||||
|
||||
while(true) // just to avoid ugly goto
|
||||
{
|
||||
double elapsed = now - m_lastUpdateSentTime;
|
||||
if (elapsed > TIME_MS_TOLERANCE)
|
||||
break;
|
||||
|
||||
if( Math.Abs(curacc.X - m_lastAcceleration.X) > VELOCITY_TOLERANCE ||
|
||||
Math.Abs(curacc.Y - m_lastAcceleration.Y) > VELOCITY_TOLERANCE ||
|
||||
Math.Abs(curacc.Z - m_lastAcceleration.Z) > VELOCITY_TOLERANCE)
|
||||
if ( !Acceleration.ApproxEquals(m_lastAcceleration, VELOCITY_TOLERANCE))
|
||||
break;
|
||||
|
||||
if( Math.Abs(curvel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE ||
|
||||
Math.Abs(curvel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE ||
|
||||
Math.Abs(curvel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE)
|
||||
Vector3 curvel = ClampVectorForTerseUpdate(Velocity, 128f);
|
||||
Vector3 tmp = ClampVectorForTerseUpdate(m_lastVelocity, 128f);
|
||||
if (!curvel.ApproxEquals(tmp, VELOCITY_TOLERANCE))
|
||||
break;
|
||||
|
||||
float vx = Math.Abs(curvel.X);
|
||||
if(vx > 128.0)
|
||||
break;
|
||||
float vy = Math.Abs(curvel.Y);
|
||||
if(vy > 128.0)
|
||||
break;
|
||||
float vz = Math.Abs(curvel.Z);
|
||||
if(vz > 128.0)
|
||||
break;
|
||||
|
||||
if(vx < VELOCITY_TOLERANCE && vy < VELOCITY_TOLERANCE && vz < VELOCITY_TOLERANCE
|
||||
)
|
||||
if (Math.Abs(curvel.X) < 1e-4 && Math.Abs(curvel.Y) < 1e-4 && Math.Abs(curvel.Z) < 1e-4)
|
||||
{
|
||||
if(!AbsolutePosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
|
||||
if (!AbsolutePosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
|
||||
break;
|
||||
if(vx < 1e-4 && vy < 1e-4 && vz < 1e-4 &&
|
||||
(
|
||||
Math.Abs(m_lastVelocity.X) > 1e-4 ||
|
||||
if ( Math.Abs(m_lastVelocity.X) > 1e-4 ||
|
||||
Math.Abs(m_lastVelocity.Y) > 1e-4 ||
|
||||
Math.Abs(m_lastVelocity.Z) > 1e-4
|
||||
))
|
||||
break;
|
||||
)
|
||||
break;
|
||||
}
|
||||
|
||||
if( Math.Abs(angvel.X - m_lastAngularVelocity.X) > ANGVELOCITY_TOLERANCE ||
|
||||
Math.Abs(angvel.Y - m_lastAngularVelocity.Y) > ANGVELOCITY_TOLERANCE ||
|
||||
Math.Abs(angvel.Z - m_lastAngularVelocity.Z) > ANGVELOCITY_TOLERANCE)
|
||||
Vector3 angvel = ClampVectorForTerseUpdate(AngularVelocity, 64f);
|
||||
tmp = ClampVectorForTerseUpdate(m_lastAngularVelocity, 64f);
|
||||
if (!angvel.ApproxEquals(tmp, ANGVELOCITY_TOLERANCE))
|
||||
break;
|
||||
|
||||
// viewer interpolators have a limit of 64rad/s
|
||||
float ax = Math.Abs(angvel.X);
|
||||
if(ax > 64.0)
|
||||
break;
|
||||
float ay = Math.Abs(angvel.Y);
|
||||
if(ay > 64.0)
|
||||
break;
|
||||
float az = Math.Abs(angvel.Z);
|
||||
if(az > 64.0)
|
||||
break;
|
||||
|
||||
if (
|
||||
ax < ANGVELOCITY_TOLERANCE &&
|
||||
ay < ANGVELOCITY_TOLERANCE &&
|
||||
az < ANGVELOCITY_TOLERANCE &&
|
||||
if ( Math.Abs(AngularVelocity.X) < 1e-4 &&
|
||||
Math.Abs(AngularVelocity.Y) < 1e-4 &&
|
||||
Math.Abs(AngularVelocity.Z) < 1e-4 &&
|
||||
!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)
|
||||
)
|
||||
break;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Default, not-often-used builder
|
||||
public TerrainChannel()
|
||||
{
|
||||
m_terrainData = new HeightmapTerrainData((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
|
||||
m_terrainData = new TerrainData((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight);
|
||||
FlatLand();
|
||||
// PinHeadIsland();
|
||||
}
|
||||
|
@ -69,14 +69,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Create terrain of given size
|
||||
public TerrainChannel(int pX, int pY)
|
||||
{
|
||||
m_terrainData = new HeightmapTerrainData(pX, pY, (int)Constants.RegionHeight);
|
||||
m_terrainData = new TerrainData(pX, pY, (int)Constants.RegionHeight);
|
||||
}
|
||||
|
||||
// Create terrain of specified size and initialize with specified terrain.
|
||||
// TODO: join this with the terrain initializers.
|
||||
public TerrainChannel(String type, int pX, int pY, int pZ)
|
||||
{
|
||||
m_terrainData = new HeightmapTerrainData(pX, pY, pZ);
|
||||
m_terrainData = new TerrainData(pX, pY, pZ);
|
||||
if (type.Equals("flat"))
|
||||
FlatLand();
|
||||
else
|
||||
|
@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
int hmSizeX = pM.GetLength(0);
|
||||
int hmSizeY = pM.GetLength(1);
|
||||
|
||||
m_terrainData = new HeightmapTerrainData(pSizeX, pSizeY, pAltitude);
|
||||
m_terrainData = new TerrainData(pSizeX, pSizeY, pAltitude);
|
||||
|
||||
for (int xx = 0; xx < pSizeX; xx++)
|
||||
for (int yy = 0; yy < pSizeY; yy++)
|
||||
|
@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
int tmpY = baseY + baseY / 2;
|
||||
int centreX = tmpX / 2;
|
||||
int centreY = tmpY / 2;
|
||||
TerrainData terrain_tmp = new HeightmapTerrainData(tmpX, tmpY, (int)Constants.RegionHeight);
|
||||
TerrainData terrain_tmp = new TerrainData(tmpX, tmpY, (int)Constants.RegionHeight);
|
||||
for (int xx = 0; xx < tmpX; xx++)
|
||||
for (int yy = 0; yy < tmpY; yy++)
|
||||
terrain_tmp[xx, yy] = -65535f; //use this height like an 'alpha' mask channel
|
||||
|
@ -483,7 +483,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
byte[] dataArray = (byte[])serializer.Deserialize(xmlReader);
|
||||
int index = 0;
|
||||
|
||||
m_terrainData = new HeightmapTerrainData(Height, Width, (int)Constants.RegionHeight);
|
||||
m_terrainData = new TerrainData(Height, Width, (int)Constants.RegionHeight);
|
||||
|
||||
for (int y = 0; y < Height; y++)
|
||||
{
|
||||
|
@ -530,7 +530,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(TerrainChannelXMLPackage));
|
||||
TerrainChannelXMLPackage package = (TerrainChannelXMLPackage)serializer.Deserialize(xmlReader);
|
||||
m_terrainData = new HeightmapTerrainData(package.Map, package.CompressionFactor, package.SizeX, package.SizeY, package.SizeZ);
|
||||
m_terrainData = new TerrainData(package.Map, package.CompressionFactor, package.SizeX, package.SizeY, package.SizeZ);
|
||||
}
|
||||
|
||||
// Fill the heightmap with the center bump terrain
|
||||
|
|
|
@ -155,7 +155,6 @@ 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[] map)
|
||||
{
|
||||
|
@ -180,15 +179,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
bitpack.PackBitsFromByte(16);
|
||||
bitpack.PackBitsFromByte(landPacketType);
|
||||
|
||||
tt = 0;
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -736,7 +736,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
|||
get
|
||||
{
|
||||
SceneObjectPart sop = m_scene.GetSceneObjectPart(m_objectID);
|
||||
if (sop == null)
|
||||
if (sop == null || sop.DynAttrs == null)
|
||||
{
|
||||
// This is bad
|
||||
return null;
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
|
||||
texface.RGBA = new Color4(value.R,value.G,value.B,value.A);
|
||||
tex.FaceTextures[m_face] = texface;
|
||||
m_parent.UpdateTextureEntry(tex.GetBytes());
|
||||
m_parent.UpdateTextureEntry(tex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
|
||||
texface.TextureID = value;
|
||||
tex.FaceTextures[m_face] = texface;
|
||||
m_parent.UpdateTextureEntry(tex.GetBytes());
|
||||
m_parent.UpdateTextureEntry(tex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
|
||||
texface.Fullbright = value;
|
||||
tex.FaceTextures[m_face] = texface;
|
||||
m_parent.UpdateTextureEntry(tex.GetBytes());
|
||||
m_parent.UpdateTextureEntry(tex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
|
||||
texface.Glow = (float) value;
|
||||
tex.FaceTextures[m_face] = texface;
|
||||
m_parent.UpdateTextureEntry(tex.GetBytes());
|
||||
m_parent.UpdateTextureEntry(tex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
|
|||
Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face);
|
||||
texface.Shiny = value ? Shininess.High : Shininess.None;
|
||||
tex.FaceTextures[m_face] = texface;
|
||||
m_parent.UpdateTextureEntry(tex.GetBytes());
|
||||
m_parent.UpdateTextureEntry(tex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
|
||||
try
|
||||
{
|
||||
OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false, false);
|
||||
OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 30000, false, false, true);
|
||||
bool success = result["success"].AsBoolean();
|
||||
if (result.ContainsKey("_Result"))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue