aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs546
1 files changed, 65 insertions, 481 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index deb8d39..c1da7fa 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -61,8 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
61 { 61 {
62 private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; 62 private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L;
63 private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; 63 private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L;
64 64
65 public const int m_defaultNumberFramesStored = 10;
66 65
67 public delegate void SynchronizeSceneHandler(Scene scene); 66 public delegate void SynchronizeSceneHandler(Scene scene);
68 67
@@ -105,15 +104,10 @@ namespace OpenSim.Region.Framework.Scenes
105 /// <summary> 104 /// <summary>
106 /// If false then physical objects are disabled, though collisions will continue as normal. 105 /// If false then physical objects are disabled, though collisions will continue as normal.
107 /// </summary> 106 /// </summary>
108<<<<<<< HEAD 107
109 public bool PhysicsEnabled
110 {
111 get
112=======
113 public bool PhysicsEnabled 108 public bool PhysicsEnabled
114 { 109 {
115 get 110 get
116>>>>>>> avn/ubitvar
117 { 111 {
118 return m_physicsEnabled; 112 return m_physicsEnabled;
119 } 113 }
@@ -222,7 +216,7 @@ namespace OpenSim.Region.Framework.Scenes
222 /// <summary> 216 /// <summary>
223 /// Maximum value of the size of a physical prim in each axis 217 /// Maximum value of the size of a physical prim in each axis
224 /// </summary> 218 /// </summary>
225 public float m_maxPhys = 64; 219 public float m_maxPhys = 10;
226 220
227 /// <summary> 221 /// <summary>
228 /// Max prims an object will hold 222 /// Max prims an object will hold
@@ -234,16 +228,15 @@ namespace OpenSim.Region.Framework.Scenes
234 public bool m_allowScriptCrossings = true; 228 public bool m_allowScriptCrossings = true;
235 229
236 /// <summary> 230 /// <summary>
237<<<<<<< HEAD 231
238 /// Can avatars cross from and to this region? 232 /// Can avatars cross from and to this region?
239 /// </summary> 233 /// </summary>
240 public bool AllowAvatarCrossing { get; set; } 234 public bool AllowAvatarCrossing { get; set; }
241======= 235
242 /// Max prims an Physical object will hold 236 /// Max prims an Physical object will hold
243 /// </summary> 237 /// </summary>
244 /// 238 ///
245 public int m_linksetPhysCapacity = 0; 239 public int m_linksetPhysCapacity = 0;
246>>>>>>> avn/ubitvar
247 240
248 public bool m_useFlySlow; 241 public bool m_useFlySlow;
249 public bool m_useTrashOnDelete = true; 242 public bool m_useTrashOnDelete = true;
@@ -278,7 +271,7 @@ namespace OpenSim.Region.Framework.Scenes
278 /// </summary> 271 /// </summary>
279 public int ChildTerseUpdatePeriod { get; set; } 272 public int ChildTerseUpdatePeriod { get; set; }
280 273
281 protected float m_defaultDrawDistance = 255.0f; 274 protected float m_defaultDrawDistance = 255f;
282 public float DefaultDrawDistance 275 public float DefaultDrawDistance
283 { 276 {
284 // get { return m_defaultDrawDistance; } 277 // get { return m_defaultDrawDistance; }
@@ -361,17 +354,6 @@ namespace OpenSim.Region.Framework.Scenes
361 private Dictionary<string, string> m_extraSettings; 354 private Dictionary<string, string> m_extraSettings;
362 355
363 /// <summary> 356 /// <summary>
364 /// If true then the next time the scene loop is activated, updates will be performed by firing of a timer
365 /// rather than on a single thread that sleeps.
366 /// </summary>
367 public bool UpdateOnTimer { get; set; }
368
369 /// <summary>
370 /// Only used if we are updating scene on a timer rather than sleeping a thread.
371 /// </summary>
372 private Timer m_sceneUpdateTimer;
373
374 /// <summary>
375 /// Current scene frame number 357 /// Current scene frame number
376 /// </summary> 358 /// </summary>
377 public uint Frame 359 public uint Frame
@@ -386,23 +368,14 @@ namespace OpenSim.Region.Framework.Scenes
386 public uint MaintenanceRun { get; private set; } 368 public uint MaintenanceRun { get; private set; }
387 369
388 /// <summary> 370 /// <summary>
389 /// The minimum length of time in milliseconds that will be taken for a scene frame. If the frame takes less time then we 371 /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we
390 /// will sleep for the remaining period. 372 /// will sleep for the remaining period.
391 /// </summary> 373 /// </summary>
392 /// <remarks> 374 /// <remarks>
393 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations 375 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations
394 /// occur too quickly (viewer 1) or with even more slide (viewer 2). 376 /// occur too quickly (viewer 1) or with even more slide (viewer 2).
395 /// </remarks> 377 /// </remarks>
396 public int MinFrameTicks 378 public float MinFrameTime { get; private set; }
397 {
398 get { return m_minFrameTicks; }
399 private set
400 {
401 m_minFrameTicks = value;
402 MinFrameSeconds = (float)m_minFrameTicks / 1000;
403 }
404 }
405 private int m_minFrameTicks;
406 379
407 /// <summary> 380 /// <summary>
408 /// The minimum length of time in seconds that will be taken for a scene frame. 381 /// The minimum length of time in seconds that will be taken for a scene frame.
@@ -410,17 +383,7 @@ namespace OpenSim.Region.Framework.Scenes
410 /// <remarks> 383 /// <remarks>
411 /// Always derived from MinFrameTicks. 384 /// Always derived from MinFrameTicks.
412 /// </remarks> 385 /// </remarks>
413 public float MinFrameSeconds { get; private set; } 386 public float MinMaintenanceTime { get; private set; }
414
415 /// <summary>
416 /// The minimum length of time in milliseconds that will be taken for a scene frame. If the frame takes less time then we
417 /// will sleep for the remaining period.
418 /// </summary>
419 /// <remarks>
420 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations
421 /// occur too quickly (viewer 1) or with even more slide (viewer 2).
422 /// </remarks>
423 public int MinMaintenanceTicks { get; set; }
424 387
425 private int m_update_physics = 1; 388 private int m_update_physics = 1;
426 private int m_update_entitymovement = 1; 389 private int m_update_entitymovement = 1;
@@ -428,13 +391,10 @@ namespace OpenSim.Region.Framework.Scenes
428 private int m_update_presences = 1; // Update scene presence movements 391 private int m_update_presences = 1; // Update scene presence movements
429 private int m_update_events = 1; 392 private int m_update_events = 1;
430 private int m_update_backup = 200; 393 private int m_update_backup = 200;
431<<<<<<< HEAD 394
432 private int m_update_terrain = 50;
433 // private int m_update_land = 1;
434=======
435 private int m_update_terrain = 1000; 395 private int m_update_terrain = 1000;
436 private int m_update_land = 10; 396 private int m_update_land = 10;
437>>>>>>> avn/ubitvar 397
438 private int m_update_coarse_locations = 50; 398 private int m_update_coarse_locations = 50;
439 private int m_update_temp_cleaning = 180; 399 private int m_update_temp_cleaning = 180;
440 400
@@ -559,13 +519,12 @@ namespace OpenSim.Region.Framework.Scenes
559 } 519 }
560 private volatile bool m_active; 520 private volatile bool m_active;
561 521
562<<<<<<< HEAD
563 /// <summary> 522 /// <summary>
564 /// If true then updates are running. This may be true for a short period after a scene is de-activated. 523 /// If true then updates are running. This may be true for a short period after a scene is de-activated.
565 /// </summary> 524 /// </summary>
566 public bool IsRunning { get { return m_isRunning; } } 525 public bool IsRunning { get { return m_isRunning; } }
567 private volatile bool m_isRunning; 526 private volatile bool m_isRunning;
568======= 527
569// private int m_lastUpdate; 528// private int m_lastUpdate;
570 private bool m_firstHeartbeat = true; 529 private bool m_firstHeartbeat = true;
571 530
@@ -574,7 +533,7 @@ namespace OpenSim.Region.Framework.Scenes
574 private double m_reprioritizationInterval = 5000.0; 533 private double m_reprioritizationInterval = 5000.0;
575 private double m_rootReprioritizationDistance = 10.0; 534 private double m_rootReprioritizationDistance = 10.0;
576 private double m_childReprioritizationDistance = 20.0; 535 private double m_childReprioritizationDistance = 20.0;
577>>>>>>> avn/ubitvar 536
578 537
579 private Timer m_mapGenerationTimer = new Timer(); 538 private Timer m_mapGenerationTimer = new Timer();
580 private bool m_generateMaptiles; 539 private bool m_generateMaptiles;
@@ -913,8 +872,8 @@ namespace OpenSim.Region.Framework.Scenes
913 : this(regInfo, physicsScene) 872 : this(regInfo, physicsScene)
914 { 873 {
915 m_config = config; 874 m_config = config;
916 MinFrameTicks = 89; 875 MinFrameTime = 0.089f;
917 MinMaintenanceTicks = 1000; 876 MinMaintenanceTime = 1;
918 SeeIntoRegion = true; 877 SeeIntoRegion = true;
919 878
920 Random random = new Random(); 879 Random random = new Random();
@@ -924,12 +883,9 @@ namespace OpenSim.Region.Framework.Scenes
924 m_sceneGridService = sceneGridService; 883 m_sceneGridService = sceneGridService;
925 m_SimulationDataService = simDataService; 884 m_SimulationDataService = simDataService;
926 m_EstateDataService = estateDataService; 885 m_EstateDataService = estateDataService;
927<<<<<<< HEAD 886
928=======
929 m_regionHandle = RegionInfo.RegionHandle;
930 m_lastIncoming = 0; 887 m_lastIncoming = 0;
931 m_lastOutgoing = 0; 888 m_lastOutgoing = 0;
932>>>>>>> avn/ubitvar
933 889
934 m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); 890 m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
935 m_asyncSceneObjectDeleter.Enabled = true; 891 m_asyncSceneObjectDeleter.Enabled = true;
@@ -988,8 +944,6 @@ namespace OpenSim.Region.Framework.Scenes
988 EventManager.OnLandObjectRemoved += 944 EventManager.OnLandObjectRemoved +=
989 new EventManager.LandObjectRemoved(simDataService.RemoveLandObject); 945 new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
990 946
991<<<<<<< HEAD
992=======
993 m_sceneGraph = new SceneGraph(this); 947 m_sceneGraph = new SceneGraph(this);
994 m_sceneGraph.PhysicsScene = physicsScene; 948 m_sceneGraph.PhysicsScene = physicsScene;
995 949
@@ -1006,7 +960,6 @@ namespace OpenSim.Region.Framework.Scenes
1006 RestartNow(); 960 RestartNow();
1007 }; 961 };
1008 962
1009>>>>>>> avn/ubitvar
1010 RegisterDefaultSceneEvents(); 963 RegisterDefaultSceneEvents();
1011 964
1012 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled 965 // XXX: Don't set the public property since we don't want to activate here. This needs to be handled
@@ -1167,8 +1120,7 @@ namespace OpenSim.Region.Framework.Scenes
1167 } 1120 }
1168 } 1121 }
1169 1122
1170 if (startupConfig.Contains("MinFrameTime")) 1123 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
1171 MinFrameTicks = (int)(startupConfig.GetFloat("MinFrameTime") * 1000);
1172 1124
1173 m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); 1125 m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup);
1174 m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); 1126 m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
@@ -1246,43 +1198,13 @@ namespace OpenSim.Region.Framework.Scenes
1246 1198
1247 #endregion Interest Management 1199 #endregion Interest Management
1248 1200
1249 // The timer used by the Stopwatch class depends on the system hardware and operating system; inform
1250 // if the timer is based on a high-resolution performance counter or based on the system timer;
1251 // the performance counter will provide a more precise time than the system timer
1252 if (Stopwatch.IsHighResolution)
1253 m_log.InfoFormat("[SCENE]: Using high-resolution performance counter for statistics.");
1254 else
1255 m_log.InfoFormat("[SCENE]: Using system timer for statistics.");
1256
1257 // Acquire the statistics section of the OpenSim.ini file located
1258 // in the bin directory
1259 IConfig statisticsConfig = m_config.Configs["Statistics"];
1260 1201
1261 // Confirm that the statistics section existed in the configuration 1202 StatsReporter = new SimStatsReporter(this);
1262 // file
1263 if (statisticsConfig != null)
1264 {
1265 // Create the StatsReporter using the number of frames to store
1266 // for the frame time statistics, or 10 frames if the config
1267 // file doesn't contain a value
1268 StatsReporter = new SimStatsReporter(this,
1269 statisticsConfig.GetInt("NumberOfFrames",
1270 m_defaultNumberFramesStored));
1271 }
1272 else
1273 {
1274 // Create a StatsReporter with the current scene and a default
1275 // 10 frames stored for the frame time statistics
1276 StatsReporter = new SimStatsReporter(this);
1277 }
1278 1203
1279 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 1204 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
1280 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 1205 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
1281 1206
1282<<<<<<< HEAD
1283=======
1284 MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); 1207 MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect);
1285>>>>>>> avn/ubitvar
1286 } 1208 }
1287 1209
1288 public Scene(RegionInfo regInfo, PhysicsScene physicsScene) 1210 public Scene(RegionInfo regInfo, PhysicsScene physicsScene)
@@ -1314,7 +1236,28 @@ namespace OpenSim.Region.Framework.Scenes
1314 PeriodicBackup = true; 1236 PeriodicBackup = true;
1315 UseBackup = true; 1237 UseBackup = true;
1316 1238
1317<<<<<<< HEAD 1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1318 IsReprioritizationEnabled = true; 1261 IsReprioritizationEnabled = true;
1319 UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time; 1262 UpdatePrioritizationScheme = UpdatePrioritizationSchemes.Time;
1320 ReprioritizationInterval = 5000; 1263 ReprioritizationInterval = 5000;
@@ -1325,8 +1268,6 @@ namespace OpenSim.Region.Framework.Scenes
1325 RootReprioritizationDistance = 10.0; 1268 RootReprioritizationDistance = 10.0;
1326 ChildReprioritizationDistance = 20.0; 1269 ChildReprioritizationDistance = 20.0;
1327 1270
1328=======
1329>>>>>>> avn/ubitvar
1330 m_eventManager = new EventManager(); 1271 m_eventManager = new EventManager();
1331 1272
1332 m_permissions = new ScenePermissions(this); 1273 m_permissions = new ScenePermissions(this);
@@ -1376,24 +1317,8 @@ namespace OpenSim.Region.Framework.Scenes
1376 { 1317 {
1377 if (RegionInfo.RegionHandle != otherRegion.RegionHandle) 1318 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
1378 { 1319 {
1379<<<<<<< HEAD 1320
1380 //// If these are cast to INT because long + negative values + abs returns invalid data
1381 //int resultX = Math.Abs((int)xcell - (int)RegionInfo.RegionLocX);
1382 //int resultY = Math.Abs((int)ycell - (int)RegionInfo.RegionLocY);
1383 //if (resultX <= 1 && resultY <= 1)
1384 float dist = (float)Math.Max(DefaultDrawDistance,
1385 (float)Math.Max(RegionInfo.RegionSizeX, RegionInfo.RegionSizeY));
1386 uint newRegionX, newRegionY, thisRegionX, thisRegionY;
1387 Util.RegionHandleToRegionLoc(otherRegion.RegionHandle, out newRegionX, out newRegionY);
1388 Util.RegionHandleToRegionLoc(RegionInfo.RegionHandle, out thisRegionX, out thisRegionY);
1389
1390 //m_log.InfoFormat("[SCENE]: (on region {0}): Region {1} up in coords {2}-{3}",
1391 // RegionInfo.RegionName, otherRegion.RegionName, newRegionX, newRegionY);
1392
1393 if (!Util.IsOutsideView(dist, thisRegionX, newRegionX, thisRegionY, newRegionY))
1394=======
1395 if (isNeighborRegion(otherRegion)) 1321 if (isNeighborRegion(otherRegion))
1396>>>>>>> avn/ubitvar
1397 { 1322 {
1398 // Let the grid service module know, so this can be cached 1323 // Let the grid service module know, so this can be cached
1399 m_eventManager.TriggerOnRegionUp(otherRegion); 1324 m_eventManager.TriggerOnRegionUp(otherRegion);
@@ -1693,45 +1618,8 @@ namespace OpenSim.Region.Framework.Scenes
1693 1618
1694 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; 1619 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
1695 m_lastFrameTick = Util.EnvironmentTickCount(); 1620 m_lastFrameTick = Util.EnvironmentTickCount();
1696 1621 Update(-1);
1697 if (UpdateOnTimer) 1622 }
1698 {
1699 m_sceneUpdateTimer = new Timer(MinFrameTicks);
1700 m_sceneUpdateTimer.AutoReset = true;
1701 m_sceneUpdateTimer.Elapsed += Update;
1702 m_sceneUpdateTimer.Start();
1703 }
1704 else
1705 {
1706 Thread.CurrentThread.Priority = ThreadPriority.Highest;
1707 Update(-1);
1708 Watchdog.RemoveThread();
1709 m_isRunning = false;
1710 }
1711 }
1712
1713 private volatile bool m_isTimerUpdateRunning;
1714
1715 private void Update(object sender, ElapsedEventArgs e)
1716 {
1717 if (m_isTimerUpdateRunning)
1718 return;
1719
1720 m_isTimerUpdateRunning = true;
1721
1722 // If the last frame did not complete on time, then immediately start the next update on the same thread
1723 // and ignore further timed updates until we have a frame that had spare time.
1724 while (!Update(1) && Active) { }
1725
1726 if (!Active || m_shuttingDown)
1727 {
1728 m_sceneUpdateTimer.Stop();
1729 m_sceneUpdateTimer = null;
1730 m_isRunning = false;
1731 }
1732
1733 m_isTimerUpdateRunning = false;
1734 }
1735 1623
1736 private void Maintenance() 1624 private void Maintenance()
1737 { 1625 {
@@ -1800,24 +1688,24 @@ namespace OpenSim.Region.Framework.Scenes
1800 previousMaintenanceTick = m_lastMaintenanceTick; 1688 previousMaintenanceTick = m_lastMaintenanceTick;
1801 m_lastMaintenanceTick = Util.EnvironmentTickCount(); 1689 m_lastMaintenanceTick = Util.EnvironmentTickCount();
1802 runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc); 1690 runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc);
1803 runtc = MinMaintenanceTicks - runtc; 1691 runtc = (int)(MinMaintenanceTime * 1000) - runtc;
1804 1692
1805 if (runtc > 0) 1693 if (runtc > 0)
1806 m_maintenanceWaitEvent.WaitOne(runtc); 1694 m_maintenanceWaitEvent.WaitOne(runtc);
1807 1695
1808 // Optionally warn if a frame takes double the amount of time that it should. 1696 // Optionally warn if a frame takes double the amount of time that it should.
1809 if (DebugUpdates 1697 if (DebugUpdates
1810 && Util.EnvironmentTickCountSubtract( 1698 && Util.EnvironmentTickCountSubtract(
1811 m_lastMaintenanceTick, previousMaintenanceTick) > MinMaintenanceTicks * 2) 1699 m_lastMaintenanceTick, previousMaintenanceTick) > (int)(MinMaintenanceTime * 1000 * 2))
1812 m_log.WarnFormat( 1700 m_log.WarnFormat(
1813 "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}", 1701 "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}",
1814 Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick), 1702 Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick),
1815 MinMaintenanceTicks, 1703 MinMaintenanceTime * 1000,
1816 RegionInfo.RegionName); 1704 RegionInfo.RegionName);
1817 } 1705 }
1818 } 1706 }
1819 1707
1820 public override bool Update(int frames) 1708 public override void Update(int frames)
1821 { 1709 {
1822 long? endFrame = null; 1710 long? endFrame = null;
1823 1711
@@ -1825,30 +1713,12 @@ namespace OpenSim.Region.Framework.Scenes
1825 endFrame = Frame + frames; 1713 endFrame = Frame + frames;
1826 1714
1827 float physicsFPS = 0f; 1715 float physicsFPS = 0f;
1828<<<<<<< HEAD 1716
1829 int previousFrameTick, tmpMS;
1830
1831 // These variables will be used to save the precise frame time using the
1832 // Stopwatch class of Microsoft SDK; the times are recorded at the start
1833 // and end of a particular section of code, and then used to calculate
1834 // the frame times, which are the sums of the sections for each given name
1835 double preciseTotalFrameTime = 0.0;
1836 double preciseSimFrameTime = 0.0;
1837 double precisePhysicsFrameTime = 0.0;
1838 Stopwatch totalFrameStopwatch = new Stopwatch();
1839 Stopwatch simFrameStopwatch = new Stopwatch();
1840 Stopwatch physicsFrameStopwatch = new Stopwatch();
1841
1842 // Begin the stopwatch to keep track of the time that the frame
1843 // started running to determine how long the frame took to complete
1844 totalFrameStopwatch.Start();
1845=======
1846 int tmpMS; 1717 int tmpMS;
1847 int previousFrameTick; 1718 int previousFrameTick;
1848 int maintc; 1719 int maintc;
1849 int sleepMS; 1720 int sleepMS;
1850 int framestart; 1721 int framestart;
1851>>>>>>> avn/ubitvar
1852 1722
1853 while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) 1723 while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame))
1854 { 1724 {
@@ -1857,11 +1727,7 @@ namespace OpenSim.Region.Framework.Scenes
1857 1727
1858 // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); 1728 // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
1859 1729
1860<<<<<<< HEAD
1861 agentMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0;
1862=======
1863 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; 1730 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1864>>>>>>> avn/ubitvar
1865 1731
1866 try 1732 try
1867 { 1733 {
@@ -1877,93 +1743,42 @@ namespace OpenSim.Region.Framework.Scenes
1877 1743
1878 if (Frame % m_update_terrain == 0) 1744 if (Frame % m_update_terrain == 0)
1879 { 1745 {
1880<<<<<<< HEAD
1881 // At several points inside the code there was a need to
1882 // create a more precise measurement of time elapsed.
1883 // This led to the addition of variables that have a
1884 // similar function and thus remain tightly connected to
1885 // their original counterparts. However, the original
1886 // code is not receiving comments from our group because
1887 // we don't feel right modifying the code to that degree
1888 // at this point in time, the precise values all begin
1889 // with the keyword precise
1890 tmpMS = Util.EnvironmentTickCount();
1891 simFrameStopwatch.Start();
1892 UpdateTerrain();
1893
1894 // Get the simulation frame time that the avatar force
1895 // input took
1896 simFrameStopwatch.Stop();
1897 preciseSimFrameTime =
1898 simFrameStopwatch.Elapsed.TotalMilliseconds;
1899 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
1900 }
1901
1902 // At several points inside the code there was a need to
1903 // create a more precise measurement of time elapsed. This
1904 // led to the addition of variables that have a similar
1905 // function and thus remain tightly connected to their
1906 // original counterparts. However, the original code is
1907 // not receiving comments from our group because we don't
1908 // feel right modifying the code to that degree at this
1909 // point in time, the precise values all begin with the
1910 // keyword precise
1911=======
1912 UpdateTerrain(); 1746 UpdateTerrain();
1913 } 1747 }
1914 1748
1915 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); 1749 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
1916>>>>>>> avn/ubitvar
1917
1918 tmpMS = Util.EnvironmentTickCount(); 1750 tmpMS = Util.EnvironmentTickCount();
1919 1751
1920 // Begin the stopwatch to track the time to prepare physics
1921 physicsFrameStopwatch.Start();
1922 if (PhysicsEnabled && Frame % m_update_physics == 0) 1752 if (PhysicsEnabled && Frame % m_update_physics == 0)
1923 m_sceneGraph.UpdatePreparePhysics(); 1753 m_sceneGraph.UpdatePreparePhysics();
1924 1754
1925 // Get the time it took to prepare the physics, this
1926 // would report the most precise time that physics was
1927 // running on the machine and should the physics not be
1928 // enabled will report the time it took to check if physics
1929 // was enabled
1930 physicsFrameStopwatch.Stop();
1931 precisePhysicsFrameTime = physicsFrameStopwatch.Elapsed.TotalMilliseconds;
1932 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); 1755 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
1933 1756
1934 // Apply any pending avatar force input to the avatar's velocity 1757 // Apply any pending avatar force input to the avatar's velocity
1935 tmpMS = Util.EnvironmentTickCount(); 1758 tmpMS = Util.EnvironmentTickCount();
1936 simFrameStopwatch.Restart();
1937 if (Frame % m_update_entitymovement == 0) 1759 if (Frame % m_update_entitymovement == 0)
1938 m_sceneGraph.UpdateScenePresenceMovement(); 1760 m_sceneGraph.UpdateScenePresenceMovement();
1939 1761
1940 // Get the simulation frame time that the avatar force input 1762 // Get the simulation frame time that the avatar force input
1941 // took 1763 // took
1942 simFrameStopwatch.Stop();
1943 preciseSimFrameTime +=
1944 simFrameStopwatch.Elapsed.TotalMilliseconds;
1945 agentMS = Util.EnvironmentTickCountSubtract(tmpMS); 1764 agentMS = Util.EnvironmentTickCountSubtract(tmpMS);
1946 1765
1947 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their 1766 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
1948 // velocity 1767 // velocity
1949 tmpMS = Util.EnvironmentTickCount(); 1768 tmpMS = Util.EnvironmentTickCount();
1950 physicsFrameStopwatch.Restart();
1951 if (Frame % m_update_physics == 0) 1769 if (Frame % m_update_physics == 0)
1952 { 1770 {
1953 if (PhysicsEnabled) 1771 if (PhysicsEnabled)
1954 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameSeconds); 1772 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
1955 1773
1956 if (SynchronizeScene != null) 1774 if (SynchronizeScene != null)
1957 SynchronizeScene(this); 1775 SynchronizeScene(this);
1958 } 1776 }
1959 1777
1960 // Add the main physics update time to the prepare physics time 1778 // Add the main physics update time to the prepare physics time
1961 physicsFrameStopwatch.Stop();
1962 precisePhysicsFrameTime += physicsFrameStopwatch.Elapsed.TotalMilliseconds;
1963 physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); 1779 physicsMS = Util.EnvironmentTickCountSubtract(tmpMS);
1964 1780
1965 // Start the stopwatch for the remainder of the simulation 1781 // Start the stopwatch for the remainder of the simulation
1966 simFrameStopwatch.Restart();
1967 tmpMS = Util.EnvironmentTickCount(); 1782 tmpMS = Util.EnvironmentTickCount();
1968 1783
1969 // Check if any objects have reached their targets 1784 // Check if any objects have reached their targets
@@ -1980,10 +1795,7 @@ namespace OpenSim.Region.Framework.Scenes
1980 m_sceneGraph.UpdatePresences(); 1795 m_sceneGraph.UpdatePresences();
1981 1796
1982 agentMS += Util.EnvironmentTickCountSubtract(tmpMS); 1797 agentMS += Util.EnvironmentTickCountSubtract(tmpMS);
1983 1798
1984<<<<<<< HEAD
1985=======
1986
1987 // Delete temp-on-rez stuff 1799 // Delete temp-on-rez stuff
1988 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) 1800 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
1989 { 1801 {
@@ -1993,7 +1805,6 @@ namespace OpenSim.Region.Framework.Scenes
1993 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); 1805 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS);
1994 } 1806 }
1995 1807
1996>>>>>>> avn/ubitvar
1997 if (Frame % m_update_events == 0) 1808 if (Frame % m_update_events == 0)
1998 { 1809 {
1999 tmpMS = Util.EnvironmentTickCount(); 1810 tmpMS = Util.EnvironmentTickCount();
@@ -2062,42 +1873,9 @@ namespace OpenSim.Region.Framework.Scenes
2062 } 1873 }
2063 1874
2064 EventManager.TriggerRegionHeartbeatEnd(this); 1875 EventManager.TriggerRegionHeartbeatEnd(this);
2065 otherMS = eventMS + backupMS + terrainMS + landMS;
2066
2067 // Get the elapsed time for the simulation frame
2068 simFrameStopwatch.Stop();
2069 preciseSimFrameTime +=
2070 simFrameStopwatch.Elapsed.TotalMilliseconds;
2071
2072<<<<<<< HEAD
2073 if (!UpdateOnTimer)
2074 {
2075 Watchdog.UpdateThread();
2076
2077 spareMS = MinFrameTicks - Util.EnvironmentTickCountSubtract(m_lastFrameTick);
2078
2079 if (spareMS > 0)
2080 m_updateWaitEvent.WaitOne(spareMS);
2081 else
2082 spareMS = 0;
2083 }
2084 else
2085 {
2086 spareMS = Math.Max(0, MinFrameTicks - physicsMS2 - agentMS - physicsMS - otherMS);
2087 }
2088 1876
2089 // Get the total frame time 1877 Watchdog.UpdateThread();
2090 totalFrameStopwatch.Stop();
2091 preciseTotalFrameTime =
2092 totalFrameStopwatch.Elapsed.TotalMilliseconds;
2093
2094 // Restart the stopwatch for the total time of the next frame
2095 totalFrameStopwatch.Restart();
2096 1878
2097 previousFrameTick = m_lastFrameTick;
2098 frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick);
2099 m_lastFrameTick = Util.EnvironmentTickCount();
2100=======
2101 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; 1879 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
2102 1880
2103 StatsReporter.AddPhysicsFPS(physicsFPS); 1881 StatsReporter.AddPhysicsFPS(physicsFPS);
@@ -2125,46 +1903,22 @@ namespace OpenSim.Region.Framework.Scenes
2125 frameMS = Util.EnvironmentTickCountSubtract(framestart); 1903 frameMS = Util.EnvironmentTickCountSubtract(framestart);
2126 StatsReporter.addSleepMS(sleepMS); 1904 StatsReporter.addSleepMS(sleepMS);
2127 StatsReporter.addFrameMS(frameMS); 1905 StatsReporter.addFrameMS(frameMS);
2128>>>>>>> avn/ubitvar
2129 1906
2130 // if (Frame%m_update_avatars == 0) 1907 // if (Frame%m_update_avatars == 0)
2131 // UpdateInWorldTime(); 1908 // UpdateInWorldTime();
2132 1909
2133<<<<<<< HEAD 1910 // Optionally warn if a frame takes double the amount of time that it should.
2134 StatsReporter.addFrameMS(frameMS);
2135 StatsReporter.addAgentMS(agentMS);
2136 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
2137 StatsReporter.addOtherMS(otherMS);
2138 StatsReporter.AddSpareMS(spareMS);
2139 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
2140 StatsReporter.AddScriptMS((int) GetAndResetScriptExecutionTime());
2141=======
2142>>>>>>> avn/ubitvar
2143
2144 // Send the correct time values to the stats reporter for the
2145 // frame times
2146 StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime,
2147 preciseSimFrameTime, precisePhysicsFrameTime, 0.0);
2148
2149 // Send the correct number of frames that the physics library
2150 // has processed to the stats reporter
2151 StatsReporter.addPhysicsFrame(1);
2152
2153 // Optionally warn if a frame takes double the amount of time that it should.
2154 if (DebugUpdates 1911 if (DebugUpdates
2155 && Util.EnvironmentTickCountSubtract( 1912 && Util.EnvironmentTickCountSubtract(
2156 m_lastFrameTick, previousFrameTick) > MinFrameTicks * 2) 1913 m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2))
1914
2157 m_log.WarnFormat( 1915 m_log.WarnFormat(
2158 "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", 1916 "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
2159 Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), 1917 Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
2160 MinFrameTicks, 1918 MinFrameTime * 1000,
1919
2161 RegionInfo.RegionName); 1920 RegionInfo.RegionName);
2162 } 1921 }
2163
2164 // Finished updating scene frame, so stop the total frame's Stopwatch
2165 totalFrameStopwatch.Stop();
2166
2167 return spareMS >= 0;
2168 } 1922 }
2169 1923
2170 /// <summary> 1924 /// <summary>
@@ -2629,13 +2383,8 @@ namespace OpenSim.Region.Framework.Scenes
2629 2383
2630 if (ei.HitTF) 2384 if (ei.HitTF)
2631 { 2385 {
2632<<<<<<< HEAD
2633 pos = ei.ipoint;
2634 }
2635=======
2636 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); 2386 pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z);
2637 } 2387 }
2638>>>>>>> avn/ubitvar
2639 else 2388 else
2640 { 2389 {
2641 // fall back to our stupid functionality 2390 // fall back to our stupid functionality
@@ -3013,8 +2762,6 @@ namespace OpenSim.Region.Framework.Scenes
3013 m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border."); 2762 m_log.Warn("[SCENE]: exception when trying to remove the prim that crossed the border.");
3014 } 2763 }
3015 return; 2764 return;
3016<<<<<<< HEAD
3017=======
3018 } 2765 }
3019 2766
3020 if (grp.RootPart.RETURN_AT_EDGE) 2767 if (grp.RootPart.RETURN_AT_EDGE)
@@ -3056,70 +2803,11 @@ namespace OpenSim.Region.Framework.Scenes
3056 // Regular region. Just check for region size 2803 // Regular region. Just check for region size
3057 if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY ) 2804 if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY )
3058 ret = true; 2805 ret = true;
3059>>>>>>> avn/ubitvar
3060 }
3061
3062 if (grp.RootPart.RETURN_AT_EDGE)
3063 {
3064<<<<<<< HEAD
3065 // We remove the object here
3066 try
3067 {
3068 List<SceneObjectGroup> objects = new List<SceneObjectGroup>();
3069 objects.Add(grp);
3070 SceneObjectGroup[] objectsArray = objects.ToArray();
3071 returnObjects(objectsArray, UUID.Zero);
3072 }
3073 catch (Exception)
3074 {
3075 m_log.Warn("[SCENE]: exception when trying to return the prim that crossed the border.");
3076 }
3077 return;
3078 }
3079
3080 if (EntityTransferModule != null)
3081 EntityTransferModule.Cross(grp, attemptedPosition, silent);
3082 }
3083
3084 // Simple test to see if a position is in the current region.
3085 // This test is mostly used to see if a region crossing is necessary.
3086 // Assuming the position is relative to the region so anything outside its bounds.
3087 // Return 'true' if position inside region.
3088 public bool PositionIsInCurrentRegion(Vector3 pos)
3089 {
3090 bool ret = false;
3091 int xx = (int)Math.Floor(pos.X);
3092 int yy = (int)Math.Floor(pos.Y);
3093 if (xx < 0 || yy < 0)
3094 return false;
3095
3096 IRegionCombinerModule regionCombinerModule = RequestModuleInterface<IRegionCombinerModule>();
3097 if (regionCombinerModule == null)
3098 {
3099 // Regular region. Just check for region size
3100 if (xx < RegionInfo.RegionSizeX && yy < RegionInfo.RegionSizeY)
3101 ret = true;
3102 }
3103 else
3104 {
3105 // We're in a mega-region so see if we are still in that larger region
3106 ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy);
3107 }
3108
3109 return ret;
3110
3111 }
3112
3113=======
3114 // We're in a mega-region so see if we are still in that larger region
3115 ret = regionCombinerModule.PositionIsInMegaregion(this.RegionInfo.RegionID, xx, yy);
3116 } 2806 }
3117 2807
3118 return ret; 2808 return ret;
3119
3120 } 2809 }
3121 2810
3122>>>>>>> avn/ubitvar
3123 /// <summary> 2811 /// <summary>
3124 /// Called when objects or attachments cross the border, or teleport, between regions. 2812 /// Called when objects or attachments cross the border, or teleport, between regions.
3125 /// </summary> 2813 /// </summary>
@@ -3141,10 +2829,6 @@ namespace OpenSim.Region.Framework.Scenes
3141 return false; 2829 return false;
3142 } 2830 }
3143 2831
3144<<<<<<< HEAD
3145 if (!EntityTransferModule.HandleIncomingSceneObject(newObject, newPosition))
3146 return false;
3147=======
3148 // If the user is banned, we won't let any of their objects 2832 // If the user is banned, we won't let any of their objects
3149 // enter. Period. 2833 // enter. Period.
3150 // 2834 //
@@ -3189,7 +2873,6 @@ namespace OpenSim.Region.Framework.Scenes
3189 //if (newObject.RootPart.KeyframeMotion != null) 2873 //if (newObject.RootPart.KeyframeMotion != null)
3190 // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject); 2874 // newObject.RootPart.KeyframeMotion.UpdateSceneObject(newObject);
3191 } 2875 }
3192>>>>>>> avn/ubitvar
3193 2876
3194 // Do this as late as possible so that listeners have full access to the incoming object 2877 // Do this as late as possible so that listeners have full access to the incoming object
3195 EventManager.TriggerOnIncomingSceneObject(newObject); 2878 EventManager.TriggerOnIncomingSceneObject(newObject);
@@ -3286,8 +2969,6 @@ namespace OpenSim.Region.Framework.Scenes
3286 return true; 2969 return true;
3287 } 2970 }
3288 2971
3289<<<<<<< HEAD
3290=======
3291 private int GetStateSource(SceneObjectGroup sog) 2972 private int GetStateSource(SceneObjectGroup sog)
3292 { 2973 {
3293 ScenePresence sp = GetScenePresence(sog.OwnerID); 2974 ScenePresence sp = GetScenePresence(sog.OwnerID);
@@ -3316,7 +2997,7 @@ namespace OpenSim.Region.Framework.Scenes
3316 return uac.UserFlags; 2997 return uac.UserFlags;
3317 //} 2998 //}
3318 } 2999 }
3319>>>>>>> avn/ubitvar 3000
3320 #endregion 3001 #endregion
3321 3002
3322 #region Add/Remove Avatar Methods 3003 #region Add/Remove Avatar Methods
@@ -3352,15 +3033,10 @@ namespace OpenSim.Region.Framework.Scenes
3352 vialogin 3033 vialogin
3353 = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 3034 = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0
3354 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 3035 || (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
3355<<<<<<< HEAD
3356
3357 // CheckHeartbeat();
3358
3359=======
3360 3036
3361 CheckHeartbeat(); 3037 CheckHeartbeat();
3362 3038
3363>>>>>>> avn/ubitvar 3039
3364 sp = GetScenePresence(client.AgentId); 3040 sp = GetScenePresence(client.AgentId);
3365 3041
3366 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this 3042 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this
@@ -3370,29 +3046,6 @@ namespace OpenSim.Region.Framework.Scenes
3370 if (sp == null) 3046 if (sp == null)
3371 { 3047 {
3372 m_log.DebugFormat( 3048 m_log.DebugFormat(
3373<<<<<<< HEAD
3374 "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}",
3375 client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos);
3376
3377 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
3378
3379 // We must set this here so that TriggerOnNewClient and TriggerOnClientLogin can determine whether the
3380 // client is for a root or child agent.
3381 // We must also set this before adding the client to the client manager so that an exception later on
3382 // does not leave a client manager entry without the scene agent set, which will cause other code
3383 // to fail since any entry in the client manager should have a ScenePresence
3384 //
3385 // XXX: This may be better set for a new client before that client is added to the client manager.
3386 // But need to know what happens in the case where a ScenePresence is already present (and if this
3387 // actually occurs).
3388 client.SceneAgent = sp;
3389
3390 m_clientManager.Add(client);
3391 SubscribeToClientEvents(client);
3392 m_eventManager.TriggerOnNewPresence(sp);
3393
3394 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
3395=======
3396 "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}", 3049 "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}",
3397 client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos, 3050 client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos,
3398 ((TPFlags)aCircuit.teleportFlags).ToString()); 3051 ((TPFlags)aCircuit.teleportFlags).ToString());
@@ -3414,8 +3067,6 @@ namespace OpenSim.Region.Framework.Scenes
3414 m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF); 3067 m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF);
3415 */ 3068 */
3416 m_eventManager.TriggerOnNewPresence(sp); 3069 m_eventManager.TriggerOnNewPresence(sp);
3417
3418>>>>>>> avn/ubitvar
3419 } 3070 }
3420 else 3071 else
3421 { 3072 {
@@ -3424,7 +3075,7 @@ namespace OpenSim.Region.Framework.Scenes
3424 // XXX: This may be better set for a new client before that client is added to the client manager. 3075 // XXX: This may be better set for a new client before that client is added to the client manager.
3425 // But need to know what happens in the case where a ScenePresence is already present (and if this 3076 // But need to know what happens in the case where a ScenePresence is already present (and if this
3426 // actually occurs). 3077 // actually occurs).
3427 client.SceneAgent = sp; 3078
3428 3079
3429 m_log.WarnFormat( 3080 m_log.WarnFormat(
3430 "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence", 3081 "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence",
@@ -3432,6 +3083,7 @@ namespace OpenSim.Region.Framework.Scenes
3432 3083
3433 reallyNew = false; 3084 reallyNew = false;
3434 } 3085 }
3086 client.SceneAgent = sp;
3435 3087
3436 // This is currently also being done earlier in NewUserConnection for real users to see if this 3088 // This is currently also being done earlier in NewUserConnection for real users to see if this
3437 // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other 3089 // resolves problems where HG agents are occasionally seen by others as "Unknown user" in chat and other
@@ -3454,15 +3106,6 @@ namespace OpenSim.Region.Framework.Scenes
3454 return sp; 3106 return sp;
3455 } 3107 }
3456 3108
3457 public string GetAgentHomeURI(UUID agentID)
3458 {
3459 AgentCircuitData circuit = AuthenticateHandler.GetAgentCircuitData(agentID);
3460 if (circuit != null && circuit.ServiceURLs != null && circuit.ServiceURLs.ContainsKey("HomeURI"))
3461 return circuit.ServiceURLs["HomeURI"].ToString();
3462 else
3463 return null;
3464 }
3465
3466 /// <summary> 3109 /// <summary>
3467 /// Returns the Home URI of the agent, or null if unknown. 3110 /// Returns the Home URI of the agent, or null if unknown.
3468 /// </summary> 3111 /// </summary>
@@ -3899,16 +3542,14 @@ namespace OpenSim.Region.Framework.Scenes
3899 if (target != null && target2 != null) 3542 if (target != null && target2 != null)
3900 { 3543 {
3901 Vector3 direction = Vector3.Normalize(RayEnd - RayStart); 3544 Vector3 direction = Vector3.Normalize(RayEnd - RayStart);
3902 Vector3 AXOrigin = RayStart; 3545
3903 Vector3 AXdirection = direction;
3904
3905 pos = target2.AbsolutePosition; 3546 pos = target2.AbsolutePosition;
3906 //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); 3547 //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString());
3907 3548
3908 // TODO: Raytrace better here 3549 // TODO: Raytrace better here
3909 3550
3910 //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection)); 3551 //EntityIntersection ei = m_sceneGraph.GetClosestIntersectingPrim(new Ray(AXOrigin, AXdirection));
3911 Ray NewRay = new Ray(AXOrigin, AXdirection); 3552 Ray NewRay = new Ray(RayStart,direction);
3912 3553
3913 // Ray Trace against target here 3554 // Ray Trace against target here
3914 EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters); 3555 EntityIntersection ei = target2.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, CopyCenters);
@@ -4010,13 +3651,8 @@ namespace OpenSim.Region.Framework.Scenes
4010 } 3651 }
4011 3652
4012 // TODO: Can we now remove this lock? 3653 // TODO: Can we now remove this lock?
4013<<<<<<< HEAD
4014 lock (acd)
4015 {
4016=======
4017 lock (m_removeClientPrivLock) 3654 lock (m_removeClientPrivLock)
4018 { 3655 {
4019>>>>>>> avn/ubitvar
4020 bool isChildAgent = false; 3656 bool isChildAgent = false;
4021 3657
4022 ScenePresence avatar = GetScenePresence(agentID); 3658 ScenePresence avatar = GetScenePresence(agentID);
@@ -4060,13 +3696,8 @@ namespace OpenSim.Region.Framework.Scenes
4060 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop 3696 // TODO: We shouldn't use closeChildAgents here - it's being used by the NPC module to stop
4061 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI 3697 // unnecessary operations. This should go away once NPCs have no accompanying IClientAPI
4062 if (closeChildAgents && CapsModule != null) 3698 if (closeChildAgents && CapsModule != null)
4063<<<<<<< HEAD
4064 CapsModule.RemoveCaps(agentID);
4065
4066=======
4067 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode); 3699 CapsModule.RemoveCaps(agentID, avatar.ControllingClient.CircuitCode);
4068 3700
4069>>>>>>> avn/ubitvar
4070 if (closeChildAgents && !isChildAgent) 3701 if (closeChildAgents && !isChildAgent)
4071 { 3702 {
4072 List<ulong> regions = avatar.KnownRegionHandles; 3703 List<ulong> regions = avatar.KnownRegionHandles;
@@ -4079,12 +3710,8 @@ namespace OpenSim.Region.Framework.Scenes
4079 m_eventManager.TriggerClientClosed(agentID, this); 3710 m_eventManager.TriggerClientClosed(agentID, this);
4080// m_log.Debug("[Scene]TriggerClientClosed done"); 3711// m_log.Debug("[Scene]TriggerClientClosed done");
4081 m_eventManager.TriggerOnRemovePresence(agentID); 3712 m_eventManager.TriggerOnRemovePresence(agentID);
4082<<<<<<< HEAD
4083
4084=======
4085// m_log.Debug("[Scene]TriggerOnRemovePresence done"); 3713// m_log.Debug("[Scene]TriggerOnRemovePresence done");
4086 3714
4087>>>>>>> avn/ubitvar
4088 if (!isChildAgent) 3715 if (!isChildAgent)
4089 { 3716 {
4090 if (AttachmentsModule != null) 3717 if (AttachmentsModule != null)
@@ -4228,14 +3855,10 @@ namespace OpenSim.Region.Framework.Scenes
4228 /// or other applications where a full grid/Hypergrid presence may not be required.</param> 3855 /// or other applications where a full grid/Hypergrid presence may not be required.</param>
4229 /// <returns>True if the region accepts this agent. False if it does not. False will 3856 /// <returns>True if the region accepts this agent. False if it does not. False will
4230 /// also return a reason.</returns> 3857 /// also return a reason.</returns>
4231<<<<<<< HEAD
4232 public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup)
4233=======
4234 /// 3858 ///
4235 private object m_newUserConnLock = new object(); 3859 private object m_newUserConnLock = new object();
4236 3860
4237 public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, out string reason, bool requirePresenceLookup) 3861 public bool NewUserConnection(AgentCircuitData acd, uint teleportFlags, GridRegion source, out string reason, bool requirePresenceLookup)
4238>>>>>>> avn/ubitvar
4239 { 3862 {
4240 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || 3863 bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 ||
4241 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); 3864 (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0);
@@ -4507,13 +4130,7 @@ namespace OpenSim.Region.Framework.Scenes
4507 { 4130 {
4508 m_log.DebugFormat( 4131 m_log.DebugFormat(
4509 "[SCENE]: Adjusting known seeds for existing agent {0} in {1}", 4132 "[SCENE]: Adjusting known seeds for existing agent {0} in {1}",
4510<<<<<<< HEAD
4511 acd.AgentID, RegionInfo.RegionName);
4512
4513 sp.AdjustKnownSeeds();
4514=======
4515 acd.AgentID, RegionInfo.RegionName); 4133 acd.AgentID, RegionInfo.RegionName);
4516>>>>>>> avn/ubitvar
4517 4134
4518 if (CapsModule != null) 4135 if (CapsModule != null)
4519 { 4136 {
@@ -4646,21 +4263,13 @@ namespace OpenSim.Region.Framework.Scenes
4646 { 4263 {
4647 if (posX < 0) 4264 if (posX < 0)
4648 posX = 0; 4265 posX = 0;
4649<<<<<<< HEAD 4266
4650 else if (posX >= (float)RegionInfo.RegionSizeX)
4651 posX = (float)RegionInfo.RegionSizeX - 0.001f;
4652 if (posY < 0)
4653 posY = 0;
4654 else if (posY >= (float)RegionInfo.RegionSizeY)
4655 posY = (float)RegionInfo.RegionSizeY - 0.001f;
4656=======
4657 else if (posX >= RegionInfo.RegionSizeX) 4267 else if (posX >= RegionInfo.RegionSizeX)
4658 posX = RegionInfo.RegionSizeX - 0.5f; 4268 posX = RegionInfo.RegionSizeX - 0.5f;
4659 if (posY < 0) 4269 if (posY < 0)
4660 posY = 0; 4270 posY = 0;
4661 else if (posY >= RegionInfo.RegionSizeY) 4271 else if (posY >= RegionInfo.RegionSizeY)
4662 posY = RegionInfo.RegionSizeY - 0.5f; 4272 posY = RegionInfo.RegionSizeY - 0.5f;
4663>>>>>>> avn/ubitvar
4664 4273
4665 reason = String.Empty; 4274 reason = String.Empty;
4666 if (Permissions.IsGod(agentID)) 4275 if (Permissions.IsGod(agentID))
@@ -5249,15 +4858,11 @@ namespace OpenSim.Region.Framework.Scenes
5249 sp.LifecycleState = ScenePresenceState.Removing; 4858 sp.LifecycleState = ScenePresenceState.Removing;
5250 } 4859 }
5251 4860
5252<<<<<<< HEAD
5253 sp.ControllingClient.Close(force);
5254=======
5255 if (sp != null) 4861 if (sp != null)
5256 { 4862 {
5257 sp.ControllingClient.Close(force, force); 4863 sp.ControllingClient.Close(force, force);
5258 return true; 4864 return true;
5259 } 4865 }
5260>>>>>>> avn/ubitvar
5261 4866
5262 return true; 4867 return true;
5263 } 4868 }
@@ -5862,9 +5467,7 @@ namespace OpenSim.Region.Framework.Scenes
5862 // 5 = We have seen a new user enter within the past 4 minutes 5467 // 5 = We have seen a new user enter within the past 4 minutes
5863 // which can be seen as positive confirmation of sim health 5468 // which can be seen as positive confirmation of sim health
5864 // 5469 //
5865<<<<<<< HEAD
5866 int health = 1; // Start at 1, means we're up 5470 int health = 1; // Start at 1, means we're up
5867=======
5868 5471
5869 flags = 0; 5472 flags = 0;
5870 message = String.Empty; 5473 message = String.Empty;
@@ -5879,9 +5482,6 @@ namespace OpenSim.Region.Framework.Scenes
5879 return 0; 5482 return 0;
5880 } 5483 }
5881 5484
5882 int health=1; // Start at 1, means we're up
5883>>>>>>> avn/ubitvar
5884
5885 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000) 5485 if ((Util.EnvironmentTickCountSubtract(m_lastFrameTick)) < 1000)
5886 { 5486 {
5887 health+=1; 5487 health+=1;
@@ -6176,13 +5776,7 @@ Environment.Exit(1);
6176 //Go to the edge, this happens in teleporting to a region with no available parcels 5776 //Go to the edge, this happens in teleporting to a region with no available parcels
6177 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar); 5777 Vector3 nearestRegionEdgePoint = GetNearestRegionEdgePosition(avatar);
6178 5778
6179<<<<<<< HEAD
6180 //m_log.Debug("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
6181
6182=======
6183 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString()); 5779 //Debug.WriteLine("They are really in a place they don't belong, sending them to: " + nearestRegionEdgePoint.ToString());
6184
6185>>>>>>> avn/ubitvar
6186 return nearestRegionEdgePoint; 5780 return nearestRegionEdgePoint;
6187 } 5781 }
6188 5782
@@ -6513,11 +6107,7 @@ Environment.Exit(1);
6513 /// <param name='position'></param> 6107 /// <param name='position'></param>
6514 /// <param name='reason'></param> 6108 /// <param name='reason'></param>
6515 /// <returns></returns> 6109 /// <returns></returns>
6516<<<<<<< HEAD
6517 public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out string reason) 6110 public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> features, out string reason)
6518=======
6519 public bool QueryAccess(UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string reason)
6520>>>>>>> avn/ubitvar
6521 { 6111 {
6522 reason = string.Empty; 6112 reason = string.Empty;
6523 6113
@@ -6527,14 +6117,8 @@ Environment.Exit(1);
6527 return true; 6117 return true;
6528 } 6118 }
6529 6119
6530<<<<<<< HEAD
6531 if (!AllowAvatarCrossing && !viaTeleport) 6120 if (!AllowAvatarCrossing && !viaTeleport)
6532 return false; 6121 return false;
6533=======
6534
6535// if (!AllowAvatarCrossing && !viaTeleport)
6536// return false;
6537>>>>>>> avn/ubitvar
6538 6122
6539 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check. 6123 // FIXME: Root agent count is currently known to be inaccurate. This forces a recount before we check.
6540 // However, the long term fix is to make sure root agent count is always accurate. 6124 // However, the long term fix is to make sure root agent count is always accurate.