From 5c28f3c3a23fee918bc1acd4aa3cf40953f4d0e6 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 2 Aug 2007 16:40:50 +0000 Subject: Some more work on SceneObject/ Primitive rewrites (slowly getting there) --- .../Environment/Scenes/AllNewSceneObjectGroup2.cs | 35 +++++++ .../Environment/Scenes/AllNewSceneObjectPart2.cs | 103 ++++++++++++++++++--- 2 files changed, 127 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs index f932b70..e43329d 100644 --- a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs +++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectGroup2.cs @@ -107,6 +107,41 @@ namespace OpenSim.Region.Environment.Scenes return null; } + /// + /// Does this group contain the child prim + /// should be able to remove these methods once we have a entity index in scene + /// + /// + /// + public bool HasChildPrim(LLUUID primID) + { + AllNewSceneObjectPart2 childPart = null; + if (this.m_parts.ContainsKey(primID)) + { + childPart = this.m_parts[primID]; + return true; + } + return false; + } + + /// + /// Does this group contain the child prim + /// should be able to remove these methods once we have a entity index in scene + /// + /// + /// + public bool HasChildPrim(uint localID) + { + foreach (AllNewSceneObjectPart2 part in this.m_parts.Values) + { + if (part.LocalID == localID) + { + return true; + } + } + return false; + } + public void TriggerTainted() { if (OnPrimCountTainted != null) diff --git a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs index a5d5cde..c4b4b43 100644 --- a/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs +++ b/OpenSim/Region/Environment/Scenes/AllNewSceneObjectPart2.cs @@ -14,10 +14,6 @@ namespace OpenSim.Region.Environment.Scenes { private const uint FULL_MASK_PERMISSIONS = 2147483647; - public string SitName = ""; - public string TouchName = ""; - public string Text = ""; - public LLUUID CreatorID; public LLUUID OwnerID; public LLUUID GroupID; @@ -36,6 +32,11 @@ namespace OpenSim.Region.Environment.Scenes protected AllNewSceneObjectGroup2 m_parentGroup; + /// + /// Only used internally to schedule client updates + /// + private byte m_updateFlag; + #region Properties protected LLUUID m_uuid; @@ -194,6 +195,37 @@ namespace OpenSim.Region.Environment.Scenes } } + private string m_text = ""; + public string Text + { + get { return m_text; } + set + { + m_text = value; + ScheduleFullUpdate(); + } + } + + private string m_sitName = ""; + public string SitName + { + get { return m_sitName; } + set + { + m_sitName = value; + } + } + + private string m_touchName = ""; + public string TouchName + { + get { return m_touchName; } + set + { + m_touchName = value; + } + } + public PrimitiveBaseShape Shape { get @@ -243,6 +275,26 @@ namespace OpenSim.Region.Environment.Scenes } #endregion + #region Update Scheduling + private void ClearUpdateSchedule() + { + m_updateFlag = 0; + } + + private void ScheduleFullUpdate() + { + m_updateFlag = 2; + } + + private void ScheduleTerseUpdate() + { + if (m_updateFlag < 1) + { + m_updateFlag = 1; + } + } + #endregion + #region Shape /// /// @@ -281,6 +333,7 @@ namespace OpenSim.Region.Environment.Scenes } #endregion + #region ExtraParams public void UpdateExtraParam(ushort type, bool inUse, byte[] data) { this.m_Shape.ExtraParams = new byte[data.Length + 7]; @@ -298,7 +351,7 @@ namespace OpenSim.Region.Environment.Scenes //this.ScheduleFullUpdate(); } - + #endregion #region Texture /// @@ -311,10 +364,12 @@ namespace OpenSim.Region.Environment.Scenes } #endregion + #region ParticleSystem public void AddNewParticleSystem(libsecondlife.Primitive.ParticleSystem pSystem) { this.m_particleSystem = pSystem.GetBytes(); } + #endregion #region Position /// @@ -342,15 +397,41 @@ namespace OpenSim.Region.Environment.Scenes /// public void Resize(LLVector3 scale) { - LLVector3 offset = (scale - this.m_Shape.Scale); - offset.X /= 2; - offset.Y /= 2; - offset.Z /= 2; - - this.OffsetPosition += offset; this.m_Shape.Scale = scale; } #endregion + + #region Client Update Methods + /// + /// + /// + /// + public void SendFullUpdateToClient(IClientAPI remoteClient) + { + LLVector3 lPos; + lPos = OffsetPosition; + LLQuaternion lRot; + lRot = RotationOffset; + + remoteClient.SendPrimitiveToClient(m_regionHandle, 64096, LocalID, m_Shape, lPos, lRot, this.ObjectFlags, m_uuid, + OwnerID, m_text, ParentID, this.m_particleSystem); + } + + /// + /// + /// + /// + public void SendTerseUpdateToClient(IClientAPI remoteClient) + { + LLVector3 lPos; + lPos = this.OffsetPosition; + LLQuaternion mRot = this.RotationOffset; + + remoteClient.SendPrimTerseUpdate(m_regionHandle, 64096, LocalID, lPos, mRot); + } + + + #endregion } } -- cgit v1.1