From d4f32649cd298168ec7645ac75f08455e8bed49e Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 2 Feb 2008 03:57:57 +0000 Subject: [PATCH] * Committing some untested stuff regarding texture animations. This won't break anything, but the llSetTextureAnim function is completely untested.. (though it may be functional once the script engine works again) --- OpenSim/Framework/IClientAPI.cs | 4 ++++ OpenSim/Region/ClientStack/ClientView.cs | 19 ++++++++++++++++++- .../Environment/Scenes/SceneObjectPart.cs | 12 ++++++++++-- .../Examples/SimpleApp/MyNpcCharacter.cs | 8 +++++++- .../Common/LSL_BuiltIn_Commands.cs | 11 ++++++++++- 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index d163ae73e9..9bf1f9a053 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -570,6 +570,10 @@ namespace OpenSim.Framework void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); void SetChildAgentThrottle(byte[] throttle); + void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, + LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, + uint parentID, byte[] particleSystem, LLQuaternion rotation, byte clickAction, byte[] textureanimation); + void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, LLQuaternion rotation, byte clickAction); diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 370bdbb781..c68c3c76ed 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -1588,12 +1588,23 @@ namespace OpenSim.Region.ClientStack OutPacket(attach, ThrottleOutPacketType.Task); } - public void SendPrimitiveToClient( ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, LLQuaternion rotation, byte clickAction) + { + byte[] textureanim = new byte[0]; + + SendPrimitiveToClient(regionHandle, timeDilation, localID, primShape, pos, flags, + objectID, ownerID, text, color, parentID, particleSystem, + rotation, clickAction, textureanim); + } + public void SendPrimitiveToClient( + ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, + uint flags, + LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, + LLQuaternion rotation, byte clickAction, byte[] textureanim) { ObjectUpdatePacket outPacket = (ObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ObjectUpdate); // TODO: don't create new blocks if recycling an old packet @@ -1615,6 +1626,8 @@ namespace OpenSim.Region.ClientStack outPacket.ObjectData[0].PSBlock = particleSystem; outPacket.ObjectData[0].ClickAction = clickAction; //outPacket.ObjectData[0].Flags = 0; + + // Sound Radius outPacket.ObjectData[0].Radius = 20; byte[] pb = pos.GetBytes(); @@ -1623,6 +1636,10 @@ namespace OpenSim.Region.ClientStack byte[] rot = rotation.GetBytes(); Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 36, rot.Length); + if (textureanim.Length > 0) + outPacket.ObjectData[0].TextureAnim = textureanim; + + OutPacket(outPacket, ThrottleOutPacketType.Task); } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 452614cd28..9be75da06d 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -276,6 +276,8 @@ namespace OpenSim.Region.Environment.Scenes } } + private byte[] m_TextureAnimation; + protected LLVector3 m_offsetPosition; public LLVector3 OffsetPosition @@ -600,6 +602,7 @@ namespace OpenSim.Region.Environment.Scenes { // It's not necessary to persist this m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString(); + m_TextureAnimation = new byte[0]; } public SceneObjectPart(ulong regionHandle, SceneObjectGroup parent, LLUUID ownerID, uint localID, @@ -646,7 +649,7 @@ namespace OpenSim.Region.Environment.Scenes m_rotationalvelocity = new LLVector3(0, 0, 0); AngularVelocity = new LLVector3(0, 0, 0); Acceleration = new LLVector3(0, 0, 0); - + m_TextureAnimation = new byte[0]; m_inventoryFileName = "taskinventory" + LLUUID.Random().ToString(); m_folderID = LLUUID.Random(); @@ -1364,6 +1367,11 @@ namespace OpenSim.Region.Environment.Scenes UpdateTextureEntry(tex.ToBytes()); } + public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) + { + m_TextureAnimation = pTexAnim.GetBytes(); + } + #endregion #region ParticleSystem @@ -1534,7 +1542,7 @@ namespace OpenSim.Region.Environment.Scenes byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_shape, lPos, clientFlags, m_uuid, OwnerID, - m_text, color, ParentID, m_particleSystem, lRot, m_clickAction); + m_text, color, ParentID, m_particleSystem, lRot, m_clickAction, m_TextureAnimation); } /// Terse updates diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index ea1e28e766..b5663deaa1 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -327,7 +327,13 @@ namespace SimpleApp byte[] particleSystem, LLQuaternion rotation, byte clickAction) { } - + public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, + PrimitiveBaseShape primShape, LLVector3 pos, uint flags, + LLUUID objectID, LLUUID ownerID, string text, byte[] color, + uint parentID, + byte[] particleSystem, LLQuaternion rotation, byte clickAction, byte[] textureanimation) + { + } public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index bbf301d9c0..3f719fb847 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -2007,7 +2007,16 @@ namespace OpenSim.Region.ScriptEngine.Common public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) { - NotImplemented("llSetTextureAnim"); + Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation(); + pTexAnim.Flags = (uint)mode; + pTexAnim.Face = (uint)face; + pTexAnim.Length = (float)length; + pTexAnim.Rate = (float)rate; + pTexAnim.SizeX = (uint)sizex; + pTexAnim.SizeY = (uint)sizey; + pTexAnim.Start = (float)start; + m_host.AddTextureAnimation(pTexAnim); + m_host.SendFullUpdateToAllClients(); } public void llTriggerSoundLimited(string sound, double volume, LSL_Types.Vector3 top_north_east,