diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/EventManager.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 30 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 120 |
4 files changed, 125 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 1018b54..6e8eb91 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -743,7 +743,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
743 | public event OnIncomingSceneObjectDelegate OnIncomingSceneObject; | 743 | public event OnIncomingSceneObjectDelegate OnIncomingSceneObject; |
744 | public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so); | 744 | public delegate void OnIncomingSceneObjectDelegate(SceneObjectGroup so); |
745 | 745 | ||
746 | public delegate void NewInventoryItemUploadComplete(UUID avatarID, UUID assetID, string name, int userlevel); | 746 | public delegate void NewInventoryItemUploadComplete(UUID avatarID, AssetType type, UUID assetID, string name, int userlevel); |
747 | 747 | ||
748 | public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; | 748 | public event NewInventoryItemUploadComplete OnNewInventoryItemUploadComplete; |
749 | 749 | ||
@@ -2172,7 +2172,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2172 | } | 2172 | } |
2173 | } | 2173 | } |
2174 | 2174 | ||
2175 | public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, UUID AssetID, String AssetName, int userlevel) | 2175 | public void TriggerOnNewInventoryItemUploadComplete(UUID agentID, AssetType type, UUID AssetID, String AssetName, int userlevel) |
2176 | { | 2176 | { |
2177 | NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete; | 2177 | NewInventoryItemUploadComplete handlerNewInventoryItemUpdateComplete = OnNewInventoryItemUploadComplete; |
2178 | if (handlerNewInventoryItemUpdateComplete != null) | 2178 | if (handlerNewInventoryItemUpdateComplete != null) |
@@ -2181,7 +2181,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2181 | { | 2181 | { |
2182 | try | 2182 | try |
2183 | { | 2183 | { |
2184 | d(agentID, AssetID, AssetName, userlevel); | 2184 | d(agentID, type, AssetID, AssetName, userlevel); |
2185 | } | 2185 | } |
2186 | catch (Exception e) | 2186 | catch (Exception e) |
2187 | { | 2187 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 70018c8..8f6073a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -139,7 +139,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
139 | { | 139 | { |
140 | userlevel = 1; | 140 | userlevel = 1; |
141 | } | 141 | } |
142 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); | 142 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); |
143 | 143 | ||
144 | return true; | 144 | return true; |
145 | } | 145 | } |
@@ -178,7 +178,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
178 | { | 178 | { |
179 | userlevel = 1; | 179 | userlevel = 1; |
180 | } | 180 | } |
181 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); | 181 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, (AssetType)item.AssetType, item.AssetID, item.Name, userlevel); |
182 | 182 | ||
183 | if (originalFolder != UUID.Zero) | 183 | if (originalFolder != UUID.Zero) |
184 | { | 184 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ce6415a..421cb08 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -416,6 +416,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
416 | void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args) | 416 | void ProcessViewerEffect(IClientAPI remoteClient, List<ViewerEffectEventHandlerArg> args) |
417 | { | 417 | { |
418 | // TODO: don't create new blocks if recycling an old packet | 418 | // TODO: don't create new blocks if recycling an old packet |
419 | bool discardableEffects = true; | ||
419 | ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count]; | 420 | ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count]; |
420 | for (int i = 0; i < args.Count; i++) | 421 | for (int i = 0; i < args.Count; i++) |
421 | { | 422 | { |
@@ -427,17 +428,34 @@ namespace OpenSim.Region.Framework.Scenes | |||
427 | effect.Type = args[i].Type; | 428 | effect.Type = args[i].Type; |
428 | effect.TypeData = args[i].TypeData; | 429 | effect.TypeData = args[i].TypeData; |
429 | effectBlockArray[i] = effect; | 430 | effectBlockArray[i] = effect; |
431 | |||
432 | if ((EffectType)effect.Type != EffectType.LookAt && (EffectType)effect.Type != EffectType.Beam) | ||
433 | discardableEffects = false; | ||
434 | |||
435 | //m_log.DebugFormat("[YYY]: VE {0} {1} {2}", effect.AgentID, effect.Duration, (EffectType)effect.Type); | ||
430 | } | 436 | } |
431 | 437 | ||
432 | ForEachClient( | 438 | ForEachScenePresence(sp => |
433 | delegate(IClientAPI client) | ||
434 | { | 439 | { |
435 | if (client.AgentId != remoteClient.AgentId) | 440 | if (sp.ControllingClient.AgentId != remoteClient.AgentId) |
436 | client.SendViewerEffect(effectBlockArray); | 441 | { |
437 | } | 442 | if (!discardableEffects || |
438 | ); | 443 | (discardableEffects && ShouldSendDiscardableEffect(remoteClient, sp))) |
444 | { | ||
445 | //m_log.DebugFormat("[YYY]: Sending to {0}", sp.UUID); | ||
446 | sp.ControllingClient.SendViewerEffect(effectBlockArray); | ||
447 | } | ||
448 | //else | ||
449 | // m_log.DebugFormat("[YYY]: Not sending to {0}", sp.UUID); | ||
450 | } | ||
451 | }); | ||
439 | } | 452 | } |
440 | 453 | ||
454 | private bool ShouldSendDiscardableEffect(IClientAPI thisClient, ScenePresence other) | ||
455 | { | ||
456 | return Vector3.Distance(other.CameraPosition, thisClient.SceneAgent.AbsolutePosition) < 10; | ||
457 | } | ||
458 | |||
441 | private class DescendentsRequestData | 459 | private class DescendentsRequestData |
442 | { | 460 | { |
443 | public IClientAPI RemoteClient; | 461 | public IClientAPI RemoteClient; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6e4ac98..1225c2e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -142,6 +142,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
142 | private Vector3 m_lastVelocity; | 142 | private Vector3 m_lastVelocity; |
143 | private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); | 143 | private Vector3 m_lastSize = new Vector3(0.45f,0.6f,1.9f); |
144 | 144 | ||
145 | private bool m_followCamAuto = false; | ||
146 | |||
145 | 147 | ||
146 | private Vector3? m_forceToApply; | 148 | private Vector3? m_forceToApply; |
147 | private int m_userFlags; | 149 | private int m_userFlags; |
@@ -874,6 +876,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
874 | { | 876 | { |
875 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; | 877 | ControllingClient.OnCompleteMovementToRegion += CompleteMovement; |
876 | ControllingClient.OnAgentUpdate += HandleAgentUpdate; | 878 | ControllingClient.OnAgentUpdate += HandleAgentUpdate; |
879 | ControllingClient.OnAgentCameraUpdate += HandleAgentCamerasUpdate; | ||
877 | ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; | 880 | ControllingClient.OnAgentRequestSit += HandleAgentRequestSit; |
878 | ControllingClient.OnAgentSit += HandleAgentSit; | 881 | ControllingClient.OnAgentSit += HandleAgentSit; |
879 | ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; | 882 | ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; |
@@ -1306,7 +1309,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
1306 | 1309 | ||
1307 | public void StopFlying() | 1310 | public void StopFlying() |
1308 | { | 1311 | { |
1309 | ControllingClient.StopFlying(this); | 1312 | Vector3 pos = AbsolutePosition; |
1313 | if (Appearance.AvatarHeight != 127.0f) | ||
1314 | pos += new Vector3(0f, 0f, (Appearance.AvatarHeight / 6f)); | ||
1315 | else | ||
1316 | pos += new Vector3(0f, 0f, (1.56f / 6f)); | ||
1317 | |||
1318 | AbsolutePosition = pos; | ||
1319 | |||
1320 | // attach a suitable collision plane regardless of the actual situation to force the LLClient to land. | ||
1321 | // Collision plane below the avatar's position a 6th of the avatar's height is suitable. | ||
1322 | // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a | ||
1323 | // certain amount.. because the LLClient wouldn't land in that situation anyway. | ||
1324 | |||
1325 | // why are we still testing for this really old height value default??? | ||
1326 | if (Appearance.AvatarHeight != 127.0f) | ||
1327 | CollisionPlane = new Vector4(0, 0, 0, pos.Z - Appearance.AvatarHeight / 6f); | ||
1328 | else | ||
1329 | CollisionPlane = new Vector4(0, 0, 0, pos.Z - (1.56f / 6f)); | ||
1330 | |||
1331 | ControllingClient.SendAgentTerseUpdate(this); | ||
1310 | } | 1332 | } |
1311 | 1333 | ||
1312 | /// <summary> | 1334 | /// <summary> |
@@ -1662,9 +1684,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1662 | /// </summary> | 1684 | /// </summary> |
1663 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 1685 | public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
1664 | { | 1686 | { |
1665 | // m_log.DebugFormat( | 1687 | //m_log.DebugFormat( |
1666 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", | 1688 | // "[SCENE PRESENCE]: In {0} received agent update from {1}, flags {2}", |
1667 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); | 1689 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); |
1668 | 1690 | ||
1669 | if (IsChildAgent) | 1691 | if (IsChildAgent) |
1670 | { | 1692 | { |
@@ -1672,10 +1694,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1672 | return; | 1694 | return; |
1673 | } | 1695 | } |
1674 | 1696 | ||
1675 | ++m_movementUpdateCount; | ||
1676 | if (m_movementUpdateCount < 1) | ||
1677 | m_movementUpdateCount = 1; | ||
1678 | |||
1679 | #region Sanity Checking | 1697 | #region Sanity Checking |
1680 | 1698 | ||
1681 | // This is irritating. Really. | 1699 | // This is irritating. Really. |
@@ -1706,21 +1724,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1706 | 1724 | ||
1707 | AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; | 1725 | AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; |
1708 | 1726 | ||
1709 | // Camera location in world. We'll need to raytrace | ||
1710 | // from this location from time to time. | ||
1711 | CameraPosition = agentData.CameraCenter; | ||
1712 | if (Vector3.Distance(m_lastCameraPosition, CameraPosition) >= Scene.RootReprioritizationDistance) | ||
1713 | { | ||
1714 | ReprioritizeUpdates(); | ||
1715 | m_lastCameraPosition = CameraPosition; | ||
1716 | } | ||
1717 | |||
1718 | // Use these three vectors to figure out what the agent is looking at | ||
1719 | // Convert it to a Matrix and/or Quaternion | ||
1720 | CameraAtAxis = agentData.CameraAtAxis; | ||
1721 | CameraLeftAxis = agentData.CameraLeftAxis; | ||
1722 | CameraUpAxis = agentData.CameraUpAxis; | ||
1723 | |||
1724 | // The Agent's Draw distance setting | 1727 | // The Agent's Draw distance setting |
1725 | // When we get to the point of re-computing neighbors everytime this | 1728 | // When we get to the point of re-computing neighbors everytime this |
1726 | // changes, then start using the agent's drawdistance rather than the | 1729 | // changes, then start using the agent's drawdistance rather than the |
@@ -2005,10 +2008,79 @@ namespace OpenSim.Region.Framework.Scenes | |||
2005 | SendControlsToScripts(flagsForScripts); | 2008 | SendControlsToScripts(flagsForScripts); |
2006 | } | 2009 | } |
2007 | 2010 | ||
2011 | // We need to send this back to the client in order to see the edit beams | ||
2012 | if ((State & (uint)AgentState.Editing) != 0) | ||
2013 | ControllingClient.SendAgentTerseUpdate(this); | ||
2014 | |||
2008 | m_scene.EventManager.TriggerOnClientMovement(this); | 2015 | m_scene.EventManager.TriggerOnClientMovement(this); |
2009 | TriggerScenePresenceUpdated(); | ||
2010 | } | 2016 | } |
2011 | 2017 | ||
2018 | |||
2019 | /// <summary> | ||
2020 | /// This is the event handler for client cameras. If a client is moving, or moving the camera, this event is triggering. | ||
2021 | /// </summary> | ||
2022 | private void HandleAgentCamerasUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | ||
2023 | { | ||
2024 | //m_log.DebugFormat( | ||
2025 | // "[SCENE PRESENCE]: In {0} received agent camera update from {1}, flags {2}", | ||
2026 | // Scene.RegionInfo.RegionName, remoteClient.Name, (AgentManager.ControlFlags)agentData.ControlFlags); | ||
2027 | |||
2028 | if (IsChildAgent) | ||
2029 | { | ||
2030 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | ||
2031 | return; | ||
2032 | } | ||
2033 | |||
2034 | ++m_movementUpdateCount; | ||
2035 | if (m_movementUpdateCount < 1) | ||
2036 | m_movementUpdateCount = 1; | ||
2037 | |||
2038 | |||
2039 | AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; | ||
2040 | |||
2041 | // Camera location in world. We'll need to raytrace | ||
2042 | // from this location from time to time. | ||
2043 | CameraPosition = agentData.CameraCenter; | ||
2044 | if (Vector3.Distance(m_lastCameraPosition, CameraPosition) >= Scene.RootReprioritizationDistance) | ||
2045 | { | ||
2046 | ReprioritizeUpdates(); | ||
2047 | m_lastCameraPosition = CameraPosition; | ||
2048 | } | ||
2049 | |||
2050 | // Use these three vectors to figure out what the agent is looking at | ||
2051 | // Convert it to a Matrix and/or Quaternion | ||
2052 | CameraAtAxis = agentData.CameraAtAxis; | ||
2053 | CameraLeftAxis = agentData.CameraLeftAxis; | ||
2054 | CameraUpAxis = agentData.CameraUpAxis; | ||
2055 | |||
2056 | // The Agent's Draw distance setting | ||
2057 | // When we get to the point of re-computing neighbors everytime this | ||
2058 | // changes, then start using the agent's drawdistance rather than the | ||
2059 | // region's draw distance. | ||
2060 | // DrawDistance = agentData.Far; | ||
2061 | DrawDistance = Scene.DefaultDrawDistance; | ||
2062 | |||
2063 | // Check if Client has camera in 'follow cam' or 'build' mode. | ||
2064 | Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); | ||
2065 | |||
2066 | m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f) | ||
2067 | && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false; | ||
2068 | |||
2069 | |||
2070 | //m_log.DebugFormat("[FollowCam]: {0}", m_followCamAuto); | ||
2071 | // Raycast from the avatar's head to the camera to see if there's anything blocking the view | ||
2072 | if ((m_movementUpdateCount % NumMovementsBetweenRayCast) == 0 && m_scene.PhysicsScene.SupportsRayCast()) | ||
2073 | { | ||
2074 | if (m_followCamAuto) | ||
2075 | { | ||
2076 | Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; | ||
2077 | m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback); | ||
2078 | } | ||
2079 | } | ||
2080 | |||
2081 | TriggerScenePresenceUpdated(); | ||
2082 | } | ||
2083 | |||
2012 | /// <summary> | 2084 | /// <summary> |
2013 | /// Calculate an update to move the presence to the set target. | 2085 | /// Calculate an update to move the presence to the set target. |
2014 | /// </summary> | 2086 | /// </summary> |