Exemplo n.º 1
0
        private void UpdateClientsSunTime()
        {
            if (m_scene.GetNumberOfClients() == 0)
            {
                return;
            }

            //m_log.DebugFormat("{0} {1} {2} {3}", dayFrac, eepDayFrac, wldayFrac, Util.UnixTimeSinceEpoch_uS());

            m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
            {
                if (sp.IsDeleted || sp.IsInTransit || sp.IsNPC)
                {
                    return;
                }

                ViewerEnvironment VEnv;
                if (sp.Environment != null)
                {
                    VEnv = sp.Environment;
                }
                else
                {
                    VEnv = GetEnvironment(sp.AbsolutePosition.X, sp.AbsolutePosition.Y);
                }

                float dayFrac = GetDayFractionTime(VEnv);

                IClientAPI client = sp.ControllingClient;
                uint vflags       = client.GetViewerCaps();

                if ((vflags & 0x8000) != 0)
                {
                    client.SendViewerTime(Vector3.Zero, dayFrac * Utils.TWO_PI);
                    return;
                }

                if (dayFrac <= 0.25f)
                {
                    dayFrac += 1.5f;
                }
                else if (dayFrac > 0.75f)
                {
                    dayFrac += 0.5f;
                }
                else if (dayFrac >= 0.333333f)
                {
                    dayFrac = 3f * dayFrac - 1f;
                }
                else
                {
                    dayFrac = 3f * dayFrac + 1f;
                }

                dayFrac  = Utils.Clamp(dayFrac, 0, 2f);
                dayFrac *= Utils.PI;

                client.SendViewerTime(Vector3.Zero, dayFrac);
            });
        }
Exemplo n.º 2
0
        public void WindlightRefresh(int interpolate, bool forRegion = true)
        {
            List <byte[]> ls = null;

            m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
            {
                if (sp.IsInTransit || sp.IsNPC)
                {
                    return;
                }

                IClientAPI client = sp.ControllingClient;

                if (!client.IsActive)
                {
                    return;
                }

                uint vflags = client.GetViewerCaps();

                if ((vflags & 0x8000) != 0)
                {
                    if (forRegion)
                    {
                        m_estateModule.HandleRegionInfoRequest(client);
                    }
                }
                else if ((vflags & 0x4000) != 0)
                {
                    m_eventQueue.WindlightRefreshEvent(interpolate, client.AgentId);
                }

                else
                {
                    if (ls == null)
                    {
                        ls = MakeLightShareData();
                    }
                    SendLightShare(client, ls);
                }
            });
        }
Exemplo n.º 3
0
        private void OnAvatarEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
        {
            if (sp.Environment != null)
            {
                return;
            }

            if (!m_scene.RegionInfo.EstateSettings.AllowEnvironmentOverride)
            {
                return;
            }

            IClientAPI client = sp.ControllingClient;
            uint       vflags = client.GetViewerCaps();

            if ((vflags & 0x8000) != 0)
            {
                return;
            }
            m_eventQueue.WindlightRefreshEvent(1, client.AgentId);
        }
Exemplo n.º 4
0
        public void WindlightRefreshForced(IScenePresence isp, int interpolate)
        {
            List <byte[]> ls = null;

            IClientAPI client = isp.ControllingClient;

            if (!client.IsActive)
            {
                return;
            }

            uint vflags = client.GetViewerCaps();

            if ((vflags & 0x8000) != 0)
            {
                ScenePresence sp = isp as ScenePresence;
                ILandObject   lo = m_scene.LandChannel.GetLandObject(sp.AbsolutePosition.X, sp.AbsolutePosition.Y);
                if (lo != null && lo.LandData != null && lo.LandData.Environment != null)
                {
                    lo.SendLandUpdateToClient(client);
                }
                m_estateModule.HandleRegionInfoRequest(client);
            }
            else if ((vflags & 0x4000) != 0)
            {
                m_eventQueue.WindlightRefreshEvent(interpolate, client.AgentId);
            }
            else
            {
                if (ls == null)
                {
                    ls = MakeLightShareData();
                }
                SendLightShare(client, ls);
            }
        }