mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Merge branch 'master' into bigmerge
Conflicts: OpenSim/Region/Framework/Scenes/SceneGraph.cs OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs OpenSim/Region/Framework/Scenes/SceneObjectPart.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
This commit is contained in:
@@ -107,6 +107,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SCULPT = 7
|
||||
}
|
||||
|
||||
public enum UpdateRequired : byte
|
||||
{
|
||||
NONE = 0,
|
||||
TERSE = 1,
|
||||
FULL = 2
|
||||
}
|
||||
|
||||
#endregion Enumerations
|
||||
|
||||
public class SceneObjectPart : IScriptHost, ISceneEntity
|
||||
@@ -265,15 +272,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
private bool m_passTouches;
|
||||
|
||||
/// <summary>
|
||||
/// Only used internally to schedule client updates.
|
||||
/// 0 - no update is scheduled
|
||||
/// 1 - terse update scheduled
|
||||
/// 2 - full update scheduled
|
||||
///
|
||||
/// TODO - This should be an enumeration
|
||||
/// </summary>
|
||||
private byte m_updateFlag;
|
||||
private UpdateRequired m_updateFlag;
|
||||
|
||||
private PhysicsActor m_physActor;
|
||||
protected Vector3 m_acceleration;
|
||||
@@ -908,7 +907,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary></summary>
|
||||
/// <summary>Update angular velocity and schedule terse update.</summary>
|
||||
public void UpdateAngularVelocity(Vector3 avel)
|
||||
{
|
||||
AngularVelocity = avel;
|
||||
ScheduleTerseUpdate();
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
}
|
||||
|
||||
/// <summary>Get or set angular velocity. Does not schedule update.</summary>
|
||||
public Vector3 AngularVelocity
|
||||
{
|
||||
get
|
||||
@@ -1056,8 +1063,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
TriggerScriptChangedEvent(Changed.SCALE);
|
||||
}
|
||||
}
|
||||
|
||||
public byte UpdateFlag
|
||||
|
||||
public UpdateRequired UpdateFlag
|
||||
{
|
||||
get { return m_updateFlag; }
|
||||
set { m_updateFlag = value; }
|
||||
@@ -1362,9 +1369,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
/// <summary>
|
||||
/// Clear all pending updates of parts to clients
|
||||
/// </summary>
|
||||
private void ClearUpdateSchedule()
|
||||
public void ClearUpdateSchedule()
|
||||
{
|
||||
m_updateFlag = 0;
|
||||
UpdateFlag = UpdateRequired.NONE;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2884,7 +2891,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
TimeStampFull = (uint)timeNow;
|
||||
}
|
||||
|
||||
m_updateFlag = 2;
|
||||
UpdateFlag = UpdateRequired.FULL;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}",
|
||||
@@ -2900,13 +2907,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (m_parentGroup == null)
|
||||
return;
|
||||
|
||||
if (m_updateFlag < 1)
|
||||
if (UpdateFlag == UpdateRequired.NONE)
|
||||
{
|
||||
m_parentGroup.HasGroupChanged = true;
|
||||
m_parentGroup.QueueForUpdateCheck();
|
||||
|
||||
TimeStampTerse = (uint) Util.UnixTimeSinceEpoch();
|
||||
m_updateFlag = 1;
|
||||
UpdateFlag = UpdateRequired.TERSE;
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1} at {2}",
|
||||
@@ -3073,48 +3080,40 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
|
||||
const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
|
||||
|
||||
if (m_updateFlag == 1)
|
||||
switch (UpdateFlag)
|
||||
{
|
||||
// Throw away duplicate or insignificant updates
|
||||
if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
|
||||
!Acceleration.Equals(m_lastAcceleration) ||
|
||||
!Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
|
||||
Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) ||
|
||||
!AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) ||
|
||||
!OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
|
||||
Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
|
||||
case UpdateRequired.TERSE:
|
||||
{
|
||||
AddTerseUpdateToAllAvatars();
|
||||
|
||||
// Throw away duplicate or insignificant updates
|
||||
if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
|
||||
!Acceleration.Equals(m_lastAcceleration) ||
|
||||
!Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
|
||||
Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) ||
|
||||
!AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) ||
|
||||
!OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
|
||||
Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
|
||||
{
|
||||
AddTerseUpdateToAllAvatars();
|
||||
ClearUpdateSchedule();
|
||||
|
||||
// This causes the Scene to 'poll' physical objects every couple of frames
|
||||
// bad, so it's been replaced by an event driven method.
|
||||
//if ((ObjectFlags & (uint)PrimFlags.Physics) != 0)
|
||||
//{
|
||||
// Only send the constant terse updates on physical objects!
|
||||
//ScheduleTerseUpdate();
|
||||
//}
|
||||
|
||||
// Update the "last" values
|
||||
m_lastPosition = OffsetPosition;
|
||||
m_lastRotation = RotationOffset;
|
||||
m_lastVelocity = Velocity;
|
||||
m_lastAcceleration = Acceleration;
|
||||
m_lastAngularVelocity = AngularVelocity;
|
||||
m_lastTerseSent = Environment.TickCount;
|
||||
// Update the "last" values
|
||||
m_lastPosition = OffsetPosition;
|
||||
m_lastRotation = RotationOffset;
|
||||
m_lastVelocity = Velocity;
|
||||
m_lastAcceleration = Acceleration;
|
||||
m_lastAngularVelocity = AngularVelocity;
|
||||
m_lastTerseSent = Environment.TickCount;
|
||||
}
|
||||
break;
|
||||
}
|
||||
//Moved this outside of the if clause so updates don't get blocked.. *sigh*
|
||||
m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams*
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes
|
||||
case UpdateRequired.FULL:
|
||||
{
|
||||
AddFullUpdateToAllAvatars();
|
||||
m_updateFlag = 0; //Same here
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_updateFlag = 0;
|
||||
|
||||
ClearUpdateSchedule();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -3492,7 +3491,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
_groupID = groupID;
|
||||
if (client != null)
|
||||
SendPropertiesToClient(client);
|
||||
m_updateFlag = 2;
|
||||
UpdateFlag = UpdateRequired.FULL;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -4699,7 +4698,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
m_shape.TextureEntry = textureEntry;
|
||||
TriggerScriptChangedEvent(Changed.TEXTURE);
|
||||
m_updateFlag = 1;
|
||||
UpdateFlag = UpdateRequired.FULL;
|
||||
ParentGroup.HasGroupChanged = true;
|
||||
|
||||
//This is madness..
|
||||
|
||||
Reference in New Issue
Block a user