aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/IClientAPI.cs2
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs36
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs82
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs5
5 files changed, 114 insertions, 14 deletions
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 0e8b82d..05adf22 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -237,7 +237,7 @@ namespace OpenSim.Framework
237 237
238 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); 238 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status);
239 239
240 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); 240 public delegate void UpdateAgent(IClientAPI remoteClient, AgentUpdatePacket agentData);
241 241
242 public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset); 242 public delegate void AgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset);
243 243
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index f62407d..7f762b6 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -186,7 +186,8 @@ namespace OpenSim.Region.ClientStack
186 if (OnAgentUpdate != null) 186 if (OnAgentUpdate != null)
187 { 187 {
188 AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack; 188 AgentUpdatePacket agenUpdate = (AgentUpdatePacket) Pack;
189 OnAgentUpdate(this, agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotation); 189
190 OnAgentUpdate(this, agenUpdate); //agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa);
190 } 191 }
191 break; 192 break;
192 case PacketType.AgentAnimation: 193 case PacketType.AgentAnimation:
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 1f3bc95..38a8a06 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -1,6 +1,7 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using Axiom.Math;
4using libsecondlife; 5using libsecondlife;
5using libsecondlife.Packets; 6using libsecondlife.Packets;
6using OpenSim.Framework; 7using OpenSim.Framework;
@@ -325,7 +326,32 @@ namespace OpenSim.Region.Environment.Scenes
325 { 326 {
326 if (ent is SceneObjectGroup) 327 if (ent is SceneObjectGroup)
327 { 328 {
328 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence); 329 // Only send child agents stuff in their draw distance.
330 // This will need to be done for every agent once we figure out
331 // what we're going to use to store prim that agents already got
332 // the initial update for and what we'll use to limit the
333 // space we check for new objects on movement.
334
335 if (presence.IsChildAgent)
336 {
337 //Vector3 avPosition = new Vector3(presence.AbsolutePosition.X,presence.AbsolutePosition.Y,presence.AbsolutePosition.Z);
338 //LLVector3 oLoc = ((SceneObjectGroup)ent).AbsolutePosition;
339 //Vector3 objPosition = new Vector3(oLoc.X,oLoc.Y,oLoc.Z);
340 //float distResult = Vector3Distance(avPosition, objPosition);
341 //if (distResult > 512)
342 //{
343 //int x = 0;
344 //}
345 //if (distResult < presence.DrawDistance)
346 //{
347 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
348 //}
349
350 }
351 else
352 {
353 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
354 }
329 } 355 }
330 } 356 }
331 } 357 }
@@ -642,7 +668,15 @@ namespace OpenSim.Region.Environment.Scenes
642 } 668 }
643 669
644 } 670 }
671 public float Vector3Distance(Vector3 v1, Vector3 v2)
672 {
673 // Calculates the distance between two Vector3s
674 // We don't really need the double floating point precision...
675 // so casting it to a single
645 676
677 return (float)Math.Sqrt((v1.x - v2.x) * (v1.x - v2.x) + (v1.y - v2.y) * (v1.y - v2.y) + (v1.z - v2.z) * (v1.z - v2.z));
678
679 }
646 #endregion 680 #endregion
647 } 681 }
648} 682}
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 }
diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
index f7af2f2..65c8ee7 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs
@@ -364,7 +364,10 @@ namespace SimpleApp
364 364
365 if (OnAgentUpdate != null) 365 if (OnAgentUpdate != null)
366 { 366 {
367 OnAgentUpdate(this, movementFlag, bodyDirection); 367 AgentUpdatePacket pack = new AgentUpdatePacket();
368 pack.AgentData.ControlFlags = movementFlag;
369 pack.AgentData.BodyRotation = bodyDirection;
370 OnAgentUpdate(this, pack);
368 } 371 }
369 if (flyState == 0) 372 if (flyState == 0)
370 { 373 {