public void OnAgentEnteredRegion(ScenePresence avatar)
        {
            Vector3 apos;

            if (m_ready)
            {
                if (avatar.HasSafePosition(out apos))
                {
                    // Quantize the position to a 16 x 16 x 3 meter box. This reduces
                    // the number of calls into the wind plugin when the avatar density
                    // is high.
                    apos.X = (((int)apos.X) / 16) * 16;
                    apos.Y = (((int)apos.Y) / 16) * 16;
                    apos.Z = (((int)apos.Z) / 3) * 3;
                    if (m_activeWindPlugin != null && apos != windZpos)
                    {
                        // Ask wind plugin to generate a LL wind array for the specified position
                        windSpeeds = m_activeWindPlugin.WindLLClientArray(apos);
                        windZpos   = apos;
                    }

                    avatar.ControllingClient.SendWindData(windSpeeds);
                }
            }
        }
Beispiel #2
0
        public void OnAgentEnteredRegion(IScenePresence avatar)
        {
            if (m_ready)
            {
                if (m_activeWindPlugin != null)
                {
                    // Ask wind plugin to generate a LL wind array to be cached locally
                    // Try not to update this too often, as it may involve array copies
                    if (m_frame >= (m_frameLastUpdateClientArray + m_frameUpdateRate))
                    {
                        windSpeeds = m_activeWindPlugin.WindLLClientArray();
                        m_frameLastUpdateClientArray = m_frame;
                    }
                }

                avatar.ControllingClient.SendWindData(windSpeeds);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Calculate new wind
        /// returns false if no change
        /// </summary>

        private bool GenWind()
        {
            if (m_activeWindPlugin != null && m_activeWindPlugin.WindUpdate(m_frame))
            {
                windSpeeds = m_activeWindPlugin.WindLLClientArray();
                m_dataVersion++;
                return(true);
            }
            return(false);
        }
        private void SendWindAllClients()
        {
            if (m_ready)
            {
                if (m_scene.GetRootAgentCount() > 0)
                {
                    // Ask wind plugin to generate a LL wind array to be cached locally
                    // Try not to update this too often, as it may involve array copies
                    if (m_frame >= (m_frameLastUpdateClientArray + m_frameUpdateRate))
                    {
                        windSpeeds = m_activeWindPlugin.WindLLClientArray();
                        m_frameLastUpdateClientArray = m_frame;
                    }

                    m_scene.ForEachRootClient(delegate(IClientAPI client)
                    {
                        client.SendWindData(windSpeeds);
                    });
                }
            }
        }