Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster

avinationmerge
Melanie 2013-01-23 02:39:30 +00:00
commit 74e04c0f03
14 changed files with 259 additions and 487 deletions

View File

@ -1558,7 +1558,58 @@ namespace OpenSim.Framework
SHAPE_EYELID_INNER_CORNER_UP = 214,
SKIRT_SKIRT_RED = 215,
SKIRT_SKIRT_GREEN = 216,
SKIRT_SKIRT_BLUE = 217
SKIRT_SKIRT_BLUE = 217,
/// <summary>
/// Avatar Physics section. These are 0 type visual params which get transmitted.
/// </summary>
/// <summary>
/// Breast Part 1
/// </summary>
BREAST_PHYSICS_MASS = 218,
BREAST_PHYSICS_GRAVITY = 219,
BREAST_PHYSICS_DRAG = 220,
BREAST_PHYSICS_UPDOWN_MAX_EFFECT = 221,
BREAST_PHYSICS_UPDOWN_SPRING = 222,
BREAST_PHYSICS_UPDOWN_GAIN = 223,
BREAST_PHYSICS_UPDOWN_DAMPING = 224,
BREAST_PHYSICS_INOUT_MAX_EFFECT = 225,
BREAST_PHYSICS_INOUT_SPRING = 226,
BREAST_PHYSICS_INOUT_GAIN = 227,
BREAST_PHYSICS_INOUT_DAMPING = 228,
/// <summary>
/// Belly
/// </summary>
BELLY_PHYISCS_MASS = 229,
BELLY_PHYSICS_GRAVITY = 230,
BELLY_PHYSICS_DRAG = 231,
BELLY_PHYISCS_UPDOWN_MAX_EFFECT = 232,
BELLY_PHYSICS_UPDOWN_SPRING = 233,
BELLY_PHYSICS_UPDOWN_GAIN = 234,
BELLY_PHYSICS_UPDOWN_DAMPING = 235,
/// <summary>
/// Butt
/// </summary>
BUTT_PHYSICS_MASS = 236,
BUTT_PHYSICS_GRAVITY = 237,
BUTT_PHYSICS_DRAG = 238,
BUTT_PHYSICS_UPDOWN_MAX_EFFECT = 239,
BUTT_PHYSICS_UPDOWN_SPRING = 240,
BUTT_PHYSICS_UPDOWN_GAIN = 241,
BUTT_PHYSICS_UPDOWN_DAMPING = 242,
BUTT_PHYSICS_LEFTRIGHT_MAX_EFFECT = 243,
BUTT_PHYSICS_LEFTRIGHT_SPRING = 244,
BUTT_PHYSICS_LEFTRIGHT_GAIN = 245,
BUTT_PHYSICS_LEFTRIGHT_DAMPING = 246,
/// <summary>
/// Breast Part 2
/// </summary>
BREAST_PHYSICS_LEFTRIGHT_MAX_EFFECT = 247,
BREAST_PHYSICS_LEFTRIGHT_SPRING= 248,
BREAST_PHYSICS_LEFTRIGHT_GAIN = 249,
BREAST_PHYSICS_LEFTRIGHT_DAMPING = 250
}
#endregion
}

View File

@ -29,7 +29,7 @@ using System.Threading;
namespace OpenSim.Framework
{
public sealed class LocklessQueue<T>
public class LocklessQueue<T>
{
private sealed class SingleLinkNode
{
@ -41,7 +41,7 @@ namespace OpenSim.Framework
SingleLinkNode tail;
int count;
public int Count { get { return count; } }
public virtual int Count { get { return count; } }
public LocklessQueue()
{
@ -76,7 +76,7 @@ namespace OpenSim.Framework
Interlocked.Increment(ref count);
}
public bool Dequeue(out T item)
public virtual bool Dequeue(out T item)
{
item = default(T);
SingleLinkNode oldHead = null;
@ -136,4 +136,4 @@ namespace OpenSim.Framework
(object)Interlocked.CompareExchange<SingleLinkNode>(ref location, newValue, comparand);
}
}
}
}

View File

@ -47,6 +47,8 @@ namespace OpenSim.Framework
Texture = 5,
/// <summary>Non-texture assets</summary>
Asset = 6,
HighPriority = 128,
}
[Flags]

View File

@ -501,7 +501,8 @@ namespace OpenSim.Region.ClientStack.Linden
ScenePresence p;
if (m_scene.TryGetScenePresence(User, out p)) // If we don't get a user they're not here anymore.
{
AlterThrottle(UserSetThrottle, p);
// AlterThrottle(UserSetThrottle, p);
UpdateThrottle(UserSetThrottle, p);
}
}
}
@ -546,7 +547,12 @@ namespace OpenSim.Region.ClientStack.Linden
// Client set throttle !
UserSetThrottle = pimagethrottle;
CapSetThrottle = (int)(pimagethrottle*CapThrottleDistributon);
UDPSetThrottle = (int) (pimagethrottle*(100 - CapThrottleDistributon));
// UDPSetThrottle = (int) (pimagethrottle*(100 - CapThrottleDistributon));
float udp = 1.0f - CapThrottleDistributon;
if(udp < 0.5f)
udp = 0.5f;
UDPSetThrottle = (int) ((float)pimagethrottle * udp);
if (CapSetThrottle < 4068)
CapSetThrottle = 4068; // at least two discovery mesh
p.ControllingClient.SetAgentThrottleSilent((int) Throttle, UDPSetThrottle);

View File

@ -897,32 +897,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
msg.MessageBlock.Message = Util.StringToBytes1024(im.message);
msg.MessageBlock.BinaryBucket = im.binaryBucket;
if (im.message.StartsWith("[grouptest]"))
{ // this block is test code for implementing group IM - delete when group IM is finished
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
if (eq != null)
{
im.dialog = 17;
//eq.ChatterboxInvitation(
// new UUID("00000000-68f9-1111-024e-222222111123"),
// "OpenSimulator Testing", im.fromAgentID, im.message, im.toAgentID, im.fromAgentName, im.dialog, 0,
// false, 0, new Vector3(), 1, im.imSessionID, im.fromGroup, im.binaryBucket);
eq.ChatterboxInvitation(
new UUID("00000000-68f9-1111-024e-222222111123"),
"OpenSimulator Testing", new UUID(im.fromAgentID), im.message, new UUID(im.toAgentID), im.fromAgentName, im.dialog, 0,
false, 0, new Vector3(), 1, new UUID(im.imSessionID), im.fromGroup, Util.StringToBytes256("OpenSimulator Testing"));
eq.ChatterBoxSessionAgentListUpdates(
new UUID("00000000-68f9-1111-024e-222222111123"),
new UUID(im.fromAgentID), new UUID(im.toAgentID), false, false, false);
}
Console.WriteLine("SendInstantMessage: " + msg);
}
else
OutPacket(msg, ThrottleOutPacketType.Task);
OutPacket(msg, ThrottleOutPacketType.Task);
}
}
@ -2788,7 +2763,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Transfer.TransferInfo.Size = req.AssetInf.Data.Length;
Transfer.TransferInfo.TransferID = req.TransferRequestID;
Transfer.Header.Zerocoded = true;
OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset);
OutPacket(Transfer, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
if (req.NumPackets == 1)
{
@ -2799,7 +2774,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TransferPacket.TransferData.Data = req.AssetInf.Data;
TransferPacket.TransferData.Status = 1;
TransferPacket.Header.Zerocoded = true;
OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset);
OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
}
else
{
@ -2832,7 +2807,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
TransferPacket.TransferData.Status = 1;
}
TransferPacket.Header.Zerocoded = true;
OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task : ThrottleOutPacketType.Asset);
OutPacket(TransferPacket, isWearable ? ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority : ThrottleOutPacketType.Asset);
processedLength += chunkSize;
packetNumber++;
@ -3605,7 +3580,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
OutPacket(aw, ThrottleOutPacketType.Task);
OutPacket(aw, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
}
public void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry)

View File

@ -92,7 +92,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Packets we have sent that need to be ACKed by the client</summary>
public readonly UnackedPacketCollection NeedAcks = new UnackedPacketCollection();
/// <summary>ACKs that are queued up, waiting to be sent to the client</summary>
public readonly OpenSim.Framework.LocklessQueue<uint> PendingAcks = new OpenSim.Framework.LocklessQueue<uint>();
public readonly DoubleLocklessQueue<uint> PendingAcks = new DoubleLocklessQueue<uint>();
/// <summary>Current packet sequence number</summary>
public int CurrentSequence;
@ -146,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>Throttle buckets for each packet category</summary>
private readonly TokenBucket[] m_throttleCategories;
/// <summary>Outgoing queues for throttled packets</summary>
private readonly OpenSim.Framework.LocklessQueue<OutgoingPacket>[] m_packetOutboxes = new OpenSim.Framework.LocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT];
private readonly DoubleLocklessQueue<OutgoingPacket>[] m_packetOutboxes = new DoubleLocklessQueue<OutgoingPacket>[THROTTLE_CATEGORY_COUNT];
/// <summary>A container that can hold one packet for each outbox, used to store
/// dequeued packets that are being held for throttling</summary>
private readonly OutgoingPacket[] m_nextPackets = new OutgoingPacket[THROTTLE_CATEGORY_COUNT];
@ -202,7 +202,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ThrottleOutPacketType type = (ThrottleOutPacketType)i;
// Initialize the packet outboxes, where packets sit while they are waiting for tokens
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
// Initialize the token buckets that control the throttling for each category
m_throttleCategories[i] = new TokenBucket(m_throttleCategory, rates.GetRate(type));
}
@ -429,16 +429,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// false if the packet has not been queued and should be sent immediately.
/// </returns>
public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue)
{
return EnqueueOutgoing(packet, forceQueue, false);
}
public bool EnqueueOutgoing(OutgoingPacket packet, bool forceQueue, bool highPriority)
{
int category = (int)packet.Category;
if (category >= 0 && category < m_packetOutboxes.Length)
{
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
DoubleLocklessQueue<OutgoingPacket> queue = m_packetOutboxes[category];
if (m_deliverPackets == false)
{
queue.Enqueue(packet);
queue.Enqueue(packet, highPriority);
return true;
}
@ -449,7 +454,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// queued packets
if (queue.Count > 0)
{
queue.Enqueue(packet);
queue.Enqueue(packet, highPriority);
return true;
}
@ -462,7 +467,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else
{
// Force queue specified or not enough tokens in the bucket, queue this packet
queue.Enqueue(packet);
queue.Enqueue(packet, highPriority);
return true;
}
}
@ -494,7 +499,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_deliverPackets == false) return false;
OutgoingPacket packet = null;
OpenSim.Framework.LocklessQueue<OutgoingPacket> queue;
DoubleLocklessQueue<OutgoingPacket> queue;
TokenBucket bucket;
bool packetSent = false;
ThrottleOutPacketTypeFlags emptyCategories = 0;
@ -534,7 +539,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
catch
{
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
}
if (success)
{
@ -567,7 +572,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else
{
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
emptyCategories |= CategoryToFlag(i);
}
}
@ -724,4 +729,33 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
}
public class DoubleLocklessQueue<T> : OpenSim.Framework.LocklessQueue<T>
{
OpenSim.Framework.LocklessQueue<T> highQueue = new OpenSim.Framework.LocklessQueue<T>();
public override int Count
{
get
{
return base.Count + highQueue.Count;
}
}
public override bool Dequeue(out T item)
{
if (highQueue.Dequeue(out item))
return true;
return base.Dequeue(out item);
}
public void Enqueue(T item, bool highPriority)
{
if (highPriority)
highQueue.Enqueue(item);
else
Enqueue(item);
}
}
}

View File

@ -803,6 +803,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Queue or Send
bool highPriority = false;
if (category != ThrottleOutPacketType.Unknown && (category & ThrottleOutPacketType.HighPriority) != 0)
{
category = (ThrottleOutPacketType)((int)category & 127);
highPriority = true;
}
OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, null);
// If we were not provided a method for handling unacked, use the UDPServer default method
outgoingPacket.UnackedMethod = ((method == null) ? delegate(OutgoingPacket oPacket) { ResendUnacked(oPacket); } : method);
@ -811,7 +819,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// continue to display the deleted object until relog. Therefore, we need to always queue a kill object
// packet so that it isn't sent before a queued update packet.
bool requestQueue = type == PacketType.KillObject;
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue))
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority))
SendPacketFinal(outgoingPacket);
#endregion Queue or Send

View File

@ -376,6 +376,52 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
{
bool defonly = true; // are we only using default textures
IImprovedAssetCache cache = m_scene.RequestModuleInterface<IImprovedAssetCache>();
IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
WearableCacheItem[] wearableCache = null;
// Cache wearable data for teleport.
// Only makes sense if there's a bake module and a cache module
if (bakedModule != null && cache != null)
{
try
{
wearableCache = bakedModule.Get(sp.UUID);
}
catch (Exception)
{
}
if (wearableCache != null)
{
for (int i = 0; i < wearableCache.Length; i++)
{
cache.Cache(wearableCache[i].TextureAsset);
}
}
}
/*
IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
if (invService.GetRootFolder(userID) != null)
{
WearableCacheItem[] wearableCache = null;
if (bakedModule != null)
{
try
{
wearableCache = bakedModule.Get(userID);
appearance.WearableCacheItems = wearableCache;
appearance.WearableCacheItemsDirty = false;
foreach (WearableCacheItem item in wearableCache)
{
appearance.Texture.FaceTextures[item.TextureIndex].TextureID = item.TextureID;
}
}
catch (Exception)
{
}
}
*/
// Process the texture entry
for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
@ -383,9 +429,32 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
int idx = AvatarAppearance.BAKE_INDICES[i];
Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
// if there is no texture entry, skip it
// No face, so lets check our baked service cache, teleport or login.
if (face == null)
continue;
{
if (wearableCache != null)
{
// If we find the an appearance item, set it as the textureentry and the face
WearableCacheItem searchitem = WearableCacheItem.SearchTextureIndex((uint) idx, wearableCache);
if (searchitem != null)
{
sp.Appearance.Texture.FaceTextures[idx] = sp.Appearance.Texture.CreateFace((uint) idx);
sp.Appearance.Texture.FaceTextures[idx].TextureID = searchitem.TextureID;
face = sp.Appearance.Texture.FaceTextures[idx];
}
else
{
// if there is no texture entry and no baked cache, skip it
continue;
}
}
else
{
//No texture entry face and no cache. Skip this face.
continue;
}
}
// m_log.DebugFormat(
// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",

View File

@ -1,260 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using Mono.Addins;
namespace OpenSim.Region.CoreModules.Avatar.Groups
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "GroupsModule")]
public class GroupsModule : ISharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<UUID, GroupMembershipData> m_GroupMap =
new Dictionary<UUID, GroupMembershipData>();
private Dictionary<UUID, IClientAPI> m_ClientMap =
new Dictionary<UUID, IClientAPI>();
private UUID opensimulatorGroupID =
new UUID("00000000-68f9-1111-024e-222222111123");
private List<Scene> m_SceneList = new List<Scene>();
private static GroupMembershipData osGroup =
new GroupMembershipData();
private bool m_Enabled = false;
#region ISharedRegionModule Members
public void Initialise(IConfigSource config)
{
IConfig groupsConfig = config.Configs["Groups"];
if (groupsConfig == null)
{
m_log.Info("[GROUPS]: No configuration found. Using defaults");
}
else
{
m_Enabled = groupsConfig.GetBoolean("Enabled", false);
if (!m_Enabled)
{
m_log.Info("[GROUPS]: Groups disabled in configuration");
return;
}
if (groupsConfig.GetString("Module", "Default") != "Default")
{
m_Enabled = false;
return;
}
}
}
public void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
lock (m_SceneList)
{
if (!m_SceneList.Contains(scene))
{
if (m_SceneList.Count == 0)
{
osGroup.GroupID = opensimulatorGroupID;
osGroup.GroupName = "OpenSimulator Testing";
osGroup.GroupPowers =
(uint)(GroupPowers.AllowLandmark |
GroupPowers.AllowSetHome);
m_GroupMap[opensimulatorGroupID] = osGroup;
}
m_SceneList.Add(scene);
}
}
scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed;
// scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
}
public void RemoveRegion(Scene scene)
{
if (!m_Enabled)
return;
lock (m_SceneList)
{
if (m_SceneList.Contains(scene))
m_SceneList.Remove(scene);
}
scene.EventManager.OnNewClient -= OnNewClient;
scene.EventManager.OnClientClosed -= OnClientClosed;
}
public void RegionLoaded(Scene scene)
{
}
public void PostInitialise()
{
}
public void Close()
{
if (!m_Enabled)
return;
// m_log.Debug("[GROUPS]: Shutting down group module.");
lock (m_ClientMap)
{
m_ClientMap.Clear();
}
lock (m_GroupMap)
{
m_GroupMap.Clear();
}
}
public string Name
{
get { return "GroupsModule"; }
}
public Type ReplaceableInterface
{
get { return null; }
}
#endregion
private void OnNewClient(IClientAPI client)
{
// Subscribe to instant messages
// client.OnInstantMessage += OnInstantMessage;
client.OnAgentDataUpdateRequest += OnAgentDataUpdateRequest;
client.OnUUIDGroupNameRequest += HandleUUIDGroupNameRequest;
lock (m_ClientMap)
{
if (!m_ClientMap.ContainsKey(client.AgentId))
{
m_ClientMap.Add(client.AgentId, client);
}
}
GroupMembershipData[] updateGroups = new GroupMembershipData[1];
updateGroups[0] = osGroup;
client.SendGroupMembership(updateGroups);
}
private void OnAgentDataUpdateRequest(IClientAPI remoteClient,
UUID AgentID, UUID SessionID)
{
UUID ActiveGroupID;
string ActiveGroupName;
ulong ActiveGroupPowers;
string firstname = remoteClient.FirstName;
string lastname = remoteClient.LastName;
string ActiveGroupTitle = "I IZ N0T";
ActiveGroupID = osGroup.GroupID;
ActiveGroupName = osGroup.GroupName;
ActiveGroupPowers = osGroup.GroupPowers;
remoteClient.SendAgentDataUpdate(AgentID, ActiveGroupID, firstname,
lastname, ActiveGroupPowers, ActiveGroupName,
ActiveGroupTitle);
}
// private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
// {
// }
// private void OnGridInstantMessage(GridInstantMessage msg)
// {
// // Trigger the above event handler
// OnInstantMessage(null, msg);
// }
private void HandleUUIDGroupNameRequest(UUID id,IClientAPI remote_client)
{
string groupnamereply = "Unknown";
UUID groupUUID = UUID.Zero;
lock (m_GroupMap)
{
if (m_GroupMap.ContainsKey(id))
{
GroupMembershipData grp = m_GroupMap[id];
groupnamereply = grp.GroupName;
groupUUID = grp.GroupID;
}
}
remote_client.SendGroupNameReply(groupUUID, groupnamereply);
}
private void OnClientClosed(UUID agentID, Scene scene)
{
lock (m_ClientMap)
{
if (m_ClientMap.ContainsKey(agentID))
{
// IClientAPI cli = m_ClientMap[agentID];
// if (cli != null)
// {
// //m_log.Info("[GROUPS]: Removing all reference to groups for " + cli.Name);
// }
// else
// {
// //m_log.Info("[GROUPS]: Removing all reference to groups for " + agentID.ToString());
// }
m_ClientMap.Remove(agentID);
}
}
}
}
}

View File

@ -2398,6 +2398,8 @@ namespace OpenSim.Region.Framework.Scenes
if (pa != null)
pa.PIDActive = false;
RootPart.ScheduleTerseUpdate(); // send a stop information
}
public void rotLookAt(Quaternion target, float strength, float damping)

View File

@ -3751,7 +3751,7 @@ namespace OpenSim.Region.Framework.Scenes
{
ParentGroup.stopMoveToTarget();
ParentGroup.ScheduleGroupForTerseUpdate();
// ParentGroup.ScheduleGroupForTerseUpdate();
//ParentGroup.ScheduleGroupForFullUpdate();
}

View File

@ -68,7 +68,6 @@ namespace OpenSim.Region.Physics.OdePlugin
/// ODE near callback delegate
/// </summary>
private d.NearCallback nearCallback;
private d.NearCallback nearProbeCallback;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<ContactResult> m_contactResults = new List<ContactResult>();
private RayFilterFlags CurrentRayFilter;
@ -78,7 +77,6 @@ namespace OpenSim.Region.Physics.OdePlugin
{
m_scene = pScene;
nearCallback = near;
nearProbeCallback = nearProbe;
ray = d.CreateRay(IntPtr.Zero, 1.0f);
d.GeomSetCategoryBits(ray, 0);
Box = d.CreateBox(IntPtr.Zero, 1.0f, 1.0f, 1.0f);
@ -125,6 +123,24 @@ namespace OpenSim.Region.Physics.OdePlugin
{
if (req.callbackMethod != null)
{
IntPtr geom = IntPtr.Zero;
if (req.actor != null)
{
if (m_scene.haveActor(req.actor))
{
if (req.actor is OdePrim)
geom = ((OdePrim)req.actor).prim_geom;
else if (req.actor is OdeCharacter)
geom = ((OdePrim)req.actor).prim_geom;
}
if (geom == IntPtr.Zero)
{
NoContacts(req);
continue;
}
}
CurrentRayFilter = req.filter;
CurrentMaxCount = req.Count;
@ -188,7 +204,7 @@ namespace OpenSim.Region.Physics.OdePlugin
CollisionContactGeomsPerTest |= (int)d.CONTACTS_UNIMPORTANT;
}
if (req.geom == IntPtr.Zero)
if (geom == IntPtr.Zero)
{
// translate ray filter to Collision flags
catflags = 0;
@ -226,7 +242,7 @@ namespace OpenSim.Region.Physics.OdePlugin
catflags |= CollisionCategories.Space;
d.GeomSetCollideBits(Plane, (uint)catflags);
d.GeomSetCategoryBits(Plane, (uint)catflags);
doPlane(req);
doPlane(req,IntPtr.Zero);
}
else
{
@ -242,12 +258,12 @@ namespace OpenSim.Region.Physics.OdePlugin
if (req.callbackMethod is ProbePlaneCallback)
{
d.GeomSetCollideBits(Plane, (uint)CollisionCategories.All);
doPlane(req);
doPlane(req,geom);
}
else
{
d.GeomSetCollideBits(ray, (uint)CollisionCategories.All);
doGeomRay(req);
doGeomRay(req,geom);
}
}
}
@ -267,6 +283,23 @@ namespace OpenSim.Region.Physics.OdePlugin
/// <param name="req"></param>
///
private void NoContacts(ODERayRequest req)
{
if (req.callbackMethod is RaycastCallback)
{
((RaycastCallback)req.callbackMethod)(false, Vector3.Zero, 0, 0, Vector3.Zero);
return;
}
List<ContactResult> cresult = new List<ContactResult>();
if (req.callbackMethod is RayCallback)
((RayCallback)req.callbackMethod)(cresult);
else if (req.callbackMethod is ProbeBoxCallback)
((ProbeBoxCallback)req.callbackMethod)(cresult);
else if (req.callbackMethod is ProbeSphereCallback)
((ProbeSphereCallback)req.callbackMethod)(cresult);
}
private const RayFilterFlags FilterActiveSpace = RayFilterFlags.agent | RayFilterFlags.physical | RayFilterFlags.LSLPhanton;
// private const RayFilterFlags FilterStaticSpace = RayFilterFlags.water | RayFilterFlags.land | RayFilterFlags.nonphysical | RayFilterFlags.LSLPhanton;
private const RayFilterFlags FilterStaticSpace = RayFilterFlags.water | RayFilterFlags.nonphysical | RayFilterFlags.LSLPhanton;
@ -358,10 +391,10 @@ namespace OpenSim.Region.Physics.OdePlugin
((ProbeSphereCallback)req.callbackMethod)(cresult);
}
private void doPlane(ODERayRequest req)
private void doPlane(ODERayRequest req,IntPtr geom)
{
// Collide tests
if (req.geom == IntPtr.Zero)
if (geom == IntPtr.Zero)
{
if ((CurrentRayFilter & FilterActiveSpace) != 0)
{
@ -375,7 +408,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
d.SpaceCollide2(Plane, req.geom, IntPtr.Zero, nearCallback);
d.SpaceCollide2(Plane, geom, IntPtr.Zero, nearCallback);
}
List<ContactResult> cresult = new List<ContactResult>(m_contactResults.Count);
@ -392,10 +425,10 @@ namespace OpenSim.Region.Physics.OdePlugin
/// Method that actually initiates the raycast with a geom
/// </summary>
/// <param name="req"></param>
private void doGeomRay(ODERayRequest req)
private void doGeomRay(ODERayRequest req, IntPtr geom)
{
// Collide test
d.SpaceCollide2(ray, req.geom, IntPtr.Zero, nearCallback); // still do this to have full AABB pre test
d.SpaceCollide2(ray, geom, IntPtr.Zero, nearCallback); // still do this to have full AABB pre test
if (req.callbackMethod is RaycastCallback)
{
@ -607,156 +640,6 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
private void nearProbe(IntPtr space, IntPtr g1, IntPtr g2)
{
if (g1 == IntPtr.Zero || g1 == g2)
return;
if (m_contactResults.Count >= CurrentMaxCount)
return;
if (d.GeomIsSpace(g1))
{
try
{
d.SpaceCollide2(g1, g2, IntPtr.Zero, nearProbeCallback);
}
catch (Exception e)
{
m_log.WarnFormat("[PHYSICS Ray]: Unable to Space collide test an object: {0}", e.Message);
}
return;
}
int count = 0;
try
{
count = d.CollidePtr(g1, g2, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, d.ContactGeom.unmanagedSizeOf);
}
catch (Exception e)
{
m_log.WarnFormat("[PHYSICS Ray]: Unable to collide test an object: {0}", e.Message);
return;
}
if (count == 0)
return;
uint ID = 0;
PhysicsActor p1 = null;
m_scene.actor_name_map.TryGetValue(g1, out p1);
if (p1 == null)
return;
switch (p1.PhysicsActorType)
{
case (int)ActorTypes.Prim:
RayFilterFlags thisFlags;
if (p1.IsPhysical)
thisFlags = RayFilterFlags.physical;
else
thisFlags = RayFilterFlags.nonphysical;
if (p1.Phantom)
thisFlags |= RayFilterFlags.phantom;
if (p1.IsVolumeDtc)
thisFlags |= RayFilterFlags.volumedtc;
if ((thisFlags & CurrentRayFilter) == 0)
return;
ID = ((OdePrim)p1).LocalID;
break;
case (int)ActorTypes.Agent:
if ((CurrentRayFilter & RayFilterFlags.agent) == 0)
return;
else
ID = ((OdeCharacter)p1).LocalID;
break;
case (int)ActorTypes.Ground:
if ((CurrentRayFilter & RayFilterFlags.land) == 0)
return;
break;
case (int)ActorTypes.Water:
if ((CurrentRayFilter & RayFilterFlags.water) == 0)
return;
break;
default:
break;
}
d.ContactGeom curcontact = new d.ContactGeom();
// closestHit for now only works for meshs, so must do it for others
if ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0)
{
// Loop all contacts, build results.
for (int i = 0; i < count; i++)
{
if (!GetCurContactGeom(i, ref curcontact))
break;
ContactResult collisionresult = new ContactResult();
collisionresult.ConsumerID = ID;
collisionresult.Pos.X = curcontact.pos.X;
collisionresult.Pos.Y = curcontact.pos.Y;
collisionresult.Pos.Z = curcontact.pos.Z;
collisionresult.Depth = curcontact.depth;
collisionresult.Normal.X = curcontact.normal.X;
collisionresult.Normal.Y = curcontact.normal.Y;
collisionresult.Normal.Z = curcontact.normal.Z;
lock (m_contactResults)
{
m_contactResults.Add(collisionresult);
if (m_contactResults.Count >= CurrentMaxCount)
return;
}
}
}
else
{
// keep only closest contact
ContactResult collisionresult = new ContactResult();
collisionresult.ConsumerID = ID;
collisionresult.Depth = float.MaxValue;
for (int i = 0; i < count; i++)
{
if (!GetCurContactGeom(i, ref curcontact))
break;
if (curcontact.depth < collisionresult.Depth)
{
collisionresult.Pos.X = curcontact.pos.X;
collisionresult.Pos.Y = curcontact.pos.Y;
collisionresult.Pos.Z = curcontact.pos.Z;
collisionresult.Depth = curcontact.depth;
collisionresult.Normal.X = curcontact.normal.X;
collisionresult.Normal.Y = curcontact.normal.Y;
collisionresult.Normal.Z = curcontact.normal.Z;
}
}
if (collisionresult.Depth != float.MaxValue)
{
lock (m_contactResults)
m_contactResults.Add(collisionresult);
}
}
}
/// <summary>
/// Dereference the creator scene so that it can be garbage collected if needed.
/// </summary>
@ -788,7 +671,7 @@ namespace OpenSim.Region.Physics.OdePlugin
public struct ODERayRequest
{
public IntPtr geom;
public PhysicsActor actor;
public Vector3 Origin;
public Vector3 Normal;
public int Count;

View File

@ -2580,7 +2580,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (retMethod != null)
{
ODERayRequest req = new ODERayRequest();
req.geom = IntPtr.Zero;
req.actor = null;
req.callbackMethod = retMethod;
req.length = length;
req.Normal = direction;
@ -2597,7 +2597,7 @@ namespace OpenSim.Region.Physics.OdePlugin
if (retMethod != null)
{
ODERayRequest req = new ODERayRequest();
req.geom = IntPtr.Zero;
req.actor = null;
req.callbackMethod = retMethod;
req.length = length;
req.Normal = direction;
@ -2625,7 +2625,7 @@ namespace OpenSim.Region.Physics.OdePlugin
};
ODERayRequest req = new ODERayRequest();
req.geom = IntPtr.Zero;
req.actor = null;
req.callbackMethod = retMethod;
req.length = length;
req.Normal = direction;
@ -2663,7 +2663,7 @@ namespace OpenSim.Region.Physics.OdePlugin
};
ODERayRequest req = new ODERayRequest();
req.geom = IntPtr.Zero;
req.actor = null;
req.callbackMethod = retMethod;
req.length = length;
req.Normal = direction;
@ -2710,7 +2710,7 @@ namespace OpenSim.Region.Physics.OdePlugin
};
ODERayRequest req = new ODERayRequest();
req.geom = geom;
req.actor = actor;
req.callbackMethod = retMethod;
req.length = length;
req.Normal = direction;
@ -2745,7 +2745,7 @@ namespace OpenSim.Region.Physics.OdePlugin
};
ODERayRequest req = new ODERayRequest();
req.geom = IntPtr.Zero;
req.actor = null;
req.callbackMethod = retMethod;
req.Normal = size;
req.Origin = position;
@ -2777,7 +2777,7 @@ namespace OpenSim.Region.Physics.OdePlugin
};
ODERayRequest req = new ODERayRequest();
req.geom = IntPtr.Zero;
req.actor = null;
req.callbackMethod = retMethod;
req.length = radius;
req.Origin = position;
@ -2819,7 +2819,7 @@ namespace OpenSim.Region.Physics.OdePlugin
};
ODERayRequest req = new ODERayRequest();
req.geom = geom;
req.actor = null;
req.callbackMethod = retMethod;
req.length = plane.W;
req.Normal.X = plane.X;

View File

@ -2331,9 +2331,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else
{
part.OffsetPosition = (Vector3)toPos;
SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true;
parent.ScheduleGroupForTerseUpdate();
// SceneObjectGroup parent = part.ParentGroup;
// parent.HasGroupChanged = true;
// parent.ScheduleGroupForTerseUpdate();
part.ScheduleTerseUpdate();
}
}
@ -8356,9 +8357,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else
{
part.OffsetPosition = currentPosition;
SceneObjectGroup parent = part.ParentGroup;
parent.HasGroupChanged = true;
parent.ScheduleGroupForTerseUpdate();
// SceneObjectGroup parent = part.ParentGroup;
// parent.HasGroupChanged = true;
// parent.ScheduleGroupForTerseUpdate();
part.ScheduleTerseUpdate();
}
}
}