From 4c8b8d22ff66605b11a4881cdb7004cb4ce49592 Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 18 Jul 2007 21:26:31 +0000 Subject: A script/custom application should be able to add a particle system to a prim, just create a new libsecondlife.Primitive.ParticleSystem() and then call AddNewParticleSystem() on the OpenSim particle : we really need to rename our particle class to stop conflict with the one in libsl. --- OpenSim/Region/ClientStack/ClientView.API.cs | 7 ++++--- OpenSim/Region/Environment/Scenes/Primitive.cs | 9 ++++++++- OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs | 2 +- OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs | 19 ++++++++++++------- 4 files changed, 25 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 440f583..73b3887 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -719,9 +719,8 @@ namespace OpenSim.Region.ClientStack this.OutPacket(attach); } - - public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) + public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem) { ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); outPacket.RegionData.RegionHandle = regionHandle; @@ -733,6 +732,7 @@ namespace OpenSim.Region.ClientStack outPacket.ObjectData[0].OwnerID = ownerID; outPacket.ObjectData[0].Text = Helpers.StringToField( text ); outPacket.ObjectData[0].ParentID = parentID; + outPacket.ObjectData[0].PSBlock = particleSystem; byte[] pb = pos.GetBytes(); Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); byte[] rot = rotation.GetBytes(); @@ -740,7 +740,7 @@ namespace OpenSim.Region.ClientStack OutPacket(outPacket); } - public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) + public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem) { ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); outPacket.RegionData.RegionHandle = regionHandle; @@ -752,6 +752,7 @@ namespace OpenSim.Region.ClientStack outPacket.ObjectData[0].OwnerID = ownerID; outPacket.ObjectData[0].Text = Helpers.StringToField( text ); outPacket.ObjectData[0].ParentID = parentID; + outPacket.ObjectData[0].PSBlock = particleSystem; byte[] pb = pos.GetBytes(); Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs index bca8e0c..7484393 100644 --- a/OpenSim/Region/Environment/Scenes/Primitive.cs +++ b/OpenSim/Region/Environment/Scenes/Primitive.cs @@ -38,6 +38,7 @@ namespace OpenSim.Region.Environment.Scenes public uint BaseMask = FULL_MASK_PERMISSIONS; private PrimitiveBaseShape m_Shape; + private byte[] m_particleSystem = new byte[0]; public SceneObject m_RootParent; public bool m_isRootPrim; @@ -620,6 +621,12 @@ namespace OpenSim.Region.Environment.Scenes #endregion + public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem) + { + this.m_particleSystem = pSystem.GetBytes(); + ScheduleFullUpdate(); + } + #region Client Update Methods /// @@ -653,7 +660,7 @@ namespace OpenSim.Region.Environment.Scenes lRot = new LLQuaternion(Rotation.x, Rotation.y, Rotation.z, Rotation.w); remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalId, m_Shape, lPos, lRot, m_flags, m_uuid, - OwnerID, m_text, ParentID); + OwnerID, m_text, ParentID, this.m_particleSystem); } /// diff --git a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs index 26ecf01..e6505b4 100644 --- a/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs +++ b/OpenSim/Region/Examples/SimpleApp/CpuCounterObject.cs @@ -19,7 +19,7 @@ namespace SimpleApp String objectName = "Processor"; String counterName = "% Processor Time"; String instanceName = "_Total"; - + m_counter = new PerformanceCounter(objectName, counterName, instanceName); } diff --git a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs index 308dea7..8274912 100644 --- a/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleApp/MyNpcCharacter.cs @@ -132,10 +132,9 @@ namespace SimpleApp public virtual void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLVector3 velocity) { } public virtual void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint) { } - public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags) { } - public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags) { } - public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { } - public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID) { } + + public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem) { } + public virtual void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID, byte[] particleSystem) { } public virtual void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation) { } public virtual void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items) { } @@ -152,8 +151,10 @@ namespace SimpleApp { Encoding enc = Encoding.ASCII; - this.OnAgentUpdate(this, movementFlag, bodyDirection); - + if (this.OnAgentUpdate != null) + { + this.OnAgentUpdate(this, movementFlag, bodyDirection); + } if (this.flyState == 0) { movementFlag = (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY | (uint)MainAvatar.ControlFlags.AGENT_CONTROL_UP_NEG; @@ -172,8 +173,12 @@ namespace SimpleApp if (count >= 40) { - this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here, isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId); + if (OnChatFromViewer != null) + { + this.OnChatFromViewer(enc.GetBytes("Kind of quiet around here, isn't it! \0"), 2, new LLVector3(128, 128, 26), this.FirstName + " " + this.LastName, this.AgentId); + } count = -1; + } count++; -- cgit v1.1