示例#1
0
        private void EntityAddOrUpdateHandler(object sender, EntityAddOrUpdateArgs e)
        {
            // Add all entities with dynamics enabled to our dictionary
            if (e.UpdateFlags.HasFlag(UpdateFlags.PhysicalStatus) && !(e.Entity is IScenePresence) && e.Entity is IPhysical)
            {
                IPhysical physical = (IPhysical)e.Entity;

                if (physical.DynamicsEnabled)
                {
                    m_activePhysicsEntities.Add(physical.LocalID, physical);
                }
                else
                {
                    m_activePhysicsEntities.Remove(physical.LocalID);
                }
            }
        }
示例#2
0
        private void EntityAddOrUpdateHandler(object sender, EntityAddOrUpdateArgs e)
        {
            if (sender != this && e.Entity is LLPrimitive && (e.UpdateFlags != 0 || e.ExtraFlags != 0))
            {
                LLPrimitive prim   = (LLPrimitive)e.Entity;
                ILinkable   parent = prim.Parent;

                if (parent == null)
                {
                    m_writeQueue.Add(prim.ID, new PrimSerialization {
                        ID = prim.ID, Prim = prim
                    });
                }
                else if (parent is LLPrimitive)
                {
                    m_writeQueue.Add(parent.ID, new PrimSerialization {
                        ID = parent.ID, Prim = (LLPrimitive)parent
                    });
                }
            }
        }
示例#3
0
        private void EntityAddOrUpdateHandler(object sender, EntityAddOrUpdateArgs e)
        {
            if (e.UpdateFlags.HasFlag(UpdateFlags.Position))
            {
                // Ignore child entities
                ISceneEntity entity = e.Entity;
                if (entity is ILinkable && ((ILinkable)entity).Parent != null)
                {
                    return;
                }

                // Ignore child agents
                if (entity is IScenePresence && ((IScenePresence)entity).IsChildPresence)
                {
                    return;
                }

                // Check if we are currently throttling border crossing attempts for this entity
                bool borderCrossThrottled = false;
                lock (m_borderCrossThrottles)
                {
                    int tickCount;
                    if (m_borderCrossThrottles.TryGetValue(entity.ID, out tickCount))
                    {
                        int now = Util.TickCount();
                        if (tickCount > now)
                        {
                            borderCrossThrottled = true;
                        }
                        else
                        {
                            m_borderCrossThrottles.Remove(entity.ID);
                        }
                    }
                }

                SceneInfo neighbor;
                if (!borderCrossThrottled && CheckForBorderCrossing(entity, out neighbor))
                {
                    bool success;

                    if (entity is LLAgent)
                    {
                        success = BorderCrossLLAgent((LLAgent)entity, neighbor);
                    }
                    else
                    {
                        success = BorderCrossEntity(entity, neighbor);
                    }

                    if (success)
                    {
                        m_log.Debug(entity.Name + " border crossed to " + neighbor.Name + " @ " + entity.ScenePosition);
                    }
                    else
                    {
                        // Add a throttle for border crossing this entity
                        lock (m_borderCrossThrottles)
                            m_borderCrossThrottles[entity.ID] = Util.TickCount() + BORDER_CROSS_THROTTLE_MS;
                    }
                }
                else if (entity is IScenePresence && CheckForCameraMovement(entity))
                {
                    m_childUpdates.Add(entity.LocalID, (IScenePresence)entity);
                }
            }
        }
示例#4
0
        private void EntityAddOrUpdateHandler(object sender, EntityAddOrUpdateArgs e)
        {
            if (e.UpdateFlags.HasFlag(UpdateFlags.Position))
            {
                // Ignore child entities
                ISceneEntity entity = e.Entity;
                if (entity is ILinkable && ((ILinkable)entity).Parent != null)
                    return;

                // Ignore child agents
                if (entity is IScenePresence && ((IScenePresence)entity).IsChildPresence)
                    return;

                // Check if we are currently throttling border crossing attempts for this entity
                bool borderCrossThrottled = false;
                lock (m_borderCrossThrottles)
                {
                    int tickCount;
                    if (m_borderCrossThrottles.TryGetValue(entity.ID, out tickCount))
                    {
                        int now = Environment.TickCount & Int32.MaxValue;
                        if (tickCount > now)
                            borderCrossThrottled = true;
                        else
                            m_borderCrossThrottles.Remove(entity.ID);
                    }
                }

                SceneInfo neighbor;
                if (!borderCrossThrottled && CheckForBorderCrossing(entity, out neighbor))
                {
                    bool success;

                    if (entity is LLAgent)
                        success = BorderCrossLLAgent((LLAgent)entity, neighbor);
                    else
                        success = BorderCrossEntity(entity, neighbor);

                    if (success)
                    {
                        m_log.Debug(entity.Name + " border crossed to " + neighbor.Name + " @ " + entity.ScenePosition);
                    }
                    else
                    {
                        // Add a throttle for border crossing this entity
                        lock (m_borderCrossThrottles)
                            m_borderCrossThrottles[entity.ID] = (Environment.TickCount & Int32.MaxValue) + BORDER_CROSS_THROTTLE_MS;
                    }
                }
                else if (entity is IScenePresence && CheckForCameraMovement(entity))
                {
                    m_childUpdates.Add(entity.LocalID, (IScenePresence)entity);
                }
            }
        }
示例#5
0
        private void EntityAddOrUpdateHandler(object sender, EntityAddOrUpdateArgs e)
        {
            if (sender != this && e.Entity is LLPrimitive && (e.UpdateFlags != 0 || e.ExtraFlags != 0))
            {
                LLPrimitive prim = (LLPrimitive)e.Entity;
                ILinkable parent = prim.Parent;

                if (parent == null)
                    m_writeQueue.Add(prim.ID, new PrimSerialization { ID = prim.ID, Prim = prim });
                else if (parent is LLPrimitive)
                    m_writeQueue.Add(parent.ID, new PrimSerialization { ID = parent.ID, Prim = (LLPrimitive)parent });
            }
        }
示例#6
0
        private void EntityAddOrUpdateHandler(object sender, EntityAddOrUpdateArgs e)
        {
            // Add all entities with dynamics enabled to our dictionary
            if (e.UpdateFlags.HasFlag(UpdateFlags.PhysicalStatus) && !(e.Entity is IScenePresence) && e.Entity is IPhysical)
            {
                IPhysical physical = (IPhysical)e.Entity;

                if (physical.DynamicsEnabled)
                    m_activePhysicsEntities.Add(physical.LocalID, physical);
                else
                    m_activePhysicsEntities.Remove(physical.LocalID);
            }
        }
示例#7
0
        private void EntityAddOrUpdateHandler(object sender, EntityAddOrUpdateArgs e)
        {
            // Child agent updates are not sent out here
            if (e.Entity is LLAgent && ((LLAgent)e.Entity).IsChildPresence)
                return;

            // Ignore serialization-only signals
            if (e.UpdateFlags == UpdateFlags.Serialize)
                return;

            // Check for out of bounds objects
            const float LIMIT = 10000f;
            Vector3 pos = e.Entity.RelativePosition;
            if (pos.X < -LIMIT || pos.X > LIMIT ||
                pos.Y < -LIMIT || pos.Y > LIMIT ||
                pos.Z < -LIMIT || pos.Z > LIMIT)
            {
                // TODO: Return this object to the owner instead of destroying it
                m_log.Warn("Destroying out of bounds object " + e.Entity.ID + " at " + pos);
                m_scene.EntityRemove(this, e.Entity);
                return;
            }

            m_scene.CreateInterestListEvent(new InterestListEvent(e.Entity.ID, OBJECT_UPDATE, e.Entity.ScenePosition, e.Entity.Scale, e));
        }