aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionSettings.cs
diff options
context:
space:
mode:
authorDan Lake2012-02-01 16:25:35 -0800
committerDan Lake2012-02-01 16:25:35 -0800
commitc10193c72b1f029a958f04d2f5d7ee384e693aaa (patch)
tree052ec7e973c15b158310511197affad14eb9c64f /OpenSim/Framework/RegionSettings.cs
parentTrigger event when prims are scheduled for an update. This gives modules earl... (diff)
parentSmall optimization to last commit (diff)
downloadopensim-SC_OLD-c10193c72b1f029a958f04d2f5d7ee384e693aaa.zip
opensim-SC_OLD-c10193c72b1f029a958f04d2f5d7ee384e693aaa.tar.gz
opensim-SC_OLD-c10193c72b1f029a958f04d2f5d7ee384e693aaa.tar.bz2
opensim-SC_OLD-c10193c72b1f029a958f04d2f5d7ee384e693aaa.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Framework/RegionSettings.cs')
-rw-r--r--OpenSim/Framework/RegionSettings.cs94
1 files changed, 94 insertions, 0 deletions
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs
index 673cf20..91e07df 100644
--- a/OpenSim/Framework/RegionSettings.cs
+++ b/OpenSim/Framework/RegionSettings.cs
@@ -26,11 +26,53 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.IO; 30using System.IO;
30using OpenMetaverse; 31using OpenMetaverse;
31 32
32namespace OpenSim.Framework 33namespace OpenSim.Framework
33{ 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 = point - pos;
46 Distance = Vector3.Mag(offset);
47
48 // Next we need to rotate this vector into the spawn point's
49 // coordinate system
50 rot.W = -rot.W;
51 offset = offset * rot;
52
53 Vector3 dir = Vector3.Normalize(offset);
54
55 // Get the bearing (yaw)
56 Yaw = (float)Math.Atan2(dir.Y, dir.X);
57
58 // Get the elevation (pitch)
59 Pitch = (float)-Math.Atan2(dir.Z, Math.Sqrt(dir.X * dir.X + dir.Y * dir.Y));
60 }
61
62 public Vector3 GetLocation(Vector3 pos, Quaternion rot)
63 {
64 Quaternion y = Quaternion.CreateFromEulers(0, 0, Yaw);
65 Quaternion p = Quaternion.CreateFromEulers(0, Pitch, 0);
66
67 Vector3 dir = new Vector3(1, 0, 0) * p * y;
68 Vector3 offset = dir * (float)Distance;
69
70 offset *= rot;
71
72 return pos + offset;
73 }
74 }
75
34 public class RegionSettings 76 public class RegionSettings
35 { 77 {
36 public delegate void SaveDelegate(RegionSettings rs); 78 public delegate void SaveDelegate(RegionSettings rs);
@@ -331,6 +373,14 @@ namespace OpenSim.Framework
331 set { m_SunVector = value; } 373 set { m_SunVector = value; }
332 } 374 }
333 375
376 private UUID m_ParcelImageID;
377
378 public UUID ParcelImageID
379 {
380 get { return m_ParcelImageID; }
381 set { m_ParcelImageID = value; }
382 }
383
334 private UUID m_TerrainImageID; 384 private UUID m_TerrainImageID;
335 385
336 public UUID TerrainImageID 386 public UUID TerrainImageID
@@ -397,5 +447,49 @@ namespace OpenSim.Framework
397 set { m_LoadedCreationID = value; } 447 set { m_LoadedCreationID = value; }
398 } 448 }
399 449
450 // Connected Telehub object
451 private UUID m_TelehubObject;
452 public UUID TelehubObject
453 {
454 get
455 {
456 return m_TelehubObject;
457 }
458 set
459 {
460 m_TelehubObject = value;
461 }
462 }
463
464 // Our Connected Telehub's SpawnPoints
465 public List<SpawnPoint> l_SpawnPoints = new List<SpawnPoint>();
466
467 // Add a SpawnPoint
468 // ** These are not region coordinates **
469 // They are relative to the Telehub coordinates
470 //
471 public void AddSpawnPoint(SpawnPoint point)
472 {
473 l_SpawnPoints.Add(point);
474 }
475
476 // Remove a SpawnPoint
477 public void RemoveSpawnPoint(int point_index)
478 {
479 l_SpawnPoints.RemoveAt(point_index);
480 }
481
482 // Return the List of SpawnPoints
483 public List<SpawnPoint> SpawnPoints()
484 {
485 return l_SpawnPoints;
486
487 }
488
489 // Clear the SpawnPoints List of all entries
490 public void ClearSpawnPoints()
491 {
492 l_SpawnPoints.Clear();
493 }
400 } 494 }
401} 495}