diff options
author | Adam Johnson | 2007-12-28 08:51:39 +0000 |
---|---|---|
committer | Adam Johnson | 2007-12-28 08:51:39 +0000 |
commit | 79496381fc68cbd30ff5a95d1f05fcb18c6b1a93 (patch) | |
tree | 036414391293354da62fe9eac1895483111480a3 /OpenSim/Region/Environment/Scenes | |
parent | * Moved PrimitiveBaseShape subclasses into factory methods - the subclassing ... (diff) | |
download | opensim-SC-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.zip opensim-SC-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.tar.gz opensim-SC-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.tar.bz2 opensim-SC-79496381fc68cbd30ff5a95d1f05fcb18c6b1a93.tar.xz |
Patch from Johan: LibSL updated to the latest revision (1568) and all packets are now
recycled to improve performance and memory usage.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
4 files changed, 53 insertions, 45 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 999b70f..647fbf4 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -29,6 +29,8 @@ using System.Collections.Generic; | |||
29 | using libsecondlife; | 29 | using libsecondlife; |
30 | using libsecondlife.Packets; | 30 | using libsecondlife.Packets; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Framework.UserManagement; | ||
33 | using OpenSim.Framework.Console; | ||
32 | 34 | ||
33 | namespace OpenSim.Region.Environment.Scenes | 35 | namespace OpenSim.Region.Environment.Scenes |
34 | { | 36 | { |
@@ -164,7 +166,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
164 | List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>(); | 166 | List<AvatarPickerAvatar> AvatarResponses = new List<AvatarPickerAvatar>(); |
165 | AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query); | 167 | AvatarResponses = CommsManager.GenerateAgentPickerRequestResponse(RequestID, query); |
166 | 168 | ||
167 | AvatarPickerReplyPacket replyPacket = new AvatarPickerReplyPacket(); | 169 | AvatarPickerReplyPacket replyPacket = (AvatarPickerReplyPacket) PacketPool.Instance.GetPacket(PacketType.AvatarPickerReply); |
170 | // TODO: don't create new blocks if recycling an old packet | ||
171 | |||
168 | AvatarPickerReplyPacket.DataBlock[] searchData = | 172 | AvatarPickerReplyPacket.DataBlock[] searchData = |
169 | new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count]; | 173 | new AvatarPickerReplyPacket.DataBlock[AvatarResponses.Count]; |
170 | AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); | 174 | AvatarPickerReplyPacket.AgentDataBlock agentData = new AvatarPickerReplyPacket.AgentDataBlock(); |
@@ -192,4 +196,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
192 | client.SendAvatarPickerReply(replyPacket); | 196 | client.SendAvatarPickerReply(replyPacket); |
193 | } | 197 | } |
194 | } | 198 | } |
195 | } \ No newline at end of file | 199 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index d8c5255..4657264 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -474,7 +474,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
474 | if (!avatar.IsChildAgent) | 474 | if (!avatar.IsChildAgent) |
475 | avatar.ControllingClient.Kick("The simulator is going down."); | 475 | avatar.ControllingClient.Kick("The simulator is going down."); |
476 | 476 | ||
477 | avatar.ControllingClient.OutPacket(new DisableSimulatorPacket(), | 477 | avatar.ControllingClient.OutPacket(PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator), |
478 | ThrottleOutPacketType.Task); | 478 | ThrottleOutPacketType.Task); |
479 | }); | 479 | }); |
480 | 480 | ||
@@ -1016,43 +1016,42 @@ namespace OpenSim.Region.Environment.Scenes | |||
1016 | // It's wrong many times though. | 1016 | // It's wrong many times though. |
1017 | 1017 | ||
1018 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); | 1018 | LLVector3 pos = GetNewRezLocation(RayStart, RayEnd, RayTargetID, rot, bypassRaycast, RayEndIsIntersection); |
1019 | |||
1020 | |||
1021 | |||
1019 | 1022 | ||
1020 | if (PermissionsMngr.CanRezObject(ownerID, pos)) | 1023 | if (PermissionsMngr.CanRezObject(ownerID, pos)) |
1021 | { | 1024 | { |
1022 | // rez ON the ground, not IN the ground | ||
1023 | pos.Z += 0.25F; | ||
1024 | |||
1025 | AddNewPrim(ownerID, pos, rot, shape); | ||
1026 | } | ||
1027 | } | ||
1028 | 1025 | ||
1029 | public virtual void AddNewPrim(LLUUID ownerID, LLVector3 pos, LLQuaternion rot, PrimitiveBaseShape shape) | 1026 | // rez ON the ground, not IN the ground |
1030 | { | 1027 | pos.Z += 0.25F; |
1031 | SceneObjectGroup sceneOb = | 1028 | |
1032 | new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); | 1029 | |
1033 | 1030 | SceneObjectGroup sceneOb = | |
1034 | AddEntity(sceneOb); | 1031 | new SceneObjectGroup(this, m_regionHandle, ownerID, PrimIDAllocate(), pos, rot, shape); |
1035 | SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); | 1032 | AddEntity(sceneOb); |
1036 | // if grass or tree, make phantom | 1033 | SceneObjectPart rootPart = sceneOb.GetChildPart(sceneOb.UUID); |
1037 | //rootPart.ApplySanePermissions(); | 1034 | // if grass or tree, make phantom |
1038 | if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) | 1035 | //rootPart.ApplySanePermissions(); |
1039 | { | 1036 | if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255) || (rootPart.Shape.PCode == 111)) |
1040 | rootPart.AddFlag(LLObject.ObjectFlags.Phantom); | 1037 | { |
1041 | //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; | 1038 | rootPart.AddFlag(LLObject.ObjectFlags.Phantom); |
1042 | } | 1039 | //rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom; |
1043 | // if not phantom, add to physics | 1040 | } |
1044 | bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); | 1041 | // if not phantom, add to physics |
1045 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) | 1042 | bool UsePhysics = (((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) > 0) && m_physicalPrim); |
1046 | { | 1043 | if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) |
1047 | rootPart.PhysActor = | 1044 | { |
1048 | PhysicsScene.AddPrimShape( | 1045 | rootPart.PhysActor = |
1049 | rootPart.Name, | 1046 | PhysicsScene.AddPrimShape( |
1050 | rootPart.Shape, | 1047 | rootPart.Name, |
1051 | new PhysicsVector(pos.X, pos.Y, pos.Z), | 1048 | rootPart.Shape, |
1052 | new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), | 1049 | new PhysicsVector(pos.X, pos.Y, pos.Z), |
1053 | new Quaternion(), UsePhysics); | 1050 | new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), |
1054 | // subscribe to physics events. | 1051 | new Quaternion(), UsePhysics); |
1055 | rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | 1052 | // subscribe to physics events. |
1053 | rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | ||
1054 | } | ||
1056 | } | 1055 | } |
1057 | } | 1056 | } |
1058 | 1057 | ||
@@ -1499,7 +1498,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1499 | m_innerScene.removeUserCount(true); | 1498 | m_innerScene.removeUserCount(true); |
1500 | } | 1499 | } |
1501 | // Tell a single agent to disconnect from the region. | 1500 | // Tell a single agent to disconnect from the region. |
1502 | DisableSimulatorPacket disable = new DisableSimulatorPacket(); | 1501 | libsecondlife.Packets.DisableSimulatorPacket disable = (libsecondlife.Packets.DisableSimulatorPacket) PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator); |
1503 | presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); | 1502 | presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); |
1504 | } | 1503 | } |
1505 | } | 1504 | } |
@@ -2246,4 +2245,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
2246 | 2245 | ||
2247 | #endregion | 2246 | #endregion |
2248 | } | 2247 | } |
2249 | } \ No newline at end of file | 2248 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 5b74c9b..94b6797 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -74,13 +74,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
74 | { | 74 | { |
75 | get { return m_rootPart.RotationOffset; } | 75 | get { return m_rootPart.RotationOffset; } |
76 | } | 76 | } |
77 | |||
78 | public LLUUID GroupID | 77 | public LLUUID GroupID |
79 | { | 78 | { |
80 | get { return m_rootPart.GroupID; } | 79 | get { return m_rootPart.GroupID; } |
81 | set { m_rootPart.GroupID = value; } | 80 | set { m_rootPart.GroupID = value; } |
82 | } | 81 | } |
83 | |||
84 | /// <summary> | 82 | /// <summary> |
85 | /// | 83 | /// |
86 | /// </summary> | 84 | /// </summary> |
@@ -638,7 +636,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
638 | public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags) | 636 | public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, LLUUID AgentID, uint RequestFlags) |
639 | { | 637 | { |
640 | //RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags); | 638 | //RootPart.ServiceObjectPropertiesFamilyRequest(remoteClient, AgentID, RequestFlags); |
641 | ObjectPropertiesFamilyPacket objPropFamilyPack = new ObjectPropertiesFamilyPacket(); | 639 | ObjectPropertiesFamilyPacket objPropFamilyPack = (ObjectPropertiesFamilyPacket) PacketPool.Instance.GetPacket(PacketType.ObjectPropertiesFamily); |
640 | // TODO: don't create new blocks if recycling an old packet | ||
641 | |||
642 | ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock(); | 642 | ObjectPropertiesFamilyPacket.ObjectDataBlock objPropDB = new ObjectPropertiesFamilyPacket.ObjectDataBlock(); |
643 | objPropDB.RequestFlags = RequestFlags; | 643 | objPropDB.RequestFlags = RequestFlags; |
644 | objPropDB.ObjectID = RootPart.UUID; | 644 | objPropDB.ObjectID = RootPart.UUID; |
@@ -1045,7 +1045,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1045 | /// <param name="client"></param> | 1045 | /// <param name="client"></param> |
1046 | public void GetProperites(IClientAPI client) | 1046 | public void GetProperites(IClientAPI client) |
1047 | { | 1047 | { |
1048 | ObjectPropertiesPacket proper = new ObjectPropertiesPacket(); | 1048 | ObjectPropertiesPacket proper = (ObjectPropertiesPacket) PacketPool.Instance.GetPacket(PacketType.ObjectProperties); |
1049 | // TODO: don't create new blocks if recycling an old packet | ||
1050 | |||
1049 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; | 1051 | proper.ObjectData = new ObjectPropertiesPacket.ObjectDataBlock[1]; |
1050 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); | 1052 | proper.ObjectData[0] = new ObjectPropertiesPacket.ObjectDataBlock(); |
1051 | proper.ObjectData[0].ItemID = LLUUID.Zero; | 1053 | proper.ObjectData[0].ItemID = LLUUID.Zero; |
@@ -1297,6 +1299,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1297 | m_rootPart.PhysActor.IsPhysical); | 1299 | m_rootPart.PhysActor.IsPhysical); |
1298 | bool UsePhysics = ((m_rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); | 1300 | bool UsePhysics = ((m_rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Physics) != 0); |
1299 | m_rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); | 1301 | m_rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); |
1302 | |||
1300 | } | 1303 | } |
1301 | } | 1304 | } |
1302 | 1305 | ||
@@ -1737,4 +1740,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
1737 | m_rootPart.ApplyPhysics(); | 1740 | m_rootPart.ApplyPhysics(); |
1738 | } | 1741 | } |
1739 | } | 1742 | } |
1740 | } \ No newline at end of file | 1743 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index b183c04..5033965 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | |||
@@ -83,7 +83,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
83 | private void statsHeartBeat(object sender, EventArgs e) | 83 | private void statsHeartBeat(object sender, EventArgs e) |
84 | { | 84 | { |
85 | m_report.Enabled = false; | 85 | m_report.Enabled = false; |
86 | SimStatsPacket statpack = new SimStatsPacket(); | 86 | SimStatsPacket statpack = (SimStatsPacket) PacketPool.Instance.GetPacket(PacketType.SimStats); |
87 | // TODO: don't create new blocks if recycling an old packet | ||
88 | |||
87 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11]; | 89 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11]; |
88 | statpack.Region = new SimStatsPacket.RegionBlock(); | 90 | statpack.Region = new SimStatsPacket.RegionBlock(); |
89 | statpack.Region.RegionX = ReportingRegion.RegionLocX; | 91 | statpack.Region.RegionX = ReportingRegion.RegionLocX; |
@@ -241,4 +243,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
241 | m_unAckedBytes += numBytes; | 243 | m_unAckedBytes += numBytes; |
242 | } | 244 | } |
243 | } | 245 | } |
244 | } \ No newline at end of file | 246 | } |