aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2013-01-10 01:25:07 +0000
committerMelanie2013-01-10 01:25:07 +0000
commitaecb32b74efa5b74adcfc026f7261f43ad5934f4 (patch)
tree8c775eca7460a5c5c2bc08e25d2334897e693673 /OpenSim/Region/Framework
parentMerge branch 'avination' into careminster (diff)
parentChange IsRoot to use ReferenceEquals to prevent operator == messiness (diff)
downloadopensim-SC_OLD-aecb32b74efa5b74adcfc026f7261f43ad5934f4.zip
opensim-SC_OLD-aecb32b74efa5b74adcfc026f7261f43ad5934f4.tar.gz
opensim-SC_OLD-aecb32b74efa5b74adcfc026f7261f43ad5934f4.tar.bz2
opensim-SC_OLD-aecb32b74efa5b74adcfc026f7261f43ad5934f4.tar.xz
Merge branch 'avination' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs128
4 files changed, 74 insertions, 61 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs b/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs
index d63898a..21ed44f 100644
--- a/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IBakedTextureModule.cs
@@ -13,7 +13,7 @@ namespace OpenSim.Services.Interfaces
13{ 13{
14 public interface IBakedTextureModule 14 public interface IBakedTextureModule
15 { 15 {
16 AssetBase[] Get(UUID id); 16 WearableCacheItem[] Get(UUID id);
17 void Store(UUID id, AssetBase[] data); 17 void Store(UUID id, WearableCacheItem[] data);
18 } 18 }
19} 19}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 54e3b2d..a5ef2b7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2982,6 +2982,7 @@ namespace OpenSim.Region.Framework.Scenes
2982 // start the scripts again (since this is done in RezAttachments()). 2982 // start the scripts again (since this is done in RezAttachments()).
2983 // XXX: This is convoluted. 2983 // XXX: This is convoluted.
2984 sp.IsChildAgent = false; 2984 sp.IsChildAgent = false;
2985 sp.IsLoggingIn = true;
2985 2986
2986 if (AttachmentsModule != null) 2987 if (AttachmentsModule != null)
2987 Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); 2988 Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); });
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index e68793a..2a0d2ea 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes
144 /// </remarks> 144 /// </remarks>
145 public bool IsRoot 145 public bool IsRoot
146 { 146 {
147 get { return ParentGroup.RootPart == this; } 147 get { return Object.ReferenceEquals(ParentGroup.RootPart, this); }
148 } 148 }
149 149
150 /// <summary> 150 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b9cd3fc..1d6898b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -225,8 +225,6 @@ namespace OpenSim.Region.Framework.Scenes
225 /// </summary> 225 /// </summary>
226 public bool LandAtTarget { get; private set; } 226 public bool LandAtTarget { get; private set; }
227 227
228 private bool m_followCamAuto;
229
230 private int m_movementUpdateCount; 228 private int m_movementUpdateCount;
231 private const int NumMovementsBetweenRayCast = 5; 229 private const int NumMovementsBetweenRayCast = 5;
232 230
@@ -355,6 +353,9 @@ namespace OpenSim.Region.Framework.Scenes
355 /// </summary> 353 /// </summary>
356 protected Vector3 m_lastCameraPosition; 354 protected Vector3 m_lastCameraPosition;
357 355
356 private Vector4 m_lastCameraCollisionPlane = new Vector4(0f, 0f, 0f, 1);
357 private bool m_doingCamRayCast = false;
358
358 public Vector3 CameraPosition { get; set; } 359 public Vector3 CameraPosition { get; set; }
359 360
360 public Quaternion CameraRotation 361 public Quaternion CameraRotation
@@ -604,6 +605,7 @@ namespace OpenSim.Region.Framework.Scenes
604 } 605 }
605 606
606 public bool IsChildAgent { get; set; } 607 public bool IsChildAgent { get; set; }
608 public bool IsLoggingIn { get; set; }
607 609
608 /// <summary> 610 /// <summary>
609 /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero. 611 /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero.
@@ -740,6 +742,7 @@ namespace OpenSim.Region.Framework.Scenes
740 AttachmentsSyncLock = new Object(); 742 AttachmentsSyncLock = new Object();
741 AllowMovement = true; 743 AllowMovement = true;
742 IsChildAgent = true; 744 IsChildAgent = true;
745 IsLoggingIn = false;
743 m_sendCoarseLocationsMethod = SendCoarseLocationsDefault; 746 m_sendCoarseLocationsMethod = SendCoarseLocationsDefault;
744 Animator = new ScenePresenceAnimator(this); 747 Animator = new ScenePresenceAnimator(this);
745 PresenceType = type; 748 PresenceType = type;
@@ -912,6 +915,7 @@ namespace OpenSim.Region.Framework.Scenes
912 else 915 else
913 { 916 {
914 IsChildAgent = false; 917 IsChildAgent = false;
918 IsLoggingIn = false;
915 } 919 }
916 920
917 921
@@ -1405,35 +1409,43 @@ namespace OpenSim.Region.Framework.Scenes
1405 /// <param name="collisionPoint"></param> 1409 /// <param name="collisionPoint"></param>
1406 /// <param name="localid"></param> 1410 /// <param name="localid"></param>
1407 /// <param name="distance"></param> 1411 /// <param name="distance"></param>
1412 ///
1413
1414 private void UpdateCameraCollisionPlane(Vector4 plane)
1415 {
1416 if (m_lastCameraCollisionPlane != plane)
1417 {
1418 m_lastCameraCollisionPlane = plane;
1419 ControllingClient.SendCameraConstraint(plane);
1420 }
1421 }
1422
1408 public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 pNormal) 1423 public void RayCastCameraCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 pNormal)
1409 { 1424 {
1410 const float POSITION_TOLERANCE = 0.02f; 1425 const float POSITION_TOLERANCE = 0.02f;
1411 const float VELOCITY_TOLERANCE = 0.02f;
1412 const float ROTATION_TOLERANCE = 0.02f; 1426 const float ROTATION_TOLERANCE = 0.02f;
1413 1427
1414 if (m_followCamAuto) 1428 m_doingCamRayCast = false;
1429 if (hitYN && localid != LocalId)
1415 { 1430 {
1416 if (hitYN) 1431 CameraConstraintActive = true;
1417 { 1432 pNormal.X = (float)Math.Round(pNormal.X, 2);
1418 CameraConstraintActive = true; 1433 pNormal.Y = (float)Math.Round(pNormal.Y, 2);
1419 //m_log.DebugFormat("[RAYCASTRESULT]: {0}, {1}, {2}, {3}", hitYN, collisionPoint, localid, distance); 1434 pNormal.Z = (float)Math.Round(pNormal.Z, 2);
1420 1435 pNormal.Normalize();
1421 Vector3 normal = Vector3.Normalize(new Vector3(0f, 0f, collisionPoint.Z) - collisionPoint); 1436 collisionPoint.X = (float)Math.Round(collisionPoint.X, 1);
1422 ControllingClient.SendCameraConstraint(new Vector4(normal.X, normal.Y, normal.Z, -1 * Vector3.Distance(new Vector3(0,0,collisionPoint.Z),collisionPoint))); 1437 collisionPoint.Y = (float)Math.Round(collisionPoint.Y, 1);
1423 } 1438 collisionPoint.Z = (float)Math.Round(collisionPoint.Z, 1);
1424 else 1439
1425 { 1440 Vector4 plane = new Vector4(pNormal.X, pNormal.Y, pNormal.Z, Vector3.Dot(collisionPoint, pNormal));
1426 if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || 1441 UpdateCameraCollisionPlane(plane);
1427 !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || 1442 }
1428 !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) 1443 else if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
1429 { 1444 !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE))
1430 if (CameraConstraintActive) 1445 {
1431 { 1446 Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -9000f); // not right...
1432 ControllingClient.SendCameraConstraint(new Vector4(0f, 0.5f, 0.9f, -3000f)); 1447 UpdateCameraCollisionPlane(plane);
1433 CameraConstraintActive = false; 1448 CameraConstraintActive = false;
1434 }
1435 }
1436 }
1437 } 1449 }
1438 } 1450 }
1439 1451
@@ -1508,12 +1520,6 @@ namespace OpenSim.Region.Framework.Scenes
1508 // DrawDistance = agentData.Far; 1520 // DrawDistance = agentData.Far;
1509 DrawDistance = Scene.DefaultDrawDistance; 1521 DrawDistance = Scene.DefaultDrawDistance;
1510 1522
1511 // Check if Client has camera in 'follow cam' or 'build' mode.
1512 Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation);
1513
1514 m_followCamAuto = ((CameraUpAxis.Z > 0.959f && CameraUpAxis.Z < 0.98f)
1515 && (Math.Abs(camdif.X) < 0.4f && Math.Abs(camdif.Y) < 0.4f)) ? true : false;
1516
1517 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0; 1523 m_mouseLook = (flags & AgentManager.ControlFlags.AGENT_CONTROL_MOUSELOOK) != 0;
1518 m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0; 1524 m_leftButtonDown = (flags & AgentManager.ControlFlags.AGENT_CONTROL_LBUTTON_DOWN) != 0;
1519 1525
@@ -1533,24 +1539,38 @@ namespace OpenSim.Region.Framework.Scenes
1533 StandUp(); 1539 StandUp();
1534 } 1540 }
1535 1541
1536 //m_log.DebugFormat("[FollowCam]: {0}", m_followCamAuto);
1537 // Raycast from the avatar's head to the camera to see if there's anything blocking the view 1542 // Raycast from the avatar's head to the camera to see if there's anything blocking the view
1538 if ((m_movementUpdateCount % NumMovementsBetweenRayCast) == 0 && m_scene.PhysicsScene.SupportsRayCast()) 1543 // this exclude checks may not be complete
1544
1545 if (m_movementUpdateCount % NumMovementsBetweenRayCast == 0 && m_scene.PhysicsScene.SupportsRayCast())
1539 { 1546 {
1540 if (m_followCamAuto) 1547 if (!m_doingCamRayCast && !m_mouseLook && ParentID == 0)
1541 { 1548 {
1542 // Vector3 posAdjusted = m_pos + HEAD_ADJUSTMENT; 1549 Vector3 posAdjusted = AbsolutePosition;
1543 // m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(CameraPosition - posAdjusted), Vector3.Distance(CameraPosition, posAdjusted) + 0.3f, RayCastCameraCallback); 1550// posAdjusted.Z += 0.5f * Appearance.AvatarSize.Z - 0.5f;
1544 1551 posAdjusted.Z += 1.0f; // viewer current camera focus point
1545 Vector3 posAdjusted = AbsolutePosition + HEAD_ADJUSTMENT; 1552 Vector3 tocam = CameraPosition - posAdjusted;
1546 Vector3 distTocam = CameraPosition - posAdjusted; 1553 tocam.X = (float)Math.Round(tocam.X, 1);
1547 float distTocamlen = distTocam.Length(); 1554 tocam.Y = (float)Math.Round(tocam.Y, 1);
1548 if (distTocamlen > 0) 1555 tocam.Z = (float)Math.Round(tocam.Z, 1);
1556
1557 float distTocamlen = tocam.Length();
1558 if (distTocamlen > 0.3f)
1549 { 1559 {
1550 distTocam *= 1.0f / distTocamlen; 1560 tocam *= (1.0f / distTocamlen);
1551 m_scene.PhysicsScene.RaycastWorld(posAdjusted, distTocam, distTocamlen + 0.3f, RayCastCameraCallback); 1561 posAdjusted.X = (float)Math.Round(posAdjusted.X, 1);
1562 posAdjusted.Y = (float)Math.Round(posAdjusted.Y, 1);
1563 posAdjusted.Z = (float)Math.Round(posAdjusted.Z, 1);
1564
1565 m_doingCamRayCast = true;
1566 m_scene.PhysicsScene.RaycastWorld(posAdjusted, tocam, distTocamlen + 1.0f, RayCastCameraCallback);
1552 } 1567 }
1553 1568 }
1569 else if (CameraConstraintActive && (m_mouseLook || ParentID != 0))
1570 {
1571 Vector4 plane = new Vector4(0.9f, 0.0f, 0.361f, -10000f); // not right...
1572 UpdateCameraCollisionPlane(plane);
1573 CameraConstraintActive = false;
1554 } 1574 }
1555 } 1575 }
1556 1576
@@ -2265,7 +2285,6 @@ namespace OpenSim.Region.Framework.Scenes
2265 ControllingClient.SendAlertMessage(" Sit position on restricted land, try another spot"); 2285 ControllingClient.SendAlertMessage(" Sit position on restricted land, try another spot");
2266 return; 2286 return;
2267 } 2287 }
2268// m_log.InfoFormat("physsit {0} {1}", offset.ToString(),Orientation.ToString());
2269 2288
2270 RemoveFromPhysicalScene(); 2289 RemoveFromPhysicalScene();
2271 2290
@@ -2276,7 +2295,6 @@ namespace OpenSim.Region.Framework.Scenes
2276 2295
2277 part.AddSittingAvatar(UUID); 2296 part.AddSittingAvatar(UUID);
2278 2297
2279
2280 Vector3 cameraAtOffset = part.GetCameraAtOffset(); 2298 Vector3 cameraAtOffset = part.GetCameraAtOffset();
2281 Vector3 cameraEyeOffset = part.GetCameraEyeOffset(); 2299 Vector3 cameraEyeOffset = part.GetCameraEyeOffset();
2282 bool forceMouselook = part.GetForceMouselook(); 2300 bool forceMouselook = part.GetForceMouselook();
@@ -2502,20 +2520,12 @@ namespace OpenSim.Region.Framework.Scenes
2502 // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to 2520 // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to
2503 // grab the latest PhysicsActor velocity, whereas m_velocity is often 2521 // grab the latest PhysicsActor velocity, whereas m_velocity is often
2504 // storing a requested force instead of an actual traveling velocity 2522 // storing a requested force instead of an actual traveling velocity
2505 if (Appearance.AvatarSize != m_lastSize) 2523 if (Appearance.AvatarSize != m_lastSize && !IsLoggingIn)
2506 {
2507 m_lastSize = Appearance.AvatarSize;
2508 SendAvatarDataToAllAgents(); 2524 SendAvatarDataToAllAgents();
2509 }
2510 // Throw away duplicate or insignificant updates
2511 else if (
2512 // If the velocity has become zero, send it no matter what.
2513 (Velocity != m_lastVelocity && Velocity == Vector3.Zero)
2514 // otherwise, if things have changed reasonably, send the update
2515 || (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)
2516 || !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE)
2517 || !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)))
2518 2525
2526 if (!Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
2527 !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
2528 !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
2519 { 2529 {
2520 SendTerseUpdateToAllClients(); 2530 SendTerseUpdateToAllClients();
2521 2531
@@ -2704,6 +2714,8 @@ namespace OpenSim.Region.Framework.Scenes
2704 return; 2714 return;
2705 } 2715 }
2706 2716
2717 m_lastSize = Appearance.AvatarSize;
2718
2707 int count = 0; 2719 int count = 0;
2708 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2720 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2709 { 2721 {