Example #1
1
 /// <summary>
 /// Add the part to the queue of parts for which we need to send an update to the client
 /// </summary>
 /// <param name="part"></param>
 public void QueuePartForUpdate(SceneObjectPart part, PrimUpdateFlags UpdateFlags)
 {
     lock (m_partsUpdateQueue)
     {
         PrimUpdate update = new PrimUpdate();
         update.Part = part;
         update.UpdateFlags = UpdateFlags;
         m_partsUpdateQueue.Enqueue(update);
     }
 }
        public void UpdateFromNew(EntityUpdate newupdate, int pqueue)
        {
            m_propsFlags |= newupdate.PropsFlags;
            PrimUpdateFlags newFlags = newupdate.Flags;

            if ((newFlags & PrimUpdateFlags.UpdateProbe) != 0)
            {
                m_flags &= ~PrimUpdateFlags.UpdateProbe;
            }

            if ((newFlags & PrimUpdateFlags.CancelKill) != 0)
            {
                if ((newFlags & PrimUpdateFlags.UpdateProbe) != 0)
                {
                    m_flags = PrimUpdateFlags.UpdateProbe;
                }
                else
                {
                    newFlags = PrimUpdateFlags.FullUpdatewithAnim;
                }
            }
            else
            {
                m_flags |= newFlags;
            }

            PriorityQueue = pqueue;
        }
Example #3
0
 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
 {
     if (OnReceivedEntityUpdate != null)
     {
         OnReceivedEntityUpdate(entity, updateFlags);
     }
 }
        public static EntityUpdate Get(ISceneEntity entity, PrimUpdateFlags flags, bool sendfam, bool sendobj)
        {
            lock (m_poollock)
            {
                if (m_poolPtr >= 0)
                {
                    EntityUpdate eu = m_pool[m_poolPtr];
                    m_pool[m_poolPtr] = null;
                    m_poolPtr--;
                    //if (m_min > m_poolPtr)
                    //    m_min = m_poolPtr;
                    eu.Entity = entity;
                    eu.Flags  = flags;
                    ObjectPropertyUpdateFlags tmp = 0;
                    if (sendfam)
                    {
                        tmp |= ObjectPropertyUpdateFlags.Family;
                    }

                    if (sendobj)
                    {
                        tmp |= ObjectPropertyUpdateFlags.Object;
                    }

                    eu.PropsFlags = tmp;
                    return(eu);
                }
            }
            return(new EntityUpdate(entity, flags, sendfam, sendobj));
        }
Example #5
0
 public void QueuePresenceForUpdate(IScenePresence presence, PrimUpdateFlags flags)
 {
     if (Culler == null || !Culler.ShowEntityToClient(m_presence, presence))
     {
         return; // if 2 far ignore
     }
     lock (m_presenceUpdatesToSend)
     {
         EntityUpdate o = (EntityUpdate)m_presenceUpdatesToSend[presence.UUID];
         if (o == null)
         {
             o = new EntityUpdate(presence, flags);
             if (m_presence.UUID == presence.UUID)
             {
                 //Its us, set us first!
                 m_ourPresenceHasUpdate = true;
                 m_presenceUpdatesToSend.Insert(0, presence.UUID, o);
             }
             else if (m_ourPresenceHasUpdate) //If this is set, we start inserting at 1 so that our updates go first
             // We can also safely assume that 1 is fine, because there has to be 0 already there set by us
             {
                 m_presenceUpdatesToSend.Insert(1, presence.UUID, o);
             }
             else //Set us at 0, no updates from us
             {
                 m_presenceUpdatesToSend.Insert(0, presence.UUID, o);
             }
         }
         else
         {
             o.Flags = o.Flags & flags;
             m_presenceUpdatesToSend[presence.UUID] = o;
         }
     }
 }
Example #6
0
 /// <summary>
 /// Tell the SceneViewer for the given client about the update
 /// </summary>
 /// <param name="part"></param>
 /// <param name="flags"></param>
 public override void AddUpdateToAvatar(ISceneChildEntity part, PrimUpdateFlags flags)
 {
     lock (m_terseUpdates)
         m_terseUpdates.Add(new OUpdates {
             Child = part, Flags = flags
         });
     Scene.SceneGraph.TaintPresenceForUpdate(this, PresenceTaint.ObjectUpdates);
 }
Example #7
0
        /// <summary>
        /// Add the part to the queue of parts for which we need to send an update to the client
        ///
        /// THIS METHOD SHOULD ONLY BE CALLED FROM WITHIN THE SCENE LOOP!!
        /// </summary>
        /// <param name="part"></param>
        public void QueuePartForUpdate(SceneObjectPart part, PrimUpdateFlags updateFlags)
        {
            if (m_presence.IsBot)
            {
                return;
            }

            // m_log.WarnFormat("[ScenePresence]: {0} Queuing update for {1} {2} {3}", part.ParentGroup.Scene.RegionInfo.RegionName, part.UUID.ToString(), part.LocalId.ToString(), part.ParentGroup.Name);
            m_partsUpdateQueue.Enqueue(part, updateFlags);
        }
Example #8
0
        /// <summary>
        /// Add the objects to the queue for which we need to send an update to the client
        /// </summary>
        /// <param name="part"></param>
        public void QueuePartForUpdate(ISceneChildEntity part, PrimUpdateFlags flags)
        {
            if (Culler == null || !Culler.ShowEntityToClient(m_presence, part.ParentEntity))
            {
                return; // if 2 far ignore
            }
            EntityUpdate o = new EntityUpdate(part, flags);

            QueueEntityUpdate(o);
        }
Example #9
0
        /// <summary>
        /// Add the part to the queue of parts for which we need to send an update to the client
        /// </summary>
        /// <param name="part"></param>
        public void QueuePartForUpdate(SceneObjectPart part, PrimUpdateFlags UpdateFlags)
        {
            lock (m_partsUpdateQueue)
            {
                PrimUpdate update = new PrimUpdate();
                update.Part = part;
                update.UpdateFlags = UpdateFlags;
                m_partsUpdateQueue.Enqueue(update);

                //Make it check when the user comes around to it again
                if (m_objectsInView.Contains(part.UUID))
                    m_objectsInView.Remove(part.UUID);
            }
        }
Example #10
0
        private void AddPresenceUpdate(IScenePresence presence, PrimUpdateFlags flags)
        {
            lock (m_presenceUpdatesToSendLock)
            {
#if UseRemovingEntityUpdates
                EntityUpdate o = (EntityUpdate)m_presenceUpdatesToSend[presence.UUID];
                if (o == null)
                {
                    o = new EntityUpdate(presence, flags);
                }
                else
                {
                    if ((o.Flags & flags) == o.Flags)
                    {
                        return; //Same, leave it alone!
                    }
                    o.Flags |= flags;
                    return;//All done, its updated
                }

                if (m_presence.UUID == presence.UUID) //Its us, set us first!
                {
                    m_presenceUpdatesToSend.Insert(0, presence.UUID, o);
                }
                else //Not us, set at the end
                {
                    m_presenceUpdatesToSend.Insert(m_presenceUpdatesToSend.Count, presence.UUID, o);
                }
#elif UseDictionaryForEntityUpdates
                EntityUpdate o = null;
                if (!m_presenceUpdatesToSend.TryGetValue(presence.LocalId, out o))
                {
                    o = new EntityUpdate(presence, flags);
                }
                else
                {
                    if ((o.Flags & flags) == o.Flags)
                    {
                        return; //Same, leave it alone!
                    }
                    o.Flags |= flags;
                    return; //All done, its updated, no need to readd
                }

                m_presenceUpdatesToSend[presence.LocalId] = o;
#else
                m_presenceUpdatesToSend.Enqueue(new EntityUpdate(presence, flags));
#endif
            }
        }
        public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, bool sendfam, bool sendobj)
        {
            m_entity = entity;
            m_flags  = flags;

            if (sendfam)
            {
                m_propsFlags |= ObjectPropertyUpdateFlags.Family;
            }

            if (sendobj)
            {
                m_propsFlags |= ObjectPropertyUpdateFlags.Object;
            }
        }
Example #12
0
 public void Enqueue(SceneObjectPart part, PrimUpdateFlags updateFlags)
 {
     lock (m_syncObject)
     {
         PrimUpdateFlags flagsToset = updateFlags;
         if (!m_ids.FindOrAdd(part.LocalId, ref flagsToset))
         {
             m_queue.Enqueue(part);
         }
         else
         {
             m_ids.Update(part.LocalId, flagsToset | updateFlags);
         }
     }
 }
Example #13
0
        public void SendGroupUpdate(SceneObjectGroup sceneObjectGroup, PrimUpdateFlags updateFlags)
        {
            //Bots don't get to send updates
            if (m_presence.IsBot)
            {
                return;
            }

            SendPartUpdate(sceneObjectGroup.RootPart, updateFlags);
            foreach (SceneObjectPart part in sceneObjectGroup.GetParts())
            {
                if (!part.IsRootPart())
                {
                    SendPartUpdate(part, updateFlags);
                }
            }
        }
 public void QueuePresenceForUpdate(IScenePresence presence, PrimUpdateFlags flags)
 {
     if (m_culler != null && !m_culler.ShowEntityToClient(m_presence, presence, m_scene))
     {
         //They are out of view and they changed, we need to update them when they do come in view
         lock (m_lastPresencesInViewLock)
             lastPresencesDInView.Remove(presence.UUID);
         return; // if 2 far ignore
     }
     //The client cannot get a terse update before a full update
     lock (m_lastPresencesInViewLock)
         if (!lastPresencesDInView.ContainsKey(presence.UUID))
         {
             return;
         }           //Only send updates if they are in view
     AddPresenceUpdate(presence, flags);
 }
        public void Update(int pqueue, ulong entry)
        {
            if ((m_flags & PrimUpdateFlags.CancelKill) != 0)
            {
                if ((m_flags & PrimUpdateFlags.UpdateProbe) != 0)
                {
                    m_flags = PrimUpdateFlags.UpdateProbe;
                }
                else
                {
                    m_flags = PrimUpdateFlags.FullUpdatewithAnim;
                }
            }

            PriorityQueue = pqueue;
            EntryOrder    = entry;
        }
 public static EntityUpdate Get(ISceneEntity entity, PrimUpdateFlags flags)
 {
     lock (m_poollock)
     {
         if (m_poolPtr >= 0)
         {
             EntityUpdate eu = m_pool[m_poolPtr];
             m_pool[m_poolPtr] = null;
             m_poolPtr--;
             //if (m_min > m_poolPtr)
             //    m_min = m_poolPtr;
             eu.Entity = entity;
             eu.Flags  = flags;
             return(eu);
         }
     }
     return(new EntityUpdate(entity, flags));
 }
Example #17
0
        public KeyValuePair <SceneObjectPart, PrimUpdateFlags>?Dequeue()
        {
            SceneObjectPart part        = null;
            PrimUpdateFlags updateFlags = PrimUpdateFlags.None;

            lock (m_syncObject)
            {
                if (m_queue.Count > 0)
                {
                    part = m_queue.Dequeue();
                    m_ids.Find(part.LocalId, out updateFlags);
                    m_ids.Remove(part.LocalId);

                    return(new KeyValuePair <SceneObjectPart, PrimUpdateFlags>(part, updateFlags));
                }
            }

            return(null);
        }
Example #18
0
        /// <summary>
        ///   Add the objects to the queue for which we need to send an update to the client
        /// </summary>
        /// <param name = "part"></param>
        public void QueuePartForUpdate(ISceneChildEntity part, PrimUpdateFlags flags)
        {
            if (m_presence == null)
            {
                return;
            }
            if (m_culler != null && !m_culler.ShowEntityToClient(m_presence, part.ParentEntity, m_scene))
            {
                //They are out of view and they changed, we need to update them when they do come in view
                lastGrpsInView.Remove(part.ParentEntity);
                return; // if 2 far ignore
            }
            if ((!(m_presence.DrawDistance > m_presence.Scene.RegionInfo.RegionSizeX &&
                   m_presence.DrawDistance > m_presence.Scene.RegionInfo.RegionSizeY)) &&
                !lastGrpsInView.Contains(part.ParentEntity))
            {
                //This object entered our draw distance on its own, and we havn't seen it before
                flags = PrimUpdateFlags.ForcedFullUpdate;
                lock (m_objectUpdatesToSendLock)
                {
#if (!ISWIN)
                    foreach (ISceneChildEntity child in part.ParentEntity.ChildrenEntities())
                    {
                        QueueEntityUpdate(new EntityUpdate(child, flags));
                    }
#else
                    foreach (EntityUpdate update in part.ParentEntity.ChildrenEntities().Select(child => new EntityUpdate(child, flags)))
                    {
                        QueueEntityUpdate(update);
                    }
#endif
                }
                lastGrpsInView.Add(part.ParentEntity);
                return;
            }

            EntityUpdate o = new EntityUpdate(part, flags);
            lock (m_objectUpdatesToSendLock)
                QueueEntityUpdate(o);
        }
Example #19
0
        /// <summary>
        /// Invoked when the client requests a prim.
        /// </summary>
        /// <param name="primLocalID"></param>
        /// <param name="remoteClient"></param>
        public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
        {
            SceneObjectPart part = GetSceneObjectPart(primLocalID);

            if (part != null)
            {
                SceneObjectGroup sog = part.ParentGroup;
                if (!sog.IsDeleted)
                {
                    PrimUpdateFlags update = PrimUpdateFlags.FullUpdate;
                    if (sog.RootPart.Shape.MeshFlagEntry)
                    {
                        update = PrimUpdateFlags.FullUpdatewithAnim;
                    }
                    part.SendUpdate(remoteClient, update);
                }
            }

            //SceneObjectGroup sog = GetGroupByPrim(primLocalID);

            //if (sog != null)
            //sog.SendFullAnimUpdateToClient(remoteClient);
        }
Example #20
0
        public void SendPartUpdate(SceneObjectPart part, PrimUpdateFlags updateFlags)
        {
            ScenePartUpdate update = null;

            int partFullUpdateCounter  = part.FullUpdateCounter;
            int partTerseUpdateCounter = part.TerseUpdateCounter;

            bool sendFullUpdate = false, sendFullInitialUpdate = false, sendTerseUpdate = false;

            lock (m_updateTimes)
            {
                if (m_updateTimes.TryGetValue(part.LocalId, out update))
                {
                    if ((update.LastFullUpdateTime != partFullUpdateCounter) ||
                        part.ParentGroup.IsAttachment)
                    {
                        //                            m_log.DebugFormat(
                        //                                "[SCENE PRESENCE]: Fully   updating prim {0}, {1} - part timestamp {2}",
                        //                                part.Name, part.UUID, part.TimeStampFull);

                        update.LastFullUpdateTime          = partFullUpdateCounter;
                        update.LastFullUpdateTimeRequested = partFullUpdateCounter;
                        //also cancel any pending terses since the full covers it
                        update.LastTerseUpdateTime          = partTerseUpdateCounter;
                        update.LastTerseUpdateTimeRequested = partTerseUpdateCounter;

                        sendFullUpdate = true;
                    }
                    else if (update.LastTerseUpdateTime != partTerseUpdateCounter)
                    {
                        //                            m_log.DebugFormat(
                        //                                "[SCENE PRESENCE]: Tersely updating prim {0}, {1} - part timestamp {2}",
                        //                                part.Name, part.UUID, part.TimeStampTerse);

                        update.LastTerseUpdateTime          = partTerseUpdateCounter;
                        update.LastTerseUpdateTimeRequested = partTerseUpdateCounter;

                        sendTerseUpdate = true;
                    }
                }
                else
                {
                    //never been sent to client before so do full update
                    ScenePartUpdate newUpdate = new ScenePartUpdate();
                    newUpdate.FullID                      = part.UUID;
                    newUpdate.LastFullUpdateTime          = partFullUpdateCounter;
                    newUpdate.LastFullUpdateTimeRequested = partFullUpdateCounter;

                    m_updateTimes.Add(part.LocalId, newUpdate);
                    sendFullInitialUpdate = true;
                }
            }
            if (sendFullUpdate)
            {
                part.SendFullUpdate(m_presence.ControllingClient, m_presence.GenerateClientFlags(part.UUID), updateFlags);
            }
            else if (sendTerseUpdate)
            {
                part.SendTerseUpdateToClient(m_presence.ControllingClient);
            }
            else if (sendFullInitialUpdate)
            {
                // Attachment handling
                //
                if (part.ParentGroup.IsAttachment)
                {
                    if (part != part.ParentGroup.RootPart)
                    {
                        return;
                    }

                    part.ParentGroup.SendFullUpdateToClient(m_presence.ControllingClient, PrimUpdateFlags.FullUpdate);
                    return;
                }

                part.SendFullUpdate(m_presence.ControllingClient, m_presence.GenerateClientFlags(part.UUID), PrimUpdateFlags.FullUpdate);
            }
        }
Example #21
0
 public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
 {
     throw new System.NotImplementedException();
 }
Example #22
0
 /// <summary>
 /// Tell a specific avatar about the update
 /// </summary>
 /// <param name="UpdateFlags"></param>
 /// <param name="avatar"></param>
 public void ScheduleUpdateToAvatar(PrimUpdateFlags UpdateFlags, ScenePresence avatar)
 {
     PrimUpdateFlags PostUpdateFlags;
     if (ShouldScheduleUpdate(UpdateFlags, out PostUpdateFlags))
     {
         avatar.AddUpdateToAvatar(this, PostUpdateFlags);
     }
 }
 public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags, double priority)
 {
 }
 /// <summary>
 ///     Tell the SceneViewer for the given client about the update
 /// </summary>
 /// <param name="part"></param>
 /// <param name="flags"></param>
 public virtual void AddUpdateToAvatar(ISceneChildEntity part, PrimUpdateFlags flags)
 {
     m_sceneViewer.QueuePartForUpdate(part, flags);
 }
Example #25
0
 /// <summary>
 /// Check to see whether the given flags make it a terse update
 /// </summary>
 /// <param name="flags"></param>
 /// <returns></returns>
 private bool IsTerse(PrimUpdateFlags flags)
 {
     return flags.HasFlag((PrimUpdateFlags.Position | PrimUpdateFlags.Rotation
         | PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity))
         && !flags.HasFlag((PrimUpdateFlags.AttachmentPoint | PrimUpdateFlags.ClickAction |
         PrimUpdateFlags.CollisionPlane | PrimUpdateFlags.ExtraData | PrimUpdateFlags.FindBest | PrimUpdateFlags.FullUpdate |
         PrimUpdateFlags.Joint | PrimUpdateFlags.Material | PrimUpdateFlags.MediaURL | PrimUpdateFlags.NameValue |
         PrimUpdateFlags.ParentID | PrimUpdateFlags.Particles | PrimUpdateFlags.PrimData | PrimUpdateFlags.PrimFlags |
         PrimUpdateFlags.ScratchPad | PrimUpdateFlags.Shape | PrimUpdateFlags.Sound | PrimUpdateFlags.Text |
         PrimUpdateFlags.TextureAnim | PrimUpdateFlags.Textures));
 }
Example #26
0
        /// <summary>
        /// Schedules this prim for a full update
        /// </summary>
        public void ScheduleFullUpdate(PrimUpdateFlags updateFlags)
        {
            if (_isInTransaction) return;

            if (m_parentGroup != null)
            {
                if (m_parentGroup.Scene == null)
                    return; // no updates unless the object is at least in the scene

                m_parentGroup.QueueForUpdateCheck(this, UpdateLevel.Full, updateFlags);
            }

            Interlocked.Increment(ref FullUpdateCounter);

            //            m_log.DebugFormat(
            //                "[SCENE OBJECT PART]: Scheduling full  update for {0}, {1} at {2}",
            //                UUID, Name, TimeStampFull);
        }
Example #27
0
 /// <summary>
 ///     Tell all avatars in the Scene about the new update
 /// </summary>
 /// <param name="UpdateFlags"></param>
 public void ScheduleUpdate(PrimUpdateFlags UpdateFlags)
 {
     if (m_parentGroup != null && m_parentGroup.Scene != null)
         m_parentGroup.Scene.ForEachScenePresence(avatar => avatar.AddUpdateToAvatar(this, UpdateFlags));
 }
 /// <summary>
 /// Tell the SceneViewer for the given client about the update
 /// </summary>
 /// <param name="part"></param>
 /// <param name="flags"></param>
 public void AddUpdateToAvatar(ISceneChildEntity part, PrimUpdateFlags flags)
 {
    lock (m_terseUpdates)
         m_terseUpdates.Add(new OUpdates {Child = part, Flags = flags});
     Scene.SceneGraph.TaintPresenceForUpdate(this, PresenceTaint.ObjectUpdates);
 }
Example #29
0
 /// <summary>
 /// Tell all scene presences that they should send updates for this part to their clients
 /// </summary>
 public void AddFullUpdateToAllAvatars(PrimUpdateFlags flags)
 {
     List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
     foreach (ScenePresence avatar in avatars)
     {
         if (!(avatar.IsDeleted || avatar.IsInTransit))
             avatar.SceneView.QueuePartForUpdate(this, flags);
     }
 }
Example #30
0
 public void SendPrimitiveToClient(object sop, uint clientFlags, OpenMetaverse.Vector3 lpos, PrimUpdateFlags updateFlags)
 {
 }
Example #31
0
        /// <summary>
        ///   Tell all avatars in the Scene about the new update
        /// </summary>
        /// <param name = "UpdateFlags"></param>
        public void ScheduleUpdate(PrimUpdateFlags UpdateFlags)
        {
#if (!ISWIN)
            m_parentGroup.Scene.ForEachScenePresence(delegate(IScenePresence avatar)
            {
                avatar.AddUpdateToAvatar(this, UpdateFlags);
            });
#else
            m_parentGroup.Scene.ForEachScenePresence(avatar => avatar.AddUpdateToAvatar(this, UpdateFlags));
#endif
        }
 public void SendPrimitiveToClient(object sop, uint clientFlags, OpenMetaverse.Vector3 lpos, PrimUpdateFlags updateFlags)
 {
 }
Example #33
0
        public void SendAttachmentScheduleUpdate(SceneObjectGroup sog)
        {
            if (IsChildAgent || IsInTransit)
                return;

            SceneObjectPart[] origparts = sog.Parts;
            SceneObjectPart[] parts = new SceneObjectPart[origparts.Length];
            PrimUpdateFlags[] flags = new PrimUpdateFlags[origparts.Length];

            SceneObjectPart rootpart = sog.RootPart;
            UpdateRequired rootreq = sog.RootPart.UpdateFlag;

            int j = 0;
            bool allterse = true;
            for (int i = 0; i < origparts.Length; i++)
            {
                if (origparts[i] != rootpart)
                {
                    switch (origparts[i].UpdateFlag)
                    {
                        case UpdateRequired.NONE:
                            break;

                        case UpdateRequired.TERSE:
                            flags[j] = PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
                            | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity;
                            parts[j] = origparts[i];
                            j++;
                            break;

                        case UpdateRequired.FULL:
                            flags[j] = PrimUpdateFlags.FullUpdate;
                            allterse = false;
                            parts[j] = origparts[i];
                            j++;
                            break;
                    }
                }
                origparts[i].UpdateFlag = 0;
            }

            if (j == 0 && rootreq == UpdateRequired.NONE)
                return;

            PrimUpdateFlags rootflag = PrimUpdateFlags.FullUpdate;

            if (rootreq != UpdateRequired.FULL && allterse)
            {
                rootflag = PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
                        | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity;
            }

            int nparts = j;

            ControllingClient.SendEntityUpdate(rootpart, rootflag);

            for (int i = 0; i < nparts; i++)
            {
                ControllingClient.SendEntityUpdate(parts[i], flags[i]);
            }

            if (sog.HasPrivateAttachmentPoint)
                return;

            List<ScenePresence> allPresences = m_scene.GetScenePresences();
            foreach (ScenePresence p in allPresences)
            {
                if (p == this)
                    continue;

                if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
                    continue;

                p.ControllingClient.SendEntityUpdate(rootpart, rootflag);

                for (int i = 0; i < nparts; i++)
                {
                    p.ControllingClient.SendEntityUpdate(parts[i], flags[i]);
                }
            }
        }
 /// <summary>
 ///     Check to see whether the given flags make it a terse update
 /// </summary>
 /// <param name="flags"></param>
 /// <returns></returns>
 bool IsTerse(PrimUpdateFlags flags)
 {
     return flags.HasFlag((PrimUpdateFlags.TerseUpdate))
            && !flags.HasFlag((PrimUpdateFlags.AttachmentPoint | PrimUpdateFlags.ClickAction |
                               PrimUpdateFlags.CollisionPlane | PrimUpdateFlags.ExtraData |
                               PrimUpdateFlags.FindBest | PrimUpdateFlags.FullUpdate |
                               PrimUpdateFlags.Joint | PrimUpdateFlags.Material | PrimUpdateFlags.MediaURL |
                               PrimUpdateFlags.NameValue |
                               PrimUpdateFlags.ParentID | PrimUpdateFlags.Particles | PrimUpdateFlags.PrimData |
                               PrimUpdateFlags.PrimFlags |
                               PrimUpdateFlags.ScratchPad | PrimUpdateFlags.Shape | PrimUpdateFlags.Sound |
                               PrimUpdateFlags.Text |
                               PrimUpdateFlags.TextureAnim | PrimUpdateFlags.Textures)) &&
            !flags.HasFlag(PrimUpdateFlags.ForcedFullUpdate);
 }
        /// <summary>
        /// Send an update to all prims in the group
        /// </summary>
        /// <param name="UpdateFlags"></param>
        public void ScheduleGroupUpdate(PrimUpdateFlags UpdateFlags)
        {
            //We have to send the root part first as the client wants it that way
            RootPart.ScheduleUpdate(UpdateFlags);

            foreach (SceneObjectPart part in m_partsList)
            {
                if (part != RootPart)
                {
                    part.ScheduleUpdate(UpdateFlags);
                }
            }
        }
Example #36
0
        public void SendFullUpdateToAllClientsExcept(UUID agentID, PrimUpdateFlags updateFlags)
        {
            if (m_parentGroup.InTransit)
                return;
            if (m_parentGroup.IsDeleted)
                return;

            List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
            foreach (ScenePresence avatar in avatars)
            {
                if (avatar.UUID != agentID)
                    if (!(avatar.IsDeleted || avatar.IsInTransit))
                        m_parentGroup.SendPartFullUpdate(avatar.ControllingClient, this, avatar.GenerateClientFlags(UUID), updateFlags);
            }
        }
Example #37
0
 public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
 {
 }
Example #38
0
        /// <summary>
        /// Sends a full update to the client
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="clientFlags"></param>
        public void SendFullUpdateToClient(IClientAPI remoteClient, uint clientflags, PrimUpdateFlags updateFlags)
        {
            if (m_parentGroup.InTransit)
                return;
            if (m_parentGroup.IsDeleted)
                return;

            Vector3 lPos;
            lPos = OffsetPosition;
            SendFullUpdateToClient(remoteClient, lPos, clientflags, updateFlags);
        }
Example #39
0
        /// <summary>
        /// Send an update to all prims in the group to a specific avatar
        /// </summary>
        /// <param name="presence"></param>
        /// <param name="UpdateFlags"></param>
        public void ScheduleGroupUpdateToAvatar (IScenePresence presence, PrimUpdateFlags UpdateFlags)
        {
            //We have to send the root part first as the client wants it that way
            RootPart.ScheduleUpdateToAvatar(UpdateFlags, presence);

            lock (m_partsLock)
            {
                foreach (SceneObjectPart part in m_partsList)
                {
                    if (part != RootPart)
                    {
                        part.ScheduleUpdateToAvatar(UpdateFlags, presence);
                    }
                }
            }
        }
Example #40
0
        /// <summary>
        /// Sends a full update to the client
        /// </summary>
        /// <param name="remoteClient"></param>
        /// <param name="lPos"></param>
        /// <param name="clientFlags"></param>
        /// <param name="updateFlags">The properties that were changed that caused this update</param>
        public void SendFullUpdateToClient(IClientAPI remoteClient, Vector3 lPos,
            uint clientFlags, PrimUpdateFlags updateFlags)
        {
            if (m_parentGroup.IsDeleted)
                return;
            if (m_parentGroup.InTransit)
                return;

            clientFlags &= ~(uint) PrimFlags.CreateSelected;
            if ((uint)(_flags & PrimFlags.Scripted) != 0)
                clientFlags |= (uint)PrimFlags.Scripted;
            else
                clientFlags &= ~(uint)PrimFlags.Scripted;

            if (remoteClient.AgentId == _ownerID)
            {
                if ((uint)(_flags & PrimFlags.CreateSelected) != 0)
                {
                    clientFlags |= (uint)PrimFlags.CreateSelected;
                    _flags &= ~PrimFlags.CreateSelected;
                }
            }
            else
            {   // Someone else's object
                // If it's worn as a HUD, don't send this no matter what
                if (ParentGroup.IsAttachedHUD)
                    return;
            }

            remoteClient.SendPrimitiveToClient(this, clientFlags, lPos, updateFlags);
        }
Example #41
0
 /// <summary>
 /// Tell all avatars in the Scene about the new update
 /// </summary>
 /// <param name="UpdateFlags"></param>
 public void ScheduleUpdate(PrimUpdateFlags UpdateFlags)
 {
     PrimUpdateFlags PostUpdateFlags;
     if (ShouldScheduleUpdate(UpdateFlags, out PostUpdateFlags))
     {
         m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
         {
             avatar.AddUpdateToAvatar(this, PostUpdateFlags);
         });
     }
 }
Example #42
0
        /// <summary>
        /// Tell all the prims which have had updates scheduled
        /// </summary>
        public void SendScheduledUpdates(UpdateLevel level, PrimUpdateFlags updateFlags)
        {
            switch (level)
            {
                case UpdateLevel.Terse:
                    AddTerseUpdateToAllAvatars();
                    break;

                /*case UpdateLevel.Compressed:
                    AddCompressedUpdateToAllAvatars();
                    break;*/

                case UpdateLevel.Full:
                    AddFullUpdateToAllAvatars(updateFlags);
                    break;
            }
        }
Example #43
0
        /// <summary>
        /// Make sure that we should send the specified update to the client
        /// </summary>
        /// <param name="UpdateFlags"></param>
        /// <returns></returns>
        protected bool ShouldScheduleUpdate(PrimUpdateFlags UpdateFlags, out PrimUpdateFlags PostUpdateFlags)
        {
            PostUpdateFlags = UpdateFlags;
            //If its not a terse update, we need to make sure to add the text, media, etc pieces on, otherwise the client will forget about them
            if (!IsTerse(UpdateFlags))
            {
                //If it is find best, we add the defaults
                if (UpdateFlags == PrimUpdateFlags.FindBest)
                {
                    //Add the defaults
                    UpdateFlags = PrimUpdateFlags.None;
                    UpdateFlags |= PrimUpdateFlags.ClickAction;
                    UpdateFlags |= PrimUpdateFlags.ExtraData;
                    UpdateFlags |= PrimUpdateFlags.Shape;
                    UpdateFlags |= PrimUpdateFlags.Material;
                    UpdateFlags |= PrimUpdateFlags.Textures;
                    UpdateFlags |= PrimUpdateFlags.Rotation;
                    UpdateFlags |= PrimUpdateFlags.PrimFlags;
                    UpdateFlags |= PrimUpdateFlags.Position;
                    UpdateFlags |= PrimUpdateFlags.AngularVelocity;
                }

                //Must send these as well
                if (Text != "")
                    UpdateFlags |= PrimUpdateFlags.Text;
                if (AngularVelocity != Vector3.Zero)
                    UpdateFlags |= PrimUpdateFlags.AngularVelocity;
                if (TextureAnimation != null && TextureAnimation.Length != 0)
                    UpdateFlags |= PrimUpdateFlags.TextureAnim;
                if (Sound != UUID.Zero)
                    UpdateFlags |= PrimUpdateFlags.Sound;
                if (ParticleSystem != null && ParticleSystem.Length != 0)
                    UpdateFlags |= PrimUpdateFlags.Particles;
                if (CurrentMediaVersion != "x-mv:0000000001/00000000-0000-0000-0000-000000000000")
                    UpdateFlags |= PrimUpdateFlags.MediaURL;

                //Make sure that we send this! Otherwise, the client will only see one prim
                if (m_parentGroup != null)
                    if (ParentGroup.ChildrenList.Count != 1)
                        UpdateFlags |= PrimUpdateFlags.ParentID;

                //Increment the CRC code so that the client won't be sent a cached update for this
                CRC++;
            }

            if (ParentGroup != null)
            {
                if (ParentGroup.Scene == null) // Need to check here as it's null during object creation
                    return false;

                // Check that the group was not deleted before the scheduled update
                // FIXME: This is merely a temporary measure to reduce the incidence of failure when
                // an object has been deleted from a scene before update was processed.
                // A more fundamental overhaul of the update mechanism is required to eliminate all
                // the race conditions.
                if (ParentGroup.IsDeleted)
                    return false;

                if (IsTerse(UpdateFlags))
                {
                    const float ROTATION_TOLERANCE = 0.01f;
                    const float VELOCITY_TOLERANCE = 0.001f;
                    const float POSITION_TOLERANCE = 0.01f;

                    // Throw away duplicate or insignificant updates
                    if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
                        !Acceleration.Equals(m_lastAcceleration) ||
                        !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
                        !Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) ||
                        !AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) ||
                        !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
                        !GroupPosition.ApproxEquals(m_lastGroupPosition, POSITION_TOLERANCE))
                    {
                        // Update the "last" values
                        m_lastPosition = OffsetPosition;
                        m_lastGroupPosition = GroupPosition;
                        m_lastRotation = RotationOffset;
                        m_lastVelocity = Velocity;
                        m_lastAcceleration = Acceleration;
                        m_lastAngularVelocity = AngularVelocity;
                    }
                    else
                    {
                        IMonitorModule m = ParentGroup.Scene.RequestModuleInterface<IMonitorModule>();
                        if (m != null)
                            ((IObjectUpdateMonitor)m.GetMonitor(ParentGroup.Scene.RegionInfo.RegionID.ToString(), "PrimUpdates")).AddLimitedPrims(1);
                        return false;
                    }
                }
                //Reupdate so they get sent properly
                PostUpdateFlags = UpdateFlags;
                return true;
            }
            return false;
        }
Example #44
0
 public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation)
     : base(entity, (uint)flags)
 {
     // Flags = flags;
     m_timeDilation = timedilation;
 }
 public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags)
 {
     m_entity = entity;
     m_flags  = flags;
 }
Example #46
0
 public EntityUpdate(ISceneEntity entity, PrimUpdateFlags flags, float timedilation, Int32 updateTime)
     : base(entity,(uint)flags,updateTime)
 {
     m_timeDilation = timedilation;
 }
Example #47
0
 public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
 {
     // m_log.Debug("[REGION SYNC AVATAR] SendPrimUpdate");
 }
Example #48
0
 public static bool HasFlag(this PrimUpdateFlags updateFlags, PrimUpdateFlags flag)
 {
     return (updateFlags & flag) == flag;
 }
Example #49
0
 public static bool HasFlag(this PrimUpdateFlags updateFlags, PrimUpdateFlags flag)
 {
     return((updateFlags & flag) == flag);
 }
Example #50
0
        /// <summary>
        ///   Send an update to all prims in the group to a specific avatar
        /// </summary>
        /// <param name = "presence"></param>
        /// <param name = "UpdateFlags"></param>
        public void ScheduleGroupUpdateToAvatar(IScenePresence presence, PrimUpdateFlags UpdateFlags)
        {
            //We have to send the root part first as the client wants it that way
            presence.AddUpdateToAvatar(RootPart, UpdateFlags);

#if (!ISWIN)
            foreach (SceneObjectPart part in m_partsList)
            {
                if (part != RootPart)
                {
                    presence.AddUpdateToAvatar(part, UpdateFlags);
                }
            }
#else
            foreach (SceneObjectPart part in m_partsList.Where(part => part != RootPart))
            {
                presence.AddUpdateToAvatar(part, UpdateFlags);
            }
#endif
        }
Example #51
0
 public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
 {
 }
Example #52
0
        /// <summary>
        ///   Send an update to all prims in the group
        /// </summary>
        /// <param name = "UpdateFlags"></param>
        public void ScheduleGroupUpdate(PrimUpdateFlags UpdateFlags)
        {
            //We have to send the root part first as the client wants it that way
            RootPart.ScheduleUpdate(UpdateFlags);

#if (!ISWIN)
            foreach (SceneObjectPart part in m_partsList)
            {
                if (part != RootPart)
                {
                    part.ScheduleUpdate(UpdateFlags);
                }
            }
#else
            foreach (SceneObjectPart part in m_partsList.Where(part => part != RootPart))
            {
                part.ScheduleUpdate(UpdateFlags);
            }
#endif
        }
Example #53
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="remoteClient"></param>
        public void SendFullUpdate(IClientAPI remoteClient, uint clientFlags, PrimUpdateFlags updateFlags)
        {
            if (m_parentGroup.InTransit)
                return;
            if (m_parentGroup.IsDeleted)
                return;

            m_parentGroup.SendPartFullUpdate(remoteClient, this, clientFlags, updateFlags);
        }
Example #54
0
 public EntityUpdate (IEntity entity, PrimUpdateFlags flags)
 {
     Entity = entity;
     Flags = flags;
 }