diff options
Avatar Appearance refactoring /changes. Added a AvatarAppearance class, each ScenePresence "has" a AvatarAppearance object. All the ScenePresences in a opensim related to one user (so a user's various ScenePresence's in all the regions in that instance) share the same AvatarAppearance object. This means that a user's avatar should appear correctly (to both that user and other users) no matter what border crossing or teleporting they have done.
Note: this mainly improves Standalone mode, as in grid mode the appearance data isn't passed between region servers. Although people should notice a improvement when moving between regions in the same instance.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 268 |
1 files changed, 137 insertions, 131 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 66872fa..f8571a9 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -58,10 +58,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
58 | private bool m_setAlwaysRun = false; | 58 | private bool m_setAlwaysRun = false; |
59 | 59 | ||
60 | private Quaternion m_bodyRot; | 60 | private Quaternion m_bodyRot; |
61 | private byte[] m_visualParams; | 61 | |
62 | private AvatarWearable[] m_wearables; | ||
63 | private LLObject.TextureEntry m_textureEntry; | ||
64 | |||
65 | public bool IsRestrictedToRegion = false; | 62 | public bool IsRestrictedToRegion = false; |
66 | 63 | ||
67 | private bool m_newForce = false; | 64 | private bool m_newForce = false; |
@@ -75,7 +72,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
75 | 72 | ||
76 | private readonly Vector3[] Dir_Vectors = new Vector3[6]; | 73 | private readonly Vector3[] Dir_Vectors = new Vector3[6]; |
77 | private LLVector3 lastPhysPos = new LLVector3(); | 74 | private LLVector3 lastPhysPos = new LLVector3(); |
78 | private int m_wearablesSerial = 1; | 75 | |
79 | 76 | ||
80 | // Position of agent's camera in world | 77 | // Position of agent's camera in world |
81 | protected Vector3 m_CameraCenter = new Vector3(0, 0, 0); | 78 | protected Vector3 m_CameraCenter = new Vector3(0, 0, 0); |
@@ -89,6 +86,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
89 | // Agent's Draw distance. | 86 | // Agent's Draw distance. |
90 | protected float m_DrawDistance = 0f; | 87 | protected float m_DrawDistance = 0f; |
91 | 88 | ||
89 | protected AvatarAppearance m_appearance; | ||
90 | |||
92 | private readonly List<ulong> m_knownChildRegions = new List<ulong>(); //neighbouring regions we have enabled a child agent in | 91 | private readonly List<ulong> m_knownChildRegions = new List<ulong>(); //neighbouring regions we have enabled a child agent in |
93 | 92 | ||
94 | private enum Dir_ControlFlags | 93 | private enum Dir_ControlFlags |
@@ -110,13 +109,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
110 | 109 | ||
111 | public event SignificantClientMovement OnSignificantClientMovement; | 110 | public event SignificantClientMovement OnSignificantClientMovement; |
112 | 111 | ||
113 | //public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>(); | ||
114 | |||
115 | // private string m_currentQuadNode = " "; | ||
116 | |||
117 | // private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); | ||
118 | //private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>(); | ||
119 | |||
120 | private UpdateQueue m_partsUpdateQueue = new UpdateQueue(); | 112 | private UpdateQueue m_partsUpdateQueue = new UpdateQueue(); |
121 | private Dictionary<LLUUID, ScenePartUpdate> m_updateTimes = new Dictionary<LLUUID, ScenePartUpdate>(); | 113 | private Dictionary<LLUUID, ScenePartUpdate> m_updateTimes = new Dictionary<LLUUID, ScenePartUpdate>(); |
122 | 114 | ||
@@ -280,23 +272,74 @@ namespace OpenSim.Region.Environment.Scenes | |||
280 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, | 272 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, |
281 | AvatarWearable[] wearables) | 273 | AvatarWearable[] wearables) |
282 | { | 274 | { |
283 | m_scene = world; | 275 | //couldn't move the following into SetInitialValues as they are readonly |
284 | m_uuid = client.AgentId; | 276 | m_regionHandle = reginfo.RegionHandle; |
277 | m_controllingClient = client; | ||
278 | m_firstname = m_controllingClient.FirstName; | ||
279 | m_lastname = m_controllingClient.LastName; | ||
285 | 280 | ||
286 | m_regionInfo = reginfo; | 281 | SetInitialValues(client, world, reginfo); |
282 | |||
283 | m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); | ||
284 | |||
285 | Animations = new AvatarAnimations(); | ||
286 | Animations.LoadAnims(); | ||
287 | |||
288 | RegisterToEvents(); | ||
289 | |||
290 | SetDirectionVectors(); | ||
291 | |||
292 | //m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length); | ||
293 | |||
294 | // m_textureEntry = GetDefaultTextureEntry(); | ||
295 | //temporary until we move some code into the body classes | ||
296 | |||
297 | if (m_newAvatar) | ||
298 | { | ||
299 | //do we need to use newAvatar? not sure so have added this to kill the compile warning | ||
300 | } | ||
301 | |||
302 | m_scene.LandManager.sendLandUpdate(this); | ||
303 | } | ||
304 | |||
305 | |||
306 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) | ||
307 | { | ||
308 | //couldn't move the following into SetInitialValues as they are readonly | ||
287 | m_regionHandle = reginfo.RegionHandle; | 309 | m_regionHandle = reginfo.RegionHandle; |
288 | m_controllingClient = client; | 310 | m_controllingClient = client; |
289 | m_firstname = m_controllingClient.FirstName; | 311 | m_firstname = m_controllingClient.FirstName; |
290 | m_lastname = m_controllingClient.LastName; | 312 | m_lastname = m_controllingClient.LastName; |
291 | m_localId = m_scene.NextLocalId; | ||
292 | AbsolutePosition = m_controllingClient.StartPos; | ||
293 | 313 | ||
294 | m_visualParams = visualParams; | 314 | SetInitialValues(client, world, reginfo); |
295 | m_wearables = wearables; | 315 | |
316 | m_appearance = appearance; | ||
296 | 317 | ||
297 | Animations = new AvatarAnimations(); | 318 | Animations = new AvatarAnimations(); |
298 | Animations.LoadAnims(); | 319 | Animations.LoadAnims(); |
299 | 320 | ||
321 | RegisterToEvents(); | ||
322 | SetDirectionVectors(); | ||
323 | |||
324 | if (m_newAvatar) | ||
325 | { | ||
326 | //do we need to use newAvatar? not sure so have added this to kill the compile warning | ||
327 | } | ||
328 | |||
329 | m_scene.LandManager.sendLandUpdate(this); | ||
330 | } | ||
331 | |||
332 | private void SetInitialValues(IClientAPI client, Scene world, RegionInfo reginfo) | ||
333 | { | ||
334 | m_scene = world; | ||
335 | m_uuid = client.AgentId; | ||
336 | m_regionInfo = reginfo; | ||
337 | m_localId = m_scene.NextLocalId; | ||
338 | AbsolutePosition = m_controllingClient.StartPos; | ||
339 | } | ||
340 | |||
341 | private void RegisterToEvents() | ||
342 | { | ||
300 | //register for events | 343 | //register for events |
301 | m_controllingClient.OnRequestWearables += SendOwnAppearance; | 344 | m_controllingClient.OnRequestWearables += SendOwnAppearance; |
302 | m_controllingClient.OnSetAppearance += SetAppearance; | 345 | m_controllingClient.OnSetAppearance += SetAppearance; |
@@ -306,30 +349,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
306 | m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; | 349 | m_controllingClient.OnAgentRequestSit += HandleAgentRequestSit; |
307 | m_controllingClient.OnAgentSit += HandleAgentSit; | 350 | m_controllingClient.OnAgentSit += HandleAgentSit; |
308 | m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; | 351 | m_controllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; |
309 | 352 | ||
310 | // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); | 353 | // ControllingClient.OnStartAnim += new StartAnim(this.SendAnimPack); |
311 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); | 354 | // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); |
312 | //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); | 355 | //ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); |
356 | } | ||
313 | 357 | ||
358 | private void SetDirectionVectors() | ||
359 | { | ||
314 | Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD | 360 | Dir_Vectors[0] = new Vector3(1, 0, 0); //FOWARD |
315 | Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK | 361 | Dir_Vectors[1] = new Vector3(-1, 0, 0); //BACK |
316 | Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT | 362 | Dir_Vectors[2] = new Vector3(0, 1, 0); //LEFT |
317 | Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT | 363 | Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT |
318 | Dir_Vectors[4] = new Vector3(0, 0, 1); //UP | 364 | Dir_Vectors[4] = new Vector3(0, 0, 1); //UP |
319 | Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN | 365 | Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN |
320 | |||
321 | m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length); | ||
322 | |||
323 | //temporary until we move some code into the body classes | ||
324 | |||
325 | if (m_newAvatar) | ||
326 | { | ||
327 | //do we need to use newAvatar? not sure so have added this to kill the compile warning | ||
328 | } | ||
329 | |||
330 | m_scene.LandManager.sendLandUpdate(this); | ||
331 | } | 366 | } |
332 | |||
333 | #endregion | 367 | #endregion |
334 | 368 | ||
335 | public void QueuePartForUpdate(SceneObjectPart part) | 369 | public void QueuePartForUpdate(SceneObjectPart part) |
@@ -371,33 +405,33 @@ namespace OpenSim.Region.Environment.Scenes | |||
371 | if (m_updateTimes.ContainsKey(part.UUID)) | 405 | if (m_updateTimes.ContainsKey(part.UUID)) |
372 | { | 406 | { |
373 | ScenePartUpdate update = m_updateTimes[part.UUID]; | 407 | ScenePartUpdate update = m_updateTimes[part.UUID]; |
374 | 408 | ||
375 | // Two updates can occur with the same timestamp (especially | 409 | // Two updates can occur with the same timestamp (especially |
376 | // since our timestamp resolution is to the nearest second). The first | 410 | // since our timestamp resolution is to the nearest second). The first |
377 | // could have been sent in the last update - we still need to send the | 411 | // could have been sent in the last update - we still need to send the |
378 | // second here. | 412 | // second here. |
379 | 413 | ||
380 | 414 | ||
381 | 415 | ||
382 | if (update.LastFullUpdateTime < part.TimeStampFull) | 416 | if (update.LastFullUpdateTime < part.TimeStampFull) |
383 | { | 417 | { |
384 | //need to do a full update | 418 | //need to do a full update |
385 | part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID)); | 419 | part.SendFullUpdate(ControllingClient, GenerateClientFlags(part.UUID)); |
386 | 420 | ||
387 | // We'll update to the part's timestamp rather than the current to | 421 | // We'll update to the part's timestamp rather than the current to |
388 | // avoid the race condition whereby the next tick occurs while we are | 422 | // avoid the race condition whereby the next tick occurs while we are |
389 | // doing this update. If this happened, then subsequent updates which occurred | 423 | // doing this update. If this happened, then subsequent updates which occurred |
390 | // on the same tick or the next tick of the last update would be ignored. | 424 | // on the same tick or the next tick of the last update would be ignored. |
391 | update.LastFullUpdateTime = part.TimeStampFull; | 425 | update.LastFullUpdateTime = part.TimeStampFull; |
392 | 426 | ||
393 | updateCount++; | 427 | updateCount++; |
394 | } | 428 | } |
395 | else if (update.LastTerseUpdateTime <= part.TimeStampTerse) | 429 | else if (update.LastTerseUpdateTime <= part.TimeStampTerse) |
396 | { | 430 | { |
397 | 431 | ||
398 | 432 | ||
399 | part.SendTerseUpdate(ControllingClient); | 433 | part.SendTerseUpdate(ControllingClient); |
400 | 434 | ||
401 | update.LastTerseUpdateTime = part.TimeStampTerse; | 435 | update.LastTerseUpdateTime = part.TimeStampTerse; |
402 | updateCount++; | 436 | updateCount++; |
403 | } | 437 | } |
@@ -437,8 +471,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
437 | m_scene.CommsManager.UserProfileCacheService.UpdateUserInventory(m_uuid); | 471 | m_scene.CommsManager.UserProfileCacheService.UpdateUserInventory(m_uuid); |
438 | //if (!m_gotAllObjectsInScene) | 472 | //if (!m_gotAllObjectsInScene) |
439 | //{ | 473 | //{ |
440 | //m_scene.SendAllSceneObjectsToClient(this); | 474 | //m_scene.SendAllSceneObjectsToClient(this); |
441 | //m_gotAllObjectsInScene = true; | 475 | //m_gotAllObjectsInScene = true; |
442 | //} | 476 | //} |
443 | 477 | ||
444 | } | 478 | } |
@@ -449,7 +483,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
449 | m_isChildAgent = true; | 483 | m_isChildAgent = true; |
450 | 484 | ||
451 | RemoveFromPhysicalScene(); | 485 | RemoveFromPhysicalScene(); |
452 | 486 | ||
453 | //this.Pos = new LLVector3(128, 128, 70); | 487 | //this.Pos = new LLVector3(128, 128, 70); |
454 | } | 488 | } |
455 | 489 | ||
@@ -500,34 +534,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
500 | 534 | ||
501 | #region Event Handlers | 535 | #region Event Handlers |
502 | 536 | ||
503 | /// <summary> | 537 | internal void SetHeight(float height) |
504 | /// | ||
505 | /// </summary> | ||
506 | /// <param name="texture"></param> | ||
507 | /// <param name="visualParam"></param> | ||
508 | public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) | ||
509 | { | 538 | { |
510 | LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); | 539 | m_avHeight = height; |
511 | m_textureEntry = textureEnt; | ||
512 | |||
513 | for (int i = 0; i < visualParam.Length; i++) | ||
514 | { | ||
515 | m_visualParams[i] = visualParam[i].ParamValue; | ||
516 | //MainLog.Instance.Verbose("CLIENT", "VisualData[" + i.ToString() + "]: " + visualParam[i].ParamValue.ToString() + "m"); | ||
517 | } | ||
518 | |||
519 | // Teravus : Nifty AV Height Getting Maaaaagical formula. Oh how we love turning 0-255 into meters. | ||
520 | // (float)m_visualParams[25] = Height | ||
521 | // (float)m_visualParams[125] = LegLength | ||
522 | m_avHeight = (1.50856f + (((float)m_visualParams[25] / 255.0f) * (2.525506f - 1.50856f))) | ||
523 | + (((float)m_visualParams[125] / 255.0f) / 1.5f); | ||
524 | if (PhysicsActor != null) | 540 | if (PhysicsActor != null) |
525 | { | 541 | { |
526 | PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight); | 542 | PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight); |
527 | PhysicsActor.Size = SetSize; | 543 | PhysicsActor.Size = SetSize; |
528 | } | 544 | } |
529 | //MainLog.Instance.Verbose("CLIENT", "Set Avatar Height to: " + (1.50856f + (((float)m_visualParams[25] / 255.0f) * (2.525506f - 1.50856f))).ToString() + "m" + " Leglength: " + ((float)m_visualParams[125]).ToString() + ":" + (((float)m_visualParams[125] / 255.0f)).ToString() + "m"); | ||
530 | SendAppearanceToAllOtherAgents(); | ||
531 | } | 545 | } |
532 | 546 | ||
533 | /// <summary> | 547 | /// <summary> |
@@ -571,7 +585,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
571 | m_CameraCenter.x = agentData.AgentData.CameraCenter.X; | 585 | m_CameraCenter.x = agentData.AgentData.CameraCenter.X; |
572 | m_CameraCenter.y = agentData.AgentData.CameraCenter.Y; | 586 | m_CameraCenter.y = agentData.AgentData.CameraCenter.Y; |
573 | m_CameraCenter.z = agentData.AgentData.CameraCenter.Z; | 587 | m_CameraCenter.z = agentData.AgentData.CameraCenter.Z; |
574 | 588 | ||
575 | // Use these three vectors to figure out what the agent is looking at | 589 | // Use these three vectors to figure out what the agent is looking at |
576 | // Convert it to a Matrix and/or Quaternion | 590 | // Convert it to a Matrix and/or Quaternion |
577 | m_CameraAtAxis.x = agentData.AgentData.CameraAtAxis.X; | 591 | m_CameraAtAxis.x = agentData.AgentData.CameraAtAxis.X; |
@@ -592,24 +606,24 @@ namespace OpenSim.Region.Environment.Scenes | |||
592 | // We don't know the agent's draw distance until the first agentUpdate packet | 606 | // We don't know the agent's draw distance until the first agentUpdate packet |
593 | //if (m_DrawDistance > 0) | 607 | //if (m_DrawDistance > 0) |
594 | //{ | 608 | //{ |
595 | //if (!m_gotAllObjectsInScene && m_DrawDistance > 0) | 609 | //if (!m_gotAllObjectsInScene && m_DrawDistance > 0) |
596 | //{ | 610 | //{ |
597 | // This will need to end up being a space based invalidator | 611 | // This will need to end up being a space based invalidator |
598 | // where we send object updates on spaces in 3d space (possibily a cube) | 612 | // where we send object updates on spaces in 3d space (possibily a cube) |
599 | // that the avatar hasn't been surrounding it's draw distance. | 613 | // that the avatar hasn't been surrounding it's draw distance. |
600 | // It would be better if the distance increased incrementally | 614 | // It would be better if the distance increased incrementally |
601 | // until there was no space to update because either the avatar's draw | 615 | // until there was no space to update because either the avatar's draw |
602 | // distance is smaller then the space they've been or the avatar has explored | 616 | // distance is smaller then the space they've been or the avatar has explored |
603 | // all the space in the sim. | 617 | // all the space in the sim. |
604 | 618 | ||
605 | //m_scene.SendAllSceneObjectsToClient(this); | 619 | //m_scene.SendAllSceneObjectsToClient(this); |
606 | //m_gotAllObjectsInScene = true; | 620 | //m_gotAllObjectsInScene = true; |
607 | //} | 621 | //} |
608 | //} | 622 | //} |
609 | //MainLog.Instance.Verbose("CAMERA", "AtAxis:" + m_CameraAtAxis.ToString() + " Center:" + m_CameraCenter.ToString() + " LeftAxis:" + m_CameraLeftAxis.ToString() + " UpAxis:" + m_CameraUpAxis.ToString() + " Far:" + m_CameraFar); | 623 | //MainLog.Instance.Verbose("CAMERA", "AtAxis:" + m_CameraAtAxis.ToString() + " Center:" + m_CameraCenter.ToString() + " LeftAxis:" + m_CameraLeftAxis.ToString() + " UpAxis:" + m_CameraUpAxis.ToString() + " Far:" + m_CameraFar); |
610 | |||
611 | 624 | ||
612 | if ((flags & (uint) AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) | 625 | |
626 | if ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) | ||
613 | { | 627 | { |
614 | StandUp(); | 628 | StandUp(); |
615 | } | 629 | } |
@@ -684,7 +698,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
684 | { | 698 | { |
685 | if (m_parentID != 0) | 699 | if (m_parentID != 0) |
686 | { | 700 | { |
687 | m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); | 701 | m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight); |
688 | m_parentPosition = new LLVector3(); | 702 | m_parentPosition = new LLVector3(); |
689 | 703 | ||
690 | AddToPhysicalScene(); | 704 | AddToPhysicalScene(); |
@@ -692,7 +706,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
692 | m_parentID = 0; | 706 | m_parentID = 0; |
693 | SendFullUpdateToAllClients(); | 707 | SendFullUpdateToAllClients(); |
694 | } | 708 | } |
695 | 709 | ||
696 | UpdateMovementAnimations(true); | 710 | UpdateMovementAnimations(true); |
697 | } | 711 | } |
698 | 712 | ||
@@ -718,13 +732,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
718 | m_sitAvatarHeight = m_physicsActor.Size.Z; | 732 | m_sitAvatarHeight = m_physicsActor.Size.Z; |
719 | } | 733 | } |
720 | 734 | ||
721 | // this doesn't seem to quite work yet.... | 735 | // this doesn't seem to quite work yet.... |
722 | // // if we're close, set the avatar position to the target position and forgo autopilot | 736 | // // if we're close, set the avatar position to the target position and forgo autopilot |
723 | // if (AbsolutePosition.GetDistanceTo(pos) < 2.5) | 737 | // if (AbsolutePosition.GetDistanceTo(pos) < 2.5) |
724 | // { | 738 | // { |
725 | // autopilot = false; | 739 | // autopilot = false; |
726 | // AbsolutePosition = pos + new LLVector3(0.0f, 0.0f, m_sitAvatarHeight); | 740 | // AbsolutePosition = pos + new LLVector3(0.0f, 0.0f, m_sitAvatarHeight); |
727 | // } | 741 | // } |
728 | } | 742 | } |
729 | 743 | ||
730 | avatarSitResponse.SitTransform.AutoPilot = autopilot; | 744 | avatarSitResponse.SitTransform.AutoPilot = autopilot; |
@@ -796,7 +810,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
796 | } | 810 | } |
797 | else | 811 | else |
798 | { | 812 | { |
799 | if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && | 813 | if (((m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && |
800 | PhysicsActor.IsColliding) | 814 | PhysicsActor.IsColliding) |
801 | { | 815 | { |
802 | SendAnimPack(Animations.AnimsLLUUID["CROUCHWALK"], 1); | 816 | SendAnimPack(Animations.AnimsLLUUID["CROUCHWALK"], 1); |
@@ -807,7 +821,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
807 | { | 821 | { |
808 | SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1); | 822 | SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1); |
809 | } | 823 | } |
810 | else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) | 824 | else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && (m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) |
811 | { | 825 | { |
812 | SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1); | 826 | SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1); |
813 | } | 827 | } |
@@ -839,7 +853,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
839 | } | 853 | } |
840 | else | 854 | else |
841 | { | 855 | { |
842 | if (((m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && | 856 | if (((m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) && |
843 | PhysicsActor.IsColliding) | 857 | PhysicsActor.IsColliding) |
844 | { | 858 | { |
845 | SendAnimPack(Animations.AnimsLLUUID["CROUCH"], 1); | 859 | SendAnimPack(Animations.AnimsLLUUID["CROUCH"], 1); |
@@ -854,7 +868,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
854 | { | 868 | { |
855 | SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1); | 869 | SendAnimPack(Animations.AnimsLLUUID["FALLDOWN"], 1); |
856 | } | 870 | } |
857 | else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && (m_movementflag & (uint) AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) | 871 | else if (!PhysicsActor.IsColliding && Velocity.Z > 0 && !m_physicsActor.Flying && (m_movementflag & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_POS) != 0) |
858 | { | 872 | { |
859 | SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1); | 873 | SendAnimPack(Animations.AnimsLLUUID["JUMP"], 1); |
860 | } | 874 | } |
@@ -865,7 +879,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
865 | SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); | 879 | SendAnimPack(Animations.AnimsLLUUID["STAND"], 1); |
866 | } | 880 | } |
867 | } | 881 | } |
868 | 882 | ||
869 | } | 883 | } |
870 | } | 884 | } |
871 | } | 885 | } |
@@ -1022,7 +1036,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1022 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) | 1036 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) |
1023 | { | 1037 | { |
1024 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, | 1038 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, |
1025 | LocalId, m_pos, m_textureEntry.ToBytes(), m_parentID); | 1039 | LocalId, m_pos, m_appearance.TextureEntry.ToBytes(), m_parentID); |
1026 | } | 1040 | } |
1027 | 1041 | ||
1028 | public void SendFullUpdateToAllClients() | 1042 | public void SendFullUpdateToAllClients() |
@@ -1048,7 +1062,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1048 | public void SendInitialData() | 1062 | public void SendInitialData() |
1049 | { | 1063 | { |
1050 | m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, | 1064 | m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid, LocalId, |
1051 | m_pos, m_textureEntry.ToBytes(), m_parentID); | 1065 | m_pos, m_appearance.TextureEntry.ToBytes(), m_parentID); |
1052 | if (!m_isChildAgent) | 1066 | if (!m_isChildAgent) |
1053 | { | 1067 | { |
1054 | m_scene.InformClientOfNeighbours(this); | 1068 | m_scene.InformClientOfNeighbours(this); |
@@ -1065,7 +1079,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1065 | /// <param name="client"></param> | 1079 | /// <param name="client"></param> |
1066 | public void SendOwnAppearance() | 1080 | public void SendOwnAppearance() |
1067 | { | 1081 | { |
1068 | SendOwnWearables(); | 1082 | m_appearance.SendOwnWearables(ControllingClient); |
1069 | 1083 | ||
1070 | // TODO: remove this once the SunModule is slightly more tested | 1084 | // TODO: remove this once the SunModule is slightly more tested |
1071 | // m_controllingClient.SendViewerTime(m_scene.TimePhase); | 1085 | // m_controllingClient.SendViewerTime(m_scene.TimePhase); |
@@ -1078,23 +1092,32 @@ namespace OpenSim.Region.Environment.Scenes | |||
1078 | { | 1092 | { |
1079 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 1093 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
1080 | { | 1094 | { |
1081 | // if (scenePresence != this) | 1095 | if (scenePresence.UUID != UUID) |
1082 | // { | 1096 | { |
1083 | SendAppearanceToOtherAgent(scenePresence); | 1097 | m_appearance.SendAppearanceToOtherAgent(scenePresence); |
1084 | // } | 1098 | } |
1085 | }); | 1099 | }); |
1086 | } | 1100 | } |
1087 | 1101 | ||
1088 | /// <summary> | 1102 | public void SendAppearanceToOtherAgent(ScenePresence avatar) |
1089 | /// | ||
1090 | /// </summary> | ||
1091 | /// <param name="avatarInfo"></param> | ||
1092 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) | ||
1093 | { | 1103 | { |
1094 | avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams, | 1104 | m_appearance.SendAppearanceToOtherAgent(avatar); |
1095 | m_textureEntry.ToBytes()); | ||
1096 | } | 1105 | } |
1097 | 1106 | ||
1107 | public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) | ||
1108 | { | ||
1109 | m_appearance.SetAppearance(texture, visualParam); | ||
1110 | SetHeight(m_appearance.AvatarHeight); | ||
1111 | |||
1112 | SendAppearanceToAllOtherAgents(); | ||
1113 | } | ||
1114 | |||
1115 | public void SetWearable(int wearableId, AvatarWearable wearable) | ||
1116 | { | ||
1117 | m_appearance.SetWearable(ControllingClient, wearableId, wearable); | ||
1118 | } | ||
1119 | |||
1120 | |||
1098 | /// <summary> | 1121 | /// <summary> |
1099 | /// | 1122 | /// |
1100 | /// </summary> | 1123 | /// </summary> |
@@ -1147,9 +1170,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1147 | LLVector3 vel = Velocity; | 1170 | LLVector3 vel = Velocity; |
1148 | 1171 | ||
1149 | float timeStep = 0.1f; | 1172 | float timeStep = 0.1f; |
1150 | pos2.X = pos2.X + (vel.X*timeStep); | 1173 | pos2.X = pos2.X + (vel.X * timeStep); |
1151 | pos2.Y = pos2.Y + (vel.Y*timeStep); | 1174 | pos2.Y = pos2.Y + (vel.Y * timeStep); |
1152 | pos2.Z = pos2.Z + (vel.Z*timeStep); | 1175 | pos2.Z = pos2.Z + (vel.Z * timeStep); |
1153 | 1176 | ||
1154 | if ((pos2.X < 0) || (pos2.X > 256)) | 1177 | if ((pos2.X < 0) || (pos2.X > 256)) |
1155 | { | 1178 | { |
@@ -1194,7 +1217,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1194 | } | 1217 | } |
1195 | 1218 | ||
1196 | LLVector3 vel = m_velocity; | 1219 | LLVector3 vel = m_velocity; |
1197 | ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256)); | 1220 | ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256)); |
1198 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); | 1221 | SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); |
1199 | if (neighbourRegion != null) | 1222 | if (neighbourRegion != null) |
1200 | { | 1223 | { |
@@ -1269,14 +1292,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1269 | 1292 | ||
1270 | static ScenePresence() | 1293 | static ScenePresence() |
1271 | { | 1294 | { |
1272 | LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); | 1295 | LLObject.TextureEntry textu = AvatarAppearance.GetDefaultTextureEntry(); |
1273 | textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012"); | ||
1274 | textu.CreateFace(1).TextureID = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); | ||
1275 | textu.CreateFace(2).TextureID = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); | ||
1276 | textu.CreateFace(3).TextureID = new LLUUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); | ||
1277 | textu.CreateFace(4).TextureID = new LLUUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); | ||
1278 | textu.CreateFace(5).TextureID = new LLUUID("00000000-0000-1111-9999-000000000010"); | ||
1279 | textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); | ||
1280 | DefaultTexture = textu.ToBytes(); | 1296 | DefaultTexture = textu.ToBytes(); |
1281 | } | 1297 | } |
1282 | 1298 | ||
@@ -1334,15 +1350,5 @@ namespace OpenSim.Region.Environment.Scenes | |||
1334 | RemoveFromPhysicalScene(); | 1350 | RemoveFromPhysicalScene(); |
1335 | } | 1351 | } |
1336 | 1352 | ||
1337 | public void SetWearable(int wearableId, AvatarWearable wearable) | ||
1338 | { | ||
1339 | m_wearables[wearableId] = wearable; | ||
1340 | SendOwnWearables(); | ||
1341 | } | ||
1342 | |||
1343 | private void SendOwnWearables() | ||
1344 | { | ||
1345 | m_controllingClient.SendWearables(m_wearables, m_wearablesSerial++); | ||
1346 | } | ||
1347 | } | 1353 | } |
1348 | } | 1354 | } |