a few more changes on entities updates
parent
9dbcb4e5f6
commit
f8cdccc167
|
@ -6256,20 +6256,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <param name='x'></param>
|
/// <param name='x'></param>
|
||||||
private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
|
private bool CheckAgentCameraUpdateSignificance(AgentUpdatePacket.AgentDataBlock x)
|
||||||
{
|
{
|
||||||
float vdelta = Vector3.Distance(x.CameraAtAxis, m_thisAgentUpdateArgs.CameraAtAxis);
|
if(Math.Abs(x.CameraCenter.X - m_thisAgentUpdateArgs.CameraCenter.X) > VDELTA ||
|
||||||
if((vdelta > VDELTA))
|
Math.Abs(x.CameraCenter.Y - m_thisAgentUpdateArgs.CameraCenter.Y) > VDELTA ||
|
||||||
return true;
|
Math.Abs(x.CameraCenter.Z - m_thisAgentUpdateArgs.CameraCenter.Z) > VDELTA ||
|
||||||
|
|
||||||
vdelta = Vector3.Distance(x.CameraCenter, m_thisAgentUpdateArgs.CameraCenter);
|
Math.Abs(x.CameraAtAxis.X - m_thisAgentUpdateArgs.CameraAtAxis.X) > VDELTA ||
|
||||||
if((vdelta > VDELTA))
|
Math.Abs(x.CameraAtAxis.Y - m_thisAgentUpdateArgs.CameraAtAxis.Y) > VDELTA ||
|
||||||
return true;
|
// Math.Abs(x.CameraAtAxis.Z - m_thisAgentUpdateArgs.CameraAtAxis.Z) > VDELTA ||
|
||||||
|
|
||||||
vdelta = Vector3.Distance(x.CameraLeftAxis, m_thisAgentUpdateArgs.CameraLeftAxis);
|
Math.Abs(x.CameraLeftAxis.X - m_thisAgentUpdateArgs.CameraLeftAxis.X) > VDELTA ||
|
||||||
if((vdelta > VDELTA))
|
Math.Abs(x.CameraLeftAxis.Y - m_thisAgentUpdateArgs.CameraLeftAxis.Y) > VDELTA ||
|
||||||
return true;
|
// Math.Abs(x.CameraLeftAxis.Z - m_thisAgentUpdateArgs.CameraLeftAxis.Z) > VDELTA ||
|
||||||
|
|
||||||
vdelta = Vector3.Distance(x.CameraUpAxis, m_thisAgentUpdateArgs.CameraUpAxis);
|
Math.Abs(x.CameraUpAxis.X - m_thisAgentUpdateArgs.CameraUpAxis.X) > VDELTA ||
|
||||||
if((vdelta > VDELTA))
|
Math.Abs(x.CameraUpAxis.Y - m_thisAgentUpdateArgs.CameraUpAxis.Y) > VDELTA
|
||||||
|
// Math.Abs(x.CameraLeftAxis.Z - m_thisAgentUpdateArgs.CameraLeftAxis.Z) > VDELTA ||
|
||||||
|
)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -3237,7 +3237,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Schedule a terse update for this prim. Terse updates only send position,
|
/// Schedule a terse update for this prim. Terse updates only send position,
|
||||||
/// rotation, velocity and rotational velocity information.
|
/// rotation, velocity and rotational velocity information. WRONG!!!!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ScheduleTerseUpdate()
|
public void ScheduleTerseUpdate()
|
||||||
{
|
{
|
||||||
|
@ -3296,21 +3296,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
sp.SendAttachmentUpdate(this, UpdateRequired.FULL);
|
sp.SendAttachmentUpdate(this, UpdateRequired.FULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this does nothing
|
|
||||||
SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
|
||||||
if (IsRoot)
|
|
||||||
{
|
|
||||||
if (ParentGroup.IsAttachment)
|
|
||||||
{
|
|
||||||
SendFullUpdateToClient(remoteClient, AttachedPos);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SendFullUpdateToClient(remoteClient, AbsolutePosition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SendFullUpdateToClient(remoteClient);
|
SendFullUpdateToClient(remoteClient);
|
||||||
|
@ -3396,24 +3381,26 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
ParentGroup.Scene.StatsReporter.AddObjectUpdates(1);
|
ParentGroup.Scene.StatsReporter.AddObjectUpdates(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private const float ROTATION_TOLERANCE = 0.01f;
|
||||||
|
private const float VELOCITY_TOLERANCE = 0.1f; // terse update vel has low resolution
|
||||||
|
private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
|
||||||
|
private const double TIME_MS_TOLERANCE = 200f; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tell all the prims which have had updates scheduled
|
/// Tell all the prims which have had updates scheduled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendScheduledUpdates()
|
public void SendScheduledUpdates()
|
||||||
{
|
{
|
||||||
const float ROTATION_TOLERANCE = 0.01f;
|
|
||||||
const float VELOCITY_TOLERANCE = 0.1f; // terse update vel has low resolution
|
|
||||||
const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary
|
|
||||||
const double TIME_MS_TOLERANCE = 200f; //llSetPos has a 200ms delay. This should NOT be 3 seconds.
|
|
||||||
|
|
||||||
switch (UpdateFlag)
|
switch (UpdateFlag)
|
||||||
{
|
{
|
||||||
// this is wrong we need to get back to this
|
case UpdateRequired.NONE:
|
||||||
case UpdateRequired.TERSE:
|
|
||||||
{
|
|
||||||
ClearUpdateSchedule();
|
ClearUpdateSchedule();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case UpdateRequired.TERSE:
|
||||||
|
|
||||||
|
ClearUpdateSchedule();
|
||||||
bool needupdate = true;
|
bool needupdate = true;
|
||||||
double now = Util.GetTimeStampMS();
|
double now = Util.GetTimeStampMS();
|
||||||
Vector3 curvel = Velocity;
|
Vector3 curvel = Velocity;
|
||||||
|
@ -3423,8 +3410,6 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
while(true) // just to avoid ugly goto
|
while(true) // just to avoid ugly goto
|
||||||
{
|
{
|
||||||
double elapsed = now - m_lastUpdateSentTime;
|
double elapsed = now - m_lastUpdateSentTime;
|
||||||
|
|
||||||
// minimal rate also for the other things on terse updates
|
|
||||||
if (elapsed > TIME_MS_TOLERANCE)
|
if (elapsed > TIME_MS_TOLERANCE)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3514,13 +3499,11 @@ SendFullUpdateToClient(remoteClient, Position) ignores position parameter
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case UpdateRequired.FULL:
|
case UpdateRequired.FULL:
|
||||||
{
|
|
||||||
ClearUpdateSchedule();
|
ClearUpdateSchedule();
|
||||||
SendFullUpdateToAllClientsInternal();
|
SendFullUpdateToAllClientsInternal();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -279,8 +279,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private bool MouseDown = false;
|
private bool MouseDown = false;
|
||||||
public Vector3 lastKnownAllowedPosition;
|
public Vector3 lastKnownAllowedPosition;
|
||||||
public bool sentMessageAboutRestrictedParcelFlyingDown;
|
public bool sentMessageAboutRestrictedParcelFlyingDown;
|
||||||
|
|
||||||
public Vector4 CollisionPlane = Vector4.UnitW;
|
public Vector4 CollisionPlane = Vector4.UnitW;
|
||||||
|
|
||||||
|
public Vector4 m_lastCollisionPlane = Vector4.UnitW;
|
||||||
|
private byte m_lastState;
|
||||||
private Vector3 m_lastPosition;
|
private Vector3 m_lastPosition;
|
||||||
private Quaternion m_lastRotation;
|
private Quaternion m_lastRotation;
|
||||||
private Vector3 m_lastVelocity;
|
private Vector3 m_lastVelocity;
|
||||||
|
@ -2818,16 +2821,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
CameraAtAxis = agentData.CameraAtAxis;
|
CameraAtAxis = agentData.CameraAtAxis;
|
||||||
CameraLeftAxis = agentData.CameraLeftAxis;
|
CameraLeftAxis = agentData.CameraLeftAxis;
|
||||||
CameraUpAxis = agentData.CameraUpAxis;
|
CameraUpAxis = agentData.CameraUpAxis;
|
||||||
Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis);
|
|
||||||
CameraRotation = camRot;
|
|
||||||
|
|
||||||
// The Agent's Draw distance setting
|
|
||||||
// When we get to the point of re-computing neighbors everytime this
|
|
||||||
// changes, then start using the agent's drawdistance rather than the
|
|
||||||
// region's draw distance.
|
|
||||||
|
|
||||||
DrawDistance = agentData.Far;
|
DrawDistance = agentData.Far;
|
||||||
|
|
||||||
|
CameraAtAxis.Normalize();
|
||||||
|
CameraLeftAxis.Normalize();
|
||||||
|
CameraUpAxis.Normalize();
|
||||||
|
Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis);
|
||||||
|
CameraRotation = camRot;
|
||||||
|
|
||||||
// Check if Client has camera in 'follow cam' or 'build' mode.
|
// Check if Client has camera in 'follow cam' or 'build' mode.
|
||||||
// Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
|
// Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
|
||||||
|
@ -3794,15 +3794,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// this does need to be more complex later
|
// this does need to be more complex later
|
||||||
Vector3 vel = Velocity;
|
Vector3 vel = Velocity;
|
||||||
Vector3 dpos = m_pos - m_lastPosition;
|
Vector3 dpos = m_pos - m_lastPosition;
|
||||||
if( Math.Abs(vel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE ||
|
if( State != m_lastState ||
|
||||||
|
Math.Abs(vel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE ||
|
||||||
Math.Abs(vel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE ||
|
Math.Abs(vel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE ||
|
||||||
Math.Abs(vel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE ||
|
Math.Abs(vel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE ||
|
||||||
|
|
||||||
Math.Abs(m_bodyRot.X - m_lastRotation.X) > ROTATION_TOLERANCE ||
|
Math.Abs(m_bodyRot.X - m_lastRotation.X) > ROTATION_TOLERANCE ||
|
||||||
Math.Abs(m_bodyRot.Y - m_lastRotation.Y) > ROTATION_TOLERANCE ||
|
Math.Abs(m_bodyRot.Y - m_lastRotation.Y) > ROTATION_TOLERANCE ||
|
||||||
Math.Abs(m_bodyRot.Z - m_lastRotation.Z) > ROTATION_TOLERANCE ||
|
Math.Abs(m_bodyRot.Z - m_lastRotation.Z) > ROTATION_TOLERANCE ||
|
||||||
|
|
||||||
(vel == Vector3.Zero && m_lastVelocity != Vector3.Zero) ||
|
(vel == Vector3.Zero && m_lastVelocity != Vector3.Zero) ||
|
||||||
|
|
||||||
Math.Abs(dpos.X) > POSITION_LARGETOLERANCE ||
|
Math.Abs(dpos.X) > POSITION_LARGETOLERANCE ||
|
||||||
Math.Abs(dpos.Y) > POSITION_LARGETOLERANCE ||
|
Math.Abs(dpos.Y) > POSITION_LARGETOLERANCE ||
|
||||||
Math.Abs(dpos.Z) > POSITION_LARGETOLERANCE ||
|
Math.Abs(dpos.Z) > POSITION_LARGETOLERANCE ||
|
||||||
|
@ -3811,7 +3813,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Math.Abs(dpos.Y) > POSITION_SMALLTOLERANCE ||
|
Math.Abs(dpos.Y) > POSITION_SMALLTOLERANCE ||
|
||||||
Math.Abs(dpos.Z) > POSITION_SMALLTOLERANCE)
|
Math.Abs(dpos.Z) > POSITION_SMALLTOLERANCE)
|
||||||
&& vel.LengthSquared() < LOWVELOCITYSQ
|
&& vel.LengthSquared() < LOWVELOCITYSQ
|
||||||
))
|
) ||
|
||||||
|
|
||||||
|
Math.Abs(CollisionPlane.X - m_lastCollisionPlane.X) > POSITION_SMALLTOLERANCE ||
|
||||||
|
Math.Abs(CollisionPlane.Y - m_lastCollisionPlane.Y) > POSITION_SMALLTOLERANCE ||
|
||||||
|
Math.Abs(CollisionPlane.W - m_lastCollisionPlane.W) > POSITION_SMALLTOLERANCE
|
||||||
|
)
|
||||||
{
|
{
|
||||||
SendTerseUpdateToAllClients();
|
SendTerseUpdateToAllClients();
|
||||||
}
|
}
|
||||||
|
@ -3910,11 +3917,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendTerseUpdateToAllClients()
|
public void SendTerseUpdateToAllClients()
|
||||||
{
|
{
|
||||||
m_scene.ForEachScenePresence(SendTerseUpdateToAgent);
|
m_lastState = State;
|
||||||
// Update the "last" values
|
|
||||||
m_lastPosition = m_pos;
|
m_lastPosition = m_pos;
|
||||||
m_lastRotation = m_bodyRot;
|
m_lastRotation = m_bodyRot;
|
||||||
m_lastVelocity = Velocity;
|
m_lastVelocity = Velocity;
|
||||||
|
m_lastCollisionPlane = CollisionPlane;
|
||||||
|
|
||||||
|
m_scene.ForEachScenePresence(SendTerseUpdateToAgent);
|
||||||
|
// Update the "last" values
|
||||||
TriggerScenePresenceUpdated();
|
TriggerScenePresenceUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue