mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 10:46:00 +08:00
Merge branch 'master' into careminster-presence-refactor
This commit is contained in:
@@ -3841,107 +3841,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
SetFromItemID(uuid);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public double GetUpdatePriority(IClientAPI client)
|
||||
{
|
||||
switch (Scene.UpdatePrioritizationScheme)
|
||||
{
|
||||
case Scene.UpdatePrioritizationSchemes.Time:
|
||||
return GetPriorityByTime();
|
||||
case Scene.UpdatePrioritizationSchemes.Distance:
|
||||
return GetPriorityByDistance(client);
|
||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
||||
return GetPriorityBySimpleAngularDistance(client);
|
||||
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
||||
return GetPriorityByFrontBack(client);
|
||||
default:
|
||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
||||
}
|
||||
}
|
||||
|
||||
private double GetPriorityByTime()
|
||||
{
|
||||
return DateTime.Now.ToOADate();
|
||||
}
|
||||
|
||||
private double GetPriorityByDistance(IClientAPI client)
|
||||
{
|
||||
ScenePresence presence = Scene.GetScenePresence(client.AgentId);
|
||||
if (presence != null)
|
||||
{
|
||||
return GetPriorityByDistance((presence.IsChildAgent) ?
|
||||
presence.AbsolutePosition : presence.CameraPosition);
|
||||
}
|
||||
return double.NaN;
|
||||
}
|
||||
|
||||
private double GetPriorityBySimpleAngularDistance(IClientAPI client)
|
||||
{
|
||||
ScenePresence presence = Scene.GetScenePresence(client.AgentId);
|
||||
if (presence != null)
|
||||
{
|
||||
return GetPriorityBySimpleAngularDistance((presence.IsChildAgent) ?
|
||||
presence.AbsolutePosition : presence.CameraPosition);
|
||||
}
|
||||
return double.NaN;
|
||||
}
|
||||
|
||||
private double GetPriorityByFrontBack(IClientAPI client)
|
||||
{
|
||||
ScenePresence presence = Scene.GetScenePresence(client.AgentId);
|
||||
if (presence != null)
|
||||
{
|
||||
return GetPriorityByFrontBack(presence.CameraPosition, presence.CameraAtAxis);
|
||||
}
|
||||
return double.NaN;
|
||||
}
|
||||
|
||||
public double GetPriorityByDistance(Vector3 position)
|
||||
{
|
||||
return Vector3.Distance(AbsolutePosition, position);
|
||||
}
|
||||
|
||||
public double GetPriorityBySimpleAngularDistance(Vector3 position)
|
||||
{
|
||||
double distance = Vector3.Distance(position, AbsolutePosition);
|
||||
if (distance >= double.Epsilon)
|
||||
{
|
||||
float height;
|
||||
Vector3 box = GetAxisAlignedBoundingBox(out height);
|
||||
|
||||
double angle = box.X / distance;
|
||||
double max = angle;
|
||||
|
||||
angle = box.Y / distance;
|
||||
if (max < angle)
|
||||
max = angle;
|
||||
|
||||
angle = box.Z / distance;
|
||||
if (max < angle)
|
||||
max = angle;
|
||||
|
||||
return -max;
|
||||
}
|
||||
else
|
||||
return double.MinValue;
|
||||
}
|
||||
|
||||
public double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
|
||||
{
|
||||
// Distance
|
||||
double priority = Vector3.Distance(camPosition, AbsolutePosition);
|
||||
|
||||
// Scale
|
||||
//priority -= GroupScale().Length();
|
||||
|
||||
// Plane equation
|
||||
float d = -Vector3.Dot(camPosition, camAtAxis);
|
||||
float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
|
||||
if (p < 0.0f) priority *= 2.0f;
|
||||
|
||||
return priority;
|
||||
}
|
||||
|
||||
public void ResetOwnerChangeFlag()
|
||||
{
|
||||
@@ -3950,5 +3849,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
part.ResetOwnerChangeFlag();
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user