diff options
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 59 |
1 files changed, 48 insertions, 11 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 124b426..30f00d6 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -52,9 +52,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
52 | private byte movementflag = 0; | 52 | private byte movementflag = 0; |
53 | private List<NewForce> forcesList = new List<NewForce>(); | 53 | private List<NewForce> forcesList = new List<NewForce>(); |
54 | private short _updateCount = 0; | 54 | private short _updateCount = 0; |
55 | |||
55 | private Quaternion bodyRot; | 56 | private Quaternion bodyRot; |
56 | private byte[] visualParams; | 57 | private byte[] visualParams; |
57 | private AvatarWearable[] Wearables; | 58 | private AvatarWearable[] Wearables; |
59 | private LLObject.TextureEntry m_textureEntry; | ||
60 | |||
58 | private ulong m_regionHandle; | 61 | private ulong m_regionHandle; |
59 | 62 | ||
60 | public bool childAgent = false; | 63 | public bool childAgent = false; |
@@ -143,6 +146,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
143 | this.lastname = ControllingClient.LastName; | 146 | this.lastname = ControllingClient.LastName; |
144 | m_localId = m_scene.NextLocalId; | 147 | m_localId = m_scene.NextLocalId; |
145 | Pos = ControllingClient.StartPos; | 148 | Pos = ControllingClient.StartPos; |
149 | |||
146 | visualParams = new byte[218]; | 150 | visualParams = new byte[218]; |
147 | for (int i = 0; i < 218; i++) | 151 | for (int i = 0; i < 218; i++) |
148 | { | 152 | { |
@@ -153,11 +157,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
153 | Animations = new ScenePresence.AvatarAnimations(); | 157 | Animations = new ScenePresence.AvatarAnimations(); |
154 | Animations.LoadAnims(); | 158 | Animations.LoadAnims(); |
155 | 159 | ||
156 | // this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); | ||
157 | |||
158 | //register for events | 160 | //register for events |
159 | ControllingClient.OnRequestWearables += this.SendOurAppearance; | 161 | ControllingClient.OnRequestWearables += this.SendOurAppearance; |
160 | //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); | 162 | ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); |
161 | ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement; | 163 | ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement; |
162 | ControllingClient.OnCompleteMovementToRegion += this.SendInitialData; | 164 | ControllingClient.OnCompleteMovementToRegion += this.SendInitialData; |
163 | ControllingClient.OnAgentUpdate += this.HandleAgentUpdate; | 165 | ControllingClient.OnAgentUpdate += this.HandleAgentUpdate; |
@@ -171,8 +173,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
171 | Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT | 173 | Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT |
172 | Dir_Vectors[4] = new Vector3(0, 0, 1); //UP | 174 | Dir_Vectors[4] = new Vector3(0, 0, 1); //UP |
173 | Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN | 175 | Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN |
174 | 176 | ||
175 | //tempoary until we move some code into the body classes | 177 | this.m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length); |
178 | |||
179 | //temporary until we move some code into the body classes | ||
176 | this.m_body = new ChildAgent(); | 180 | this.m_body = new ChildAgent(); |
177 | 181 | ||
178 | } | 182 | } |
@@ -242,7 +246,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
242 | /// <param name="visualParam"></param> | 246 | /// <param name="visualParam"></param> |
243 | public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) | 247 | public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) |
244 | { | 248 | { |
249 | LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); | ||
250 | this.m_textureEntry = textureEnt; | ||
251 | |||
252 | for (int i = 0; i < visualParam.Length; i++) | ||
253 | { | ||
254 | this.visualParams[i] = visualParam[i].ParamValue; | ||
255 | } | ||
245 | 256 | ||
257 | this.SendArrearanceToAllOtherAgents(); | ||
246 | } | 258 | } |
247 | 259 | ||
248 | /// <summary> | 260 | /// <summary> |
@@ -422,7 +434,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
422 | /// <param name="remoteAvatar"></param> | 434 | /// <param name="remoteAvatar"></param> |
423 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) | 435 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) |
424 | { | 436 | { |
425 | remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, DefaultTexture); | 437 | remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); |
426 | } | 438 | } |
427 | 439 | ||
428 | public void SendFullUpdateToALLClients() | 440 | public void SendFullUpdateToALLClients() |
@@ -440,7 +452,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
440 | /// </summary> | 452 | /// </summary> |
441 | public void SendInitialData() | 453 | public void SendInitialData() |
442 | { | 454 | { |
443 | this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, DefaultTexture); | 455 | this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); |
444 | if (this.newAvatar) | 456 | if (this.newAvatar) |
445 | { | 457 | { |
446 | this.m_scene.InformClientOfNeighbours(this.ControllingClient); | 458 | this.m_scene.InformClientOfNeighbours(this.ControllingClient); |
@@ -455,17 +467,32 @@ namespace OpenSim.Region.Environment.Scenes | |||
455 | public void SendOurAppearance(IClientAPI OurClient) | 467 | public void SendOurAppearance(IClientAPI OurClient) |
456 | { | 468 | { |
457 | this.ControllingClient.SendWearables(this.Wearables); | 469 | this.ControllingClient.SendWearables(this.Wearables); |
470 | |||
458 | this.SendFullUpdateToALLClients(); | 471 | this.SendFullUpdateToALLClients(); |
472 | this.SendArrearanceToAllOtherAgents(); | ||
473 | |||
459 | this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); | 474 | this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); |
460 | } | 475 | } |
461 | 476 | ||
462 | /// <summary> | 477 | /// <summary> |
463 | /// | 478 | /// |
464 | /// </summary> | 479 | /// </summary> |
480 | public void SendArrearanceToAllOtherAgents() | ||
481 | { | ||
482 | List<ScenePresence> avatars = this.m_scene.RequestAvatarList(); | ||
483 | foreach (ScenePresence avatar in this.m_scene.RequestAvatarList()) | ||
484 | { | ||
485 | this.SendAppearanceToOtherAgent(avatar); | ||
486 | } | ||
487 | } | ||
488 | |||
489 | /// <summary> | ||
490 | /// | ||
491 | /// </summary> | ||
465 | /// <param name="avatarInfo"></param> | 492 | /// <param name="avatarInfo"></param> |
466 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) | 493 | public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) |
467 | { | 494 | { |
468 | 495 | avatarInfo.ControllingClient.SendAppearance(this.ControllingClient.AgentId, this.visualParams, this.m_textureEntry.ToBytes()); | |
469 | } | 496 | } |
470 | 497 | ||
471 | /// <summary> | 498 | /// <summary> |
@@ -614,7 +641,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
614 | 641 | ||
615 | public static void LoadTextureFile(string name) | 642 | public static void LoadTextureFile(string name) |
616 | { | 643 | { |
617 | FileInfo fInfo = new FileInfo(name); | 644 | /* FileInfo fInfo = new FileInfo(name); |
618 | long numBytes = fInfo.Length; | 645 | long numBytes = fInfo.Length; |
619 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); | 646 | FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); |
620 | BinaryReader br = new BinaryReader(fStream); | 647 | BinaryReader br = new BinaryReader(fStream); |
@@ -622,8 +649,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
622 | br.Close(); | 649 | br.Close(); |
623 | fStream.Close(); | 650 | fStream.Close(); |
624 | DefaultTexture = data1; | 651 | DefaultTexture = data1; |
625 | // LLObject.TextureEntry textu = new LLObject.TextureEntry(data1, 0, data1.Length); | 652 | LLObject.TextureEntry textu = new LLObject.TextureEntry(data1, 0, data1.Length); |
626 | // Console.WriteLine("default texture entry: " + textu.ToString()); | 653 | Console.WriteLine("default texture entry: " + textu.ToString());*/ |
654 | |||
655 | LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); | ||
656 | textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012"); | ||
657 | textu.CreateFace(1).TextureID = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); | ||
658 | textu.CreateFace(2).TextureID = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); | ||
659 | textu.CreateFace(3).TextureID = new LLUUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); | ||
660 | textu.CreateFace(4).TextureID = new LLUUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); | ||
661 | textu.CreateFace(5).TextureID = new LLUUID("00000000-0000-1111-9999-000000000010"); | ||
662 | textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); | ||
663 | DefaultTexture = textu.ToBytes(); | ||
627 | } | 664 | } |
628 | 665 | ||
629 | public class NewForce | 666 | public class NewForce |