aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMelanie2012-01-24 00:36:42 +0000
committerMelanie2012-01-24 00:36:42 +0000
commit07ad821157a5e86d706114645eee1339a6ba51ae (patch)
treec2cf6cdd466fc6e492e95a852b94cbbc7604ee83 /OpenSim/Framework
parentMerge branch 'master' of ssh://3dhosting.de/var/git/careminster (diff)
parentChange Telehubs to store only the data that is really needed and not (diff)
downloadopensim-SC_OLD-07ad821157a5e86d706114645eee1339a6ba51ae.zip
opensim-SC_OLD-07ad821157a5e86d706114645eee1339a6ba51ae.tar.gz
opensim-SC_OLD-07ad821157a5e86d706114645eee1339a6ba51ae.tar.bz2
opensim-SC_OLD-07ad821157a5e86d706114645eee1339a6ba51ae.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Data/MySQL/MySQLSimulationData.cs OpenSim/Framework/RegionSettings.cs
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/RegionSettings.cs108
1 files changed, 45 insertions, 63 deletions
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs
index 01406ce..7cdfc1c 100644
--- a/OpenSim/Framework/RegionSettings.cs
+++ b/OpenSim/Framework/RegionSettings.cs
@@ -32,6 +32,47 @@ using OpenMetaverse;
32 32
33namespace OpenSim.Framework 33namespace OpenSim.Framework
34{ 34{
35 public struct SpawnPoint
36 {
37 public float Yaw;
38 public float Pitch;
39 public float Distance;
40
41 public void SetLocation(Vector3 pos, Quaternion rot, Vector3 point)
42 {
43 // The point is an absolute position, so we need the relative
44 // location to the spawn point
45 Vector3 offset = pos - point;
46 Distance = Vector3.Mag(offset);
47
48 // Next we need to rotate this vector into the spawn point's
49 // coordinate system
50 offset = offset * rot;
51
52 Vector3 dir = Vector3.Normalize(offset);
53
54 // Get the bearing (yaw)
55 Yaw = (float)Math.Atan2(dir.Y, dir.X);
56
57 // Get the elevation (pitch)
58 Pitch = (float)-Math.Atan2(dir.Z, Math.Sqrt(dir.X * dir.X + dir.Y * dir.Y));
59 }
60
61 public Vector3 GetLocation(Vector3 pos, Quaternion rot)
62 {
63 Quaternion y = Quaternion.CreateFromEulers(0, 0, Yaw);
64 Quaternion p = Quaternion.CreateFromEulers(0, Pitch, 0);
65
66 Vector3 dir = new Vector3(1, 0, 0) * p * y;
67 Vector3 offset = dir * (float)Distance;
68
69 rot.W = -rot.W;
70 offset *= rot;
71
72 return pos + offset;
73 }
74 }
75
35 public class RegionSettings 76 public class RegionSettings
36 { 77 {
37 public delegate void SaveDelegate(RegionSettings rs); 78 public delegate void SaveDelegate(RegionSettings rs);
@@ -426,14 +467,7 @@ namespace OpenSim.Framework
426 { 467 {
427 get 468 get
428 { 469 {
429 if (HasTelehub) 470 return m_TelehubObject;
430 {
431 return m_TelehubObject;
432 }
433 else
434 {
435 return UUID.Zero;
436 }
437 } 471 }
438 set 472 set
439 { 473 {
@@ -441,66 +475,14 @@ namespace OpenSim.Framework
441 } 475 }
442 } 476 }
443 477
444 // Connected Telehub name
445 private string m_TelehubName;
446 public string TelehubName
447 {
448 get
449 {
450 if (HasTelehub)
451 {
452 return m_TelehubName;
453 }
454 else
455 {
456 return String.Empty;
457 }
458 }
459 set
460 {
461 m_TelehubName = value;
462 }
463 }
464
465 // Connected Telehub position
466 private Vector3 m_TelehubPos;
467 public Vector3 TelehubPos
468 {
469 get
470 {
471 if (HasTelehub)
472 {
473 return m_TelehubPos;
474 }
475 else
476 {
477 return Vector3.Zero;
478 }
479 }
480 set
481 {
482 m_TelehubPos = value;
483 }
484 }
485
486 // Connected Telehub rotation
487 private Quaternion m_TelehubRot;
488 public Quaternion TelehubRot
489 {
490 get
491 { return m_TelehubRot; }
492 set
493 { m_TelehubRot = value; }
494 }
495
496 // Our Connected Telehub's SpawnPoints 478 // Our Connected Telehub's SpawnPoints
497 public List<Vector3> l_SpawnPoints = new List<Vector3>(); 479 public List<SpawnPoint> l_SpawnPoints = new List<SpawnPoint>();
498 480
499 // Add a SpawnPoint 481 // Add a SpawnPoint
500 // ** These are not region coordinates ** 482 // ** These are not region coordinates **
501 // They are relative to the Telehub coordinates 483 // They are relative to the Telehub coordinates
502 // 484 //
503 public void AddSpawnPoint(Vector3 point) 485 public void AddSpawnPoint(SpawnPoint point)
504 { 486 {
505 l_SpawnPoints.Add(point); 487 l_SpawnPoints.Add(point);
506 } 488 }
@@ -512,7 +494,7 @@ namespace OpenSim.Framework
512 } 494 }
513 495
514 // Return the List of SpawnPoints 496 // Return the List of SpawnPoints
515 public List<Vector3> SpawnPoints() 497 public List<SpawnPoint> SpawnPoints()
516 { 498 {
517 return l_SpawnPoints; 499 return l_SpawnPoints;
518 500