Merge branch 'master' of ssh://melanie@opensimulator.org/var/git/opensim
commit
1d47dbb380
|
@ -61,6 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Time = 0,
|
Time = 0,
|
||||||
Distance = 1,
|
Distance = 1,
|
||||||
SimpleAngularDistance = 2,
|
SimpleAngularDistance = 2,
|
||||||
|
FrontBack = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate void SynchronizeSceneHandler(Scene scene);
|
public delegate void SynchronizeSceneHandler(Scene scene);
|
||||||
|
@ -540,6 +541,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
case "simpleangulardistance":
|
case "simpleangulardistance":
|
||||||
m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance;
|
m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance;
|
||||||
break;
|
break;
|
||||||
|
case "frontback":
|
||||||
|
m_update_prioritization_scheme = UpdatePrioritizationSchemes.FrontBack;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time");
|
m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time");
|
||||||
m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
|
m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
|
||||||
|
|
|
@ -494,7 +494,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public Vector3 GroupScale()
|
public Vector3 GroupScale()
|
||||||
{
|
{
|
||||||
Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
|
Vector3 minScale = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionSize);
|
||||||
Vector3 maxScale = new Vector3(0f,0f,0f);
|
Vector3 maxScale = Vector3.Zero;
|
||||||
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
|
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
|
||||||
|
|
||||||
lock (m_parts)
|
lock (m_parts)
|
||||||
|
@ -577,7 +577,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in m_parts.Values)
|
foreach (SceneObjectPart part in m_parts.Values)
|
||||||
{
|
{
|
||||||
|
|
||||||
Vector3 worldPos = part.GetWorldPosition();
|
Vector3 worldPos = part.GetWorldPosition();
|
||||||
Vector3 offset = worldPos - AbsolutePosition;
|
Vector3 offset = worldPos - AbsolutePosition;
|
||||||
Quaternion worldRot;
|
Quaternion worldRot;
|
||||||
|
@ -3366,6 +3365,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return GetPriorityByDistance(client);
|
return GetPriorityByDistance(client);
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
||||||
return GetPriorityBySimpleAngularDistance(client);
|
return GetPriorityBySimpleAngularDistance(client);
|
||||||
|
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
||||||
|
return GetPriorityByFrontBack(client);
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
||||||
}
|
}
|
||||||
|
@ -3398,6 +3399,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return double.NaN;
|
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)
|
public double GetPriorityByDistance(Vector3 position)
|
||||||
{
|
{
|
||||||
return Vector3.Distance(AbsolutePosition, position);
|
return Vector3.Distance(AbsolutePosition, position);
|
||||||
|
@ -3427,5 +3438,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
else
|
else
|
||||||
return double.MinValue;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,6 +297,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); }
|
get { return Util.Axes2Rot(m_CameraAtAxis, m_CameraLeftAxis, m_CameraUpAxis); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector3 CameraAtAxis
|
||||||
|
{
|
||||||
|
get { return m_CameraAtAxis; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 CameraLeftAxis
|
||||||
|
{
|
||||||
|
get { return m_CameraLeftAxis; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 CameraUpAxis
|
||||||
|
{
|
||||||
|
get { return m_CameraUpAxis; }
|
||||||
|
}
|
||||||
|
|
||||||
public Vector3 Lookat
|
public Vector3 Lookat
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -3867,6 +3882,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return GetPriorityByDistance(client);
|
return GetPriorityByDistance(client);
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
||||||
return GetPriorityByDistance(client);
|
return GetPriorityByDistance(client);
|
||||||
|
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
||||||
|
return GetPriorityByFrontBack(client);
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
|
throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
|
||||||
}
|
}
|
||||||
|
@ -3888,11 +3905,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return double.NaN;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
private double GetPriorityByDistance(Vector3 position)
|
private double GetPriorityByDistance(Vector3 position)
|
||||||
{
|
{
|
||||||
return Vector3.Distance(AbsolutePosition, position);
|
return Vector3.Distance(AbsolutePosition, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double GetPriorityByFrontBack(Vector3 camPosition, Vector3 camAtAxis)
|
||||||
|
{
|
||||||
|
// Distance
|
||||||
|
double priority = Vector3.Distance(camPosition, AbsolutePosition);
|
||||||
|
|
||||||
|
// Plane equation
|
||||||
|
float d = -Vector3.Dot(camPosition, camAtAxis);
|
||||||
|
float p = Vector3.Dot(camAtAxis, AbsolutePosition) + d;
|
||||||
|
if (p < 0.0f) priority *= 2.0f;
|
||||||
|
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
private double GetSOGUpdatePriority(SceneObjectGroup sog)
|
private double GetSOGUpdatePriority(SceneObjectGroup sog)
|
||||||
{
|
{
|
||||||
switch (Scene.UpdatePrioritizationScheme)
|
switch (Scene.UpdatePrioritizationScheme)
|
||||||
|
@ -3903,6 +3943,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return sog.GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
return sog.GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
||||||
return sog.GetPriorityBySimpleAngularDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
return sog.GetPriorityBySimpleAngularDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
||||||
|
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
||||||
|
return sog.GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
||||||
}
|
}
|
||||||
|
@ -3929,6 +3971,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
case Scene.UpdatePrioritizationSchemes.Distance:
|
case Scene.UpdatePrioritizationSchemes.Distance:
|
||||||
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
case Scene.UpdatePrioritizationSchemes.SimpleAngularDistance:
|
||||||
return GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
return GetPriorityByDistance((IsChildAgent) ? AbsolutePosition : CameraPosition);
|
||||||
|
case Scenes.Scene.UpdatePrioritizationSchemes.FrontBack:
|
||||||
|
return GetPriorityByFrontBack(CameraPosition, CameraAtAxis);
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
throw new InvalidOperationException("UpdatePrioritizationScheme not defined");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1397,8 +1397,8 @@
|
||||||
|
|
||||||
[InterestManagement]
|
[InterestManagement]
|
||||||
; This section controls how state updates are prioritized for each client
|
; This section controls how state updates are prioritized for each client
|
||||||
; Valid values are Time, Distance, and SimpleAngularDistance
|
; Valid values are Time, Distance, SimpleAngularDistance, and FrontBack
|
||||||
UpdatePrioritizationScheme = Distance;
|
UpdatePrioritizationScheme = FrontBack;
|
||||||
ReprioritizationEnabled = true;
|
ReprioritizationEnabled = true;
|
||||||
ReprioritizationInterval = 2000.0;
|
ReprioritizationInterval = 2000.0;
|
||||||
RootReprioritizationDistance = 10.0;
|
RootReprioritizationDistance = 10.0;
|
||||||
|
|
Loading…
Reference in New Issue