Object update prioritization by Jim Greensky of Intel Labs, part one. This implements a simple distance prioritizer based on initial agent positions. Re-prioritizing and more advanced priority algorithms will follow soon

prioritization
John Hurliman 2009-10-15 16:35:27 -07:00
parent df2d5a460f
commit 4b75353cbf
20 changed files with 573 additions and 402 deletions

View File

@ -996,19 +996,19 @@ namespace OpenSim.Client.MXP.ClientStack
// Need to translate to MXP somehow
}
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID, uint avatarLocalID, Vector3 position, byte[] textureEntry, uint parentID, Quaternion rotation)
public void SendAvatarData(SendAvatarData data)
{
//ScenePresence presence=((Scene)this.Scene).GetScenePresence(avatarID);
UUID ownerID = avatarID;
MXPSendAvatarData(firstName + " " + lastName, ownerID, UUID.Zero, avatarID, avatarLocalID, position, rotation);
UUID ownerID = data.avatarID;
MXPSendAvatarData(data.firstName + " " + data.lastName, ownerID, UUID.Zero, data.avatarID, data.avatarLocalID, data.Pos, data.rotation);
}
public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Vector3 velocity, Quaternion rotation, UUID uuid)
public void SendAvatarTerseUpdate(SendAvatarTerseData data)
{
MovementEventMessage me = new MovementEventMessage();
me.ObjectIndex = localID;
me.Location =ToOmVector(position);
me.Orientation = ToOmQuaternion(rotation);
me.ObjectIndex = data.localID;
me.Location = ToOmVector(data.position);
me.Orientation = ToOmQuaternion(data.rotation);
Session.Send(me);
}
@ -1028,22 +1028,17 @@ namespace OpenSim.Client.MXP.ClientStack
// Need to translate to MXP somehow
}
public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim, bool attachment, uint AttachPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius)
public void SendPrimitiveToClient(SendPrimitiveData data)
{
MXPSendPrimitive(localID, ownerID, acc, rvel, primShape, pos, objectID, vel, rotation, flags,text,color,parentID,particleSystem,clickAction,material,textureanim);
MXPSendPrimitive(data.localID, data.ownerID, data.acc, data.rvel, data.primShape, data.pos, data.objectID, data.vel, data.rotation, data.flags, data.text, data.color, data.parentID, data.particleSystem, data.clickAction, data.material, data.textureanim);
}
public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material)
{
MXPSendPrimitive(localID, ownerID, acc, rvel, primShape, pos, objectID, vel, rotation, flags, text, color, parentID, particleSystem, clickAction, material, new byte[0]);
}
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId, UUID owner, int attachPoint)
public void SendPrimTerseUpdate(SendPrimitiveTerseData data)
{
MovementEventMessage me = new MovementEventMessage();
me.ObjectIndex = localID;
me.Location = ToOmVector(position);
me.Orientation = ToOmQuaternion(rotation);
me.ObjectIndex = data.localID;
me.Location = ToOmVector(data.position);
me.Orientation = ToOmQuaternion(data.rotation);
Session.Send(me);
}

View File

@ -560,12 +560,12 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
throw new System.NotImplementedException();
}
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID, uint avatarLocalID, Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation)
public void SendAvatarData(SendAvatarData data)
{
throw new System.NotImplementedException();
}
public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Vector3 velocity, Quaternion rotation, UUID uuid)
public void SendAvatarTerseUpdate(SendAvatarTerseData data)
{
throw new System.NotImplementedException();
}
@ -585,17 +585,12 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
throw new System.NotImplementedException();
}
public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim, bool attachment, uint AttachPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius)
public void SendPrimitiveToClient(SendPrimitiveData data)
{
throw new System.NotImplementedException();
}
public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material)
{
throw new System.NotImplementedException();
}
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId, UUID owner, int attachPoint)
public void SendPrimTerseUpdate(SendPrimitiveTerseData data)
{
throw new System.NotImplementedException();
}

View File

@ -517,6 +517,233 @@ namespace OpenSim.Framework
public float dwell;
}
public struct SendAvatarData
{
private ulong m_regionHandle;
private string m_firstName;
private string m_lastName;
private string m_grouptitle;
private UUID m_avatarID;
private uint m_avatarLocalID;
private Vector3 m_Pos;
private byte[] m_textureEntry;
private uint m_parentID;
private Quaternion m_rotation;
public SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID,
uint avatarLocalID,
Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation)
{
this.m_regionHandle = regionHandle;
this.m_firstName = firstName;
this.m_lastName = lastName;
this.m_grouptitle = grouptitle;
this.m_avatarID = avatarID;
this.m_avatarLocalID = avatarLocalID;
this.m_Pos = Pos;
this.m_textureEntry = textureEntry;
this.m_parentID = parentID;
this.m_rotation = rotation;
}
public ulong regionHandle { get { return this.m_regionHandle; } }
public string firstName { get { return this.m_firstName; } }
public string lastName { get { return this.m_lastName; } }
public string grouptitle { get { return this.m_grouptitle; } }
public UUID avatarID { get { return this.m_avatarID; } }
public uint avatarLocalID { get { return this.m_avatarLocalID; } }
public Vector3 Pos { get { return this.m_Pos; } }
public byte[] textureEntry { get { return this.m_textureEntry; } }
public uint parentID { get { return this.m_parentID; } }
public Quaternion rotation { get { return this.m_rotation; } }
}
public struct SendAvatarTerseData
{
private ulong m_regionHandle;
private ushort m_timeDilation;
private uint m_localID;
private Vector3 m_position;
private Vector3 m_velocity;
private Quaternion m_rotation;
private UUID m_agentid;
private double m_priority;
public SendAvatarTerseData(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
Vector3 velocity, Quaternion rotation, UUID agentid, double priority)
{
this.m_regionHandle = regionHandle;
this.m_timeDilation = timeDilation;
this.m_localID = localID;
this.m_position = position;
this.m_velocity = velocity;
this.m_rotation = rotation;
this.m_agentid = agentid;
this.m_priority = priority;
}
public ulong regionHandle { get { return this.m_regionHandle; } }
public ushort timeDilation { get { return this.m_timeDilation; } }
public uint localID { get { return this.m_localID; } }
public Vector3 position { get { return this.m_position; } }
public Vector3 velocity { get { return this.m_velocity; } }
public Quaternion rotation { get { return this.m_rotation; } }
public UUID agentid { get { return this.m_agentid; } }
public double priority { get { return this.m_priority; } }
}
public struct SendPrimitiveTerseData
{
private ulong m_regionHandle;
private ushort m_timeDilation;
private uint m_localID;
private Vector3 m_position;
private Quaternion m_rotation;
private Vector3 m_velocity;
private Vector3 m_rotationalvelocity;
private byte m_state;
private UUID m_AssetId;
private UUID m_owner;
private int m_attachPoint;
private double m_priority;
public SendPrimitiveTerseData(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state,
UUID AssetId, UUID owner, int attachPoint, double priority)
{
this.m_regionHandle = regionHandle;
this.m_timeDilation = timeDilation;
this.m_localID = localID;
this.m_position = position;
this.m_rotation = rotation;
this.m_velocity = velocity;
this.m_rotationalvelocity = rotationalvelocity;
this.m_state = state;
this.m_AssetId = AssetId;
this.m_owner = owner;
this.m_attachPoint = attachPoint;
this.m_priority = priority;
}
public ulong regionHandle { get { return this.m_regionHandle; } }
public ushort timeDilation { get { return this.m_timeDilation; } }
public uint localID { get { return this.m_localID; } }
public Vector3 position { get { return this.m_position; } }
public Quaternion rotation { get { return this.m_rotation; } }
public Vector3 velocity { get { return this.m_velocity; } }
public Vector3 rotationalvelocity { get { return this.m_rotationalvelocity; } }
public byte state { get { return this.m_state; } }
public UUID AssetId { get { return this.m_AssetId; } }
public UUID owner { get { return this.m_owner; } }
public int attachPoint { get { return this.m_attachPoint; } }
public double priority { get { return this.m_priority; } }
}
public struct SendPrimitiveData
{
private ulong m_regionHandle;
private ushort m_timeDilation;
private uint m_localID;
private PrimitiveBaseShape m_primShape;
private Vector3 m_pos;
private Vector3 m_vel;
private Vector3 m_acc;
private Quaternion m_rotation;
private Vector3 m_rvel;
private uint m_flags;
private UUID m_objectID;
private UUID m_ownerID;
private string m_text;
private byte[] m_color;
private uint m_parentID;
private byte[] m_particleSystem;
private byte m_clickAction;
private byte m_material;
private byte[] m_textureanim;
private bool m_attachment;
private uint m_AttachPoint;
private UUID m_AssetId;
private UUID m_SoundId;
private double m_SoundVolume;
private byte m_SoundFlags;
private double m_SoundRadius;
private double m_priority;
public SendPrimitiveData(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel,
uint flags, UUID objectID, UUID ownerID, string text, byte[] color,
uint parentID, byte[] particleSystem, byte clickAction, byte material, double priority) :
this(regionHandle, timeDilation, localID, primShape, pos, vel, acc, rotation, rvel, flags, objectID,
ownerID, text, color, parentID, particleSystem, clickAction, material, new byte[0], false, 0, UUID.Zero,
UUID.Zero, 0, 0, 0, priority) { }
public SendPrimitiveData(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel,
uint flags,
UUID objectID, UUID ownerID, string text, byte[] color, uint parentID,
byte[] particleSystem,
byte clickAction, byte material, byte[] textureanim, bool attachment,
uint AttachPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags,
double SoundRadius, double priority)
{
this.m_regionHandle = regionHandle;
this.m_timeDilation = timeDilation;
this.m_localID = localID;
this.m_primShape = primShape;
this.m_pos = pos;
this.m_vel = vel;
this.m_acc = acc;
this.m_rotation = rotation;
this.m_rvel = rvel;
this.m_flags = flags;
this.m_objectID = objectID;
this.m_ownerID = ownerID;
this.m_text = text;
this.m_color = color;
this.m_parentID = parentID;
this.m_particleSystem = particleSystem;
this.m_clickAction = clickAction;
this.m_material = material;
this.m_textureanim = textureanim;
this.m_attachment = attachment;
this.m_AttachPoint = AttachPoint;
this.m_AssetId = AssetId;
this.m_SoundId = SoundId;
this.m_SoundVolume = SoundVolume;
this.m_SoundFlags = SoundFlags;
this.m_SoundRadius = SoundRadius;
this.m_priority = priority;
}
public ulong regionHandle { get { return this.m_regionHandle; } }
public ushort timeDilation { get { return this.m_timeDilation; } }
public uint localID { get { return this.m_localID; } }
public PrimitiveBaseShape primShape { get { return this.m_primShape; } }
public Vector3 pos { get { return this.m_pos; } }
public Vector3 vel { get { return this.m_vel; } }
public Vector3 acc { get { return this.m_acc; } }
public Quaternion rotation { get { return this.m_rotation; } }
public Vector3 rvel { get { return this.m_rvel; } }
public uint flags { get { return this.m_flags; } }
public UUID objectID { get { return this.m_objectID; } }
public UUID ownerID { get { return this.m_ownerID; } }
public string text { get { return this.m_text; } }
public byte[] color { get { return this.m_color; } }
public uint parentID { get { return this.m_parentID; } }
public byte[] particleSystem { get { return this.m_particleSystem; } }
public byte clickAction { get { return this.m_clickAction; } }
public byte material { get { return this.m_material; } }
public byte[] textureanim { get { return this.m_textureanim; } }
public bool attachment { get { return this.m_attachment; } }
public uint AttachPoint { get { return this.m_AttachPoint; } }
public UUID AssetId { get { return this.m_AssetId; } }
public UUID SoundId { get { return this.m_SoundId; } }
public double SoundVolume { get { return this.m_SoundVolume; } }
public byte SoundFlags { get { return this.m_SoundFlags; } }
public double SoundRadius { get { return this.m_SoundRadius; } }
public double priority { get { return this.m_priority; } }
}
public interface IClientAPI
{
Vector3 StartPos { get; set; }
@ -877,37 +1104,18 @@ namespace OpenSim.Framework
void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance);
void SendPayPrice(UUID objectID, int[] payPrice);
void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID,
uint avatarLocalID,
Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation);
void SendAvatarData(SendAvatarData data);
void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
Vector3 velocity, Quaternion rotation, UUID agentid);
void SendAvatarTerseUpdate(SendAvatarTerseData data);
void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations);
void AttachObject(uint localID, Quaternion rotation, byte attachPoint, UUID ownerID);
void SetChildAgentThrottle(byte[] throttle);
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel,
uint flags,
UUID objectID, UUID ownerID, string text, byte[] color, uint parentID,
byte[] particleSystem,
byte clickAction, byte material, byte[] textureanim, bool attachment,
uint AttachPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags,
double SoundRadius);
void SendPrimitiveToClient(SendPrimitiveData data);
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel,
uint flags, UUID objectID, UUID ownerID, string text, byte[] color,
uint parentID, byte[] particleSystem, byte clickAction, byte material);
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state,
UUID AssetId, UUID owner, int attachPoint);
void SendPrimTerseUpdate(SendPrimitiveTerseData data);
void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items,
List<InventoryFolderBase> folders, bool fetchFolders,

View File

@ -320,14 +320,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private readonly IGroupsModule m_GroupsModule;
private int m_cachedTextureSerial;
private Timer m_avatarTerseUpdateTimer;
private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates_ =
private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_avatarTerseUpdates =
new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
private Timer m_primTerseUpdateTimer;
private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates_ =
private PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock> m_primTerseUpdates =
new PriorityQueue<double, ImprovedTerseObjectUpdatePacket.ObjectDataBlock>();
private Timer m_primFullUpdateTimer;
private PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates_ =
private PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock> m_primFullUpdates =
new PriorityQueue<double, ObjectUpdatePacket.ObjectDataBlock>();
private int m_moneyBalance;
private int m_animationSequenceNumber = 1;
@ -353,9 +350,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// LL uses these limits, apparently. Compressed terse would be 23, but we don't have that yet
protected int m_primTerseUpdatesPerPacket = 10;
protected int m_primFullUpdatesPerPacket = 14;
protected int m_primTerseUpdateRate = 10;
protected int m_primFullUpdateRate = 14;
protected int m_avatarTerseUpdateRate = 50;
protected int m_avatarTerseUpdatesPerPacket = 5;
/// <summary>Number of texture packets to put on the queue each time the
/// OnQueueEmpty event is triggered for the texture category</summary>
@ -479,25 +473,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Remove ourselves from the scene
m_scene.RemoveClient(AgentId);
// Shut down timers. Thread Context of this method is murky. Lock all timers
if (m_avatarTerseUpdateTimer.Enabled)
lock (m_avatarTerseUpdateTimer)
m_avatarTerseUpdateTimer.Stop();
if (m_primTerseUpdateTimer.Enabled)
lock (m_primTerseUpdateTimer)
m_primTerseUpdateTimer.Stop();
if (m_primFullUpdateTimer.Enabled)
lock (m_primFullUpdateTimer)
m_primFullUpdateTimer.Stop();
// We can't reach into other scenes and close the connection
// We need to do this over grid communications
//m_scene.CloseAllAgents(CircuitCode);
m_avatarTerseUpdateTimer.Dispose();
m_primTerseUpdateTimer.Dispose();
m_primFullUpdateTimer.Dispose();
// Disable UDP handling for this client
m_udpClient.Shutdown();
@ -524,18 +503,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void Stop()
{
// Shut down timers. Thread Context is Murky, lock all timers!
if (m_avatarTerseUpdateTimer.Enabled)
lock (m_avatarTerseUpdateTimer)
m_avatarTerseUpdateTimer.Stop();
if (m_primTerseUpdateTimer.Enabled)
lock (m_primTerseUpdateTimer)
m_primTerseUpdateTimer.Stop();
if (m_primFullUpdateTimer.Enabled)
lock (m_primFullUpdateTimer)
m_primFullUpdateTimer.Stop();
}
#endregion Client Methods
@ -631,18 +599,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public virtual void Start()
{
m_avatarTerseUpdateTimer = new Timer(m_avatarTerseUpdateRate);
m_avatarTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessAvatarTerseUpdates);
m_avatarTerseUpdateTimer.AutoReset = false;
m_primTerseUpdateTimer = new Timer(m_primTerseUpdateRate);
m_primTerseUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimTerseUpdates);
m_primTerseUpdateTimer.AutoReset = false;
m_primFullUpdateTimer = new Timer(m_primFullUpdateRate);
m_primFullUpdateTimer.Elapsed += new ElapsedEventHandler(ProcessPrimFullUpdates);
m_primFullUpdateTimer.AutoReset = false;
m_scene.AddNewClient(this);
RefreshGroupMembership();
@ -3394,28 +3350,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>
/// send a objectupdate packet with information about the clients avatar
/// </summary>
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID,
uint avatarLocalID, Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation)
public void SendAvatarData(SendAvatarData data)
{
ObjectUpdatePacket objupdate = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate);
// TODO: don't create new blocks if recycling an old packet
objupdate.RegionData.RegionHandle = regionHandle;
objupdate.RegionData.RegionHandle = data.regionHandle;
objupdate.RegionData.TimeDilation = ushort.MaxValue;
objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1];
objupdate.ObjectData[0] = CreateDefaultAvatarPacket(textureEntry);
objupdate.ObjectData[0] = CreateDefaultAvatarPacket(data.textureEntry);
//give this avatar object a local id and assign the user a name
objupdate.ObjectData[0].ID = avatarLocalID;
objupdate.ObjectData[0].FullID = avatarID;
objupdate.ObjectData[0].ParentID = parentID;
objupdate.ObjectData[0].ID = data.avatarLocalID;
objupdate.ObjectData[0].FullID = data.avatarID;
objupdate.ObjectData[0].ParentID = data.parentID;
objupdate.ObjectData[0].NameValue =
Utils.StringToBytes("FirstName STRING RW SV " + firstName + "\nLastName STRING RW SV " + lastName + "\nTitle STRING RW SV " + grouptitle);
Utils.StringToBytes("FirstName STRING RW SV " + data.firstName + "\nLastName STRING RW SV " + data.lastName + "\nTitle STRING RW SV " + data.grouptitle);
Vector3 pos2 = new Vector3(Pos.X, Pos.Y, Pos.Z);
Vector3 pos2 = new Vector3(data.Pos.X, data.Pos.Y, data.Pos.Z);
byte[] pb = pos2.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
byte[] rot = rotation.GetBytes();
byte[] rot = data.rotation.GetBytes();
Array.Copy(rot, 0, objupdate.ObjectData[0].ObjectData, 52, rot.Length);
objupdate.Header.Zerocoded = true;
@ -3426,38 +3381,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// Send a terse positional/rotation/velocity update about an avatar
/// to the client. This avatar can be that of the client itself.
/// </summary>
public virtual void SendAvatarTerseUpdate(ulong regionHandle,
ushort timeDilation, uint localID, Vector3 position,
Vector3 velocity, Quaternion rotation, UUID agentid)
public virtual void SendAvatarTerseUpdate(SendAvatarTerseData data)
{
if (data.priority == double.NaN)
{
m_log.Error("[LLClientView] SendAvatarTerseUpdate received a NaN priority, dropping update");
return;
}
Quaternion rotation = data.rotation;
if (rotation.X == rotation.Y &&
rotation.Y == rotation.Z &&
rotation.Z == rotation.W && rotation.W == 0)
rotation = Quaternion.Identity;
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock =
CreateAvatarImprovedBlock(localID, position, velocity,rotation);
CreateAvatarImprovedBlock(data.localID, data.position, data.velocity, rotation);
lock (m_avatarTerseUpdates_.SyncRoot)
{
m_avatarTerseUpdates_.Enqueue(DateTime.Now.ToOADate(), terseBlock, localID);
// If packet is full or own movement packet, send it.
if (m_avatarTerseUpdates_.Count >= m_avatarTerseUpdatesPerPacket)
{
ProcessAvatarTerseUpdates(this, null);
}
else if (m_avatarTerseUpdates_.Count == 1)
{
lock (m_avatarTerseUpdateTimer)
m_avatarTerseUpdateTimer.Start();
}
}
lock (m_avatarTerseUpdates.SyncRoot)
m_avatarTerseUpdates.Enqueue(data.priority, terseBlock, data.localID);
}
private void ProcessAvatarTerseUpdates(object sender, ElapsedEventArgs e)
private void ProcessAvatarTerseUpdates()
{
lock (m_avatarTerseUpdates_.SyncRoot)
lock (m_avatarTerseUpdates.SyncRoot)
{
ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
@ -3468,8 +3416,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
(ushort)(Scene.TimeDilation * ushort.MaxValue);
int max = m_avatarTerseUpdatesPerPacket;
if (max > m_avatarTerseUpdates_.Count)
max = m_avatarTerseUpdates_.Count;
if (max > m_avatarTerseUpdates.Count)
max = m_avatarTerseUpdates.Count;
int count = 0;
int size = 0;
@ -3482,12 +3430,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
for (count = 0 ; count < max ; count++)
{
int length = 0;
m_avatarTerseUpdates_.Peek().ToBytes(blockbuffer, ref length);
m_avatarTerseUpdates.Peek().ToBytes(blockbuffer, ref length);
length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
if (size + length > Packet.MTU)
break;
size += length;
updates.Enqueue(m_avatarTerseUpdates_.Dequeue());
updates.Enqueue(m_avatarTerseUpdates.Dequeue());
}
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[count];
@ -3497,14 +3445,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
terse.Header.Reliable = false;
terse.Header.Zerocoded = true;
// FIXME: Move this to ThrottleOutPacketType.State when the real prioritization code is committed
OutPacket(terse, ThrottleOutPacketType.Task);
if (m_avatarTerseUpdates_.Count == 0)
{
lock (m_avatarTerseUpdateTimer)
m_avatarTerseUpdateTimer.Stop();
}
OutPacket(terse, ThrottleOutPacketType.State);
}
}
@ -3569,54 +3511,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(attach, ThrottleOutPacketType.Task);
}
public void SendPrimitiveToClient(
ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel,
uint flags, UUID objectID, UUID ownerID, string text, byte[] color,
uint parentID, byte[] particleSystem, byte clickAction, byte material)
public void SendPrimitiveToClient(SendPrimitiveData data)
{
byte[] textureanim = new byte[0];
SendPrimitiveToClient(regionHandle, timeDilation, localID, primShape, pos, vel,
acc, rotation, rvel, flags,
objectID, ownerID, text, color, parentID, particleSystem,
clickAction, material, textureanim, false, 0, UUID.Zero, UUID.Zero, 0, 0, 0);
}
public void SendPrimitiveToClient(
ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
Vector3 pos, Vector3 velocity, Vector3 acceleration, Quaternion rotation, Vector3 rotational_velocity,
uint flags,
UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem,
byte clickAction, byte material, byte[] textureanim, bool attachment, uint AttachPoint, UUID AssetId, UUID SoundId, double SoundGain, byte SoundFlags, double SoundRadius)
{
if (AttachPoint > 30 && ownerID != AgentId) // Someone else's HUD
if (data.priority == double.NaN)
{
m_log.Error("[LLClientView] SendPrimitiveToClient received a NaN priority, dropping update");
return;
if (primShape.PCode == 9 && primShape.State != 0 && parentID == 0)
}
Quaternion rotation = data.rotation;
if (data.AttachPoint > 30 && data.ownerID != AgentId) // Someone else's HUD
return;
if (data.primShape.PCode == 9 && data.primShape.State != 0 && data.parentID == 0)
return;
if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0)
if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0.0f)
rotation = Quaternion.Identity;
ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(primShape, flags);
ObjectUpdatePacket.ObjectDataBlock objectData = CreatePrimUpdateBlock(data.primShape, data.flags);
objectData.ID = localID;
objectData.FullID = objectID;
objectData.OwnerID = ownerID;
objectData.ID = data.localID;
objectData.FullID = data.objectID;
objectData.OwnerID = data.ownerID;
objectData.Text = Util.StringToBytes256(text);
objectData.TextColor[0] = color[0];
objectData.TextColor[1] = color[1];
objectData.TextColor[2] = color[2];
objectData.TextColor[3] = color[3];
objectData.ParentID = parentID;
objectData.PSBlock = particleSystem;
objectData.ClickAction = clickAction;
objectData.Material = material;
objectData.Text = Util.StringToBytes256(data.text);
objectData.TextColor[0] = data.color[0];
objectData.TextColor[1] = data.color[1];
objectData.TextColor[2] = data.color[2];
objectData.TextColor[3] = data.color[3];
objectData.ParentID = data.parentID;
objectData.PSBlock = data.particleSystem;
objectData.ClickAction = data.clickAction;
objectData.Material = data.material;
objectData.Flags = 0;
if (attachment)
if (data.attachment)
{
// Necessary???
objectData.JointAxisOrAnchor = new Vector3(0, 0, 2);
@ -3624,14 +3554,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Item from inventory???
objectData.NameValue =
Utils.StringToBytes("AttachItemID STRING RW SV " + AssetId.Guid);
objectData.State = (byte)((AttachPoint % 16) * 16 + (AttachPoint / 16));
Utils.StringToBytes("AttachItemID STRING RW SV " + data.AssetId.Guid);
objectData.State = (byte)((data.AttachPoint % 16) * 16 + (data.AttachPoint / 16));
}
// Xantor 20080528: Send sound info as well
// Xantor 20080530: Zero out everything if there's no SoundId, so zerocompression will work again
objectData.Sound = SoundId;
if (SoundId == UUID.Zero)
objectData.Sound = data.SoundId;
if (data.SoundId == UUID.Zero)
{
objectData.OwnerID = UUID.Zero;
objectData.Gain = 0.0f;
@ -3640,39 +3570,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else
{
objectData.OwnerID = ownerID;
objectData.Gain = (float)SoundGain;
objectData.Radius = (float)SoundRadius;
objectData.Flags = SoundFlags;
objectData.OwnerID = data.ownerID;
objectData.Gain = (float)data.SoundVolume;
objectData.Radius = (float)data.SoundRadius;
objectData.Flags = data.SoundFlags;
}
byte[] pb = pos.GetBytes();
Array.Copy(pb, 0, objectData.ObjectData, 0, pb.Length);
byte[] pb = data.pos.GetBytes();
Buffer.BlockCopy(pb, 0, objectData.ObjectData, 0, pb.Length);
byte[] vel = velocity.GetBytes();
Array.Copy(vel, 0, objectData.ObjectData, pb.Length, vel.Length);
byte[] vel = data.vel.GetBytes();
Buffer.BlockCopy(vel, 0, objectData.ObjectData, pb.Length, vel.Length);
byte[] rot = rotation.GetBytes();
Array.Copy(rot, 0, objectData.ObjectData, 36, rot.Length);
Buffer.BlockCopy(rot, 0, objectData.ObjectData, 36, rot.Length);
byte[] rvel = rotational_velocity.GetBytes();
Array.Copy(rvel, 0, objectData.ObjectData, 36 + rot.Length, rvel.Length);
byte[] rvel = data.rvel.GetBytes();
Buffer.BlockCopy(rvel, 0, objectData.ObjectData, 36 + rot.Length, rvel.Length);
if (textureanim.Length > 0)
if (data.textureanim.Length > 0)
{
objectData.TextureAnim = textureanim;
objectData.TextureAnim = data.textureanim;
}
lock (m_primFullUpdates_.SyncRoot)
{
if (m_primFullUpdates_.Count == 0)
m_primFullUpdateTimer.Start();
m_primFullUpdates_.Enqueue(DateTime.Now.ToOADate(), objectData, localID);
if (m_primFullUpdates_.Count >= m_primFullUpdatesPerPacket)
ProcessPrimFullUpdates(this, null);
}
lock (m_primFullUpdates.SyncRoot)
m_primFullUpdates.Enqueue(data.priority, objectData, data.localID);
}
void HandleQueueEmpty(ThrottleOutPacketType queue)
@ -3682,6 +3604,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
case ThrottleOutPacketType.Texture:
ProcessTextureRequests();
break;
case ThrottleOutPacketType.State:
int count = 0;
lock (m_avatarTerseUpdates.SyncRoot)
count = m_avatarTerseUpdates.Count;
if (count > 0)
{
ProcessAvatarTerseUpdates();
return;
}
lock (m_primFullUpdates.SyncRoot)
count = m_primFullUpdates.Count;
if (count > 0)
{
ProcessPrimFullUpdates();
return;
}
lock (m_primTerseUpdates.SyncRoot)
count = m_primTerseUpdates.Count;
if (count > 0)
{
ProcessPrimTerseUpdates();
return;
}
break;
}
}
@ -3691,18 +3640,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_imageManager.ProcessImageQueue(m_textureSendLimit);
}
void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e)
void ProcessPrimFullUpdates()
{
lock (m_primFullUpdates_.SyncRoot)
lock (m_primFullUpdates.SyncRoot)
{
if (m_primFullUpdates_.Count == 0 && m_primFullUpdateTimer.Enabled)
{
lock (m_primFullUpdateTimer)
m_primFullUpdateTimer.Stop();
return;
}
ObjectUpdatePacket outPacket =
(ObjectUpdatePacket)PacketPool.Instance.GetPacket(
PacketType.ObjectUpdate);
@ -3712,7 +3653,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
outPacket.RegionData.TimeDilation =
(ushort)(Scene.TimeDilation * ushort.MaxValue);
int max = m_primFullUpdates_.Count;
int max = m_primFullUpdates.Count;
if (max > m_primFullUpdatesPerPacket)
max = m_primFullUpdatesPerPacket;
@ -3727,12 +3668,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
for (count = 0 ; count < max ; count++)
{
int length = 0;
m_primFullUpdates_.Peek().ToBytes(blockbuffer, ref length);
m_primFullUpdates.Peek().ToBytes(blockbuffer, ref length);
length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
if (size + length > Packet.MTU)
break;
size += length;
updates.Enqueue(m_primFullUpdates_.Dequeue());
updates.Enqueue(m_primFullUpdates.Dequeue());
}
outPacket.ObjectData =
@ -3743,53 +3684,42 @@ namespace OpenSim.Region.ClientStack.LindenUDP
outPacket.Header.Zerocoded = true;
OutPacket(outPacket, ThrottleOutPacketType.State);
if (m_primFullUpdates_.Count == 0 && m_primFullUpdateTimer.Enabled)
lock (m_primFullUpdateTimer)
m_primFullUpdateTimer.Stop();
}
}
/// <summary>
///
/// </summary>
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId, UUID ownerID, int attachPoint)
//public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
// Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId, UUID ownerID, int attachPoint)
public void SendPrimTerseUpdate(SendPrimitiveTerseData data)
{
if (attachPoint > 30 && ownerID != AgentId) // Someone else's HUD
if (data.priority == double.NaN)
{
m_log.Error("[LLClientView] SendPrimTerseUpdate received a NaN priority, dropping update");
return;
}
Quaternion rotation = data.rotation;
if (data.attachPoint > 30 && data.owner != AgentId) // Someone else's HUD
return;
if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0)
rotation = Quaternion.Identity;
ImprovedTerseObjectUpdatePacket.ObjectDataBlock objectData =
CreatePrimImprovedBlock(localID, position, rotation,
velocity, rotationalvelocity, state);
CreatePrimImprovedBlock(data.localID, data.position, rotation,
data.velocity, data.rotationalvelocity, data.state);
lock (m_primTerseUpdates_.SyncRoot)
{
if (m_primTerseUpdates_.Count == 0)
m_primTerseUpdateTimer.Start();
m_primTerseUpdates_.Enqueue(DateTime.Now.ToOADate(), objectData, localID);
if (m_primTerseUpdates_.Count >= m_primTerseUpdatesPerPacket)
ProcessPrimTerseUpdates(this, null);
}
lock (m_primTerseUpdates.SyncRoot)
m_primTerseUpdates.Enqueue(data.priority, objectData, data.localID);
}
void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e)
void ProcessPrimTerseUpdates()
{
lock (m_primTerseUpdates_.SyncRoot)
lock (m_primTerseUpdates.SyncRoot)
{
if (m_primTerseUpdates_.Count == 0)
{
lock (m_primTerseUpdateTimer)
m_primTerseUpdateTimer.Stop();
return;
}
ImprovedTerseObjectUpdatePacket outPacket =
(ImprovedTerseObjectUpdatePacket)
PacketPool.Instance.GetPacket(
@ -3800,7 +3730,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
outPacket.RegionData.TimeDilation =
(ushort)(Scene.TimeDilation * ushort.MaxValue);
int max = m_primTerseUpdates_.Count;
int max = m_primTerseUpdates.Count;
if (max > m_primTerseUpdatesPerPacket)
max = m_primTerseUpdatesPerPacket;
@ -3815,12 +3745,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
for (count = 0 ; count < max ; count++)
{
int length = 0;
m_primTerseUpdates_.Peek().ToBytes(blockbuffer, ref length);
m_primTerseUpdates.Peek().ToBytes(blockbuffer, ref length);
length = Helpers.ZeroEncode(blockbuffer, length, zerobuffer);
if (size + length > Packet.MTU)
break;
size += length;
updates.Enqueue(m_primTerseUpdates_.Dequeue());
updates.Enqueue(m_primTerseUpdates.Dequeue());
}
outPacket.ObjectData =
@ -3833,26 +3763,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
outPacket.Header.Reliable = false;
outPacket.Header.Zerocoded = true;
OutPacket(outPacket, ThrottleOutPacketType.State);
if (m_primTerseUpdates_.Count == 0)
lock (m_primTerseUpdateTimer)
m_primTerseUpdateTimer.Stop();
}
}
public void FlushPrimUpdates()
{
while (m_primFullUpdates_.Count > 0)
while (m_primFullUpdates.Count > 0)
{
ProcessPrimFullUpdates(this, null);
ProcessPrimFullUpdates();
}
while (m_primTerseUpdates_.Count > 0)
while (m_primTerseUpdates.Count > 0)
{
ProcessPrimTerseUpdates(this, null);
ProcessPrimTerseUpdates();
}
while (m_avatarTerseUpdates_.Count > 0)
while (m_avatarTerseUpdates.Count > 0)
{
ProcessAvatarTerseUpdates(this, null);
ProcessAvatarTerseUpdates();
}
}

View File

@ -499,13 +499,11 @@ namespace OpenSim.Region.Examples.SimpleModule
{
}
public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID,
uint avatarLocalID, Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation)
public virtual void SendAvatarData(SendAvatarData data)
{
}
public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
Vector3 position, Vector3 velocity, Quaternion rotation, UUID agentid)
public virtual void SendAvatarTerseUpdate(SendAvatarTerseData data)
{
}
@ -521,27 +519,11 @@ namespace OpenSim.Region.Examples.SimpleModule
{
}
public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
UUID objectID, UUID ownerID, string text, byte[] color,
uint parentID,
byte[] particleSystem, byte clickAction, byte material)
public virtual void SendPrimitiveToClient(SendPrimitiveData data)
{
}
public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
UUID objectID, UUID ownerID, string text, byte[] color,
uint parentID,
byte[] particleSystem, byte clickAction, byte material, byte[] textureanimation,
bool attachment, uint AttachmentPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius)
{
}
public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
Vector3 position, Quaternion rotation, Vector3 velocity,
Vector3 rotationalvelocity, byte state, UUID AssetId,
UUID ownerID, int attachPoint)
public virtual void SendPrimTerseUpdate(SendPrimitiveTerseData data)
{
}

View File

@ -34,7 +34,6 @@ namespace OpenSim.Region.Framework.Interfaces
{
void Reset();
void Close();
int MaxPrimsPerFrame { get; set; }
void QueuePartForUpdate(SceneObjectPart part);
void SendPrimUpdates();
}

View File

@ -57,6 +57,12 @@ namespace OpenSim.Region.Framework.Scenes
public partial class Scene : SceneBase
{
public enum UpdatePrioritizationSchemes {
Time = 0,
Distance = 1,
SimpleAngularDistance = 2,
}
public delegate void SynchronizeSceneHandler(Scene scene);
public SynchronizeSceneHandler SynchronizeScene = null;
@ -268,9 +274,10 @@ namespace OpenSim.Region.Framework.Scenes
private volatile bool shuttingdown = false;
private int m_lastUpdate = Environment.TickCount;
private int m_maxPrimsPerFrame = 200;
private bool m_firstHeartbeat = true;
private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
private object m_deleting_scene_object = new object();
// the minimum time that must elapse before a changed object will be considered for persisted
@ -282,6 +289,8 @@ namespace OpenSim.Region.Framework.Scenes
#region Properties
public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return this.m_update_prioritization_scheme; } }
public AgentCircuitManager AuthenticateHandler
{
get { return m_authenticateHandler; }
@ -326,12 +335,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_sceneGraph.m_syncRoot; }
}
public int MaxPrimsPerFrame
{
get { return m_maxPrimsPerFrame; }
set { m_maxPrimsPerFrame = value; }
}
/// <summary>
/// This is for llGetRegionFPS
/// </summary>
@ -509,7 +512,6 @@ namespace OpenSim.Region.Framework.Scenes
m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine");
m_maxPrimsPerFrame = startupConfig.GetInt("MaxPrimsPerFrame", 200);
IConfig packetConfig = m_config.Configs["PacketPool"];
if (packetConfig != null)
{
@ -518,6 +520,28 @@ namespace OpenSim.Region.Framework.Scenes
}
m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
IConfig interest_management_config = m_config.Configs["InterestManagement"];
if (interest_management_config != null)
{
string update_prioritization_scheme = interest_management_config.GetString("UpdatePrioritizationScheme", "Time").Trim().ToLower();
switch (update_prioritization_scheme)
{
case "time":
m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
break;
case "distance":
m_update_prioritization_scheme = UpdatePrioritizationSchemes.Distance;
break;
case "simpleangulardistance":
m_update_prioritization_scheme = UpdatePrioritizationSchemes.SimpleAngularDistance;
break;
default:
m_log.Warn("[SCENE]: UpdatePrioritizationScheme was not recognized, setting to default settomg of Time");
m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
break;
}
}
}
catch
{

View File

@ -613,7 +613,6 @@ namespace OpenSim.Region.Framework.Scenes
newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
newAvatar.IsChildAgent = true;
newAvatar.MaxPrimsPerFrame = m_parentScene.MaxPrimsPerFrame;
AddScenePresence(newAvatar);

View File

@ -1817,7 +1817,7 @@ namespace OpenSim.Region.Framework.Scenes
public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, UUID AgentID, uint RequestFlags)
{
remoteClient.SendObjectPropertiesFamilyData(RequestFlags, RootPart.UUID, RootPart.ObjectOwner, RootPart.GroupID, RootPart.BaseMask,
remoteClient.SendObjectPropertiesFamilyData(RequestFlags, RootPart.UUID, RootPart.OwnerID, RootPart.GroupID, RootPart.BaseMask,
RootPart.OwnerMask, RootPart.GroupMask, RootPart.EveryoneMask, RootPart.NextOwnerMask,
RootPart.OwnershipCost, RootPart.ObjectSaleType, RootPart.SalePrice, RootPart.Category,
RootPart.CreatorID, RootPart.Name, RootPart.Description);
@ -3343,5 +3343,77 @@ namespace OpenSim.Region.Framework.Scenes
return true;
}
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);
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;
}
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;
}
}
}

View File

@ -2400,10 +2400,10 @@ if (m_shape != null) {
//isattachment = ParentGroup.RootPart.IsAttachment;
byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A};
remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape,
remoteClient.SendPrimitiveToClient(new SendPrimitiveData(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape,
lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, _ownerID,
m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment,
AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius);
AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, ParentGroup.GetUpdatePriority(remoteClient)));
}
/// <summary>
@ -3794,12 +3794,12 @@ if (m_shape != null) {
// Causes this thread to dig into the Client Thread Data.
// Remember your locking here!
remoteClient.SendPrimTerseUpdate(m_regionHandle,
remoteClient.SendPrimTerseUpdate(new SendPrimitiveTerseData(m_regionHandle,
(ushort)(m_parentGroup.GetTimeDilation() *
(float)ushort.MaxValue), LocalId, lPos,
RotationOffset, Velocity,
RotationalVelocity, state, FromItemID,
OwnerID, (int)AttachmentPoint);
OwnerID, (int)AttachmentPoint, ParentGroup.GetUpdatePriority(remoteClient)));
}
public void AddScriptLPS(int count)

View File

@ -403,12 +403,6 @@ namespace OpenSim.Region.Framework.Scenes
set { m_parentPosition = value; }
}
public int MaxPrimsPerFrame
{
get { return m_sceneViewer.MaxPrimsPerFrame; }
set { m_sceneViewer.MaxPrimsPerFrame = value; }
}
/// <summary>
/// Absolute position of this avatar in 'region cordinates'
/// </summary>
@ -2457,8 +2451,8 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 pos = m_pos;
pos.Z -= m_appearance.HipOffset;
remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue),
LocalId, pos, Velocity, m_bodyRot, m_uuid);
remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
pos, m_velocity, m_rotation, m_uuid, GetUpdatePriority(remoteClient)));
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.StatsReporter.AddAgentUpdates(1);
@ -2563,9 +2557,9 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 pos = m_pos;
pos.Z -= m_appearance.HipOffset;
remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
remoteAvatar.m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
LocalId, m_pos, m_appearance.Texture.GetBytes(),
m_parentID, rot);
m_parentID, rot));
m_scene.StatsReporter.AddAgentUpdates(1);
}
@ -2634,8 +2628,8 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 pos = m_pos;
pos.Z -= m_appearance.HipOffset;
m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot);
m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot));
if (!m_isChildAgent)
{
@ -2741,8 +2735,8 @@ namespace OpenSim.Region.Framework.Scenes
}
Quaternion rot = m_bodyRot;
m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot);
m_controllingClient.SendAvatarData(new SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot));
}
@ -3870,5 +3864,41 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
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 GetPriorityByDistance(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 GetPriorityByDistance(Vector3 position)
{
return Vector3.Distance(AbsolutePosition, position);
}
}
}

View File

@ -45,14 +45,6 @@ namespace OpenSim.Region.Framework.Scenes
protected Dictionary<UUID, ScenePartUpdate> m_updateTimes = new Dictionary<UUID, ScenePartUpdate>();
protected int m_maxPrimsPerFrame = 200;
public int MaxPrimsPerFrame
{
get { return m_maxPrimsPerFrame; }
set { m_maxPrimsPerFrame = value; }
}
public SceneViewer()
{
}
@ -82,16 +74,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_pendingObjects = new Queue<SceneObjectGroup>();
List<EntityBase> ents = new List<EntityBase>(m_presence.Scene.Entities);
if (!m_presence.IsChildAgent) // Proximity sort makes no sense for
{ // Child agents
ents.Sort(delegate(EntityBase a, EntityBase b)
{
return Vector3.Distance(m_presence.AbsolutePosition, a.AbsolutePosition).CompareTo(Vector3.Distance(m_presence.AbsolutePosition, b.AbsolutePosition));
});
}
foreach (EntityBase e in ents)
foreach (EntityBase e in m_presence.Scene.Entities)
{
if (e is SceneObjectGroup)
m_pendingObjects.Enqueue((SceneObjectGroup)e);
@ -99,7 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
while (m_pendingObjects != null && m_pendingObjects.Count > 0 && m_partsUpdateQueue.Count < m_maxPrimsPerFrame)
while (m_pendingObjects != null && m_pendingObjects.Count > 0)
{
SceneObjectGroup g = m_pendingObjects.Dequeue();
@ -183,8 +166,6 @@ namespace OpenSim.Region.Framework.Scenes
m_presence.GenerateClientFlags(part.UUID));
}
}
m_presence.ControllingClient.FlushPrimUpdates();
}
public void Reset()

View File

@ -35,8 +35,8 @@ namespace OpenSim.Region.Framework.Scenes.Scripting
string Description { get; set; }
UUID UUID { get; }
UUID ObjectOwner { get; }
UUID ObjectCreator { get; }
UUID OwnerID { get; }
UUID CreatorID { get; }
Vector3 AbsolutePosition { get; }
string SitName { get; set; }

View File

@ -68,12 +68,12 @@ namespace OpenSim.Region.Framework.Scenes.Scripting
get { return UUID.Zero; }
}
public UUID ObjectOwner
public UUID OwnerID
{
get { return UUID.Zero; }
}
public UUID ObjectCreator
public UUID CreatorID
{
get { return UUID.Zero; }
}

View File

@ -1011,12 +1011,12 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
public void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID, uint avatarLocalID, Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation)
public void SendAvatarData(SendAvatarData data)
{
}
public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Vector3 velocity, Quaternion rotation, UUID agentid)
public void SendAvatarTerseUpdate(SendAvatarTerseData data)
{
}
@ -1036,17 +1036,12 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material, byte[] textureanim, bool attachment, uint AttachPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius)
public void SendPrimitiveToClient(SendPrimitiveData data)
{
}
public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel, Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags, UUID objectID, UUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, byte clickAction, byte material)
{
}
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, Quaternion rotation, Vector3 velocity, Vector3 rotationalvelocity, byte state, UUID AssetId, UUID owner, int attachPoint)
public void SendPrimTerseUpdate(SendPrimitiveTerseData data)
{
}

View File

@ -188,7 +188,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
// MISC COMPARISONS (UUID, Byte)
if (first.ClickAction != second.ClickAction)
result |= Diff.CLICKACTION;
if (first.ObjectOwner != second.ObjectOwner)
if (first.OwnerID != second.OwnerID)
result |= Diff.OBJECTOWNER;

View File

@ -588,13 +588,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{
}
public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID,
uint avatarLocalID, Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation)
public virtual void SendAvatarData(SendAvatarData data)
{
}
public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
Vector3 position, Vector3 velocity, Quaternion rotation, UUID agentId)
public virtual void SendAvatarTerseUpdate(SendAvatarTerseData data)
{
}
@ -610,26 +608,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{
}
public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
UUID objectID, UUID ownerID, string text, byte[] color,
uint parentID,
byte[] particleSystem, byte clickAction, byte material)
public virtual void SendPrimitiveToClient(SendPrimitiveData data)
{
}
public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
UUID objectID, UUID ownerID, string text, byte[] color,
uint parentID,
byte[] particleSystem, byte clickAction, byte material, byte[] textureanimation,
bool attachment, uint AttachmentPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius)
{
}
public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
Vector3 position, Quaternion rotation, Vector3 velocity,
Vector3 rotationalvelocity, byte state, UUID AssetId, UUID ownerID, int attachPoint)
public virtual void SendPrimTerseUpdate(SendPrimitiveTerseData data)
{
}

View File

@ -2875,7 +2875,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
return m_host.ObjectOwner.ToString();
return m_host.OwnerID.ToString();
}
public void llInstantMessage(string user, string message)
@ -5634,7 +5634,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y);
if (parcel != null)
{
if (m_host.ObjectOwner == parcel.LandData.OwnerID ||
if (m_host.OwnerID == parcel.LandData.OwnerID ||
(m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.LandData.GroupID
&& parcel.LandData.IsGroupOwned) || World.Permissions.IsGod(m_host.OwnerID))
{
@ -7157,7 +7157,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if (land.LandData.OwnerID != m_host.ObjectOwner)
if (land.LandData.OwnerID != m_host.OwnerID)
return;
land.SetMusicUrl(url);
@ -7215,7 +7215,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llGetCreator()
{
m_host.AddScriptLPS(1);
return m_host.ObjectCreator.ToString();
return m_host.CreatorID.ToString();
}
public LSL_String llGetTimestamp()
@ -8396,7 +8396,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IDialogModule dm = World.RequestModuleInterface<IDialogModule>();
if (null != dm)
dm.SendUrlToUser(
new UUID(avatar_id), m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, url);
new UUID(avatar_id), m_host.Name, m_host.UUID, m_host.OwnerID, false, message, url);
ConditionalScriptSleep(10000);
}
@ -8411,7 +8411,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// according to the docs, this command only works if script owner and land owner are the same
// lets add estate owners and gods, too, and use the generic permission check.
ILandObject landObject = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if (!World.Permissions.CanEditParcel(m_host.ObjectOwner, landObject)) return;
if (!World.Permissions.CanEditParcel(m_host.OwnerID, landObject)) return;
bool update = false; // send a ParcelMediaUpdate (and possibly change the land's media URL)?
byte loop = 0;
@ -9081,9 +9081,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Vector3 velocity = m_host.Velocity;
Quaternion rotation = m_host.RotationOffset;
string ownerName = String.Empty;
ScenePresence scenePresence = World.GetScenePresence(m_host.ObjectOwner);
ScenePresence scenePresence = World.GetScenePresence(m_host.OwnerID);
if (scenePresence == null)
ownerName = resolveName(m_host.ObjectOwner);
ownerName = resolveName(m_host.OwnerID);
else
ownerName = scenePresence.Name;
@ -9108,7 +9108,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
httpHeaders["X-SecondLife-Local-Velocity"] = string.Format("({0:0.000000}, {1:0.000000}, {2:0.000000})", velocity.X, velocity.Y, velocity.Z);
httpHeaders["X-SecondLife-Local-Rotation"] = string.Format("({0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000})", rotation.X, rotation.Y, rotation.Z, rotation.W);
httpHeaders["X-SecondLife-Owner-Name"] = ownerName;
httpHeaders["X-SecondLife-Owner-Key"] = m_host.ObjectOwner.ToString();
httpHeaders["X-SecondLife-Owner-Key"] = m_host.OwnerID.ToString();
string userAgent = config.Configs["Network"].GetString("user_agent", null);
if (userAgent != null)
httpHeaders["User-Agent"] = userAgent;

View File

@ -1164,7 +1164,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ILandObject land
= World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if (land.LandData.OwnerID != m_host.ObjectOwner)
if (land.LandData.OwnerID != m_host.OwnerID)
return;
land.SetMediaUrl(url);
@ -1182,7 +1182,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ILandObject land
= World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if (land.LandData.OwnerID != m_host.ObjectOwner)
if (land.LandData.OwnerID != m_host.OwnerID)
{
OSSLError("osSetParcelSIPAddress: Sorry, you need to own the land to use this function");
return;

View File

@ -592,13 +592,11 @@ namespace OpenSim.Tests.Common.Mock
{
}
public virtual void SendAvatarData(ulong regionHandle, string firstName, string lastName, string grouptitle, UUID avatarID,
uint avatarLocalID, Vector3 Pos, byte[] textureEntry, uint parentID, Quaternion rotation)
public virtual void SendAvatarData(SendAvatarData data)
{
}
public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
Vector3 position, Vector3 velocity, Quaternion rotation, UUID agentid)
public virtual void SendAvatarTerseUpdate(SendAvatarTerseData data)
{
}
@ -614,27 +612,11 @@ namespace OpenSim.Tests.Common.Mock
{
}
public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
UUID objectID, UUID ownerID, string text, byte[] color,
uint parentID,
byte[] particleSystem, byte clickAction, byte material)
public virtual void SendPrimitiveToClient(SendPrimitiveData data)
{
}
public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID,
PrimitiveBaseShape primShape, Vector3 pos, Vector3 vel,
Vector3 acc, Quaternion rotation, Vector3 rvel, uint flags,
UUID objectID, UUID ownerID, string text, byte[] color,
uint parentID,
byte[] particleSystem, byte clickAction, byte material, byte[] textureanimation,
bool attachment, uint AttachmentPoint, UUID AssetId, UUID SoundId, double SoundVolume, byte SoundFlags, double SoundRadius)
{
}
public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID,
Vector3 position, Quaternion rotation, Vector3 velocity,
Vector3 rotationalvelocity, byte state, UUID AssetId,
UUID ownerID, int attachPoint)
public virtual void SendPrimTerseUpdate(SendPrimitiveTerseData data)
{
}