diff options
author | Teravus Ovares | 2007-11-22 01:32:13 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-22 01:32:13 +0000 |
commit | e69c810486e63e8b4398c7b67e84d73154d2dfcf (patch) | |
tree | 21423ba1dfad709e85a52e455d2c65840bad21d2 /OpenSim/Region/Environment/Scenes/ScenePresence.cs | |
parent | Fixed bug that can lead to infinitive loops (diff) | |
download | opensim-SC_OLD-e69c810486e63e8b4398c7b67e84d73154d2dfcf.zip opensim-SC_OLD-e69c810486e63e8b4398c7b67e84d73154d2dfcf.tar.gz opensim-SC_OLD-e69c810486e63e8b4398c7b67e84d73154d2dfcf.tar.bz2 opensim-SC_OLD-e69c810486e63e8b4398c7b67e84d73154d2dfcf.tar.xz |
* Added code to capture the draw distance setting from the client.
* Added a support function to InnerScene to calculate the distance between two vectors.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 82 |
1 files changed, 72 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index be21748..3929f0f 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -79,6 +79,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
79 | private LLVector3 lastPhysPos = new LLVector3(); | 79 | private LLVector3 lastPhysPos = new LLVector3(); |
80 | private int m_wearablesSerial = 1; | 80 | private int m_wearablesSerial = 1; |
81 | 81 | ||
82 | |||
83 | // Position of agent's camera in world | ||
84 | protected Vector3 m_CameraCenter = new Vector3(0, 0, 0); | ||
85 | |||
86 | // Use these three vectors to figure out what the agent is looking at | ||
87 | // Convert it to a Matrix and/or Quaternion | ||
88 | protected Vector3 m_CameraAtAxis = new Vector3(0, 0, 0); | ||
89 | protected Vector3 m_CameraLeftAxis = new Vector3(0, 0, 0); | ||
90 | protected Vector3 m_CameraUpAxis = new Vector3(0, 0, 0); | ||
91 | |||
92 | // Agent's Draw distance. | ||
93 | protected float m_DrawDistance = 0f; | ||
94 | |||
82 | private readonly List<ulong> m_knownChildRegions = new List<ulong>(); //neighbouring regions we have enabled a child agent in | 95 | private readonly List<ulong> m_knownChildRegions = new List<ulong>(); //neighbouring regions we have enabled a child agent in |
83 | 96 | ||
84 | private enum Dir_ControlFlags | 97 | private enum Dir_ControlFlags |
@@ -148,6 +161,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
148 | get { return m_lastname; } | 161 | get { return m_lastname; } |
149 | } | 162 | } |
150 | 163 | ||
164 | public float DrawDistance | ||
165 | { | ||
166 | get { return m_DrawDistance; } | ||
167 | } | ||
168 | |||
151 | protected bool m_allowMovement = true; | 169 | protected bool m_allowMovement = true; |
152 | public bool AllowMovement | 170 | public bool AllowMovement |
153 | { | 171 | { |
@@ -408,11 +426,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
408 | AddToPhysicalScene(); | 426 | AddToPhysicalScene(); |
409 | m_physicsActor.Flying = isFlying; | 427 | m_physicsActor.Flying = isFlying; |
410 | 428 | ||
411 | if (!m_gotAllObjectsInScene) | 429 | //if (!m_gotAllObjectsInScene) |
412 | { | 430 | //{ |
413 | m_scene.SendAllSceneObjectsToClient(this); | 431 | //m_scene.SendAllSceneObjectsToClient(this); |
414 | m_gotAllObjectsInScene = true; | 432 | //m_gotAllObjectsInScene = true; |
415 | } | 433 | //} |
416 | 434 | ||
417 | } | 435 | } |
418 | 436 | ||
@@ -526,7 +544,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
526 | } | 544 | } |
527 | } | 545 | } |
528 | 546 | ||
529 | public void HandleAgentUpdate(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation) | 547 | public void HandleAgentUpdate(IClientAPI remoteClient,AgentUpdatePacket agentData ) |
530 | { | 548 | { |
531 | //if (m_isChildAgent) | 549 | //if (m_isChildAgent) |
532 | //{ | 550 | //{ |
@@ -536,6 +554,54 @@ namespace OpenSim.Region.Environment.Scenes | |||
536 | 554 | ||
537 | // Must check for standing up even when PhysicsActor is null, | 555 | // Must check for standing up even when PhysicsActor is null, |
538 | // since sitting currently removes avatar from physical scene | 556 | // since sitting currently removes avatar from physical scene |
557 | |||
558 | uint flags = agentData.AgentData.ControlFlags; | ||
559 | LLQuaternion bodyRotation = agentData.AgentData.BodyRotation; | ||
560 | |||
561 | // Camera location in world. We'll need to raytrace | ||
562 | // from this location from time to time. | ||
563 | m_CameraCenter.x = agentData.AgentData.CameraCenter.X; | ||
564 | m_CameraCenter.y = agentData.AgentData.CameraCenter.Y; | ||
565 | m_CameraCenter.z = agentData.AgentData.CameraCenter.Z; | ||
566 | |||
567 | |||
568 | // Use these three vectors to figure out what the agent is looking at | ||
569 | // Convert it to a Matrix and/or Quaternion | ||
570 | m_CameraAtAxis.x = agentData.AgentData.CameraAtAxis.X; | ||
571 | m_CameraAtAxis.y = agentData.AgentData.CameraAtAxis.Y; | ||
572 | m_CameraAtAxis.z = agentData.AgentData.CameraAtAxis.Z; | ||
573 | |||
574 | m_CameraLeftAxis.x = agentData.AgentData.CameraLeftAxis.X; | ||
575 | m_CameraLeftAxis.y = agentData.AgentData.CameraLeftAxis.Y; | ||
576 | m_CameraLeftAxis.z = agentData.AgentData.CameraLeftAxis.Z; | ||
577 | |||
578 | m_CameraUpAxis.x = agentData.AgentData.CameraUpAxis.X; | ||
579 | m_CameraUpAxis.y = agentData.AgentData.CameraUpAxis.Y; | ||
580 | m_CameraUpAxis.z = agentData.AgentData.CameraUpAxis.Z; | ||
581 | |||
582 | // The Agent's Draw distance setting | ||
583 | m_DrawDistance = agentData.AgentData.Far; | ||
584 | |||
585 | // We don't know the agent's draw distance until the first agentUpdate packet | ||
586 | //if (m_DrawDistance > 0) | ||
587 | //{ | ||
588 | //if (!m_gotAllObjectsInScene && m_DrawDistance > 0) | ||
589 | //{ | ||
590 | // This will need to end up being a space based invalidator | ||
591 | // where we send object updates on spaces in 3d space (possibily a cube) | ||
592 | // that the avatar hasn't been surrounding it's draw distance. | ||
593 | // It would be better if the distance increased incrementally | ||
594 | // until there was no space to update because either the avatar's draw | ||
595 | // distance is smaller then the space they've been or the avatar has explored | ||
596 | // all the space in the sim. | ||
597 | |||
598 | //m_scene.SendAllSceneObjectsToClient(this); | ||
599 | //m_gotAllObjectsInScene = true; | ||
600 | //} | ||
601 | //} | ||
602 | //MainLog.Instance.Verbose("CAMERA", "AtAxis:" + m_CameraAtAxis.ToString() + " Center:" + m_CameraCenter.ToString() + " LeftAxis:" + m_CameraLeftAxis.ToString() + " UpAxis:" + m_CameraUpAxis.ToString() + " Far:" + m_CameraFar); | ||
603 | |||
604 | |||
539 | if ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) | 605 | if ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) |
540 | { | 606 | { |
541 | StandUp(); | 607 | StandUp(); |
@@ -999,10 +1065,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
999 | { | 1065 | { |
1000 | SendOwnWearables( ); | 1066 | SendOwnWearables( ); |
1001 | 1067 | ||
1002 | //Ugly hack x.x - Trap set appearence to send all objects in this scene! | ||
1003 | |||
1004 | m_scene.SendAllSceneObjectsToClient(this); | ||
1005 | m_gotAllObjectsInScene = true; | ||
1006 | // TODO: remove this once the SunModule is slightly more tested | 1068 | // TODO: remove this once the SunModule is slightly more tested |
1007 | // m_controllingClient.SendViewerTime(m_scene.TimePhase); | 1069 | // m_controllingClient.SendViewerTime(m_scene.TimePhase); |
1008 | } | 1070 | } |