diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index a55297a67c..5aacecb31b 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs @@ -91,7 +91,7 @@ namespace OpenSim.Region.Capabilities string capsBase = "/CAPS/" + m_capsObjectPath; httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); } - + /// /// /// diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index 260da81093..c1d91d5c0a 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs @@ -172,6 +172,7 @@ namespace OpenSim.Framework.Interfaces void OutPacket(Packet newPack); void SendWearables(AvatarWearable[] wearables); + void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry); void SendStartPingCheck(byte seq); void SendKillObject(ulong regionHandle, uint avatarLocalID); void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId); diff --git a/OpenSim/Framework/General/NullClientAPI.cs b/OpenSim/Framework/General/NullClientAPI.cs index 9815acafe4..45c1a14b82 100644 --- a/OpenSim/Framework/General/NullClientAPI.cs +++ b/OpenSim/Framework/General/NullClientAPI.cs @@ -104,6 +104,7 @@ namespace OpenSim.Framework public virtual void OutPacket(Packet newPack){} public virtual void SendWearables(AvatarWearable[] wearables){} + public virtual void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) { } public virtual void SendStartPingCheck(byte seq){} public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID){} public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId){} diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 124b4260c5..30f00d61cd 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -52,9 +52,12 @@ namespace OpenSim.Region.Environment.Scenes private byte movementflag = 0; private List forcesList = new List(); private short _updateCount = 0; + private Quaternion bodyRot; private byte[] visualParams; private AvatarWearable[] Wearables; + private LLObject.TextureEntry m_textureEntry; + private ulong m_regionHandle; public bool childAgent = false; @@ -143,6 +146,7 @@ namespace OpenSim.Region.Environment.Scenes this.lastname = ControllingClient.LastName; m_localId = m_scene.NextLocalId; Pos = ControllingClient.StartPos; + visualParams = new byte[218]; for (int i = 0; i < 218; i++) { @@ -153,11 +157,9 @@ namespace OpenSim.Region.Environment.Scenes Animations = new ScenePresence.AvatarAnimations(); Animations.LoadAnims(); - // this.avatarAppearanceTexture = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005")); - //register for events ControllingClient.OnRequestWearables += this.SendOurAppearance; - //ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); + ControllingClient.OnSetAppearance += new SetAppearance(this.SetAppearance); ControllingClient.OnCompleteMovementToRegion += this.CompleteMovement; ControllingClient.OnCompleteMovementToRegion += this.SendInitialData; ControllingClient.OnAgentUpdate += this.HandleAgentUpdate; @@ -171,8 +173,10 @@ namespace OpenSim.Region.Environment.Scenes Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT Dir_Vectors[4] = new Vector3(0, 0, 1); //UP Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN - - //tempoary until we move some code into the body classes + + this.m_textureEntry = new LLObject.TextureEntry(DefaultTexture, 0, DefaultTexture.Length); + + //temporary until we move some code into the body classes this.m_body = new ChildAgent(); } @@ -242,7 +246,15 @@ namespace OpenSim.Region.Environment.Scenes /// public void SetAppearance(byte[] texture, AgentSetAppearancePacket.VisualParamBlock[] visualParam) { + LLObject.TextureEntry textureEnt = new LLObject.TextureEntry(texture, 0, texture.Length); + this.m_textureEntry = textureEnt; + for (int i = 0; i < visualParam.Length; i++) + { + this.visualParams[i] = visualParam[i].ParamValue; + } + + this.SendArrearanceToAllOtherAgents(); } /// @@ -422,7 +434,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) { - remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, DefaultTexture); + remoteAvatar.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); } public void SendFullUpdateToALLClients() @@ -440,7 +452,7 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendInitialData() { - this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, DefaultTexture); + this.ControllingClient.SendAvatarData(m_regionInfo.RegionHandle, this.firstname, this.lastname, this.m_uuid, this.LocalId, this.Pos, this.m_textureEntry.ToBytes()); if (this.newAvatar) { this.m_scene.InformClientOfNeighbours(this.ControllingClient); @@ -455,17 +467,32 @@ namespace OpenSim.Region.Environment.Scenes public void SendOurAppearance(IClientAPI OurClient) { this.ControllingClient.SendWearables(this.Wearables); + this.SendFullUpdateToALLClients(); + this.SendArrearanceToAllOtherAgents(); + this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); } + /// + /// + /// + public void SendArrearanceToAllOtherAgents() + { + List avatars = this.m_scene.RequestAvatarList(); + foreach (ScenePresence avatar in this.m_scene.RequestAvatarList()) + { + this.SendAppearanceToOtherAgent(avatar); + } + } + /// /// /// /// public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) { - + avatarInfo.ControllingClient.SendAppearance(this.ControllingClient.AgentId, this.visualParams, this.m_textureEntry.ToBytes()); } /// @@ -614,7 +641,7 @@ namespace OpenSim.Region.Environment.Scenes public static void LoadTextureFile(string name) { - FileInfo fInfo = new FileInfo(name); + /* FileInfo fInfo = new FileInfo(name); long numBytes = fInfo.Length; FileStream fStream = new FileStream(name, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fStream); @@ -622,8 +649,18 @@ namespace OpenSim.Region.Environment.Scenes br.Close(); fStream.Close(); DefaultTexture = data1; - // LLObject.TextureEntry textu = new LLObject.TextureEntry(data1, 0, data1.Length); - // Console.WriteLine("default texture entry: " + textu.ToString()); + LLObject.TextureEntry textu = new LLObject.TextureEntry(data1, 0, data1.Length); + Console.WriteLine("default texture entry: " + textu.ToString());*/ + + LLObject.TextureEntry textu = new LLObject.TextureEntry(new LLUUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); + textu.CreateFace(0).TextureID = new LLUUID("00000000-0000-1111-9999-000000000012"); + textu.CreateFace(1).TextureID = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); + textu.CreateFace(2).TextureID = new LLUUID("5748decc-f629-461c-9a36-a35a221fe21f"); + textu.CreateFace(3).TextureID = new LLUUID("6522E74D-1660-4E7F-B601-6F48C1659A77"); + textu.CreateFace(4).TextureID = new LLUUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); + textu.CreateFace(5).TextureID = new LLUUID("00000000-0000-1111-9999-000000000010"); + textu.CreateFace(6).TextureID = new LLUUID("00000000-0000-1111-9999-000000000011"); + DefaultTexture = textu.ToBytes(); } public class NewForce diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 1593f6cf5e..6bcec5c95a 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -119,6 +119,7 @@ namespace SimpleApp public virtual void OutPacket(Packet newPack) { } public virtual void SendWearables(AvatarWearable[] wearables) { } + public virtual void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry) { } public virtual void SendStartPingCheck(byte seq) { } public virtual void SendKillObject(ulong regionHandle, uint avatarLocalID) { } public virtual void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) { }