diff options
author | Teravus Ovares | 2008-02-20 00:08:04 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-20 00:08:04 +0000 |
commit | 932a1321167814ab13a21121a9b9a8bf2eca1641 (patch) | |
tree | 94de5092a91d5461eab216942ea205b0a6620eb2 /OpenSim/Region/Environment/Scenes | |
parent | Doc correction (diff) | |
download | opensim-SC_OLD-932a1321167814ab13a21121a9b9a8bf2eca1641.zip opensim-SC_OLD-932a1321167814ab13a21121a9b9a8bf2eca1641.tar.gz opensim-SC_OLD-932a1321167814ab13a21121a9b9a8bf2eca1641.tar.bz2 opensim-SC_OLD-932a1321167814ab13a21121a9b9a8bf2eca1641.tar.xz |
* Made a quickupdate method to run through only entities that have scheduled themselves for updates looking for changes. This runs 10 times a second.
* Set the massively slow UpdateEntities method to run every 2 seconds instead of 10 times a second. This method runs through *all* of the entities can calls the virtual update().
* Documented some of the code in the scene.Update method.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 3 |
4 files changed, 55 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index 57b8ae7..38bcb03 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -62,6 +62,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
62 | protected RegionInfo m_regInfo; | 62 | protected RegionInfo m_regInfo; |
63 | protected Scene m_parentScene; | 63 | protected Scene m_parentScene; |
64 | protected PermissionManager PermissionsMngr; | 64 | protected PermissionManager PermissionsMngr; |
65 | protected List<EntityBase> m_updateList = new List<EntityBase>(); | ||
65 | protected int m_numRootAgents = 0; | 66 | protected int m_numRootAgents = 0; |
66 | protected int m_numPrim = 0; | 67 | protected int m_numPrim = 0; |
67 | protected int m_numChildAgents = 0; | 68 | protected int m_numChildAgents = 0; |
@@ -146,6 +147,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
146 | } | 147 | } |
147 | } | 148 | } |
148 | 149 | ||
150 | internal void UpdatePresences() | ||
151 | { | ||
152 | List<ScenePresence> updateScenePresences = GetScenePresences(); | ||
153 | foreach (ScenePresence pres in updateScenePresences) | ||
154 | { | ||
155 | pres.Update(); | ||
156 | } | ||
157 | } | ||
158 | |||
149 | internal float UpdatePhysics(double elapsed) | 159 | internal float UpdatePhysics(double elapsed) |
150 | { | 160 | { |
151 | lock (m_syncRoot) | 161 | lock (m_syncRoot) |
@@ -194,6 +204,29 @@ namespace OpenSim.Region.Environment.Scenes | |||
194 | } | 204 | } |
195 | } | 205 | } |
196 | 206 | ||
207 | internal void AddToUpdateList(EntityBase obj) | ||
208 | { | ||
209 | lock (m_updateList) | ||
210 | { | ||
211 | if (!m_updateList.Contains(obj)) | ||
212 | { | ||
213 | m_updateList.Add(obj); | ||
214 | } | ||
215 | } | ||
216 | } | ||
217 | |||
218 | internal void ProcessUpdates() | ||
219 | { | ||
220 | lock (m_updateList) | ||
221 | { | ||
222 | for (int i = 0; i < m_updateList.Count; i++) | ||
223 | { | ||
224 | m_updateList[i].Update(); | ||
225 | } | ||
226 | m_updateList.Clear(); | ||
227 | } | ||
228 | } | ||
229 | |||
197 | public void AddPhysicalPrim(int number) | 230 | public void AddPhysicalPrim(int number) |
198 | { | 231 | { |
199 | m_physicalPrim++; | 232 | m_physicalPrim++; |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 7af3f5b..36e98cf 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -120,7 +120,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
120 | 120 | ||
121 | private int m_update_physics = 1; | 121 | private int m_update_physics = 1; |
122 | private int m_update_entitymovement = 1; | 122 | private int m_update_entitymovement = 1; |
123 | private int m_update_entities = 1; | 123 | private int m_update_entities = 20; // Run through all objects checking for updates |
124 | private int m_update_entitiesquick = 1; // Run through objects that have scheduled updates checking for updates | ||
125 | private int m_update_presences = 1; // Update scene presence movements | ||
124 | private int m_update_events = 1; | 126 | private int m_update_events = 1; |
125 | private int m_update_backup = 200; | 127 | private int m_update_backup = 200; |
126 | private int m_update_terrain = 50; | 128 | private int m_update_terrain = 50; |
@@ -706,9 +708,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
706 | physicsMS += physicsMS2; | 708 | physicsMS += physicsMS2; |
707 | 709 | ||
708 | otherMS = System.Environment.TickCount; | 710 | otherMS = System.Environment.TickCount; |
711 | // run through all entities looking for updates (slow) | ||
709 | if (m_frame % m_update_entities == 0) | 712 | if (m_frame % m_update_entities == 0) |
710 | m_innerScene.UpdateEntities(); | 713 | m_innerScene.UpdateEntities(); |
711 | 714 | ||
715 | // run through entities that have scheduled themselves for | ||
716 | // updates looking for updates(faster) | ||
717 | if (m_frame % m_update_entitiesquick == 0) | ||
718 | m_innerScene.ProcessUpdates(); | ||
719 | |||
720 | // Run through scenepresences looking for updates | ||
721 | if (m_frame % m_update_presences == 0) | ||
722 | m_innerScene.UpdatePresences(); | ||
723 | |||
712 | if (m_frame % m_update_events == 0) | 724 | if (m_frame % m_update_events == 0) |
713 | UpdateEvents(); | 725 | UpdateEvents(); |
714 | 726 | ||
@@ -1167,6 +1179,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1167 | } | 1179 | } |
1168 | // if not phantom, add to physics | 1180 | // if not phantom, add to physics |
1169 | sceneOb.ApplyPhysics(m_physicalPrim); | 1181 | sceneOb.ApplyPhysics(m_physicalPrim); |
1182 | m_innerScene.AddToUpdateList(sceneOb); | ||
1170 | 1183 | ||
1171 | return sceneOb; | 1184 | return sceneOb; |
1172 | } | 1185 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 519858b..91b9a61 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -765,6 +765,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
765 | } | 765 | } |
766 | } | 766 | } |
767 | 767 | ||
768 | public void QueueForUpdateCheck() | ||
769 | { | ||
770 | m_scene.m_innerScene.AddToUpdateList(this); | ||
771 | } | ||
772 | |||
768 | /// <summary> | 773 | /// <summary> |
769 | /// | 774 | /// |
770 | /// </summary> | 775 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 00cabf8..a522380 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1079,6 +1079,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1079 | if (m_parentGroup != null) | 1079 | if (m_parentGroup != null) |
1080 | { | 1080 | { |
1081 | m_parentGroup.HasGroupChanged = true; | 1081 | m_parentGroup.HasGroupChanged = true; |
1082 | m_parentGroup.QueueForUpdateCheck(); | ||
1082 | } | 1083 | } |
1083 | TimeStampFull = (uint) Util.UnixTimeSinceEpoch(); | 1084 | TimeStampFull = (uint) Util.UnixTimeSinceEpoch(); |
1084 | m_updateFlag = 2; | 1085 | m_updateFlag = 2; |
@@ -1120,9 +1121,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1120 | if (m_parentGroup != null) | 1121 | if (m_parentGroup != null) |
1121 | { | 1122 | { |
1122 | m_parentGroup.HasGroupChanged = true; | 1123 | m_parentGroup.HasGroupChanged = true; |
1124 | m_parentGroup.QueueForUpdateCheck(); | ||
1123 | } | 1125 | } |
1124 | TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); | 1126 | TimeStampTerse = (uint) Util.UnixTimeSinceEpoch(); |
1125 | m_updateFlag = 1; | 1127 | m_updateFlag = 1; |
1128 | |||
1126 | } | 1129 | } |
1127 | } | 1130 | } |
1128 | 1131 | ||