public RegionLightShareData ToLightShare()
        {
            if (!Enabled)
            {
                return(new RegionLightShareData());
            }

            RegionLightShareData ls = null;

            try
            {
                ViewerEnvironment VEnv = m_scene.RegionEnvironment;
                if (VEnv == null)
                {
                    return(new RegionLightShareData());
                }
                ls = VEnv.ToLightShare();
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[{0}]: Unable to convert environment to lightShare, Exception: {1} - {2}",
                                  Name, e.Message, e.StackTrace);
            }
            if (ls == null)
            {
                return(new RegionLightShareData());
            }
            return(ls);
        }
        private void EventManager_OnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID)
        {
            IClientAPI client;

            m_scene.TryGetClient(pUUID, out client);
            SendProfileToClient(client, wl);
        }
Exemple #3
0
        /// <summary>
        /// Set the current Windlight scene
        /// </summary>
        /// <param name="rules"></param>
        /// <returns>success: true or false</returns>
        public int lsSetWindlightScene(LSL_List rules)
        {
            if (!m_LSFunctionsEnabled || m_environment == null)
            {
                LSShoutError("LightShare functions are not enabled.");
                return(0);
            }

            if (!World.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_host.OwnerID))
            {
                ScenePresence sp = World.GetScenePresence(m_host.OwnerID);

                if (sp == null || !sp.IsViewerUIGod)
                {
                    LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
                    return(0);
                }
            }

            try
            {
                RegionLightShareData wl = getWindlightProfileFromRules(rules);
                m_environment.FromLightShare(wl);
            }
            catch (InvalidCastException e)
            {
                LSShoutError(e.Message);
                return(0);
            }

            return(1);
        }
Exemple #4
0
        /// <summary>
        /// Set the current Windlight scene
        /// </summary>
        /// <param name="rules"></param>
        /// <returns>success: true or false</returns>
        public int lsSetWindlightScene(LSL_List rules)
        {
            if (!m_LSFunctionsEnabled)
            {
                LSShoutError("LightShare functions are not enabled.");
                return(0);
            }
            if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
            {
                LSShoutError("lsSetWindlightScene can only be used by estate managers or owners.");
                return(0);
            }
            int success = 0;

            m_host.AddScriptLPS(1);
            if (LightShareModule.EnableWindlight)
            {
                RegionLightShareData wl = getWindlightProfileFromRules(rules);
                m_host.ParentGroup.Scene.StoreWindlightProfile(wl);
                success = 1;
            }
            else
            {
                LSShoutError("Windlight module is disabled");
                return(0);
            }
            return(success);
        }
Exemple #5
0
        //Find the correct WL settings to send to the client
        public void SendProfileToClient(IScenePresence presence)
        {
            if (presence == null)
            {
                return;
            }
            ILandObject             land             = null;
            IParcelManagementModule parcelManagement = presence.Scene.RequestModuleInterface <IParcelManagementModule>();

            if (parcelManagement != null)
            {
                land = parcelManagement.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y);
            }
            OSDMap map = land != null ? land.LandData.GenericDataMap : new OSDMap();

            if (map.ContainsKey("WindLight"))
            {
                IOpenRegionSettingsModule ORSM = presence.Scene.RequestModuleInterface <IOpenRegionSettingsModule>();
                if (ORSM != null && ORSM.AllowParcelWindLight)
                {
                    if (CheckOverRideParcels(presence))
                    {
                        //Overrides all
                        SendProfileToClient(presence, FindRegionWindLight(presence));
                    }
                    else
                    {
                        OSDMap innerMap = (OSDMap)map["WindLight"];
                        foreach (KeyValuePair <string, OSD> kvp in innerMap)
                        {
                            int minEffectiveAltitude = int.Parse(kvp.Key);
                            if (presence.AbsolutePosition.Z > minEffectiveAltitude)
                            {
                                OSDMap lsdMap = (OSDMap)kvp.Value;
                                RegionLightShareData parcelLSD = new RegionLightShareData();
                                parcelLSD.FromOSD(lsdMap);
                                if (presence.AbsolutePosition.Z < parcelLSD.maxEffectiveAltitude)
                                {
                                    //They are between both altitudes
                                    SendProfileToClient(presence, parcelLSD);
                                    return; //End it
                                }
                            }
                        }
                        //Send region since no parcel claimed the user
                        SendProfileToClient(presence, FindRegionWindLight(presence));
                    }
                }
                else
                {
                    //Only region allowed
                    SendProfileToClient(presence, FindRegionWindLight(presence));
                }
            }
            else
            {
                //Send the region by default to override any previous settings
                SendProfileToClient(presence, FindRegionWindLight(presence));
            }
        }
Exemple #6
0
        /// <summary>
        /// Set the current Windlight scene to a target avatar
        /// </summary>
        /// <param name="rules"></param>
        /// <returns>success: true or false</returns>
        public int lsSetWindlightSceneTargeted(LSL_List rules, LSL_Key target)
        {
            if (!m_LSFunctionsEnabled)
            {
                LSShoutError("LightShare functions are not enabled.");
                return(0);
            }
            if (!World.RegionInfo.EstateSettings.IsEstateManager(m_host.OwnerID) && World.GetScenePresence(m_host.OwnerID).GodLevel < 200)
            {
                LSShoutError("lsSetWindlightSceneTargeted can only be used by estate managers or owners.");
                return(0);
            }
            int success = 0;

            m_host.AddScriptLPS(1);
            if (LightShareModule.EnableWindlight)
            {
                RegionLightShareData wl = getWindlightProfileFromRules(rules);
                World.EventManager.TriggerOnSendNewWindlightProfileTargeted(wl, new UUID(target.m_string));
                success = 1;
            }
            else
            {
                LSShoutError("Windlight module is disabled");
                return(0);
            }
            return(success);
        }
 private void EventManager_OnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID)
 {
     ScenePresence Sc;
     if (m_scene.TryGetScenePresence(pUUID,out Sc))
     {
         SendProfileToClient(Sc,wl);
     }
 }
Exemple #8
0
        public void SendWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID)
        {
            IScenePresence Sc;

            if (m_scene.TryGetScenePresence(pUUID, out Sc))
            {
                SendProfileToClient(Sc, wl);
            }
        }
Exemple #9
0
        public void SendProfileToClientEQ(IScenePresence presence, RegionLightShareData wl)
        {
            OSD item = BuildSendEQMessage(wl.ToOSD());
            IEventQueueService eq = presence.Scene.RequestModuleInterface <IEventQueueService>();

            if (eq != null)
            {
                eq.Enqueue(item, presence.UUID, presence.Scene.RegionInfo.RegionHandle);
            }
        }
Exemple #10
0
 public void LoadModuleFromArchive(byte[] data, string filePath, TarArchiveReader.TarEntryType type, IScene scene)
 {
     if (filePath.StartsWith("windlight/"))
     {
         OSDMap map = (OSDMap)OSDParser.DeserializeLLSDBinary(data);
         RegionLightShareData lsd = new RegionLightShareData();
         lsd.FromOSD(map);
         SaveWindLightSettings(lsd.minEffectiveAltitude, lsd);
     }
 }
        public List <byte[]> MakeLightShareData()
        {
            if (m_scene.RegionEnvironment == null)
            {
                return(null);
            }

            RegionLightShareData wl = ToLightShare();

            byte[] mBlock = new Byte[249];
            int    pos    = 0;

            wl.waterColor.ToBytes(mBlock, 0); pos += 12;
            Utils.FloatToBytes(wl.waterFogDensityExponent).CopyTo(mBlock, pos); pos += 4;
            Utils.FloatToBytes(wl.underwaterFogModifier).CopyTo(mBlock, pos); pos   += 4;
            wl.reflectionWaveletScale.ToBytes(mBlock, pos); pos               += 12;
            Utils.FloatToBytes(wl.fresnelScale).CopyTo(mBlock, pos); pos      += 4;
            Utils.FloatToBytes(wl.fresnelOffset).CopyTo(mBlock, pos); pos     += 4;
            Utils.FloatToBytes(wl.refractScaleAbove).CopyTo(mBlock, pos); pos += 4;
            Utils.FloatToBytes(wl.refractScaleBelow).CopyTo(mBlock, pos); pos += 4;
            Utils.FloatToBytes(wl.blurMultiplier).CopyTo(mBlock, pos); pos    += 4;
            wl.bigWaveDirection.ToBytes(mBlock, pos); pos                      += 8;
            wl.littleWaveDirection.ToBytes(mBlock, pos); pos                   += 8;
            wl.normalMapTexture.ToBytes(mBlock, pos); pos                      += 16;
            wl.horizon.ToBytes(mBlock, pos); pos                               += 16;
            Utils.FloatToBytes(wl.hazeHorizon).CopyTo(mBlock, pos); pos        += 4;
            wl.blueDensity.ToBytes(mBlock, pos); pos                           += 16;
            Utils.FloatToBytes(wl.hazeDensity).CopyTo(mBlock, pos); pos        += 4;
            Utils.FloatToBytes(wl.densityMultiplier).CopyTo(mBlock, pos); pos  += 4;
            Utils.FloatToBytes(wl.distanceMultiplier).CopyTo(mBlock, pos); pos += 4;
            wl.sunMoonColor.ToBytes(mBlock, pos); pos                          += 16;
            Utils.FloatToBytes(wl.sunMoonPosition).CopyTo(mBlock, pos); pos    += 4;
            wl.ambient.ToBytes(mBlock, pos); pos                               += 16;
            Utils.FloatToBytes(wl.eastAngle).CopyTo(mBlock, pos); pos          += 4;
            Utils.FloatToBytes(wl.sunGlowFocus).CopyTo(mBlock, pos); pos       += 4;
            Utils.FloatToBytes(wl.sunGlowSize).CopyTo(mBlock, pos); pos        += 4;
            Utils.FloatToBytes(wl.sceneGamma).CopyTo(mBlock, pos); pos         += 4;
            Utils.FloatToBytes(wl.starBrightness).CopyTo(mBlock, pos); pos     += 4;
            wl.cloudColor.ToBytes(mBlock, pos); pos                            += 16;
            wl.cloudXYDensity.ToBytes(mBlock, pos); pos                        += 12;
            Utils.FloatToBytes(wl.cloudCoverage).CopyTo(mBlock, pos); pos      += 4;
            Utils.FloatToBytes(wl.cloudScale).CopyTo(mBlock, pos); pos         += 4;
            wl.cloudDetailXYDensity.ToBytes(mBlock, pos); pos                  += 12;
            Utils.FloatToBytes(wl.cloudScrollX).CopyTo(mBlock, pos); pos       += 4;
            Utils.FloatToBytes(wl.cloudScrollY).CopyTo(mBlock, pos); pos       += 4;
            Utils.UInt16ToBytes(wl.maxAltitude).CopyTo(mBlock, pos); pos       += 2;
            mBlock[pos] = Convert.ToByte(wl.cloudScrollXLock); pos++;
            mBlock[pos] = Convert.ToByte(wl.cloudScrollYLock); pos++;
            mBlock[pos] = Convert.ToByte(wl.drawClassicClouds); pos++;

            List <byte[]> param = new List <byte[]>();

            param.Add(mBlock);
            return(param);
        }
        public void RegionLightShareDataCloneSaveTest01()
        {
            RegionLightShareData rlsd = new RegionLightShareData();

            rlsd.OnSave += RegionLightShareDataSaveFired;
            rlsd.Save();
            rlsd.OnSave -= RegionLightShareDataSaveFired;
            Assert.IsTrue(m_RegionLightShareDataOnSaveEventFired, "OnSave Event Never Fired");

            object o = rlsd.Clone();
            RegionLightShareData dupe = (RegionLightShareData)o;

            Assert.IsTrue(rlsd.sceneGamma == dupe.sceneGamma, "Memberwise Clone of RegionLightShareData failed");
        }
        public void FromLightShare(RegionLightShareData ls)
        {
            if (!Enabled)
            {
                return;
            }

            ViewerEnvironment VEnv = new ViewerEnvironment();

            VEnv.FromLightShare(ls);

            StoreOnRegion(VEnv);
            WindlightRefresh(0);
        }
        private void CreateWater(WarpRenderer renderer)
        {
            float waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;

            renderer.AddPlane("Water", m_scene.RegionInfo.RegionSizeX * 0.5f);
            renderer.Scene.sceneobject("Water").setPos((m_scene.RegionInfo.RegionSizeX / 2) - 0.5f, waterHeight,
                                                       (m_scene.RegionInfo.RegionSizeY / 2) - 0.5f);

            RegionLightShareData rls = m_scene.RequestModuleInterface <IWindLightSettingsModule>().FindRegionWindLight();

            warp_Material waterColormaterial;

            if (rls != null)
            {
                waterColormaterial =
                    new warp_Material(
                        ConvertColor(new Color4(rls.waterColor.X / 256, rls.waterColor.Y / 256, rls.waterColor.Z / 256,
                                                WATER_COLOR.A)));
            }
            else
            {
                waterColormaterial = new warp_Material(ConvertColor(WATER_COLOR));
            }

            waterColormaterial.setTransparency((byte)((1f - WATER_COLOR.A) * 255f) * 2);
            waterColormaterial.setReflectivity(50);
            renderer.Scene.addMaterial("WaterColor", waterColormaterial);
            renderer.SetObjectMaterial("Water", "WaterColor");

            /*
             * AssetBase textureAsset = m_scene.AssetService.Get(rls.normalMapTexture.ToString());
             * if (textureAsset != null)
             * {
             *  IJ2KDecoder decoder = m_scene.RequestModuleInterface<IJ2KDecoder> ();
             *  Bitmap bitmap = (Bitmap)decoder.DecodeToImage (textureAsset.Data);
             *  if (bitmap != null)
             *  {
             *      textureAsset = null;
             *      warp_Texture texture = new warp_Texture (bitmap);
             *      warp_Material waterTextmaterial = new warp_Material (texture);
             *      waterTextmaterial.setTransparency ((byte)((1f - WATER_COLOR.A) * 255f) * 4);
             *      waterTextmaterial.setReflectivity (0);
             *      renderer.AddPlane ("Water2", m_scene.RegionInfo.RegionSizeX * 0.5f);
             *      renderer.Scene.sceneobject ("Water2").setPos ((m_scene.RegionInfo.RegionSizeX / 2) - 0.5f, waterHeight, (m_scene.RegionInfo.RegionSizeY / 2) - 0.5f);
             *      renderer.Scene.addMaterial ("WaterColor2", waterTextmaterial);
             *      renderer.SetObjectMaterial ("Water2", "WaterColor2");
             *  }
             * }*/
        }
Exemple #15
0
        public Dictionary <float, RegionLightShareData> LoadRegionWindlightSettings(UUID regionUUID)
        {
            Dictionary <float, RegionLightShareData> RetVal = new Dictionary <float, RegionLightShareData>();
            RegionLightShareData        RWLD  = new RegionLightShareData();
            List <RegionLightShareData> RWLDs = GenericUtils.GetGenerics <RegionLightShareData>(regionUUID, "RegionWindLightData", GD);

            foreach (RegionLightShareData lsd in RWLDs)
            {
                if (!RetVal.ContainsKey(lsd.minEffectiveAltitude))
                {
                    RetVal.Add(lsd.minEffectiveAltitude, lsd);
                }
            }
            return(RetVal);
        }
Exemple #16
0
 public bool checkAltitude(RegionLightShareData lsd, RegionLightShareData regionLSD, out string message)
 {
     message = "";
     if (lsd.minEffectiveAltitude == regionLSD.minEffectiveAltitude &&
         lsd.maxEffectiveAltitude == regionLSD.maxEffectiveAltitude)
     {
         //Updating, break
         return(false);
     }
     //Ex lsd.min = 0, regionLSD.min = 100
     if (lsd.minEffectiveAltitude < regionLSD.minEffectiveAltitude)
     {
         //new one is below somewhere
         //Ex lsd.max = 100, regionLSD.min = 101
         //Ex lsd.max = 100, regionLSD.min = 200
         if (lsd.maxEffectiveAltitude <= regionLSD.minEffectiveAltitude)
         {
             return(false);
         }
         else
         {
             //Ex lsd.max = 100, regionLSD.min = 99 ERROR
             message = "Altitudes collide. Set maximum height lower than " + regionLSD.minEffectiveAltitude + ".";
             return(true);
         }
     }// Ex. lsd.min = 200, regionLSD.min = 100
     else if (lsd.minEffectiveAltitude > regionLSD.minEffectiveAltitude)
     {
         //Check against max
         // Ex. lsd.min = 200, regionLSD.max = 200
         if (lsd.minEffectiveAltitude >= regionLSD.maxEffectiveAltitude)
         {
             return(false);
         }
         else
         {
             //Ex lsd.min = 200, regionLSD.max = 201 ERROR
             message = "Altitudes collide. Set min height higher than " + regionLSD.maxEffectiveAltitude + ".";
             return(true);
         }
     }
     else
     {
         //Equal min val, fail
         message = "Altitudes collide. There is another setting that already uses this minimum.";
         return(true);
     }
 }
 public void SendProfileToClient(IClientAPI client, RegionLightShareData wl)
 {
     if (m_enableWindlight)
     {
         if (m_scene.RegionInfo.WindlightSettings.valid)
         {
             List <byte[]> param = compileWindlightSettings(wl);
             client.SendGenericMessage("Windlight", UUID.Random(), param);
         }
         else
         {
             List <byte[]> param = new List <byte[]>();
             client.SendGenericMessage("WindlightReset", UUID.Random(), param);
         }
     }
 }
Exemple #18
0
 private void HandleReset(Object[] args)
 {
     if (!m_enableWindlight)
     {
         m_log.InfoFormat("[WINDLIGHT]: Cannot reset windlight profile, module disabled. Use 'windlight enable' first.");
     }
     else
     {
         m_log.InfoFormat("[WINDLIGHT]: Resetting Windlight profile in database");
         RegionLightShareData rlsd = new RegionLightShareData();
         rlsd.valid    = true;
         rlsd.regionID = m_scene.RegionInfo.RegionID;
         m_scene.StoreWindlightProfile(rlsd);
         m_log.InfoFormat("[WINDLIGHT]: Reset complete");
     }
 }
 public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl)
 {
     IClientAPI client = presence.ControllingClient;
     if (m_enableWindlight)
     {
         if (presence.IsChildAgent == false)
         {
             List<byte[]> param = compileWindlightSettings(wl);
             client.SendGenericMessage("Windlight", param);
         }
     }
     else
     {
         //We probably don't want to spam chat with this.. probably
         //m_log.Debug("[WINDLIGHT]: Module disabled");
     }
 }
Exemple #20
0
        public void SaveWindLightSettings(float MinEffectiveHeight, RegionLightShareData wl)
        {
            UUID oldUUID = UUID.Random();

            if (m_WindlightSettings.ContainsKey(wl.minEffectiveAltitude))
            {
                oldUUID = m_WindlightSettings[wl.minEffectiveAltitude].UUID;
            }

            m_WindlightSettings[wl.minEffectiveAltitude] = wl;
            wl.UUID = oldUUID;
            IRegionInfoConnector RegionInfoConnector = Aurora.DataManager.DataManager.RequestPlugin <IRegionInfoConnector>();

            if (RegionInfoConnector != null)
            {
                RegionInfoConnector.StoreRegionWindlightSettings(wl.regionID, oldUUID, wl);
            }
            m_scene.ForEachScenePresence(SendProfileToClient);
        }
Exemple #21
0
 public void SendProfileToClient(IScenePresence presence, RegionLightShareData wl)
 {
     if (m_enableWindlight)
     {
         if (!presence.IsChildAgent)
         {
             //Check the cache so that we don't kill the client with updates as this can lag the client
             if (m_preivouslySentWindLight.ContainsKey(presence.UUID))
             {
                 if (m_preivouslySentWindLight[presence.UUID] == wl.UUID)
                 {
                     return;
                 }
             }
             //Update the cache
             m_preivouslySentWindLight[presence.UUID] = wl.UUID;
             SendProfileToClientEQ(presence, wl);
         }
     }
 }
 public void LoadModuleFromArchive(byte[] data, string filePath, TarArchiveReader.TarEntryType type, IScene scene)
 {
     if (filePath.StartsWith("windlight/"))
     {
         OSDMap map = (OSDMap)OSDParser.DeserializeLLSDBinary(data);
         RegionLightShareData lsd = new RegionLightShareData();
         lsd.FromOSD(map);
         SaveWindLightSettings(lsd.minEffectiveAltitude, lsd);
     }
 }
Exemple #23
0
        private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
        {
            RegionLightShareData wl = m_environment.ToLightShare();

            int idx = 0;

            while (idx < rules.Length)
            {
                uint rule;

                try
                {
                    rule = (uint)rules.GetLSLIntegerItem(idx);
                }
                catch (InvalidCastException)
                {
                    throw new InvalidCastException(string.Format("Error running rule type: arg #{0} - parameter type must be integer", idx));
                }

                LSL_Types.Quaternion iQ;
                LSL_Types.Vector3    iV;
                switch (rule)
                {
                case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
                    idx++;
                    try
                    {
                        wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_SUN_MOON_POSITION: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_AMBIENT:
                    idx++;
                    try
                    {
                        iQ = rules.GetVector4Item(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_AMBIENT: arg #{0} - parameter 1 must be rotation", idx));
                    }
                    wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
                    break;

                case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
                    idx++;
                    try
                    {
                        iV = rules.GetVector3Item(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_BIG_WAVE_DIRECTION: arg #{0} - parameter 1 must be vector", idx));
                    }
                    wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
                    break;

                case (int)ScriptBaseClass.WL_BLUE_DENSITY:
                    idx++;
                    try
                    {
                        iQ = rules.GetVector4Item(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_BLUE_DENSITY: arg #{0} - parameter 1 must be rotation", idx));
                    }
                    wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
                    break;

                case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
                    idx++;
                    try
                    {
                        wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_BLUR_MULTIPLIER: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_COLOR:
                    idx++;
                    try
                    {
                        iQ = rules.GetVector4Item(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_COLOR: arg #{0} - parameter 1 must be rotation", idx));
                    }
                    wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
                    idx++;
                    try
                    {
                        wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_COVERAGE: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
                    idx++;
                    try
                    {
                        iV = rules.GetVector3Item(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_DETAIL_XY_DENSITY: arg #{0} - parameter 1 must be vector", idx));
                    }
                    wl.cloudDetailXYDensity = iV;
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCALE:
                    idx++;
                    try
                    {
                        wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_SCALE: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
                    idx++;
                    try
                    {
                        wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_SCROLL_X: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
                    idx++;
                    try
                    {
                        wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_SCROLL_Y_LOCK: arg #{0} - parameter 1 must be integer", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
                    idx++;
                    try
                    {
                        wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_SCROLL_Y: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
                    idx++;
                    try
                    {
                        wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_SCROLL_Y_LOCK: arg #{0} - parameter 1 must be integer", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
                    idx++;
                    try
                    {
                        iV = rules.GetVector3Item(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_CLOUD_XY_DENSITY: arg #{0} - parameter 1 must be vector", idx));
                    }
                    wl.cloudXYDensity = iV;
                    break;

                case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
                    idx++;
                    try
                    {
                        wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_DENSITY_MULTIPLIER: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
                    idx++;
                    try
                    {
                        wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_DISTANCE_MULTIPLIER: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
                    idx++;
                    try
                    {
                        wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_DRAW_CLASSIC_CLOUDS: arg #{0} - parameter 1 must be integer", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_EAST_ANGLE:
                    idx++;
                    try
                    {
                        wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_EAST_ANGLE: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
                    idx++;
                    try
                    {
                        wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_FRESNEL_OFFSET: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
                    idx++;
                    try
                    {
                        wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_FRESNEL_SCALE: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_HAZE_DENSITY:
                    idx++;
                    try
                    {
                        wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_HAZE_DENSITY: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_HAZE_HORIZON:
                    idx++;
                    try
                    {
                        wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_HAZE_HORIZON: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_HORIZON:
                    idx++;
                    try
                    {
                        iQ = rules.GetVector4Item(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_HORIZON: arg #{0} - parameter 1 must be rotation", idx));
                    }
                    wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
                    break;

                case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
                    idx++;
                    try
                    {
                        iV = rules.GetVector3Item(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_LITTLE_WAVE_DIRECTION: arg #{0} - parameter 1 must be vector", idx));
                    }
                    wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
                    break;

                case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
                    idx++;
                    try
                    {
                        wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_MAX_ALTITUDE: arg #{0} - parameter 1 must be integer", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
                    idx++;
                    try
                    {
                        wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
                    }
                    catch (ArgumentException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_NORMAL_MAP_TEXTURE: arg #{0} - parameter 1 must be key", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
                    idx++;
                    try
                    {
                        iV = rules.GetVector3Item(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_REFLECTION_WAVELET_SCALE: arg #{0} - parameter 1 must be vector", idx));
                    }
                    wl.reflectionWaveletScale = iV;
                    break;

                case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
                    idx++;
                    try
                    {
                        wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_REFRACT_SCALE_ABOVE: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
                    idx++;
                    try
                    {
                        wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_REFRACT_SCALE_BELOW: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_SCENE_GAMMA:
                    idx++;
                    try
                    {
                        wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_SCENE_GAMMA: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
                    idx++;
                    try
                    {
                        wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_STAR_BRIGHTNESS: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
                    idx++;
                    try
                    {
                        wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_SUN_GLOW_FOCUS: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
                    idx++;
                    try
                    {
                        wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_SUN_GLOW_SIZE: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
                    idx++;
                    iQ = rules.GetVector4Item(idx);
                    try
                    {
                        wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_SUN_MOON_COLOR: arg #{0} - parameter 1 must be rotation", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
                    idx++;
                    try
                    {
                        wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_UNDERWATER_FOG_MODIFIER: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;

                case (int)ScriptBaseClass.WL_WATER_COLOR:
                    idx++;
                    try
                    {
                        iV = rules.GetVector3Item(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_WATER_COLOR: arg #{0} - parameter 1 must be vector", idx));
                    }
                    wl.waterColor = iV;
                    break;

                case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
                    idx++;
                    try
                    {
                        wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
                    }
                    catch (InvalidCastException)
                    {
                        throw new InvalidCastException(string.Format("Error running rule WL_WATER_FOG_DENSITY_EXPONENT: arg #{0} - parameter 1 must be float", idx));
                    }
                    break;
                }
                idx++;
            }
            return(wl);
        }
Exemple #24
0
 public void StoreRegionWindlightSettings(UUID RegionID, UUID ID, RegionLightShareData map)
 {
     GenericUtils.AddGeneric(RegionID, "RegionWindLightData", ID.ToString(), map.ToOSD(), GD);
 }
 //Find the correct WL settings to send to the client
 public void SendProfileToClient(ScenePresence presence)
 {
     if (presence == null)
         return;
     ILandObject land = presence.Scene.LandChannel.GetLandObject(presence.currentLocalParcelID);
     OSDMap map = land != null ? land.LandData.GenericDataMap : new OSDMap();
     if (map.ContainsKey("WindLight"))
     {
         IOpenRegionSettingsModule ORSM = presence.Scene.RequestModuleInterface<IOpenRegionSettingsModule>();
         if (ORSM != null && ORSM.AllowParcelWindLight)
         {
             if (CheckOverRideParcels(presence))
             {
                 //Overrides all
                 SendProfileToClient(presence, FindRegionWindLight(presence));
             }
             else
             {
                 OSDMap innerMap = (OSDMap)map["WindLight"];
                 foreach (KeyValuePair<string, OSD> kvp in innerMap)
                 {
                     int minEffectiveAltitude = int.Parse(kvp.Key);
                     if (presence.AbsolutePosition.Z > minEffectiveAltitude)
                     {
                         OSDMap lsdMap = (OSDMap)kvp.Value;
                         RegionLightShareData parcelLSD = new RegionLightShareData();
                         parcelLSD.FromOSD(lsdMap);
                         if (presence.AbsolutePosition.Z < parcelLSD.maxEffectiveAltitude)
                         {
                             //They are between both altitudes
                             SendProfileToClient(presence, parcelLSD);
                             return; //End it
                         }
                     }
                 }
                 //Send region since no parcel claimed the user
                 SendProfileToClient(presence, FindRegionWindLight(presence));
             }
         }
         else
         {
             //Only region allowed 
             SendProfileToClient(presence, FindRegionWindLight(presence));
         }
     }
     else
     {
         //Send the region by default to override any previous settings
         SendProfileToClient(presence, FindRegionWindLight(presence));
     }
 }
        private Hashtable DispatchWindLightSettings(Hashtable m_dhttpMethod, UUID capuuid, UUID agentID)
        {
            Hashtable responsedata = new Hashtable();
            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"] = "text/plain";
            responsedata["keepalive"] = false;
            responsedata["str_response_string"] = "";

            ScenePresence SP = m_scene.GetScenePresence(agentID);
            if(SP == null)
                return responsedata; //They don't exist

            m_log.Info("[WindLightSettings]: Got a request to update WindLight from " + SP.Name);

            OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml((string)m_dhttpMethod["requestbody"]);

            RegionLightShareData lsd = new RegionLightShareData();
            lsd.FromOSD(rm);
            lsd.regionID = SP.Scene.RegionInfo.RegionID;
            bool remove = false;
            if (rm.ContainsKey("remove"))
                remove = rm["remove"].AsBoolean();

            if (remove)
            {
                if (lsd.type == 0) //Region
                {
                    if (!SP.Scene.Permissions.CanIssueEstateCommand(SP.UUID, false))
                        return responsedata; // No permissions
                    bool found = false;
                    foreach (RegionLightShareData regionLSD in m_WindlightSettings.Values)
                    {
                        if (lsd.minEffectiveAltitude == regionLSD.minEffectiveAltitude &&
                            lsd.maxEffectiveAltitude == regionLSD.maxEffectiveAltitude)
                        {
                            //it exists
                            found = true;
                            break;
                        }
                    }

                    //Set to default
                    if(found)
                        SaveWindLightSettings(lsd.minEffectiveAltitude, new RegionLightShareData());
                }
                else if (lsd.type == 1) //Parcel
                {
                    ILandObject land = SP.Scene.LandChannel.GetLandObject((int)SP.AbsolutePosition.X, (int)SP.AbsolutePosition.Y);
                    if (!SP.Scene.Permissions.GenericParcelPermission(SP.UUID, land, (ulong)GroupPowers.LandOptions))
                        return responsedata; // No permissions
                    IOpenRegionSettingsModule ORSM = SP.Scene.RequestModuleInterface<IOpenRegionSettingsModule>();
                    if (ORSM == null || !ORSM.AllowParcelWindLight)
                    {
                        SP.ControllingClient.SendAlertMessage("Parcel WindLight is disabled in this region.");
                        return responsedata;
                    }

                    OSDMap map = land.LandData.GenericDataMap;

                    OSDMap innerMap = new OSDMap();
                    if (land.LandData.GenericDataMap.ContainsKey("WindLight"))
                        innerMap = (OSDMap)map["WindLight"];

                    if (innerMap.ContainsKey(lsd.minEffectiveAltitude.ToString()))
                    {
                        innerMap.Remove(lsd.minEffectiveAltitude.ToString());
                    }

                    land.LandData.AddGenericData("WindLight", innerMap);
                    //Update the client
                    SendProfileToClient(SP);
                }
            }
            else
            {
                if (lsd.type == 0) //Region
                {
                    if (!SP.Scene.Permissions.CanIssueEstateCommand(SP.UUID, false))
                        return responsedata; // No permissions

                    foreach (RegionLightShareData regionLSD in m_WindlightSettings.Values)
                    {
                        string message = "";
                        if (checkAltitude(lsd, regionLSD, out message))
                        {
                            SP.ControllingClient.SendAlertMessage(message);
                            return responsedata;
                        }
                    }
                    SaveWindLightSettings(lsd.minEffectiveAltitude, lsd);
                }
                else if (lsd.type == 1) //Parcel
                {
                    ILandObject land = SP.Scene.LandChannel.GetLandObject((int)SP.AbsolutePosition.X, (int)SP.AbsolutePosition.Y);
                    if (!SP.Scene.Permissions.GenericParcelPermission(SP.UUID, land, (ulong)GroupPowers.LandOptions))
                        return responsedata; // No permissions
                    IOpenRegionSettingsModule ORSM = SP.Scene.RequestModuleInterface<IOpenRegionSettingsModule>();
                    if (ORSM == null || !ORSM.AllowParcelWindLight)
                    {
                        SP.ControllingClient.SendAlertMessage("Parcel WindLight is disabled in this region.");
                        return responsedata;
                    }

                    OSDMap map = land.LandData.GenericDataMap;

                    OSDMap innerMap = new OSDMap();
                    if (land.LandData.GenericDataMap.ContainsKey("WindLight"))
                        innerMap = (OSDMap)map["WindLight"];

                    string removeThisMap = "";

                    foreach (KeyValuePair<string, OSD> kvp in innerMap)
                    {
                        OSDMap lsdMap = (OSDMap)kvp.Value;
                        RegionLightShareData parcelLSD = new RegionLightShareData();
                        parcelLSD.FromOSD(lsdMap);

                        string message = "";
                        if (checkAltitude(lsd, parcelLSD, out message))
                        {
                            SP.ControllingClient.SendAlertMessage(message);
                            return responsedata;
                        }
                    }

                    if (removeThisMap != "")
                        innerMap.Remove(removeThisMap);

                    innerMap[lsd.minEffectiveAltitude.ToString()] = lsd.ToOSD();

                    land.LandData.AddGenericData("WindLight", innerMap);
                    //Update the client
                    SendProfileToClient(SP, lsd);
                }
            }
            SP.ControllingClient.SendAlertMessage("WindLight Settings updated.");
            return responsedata;
        }
 public Dictionary<float, RegionLightShareData> LoadRegionWindlightSettings(UUID regionUUID)
 {
     Dictionary<float, RegionLightShareData> RetVal = new Dictionary<float, RegionLightShareData>();
     List<RegionLightShareData> RWLDs = new List<RegionLightShareData>();
     RegionLightShareData RWLD = new RegionLightShareData();
     RWLDs = GenericUtils.GetGenerics<RegionLightShareData>(regionUUID, "RegionWindLightData", GD, RWLD);
     foreach (RegionLightShareData lsd in RWLDs)
     {
         if(!RetVal.ContainsKey(lsd.minEffectiveAltitude))
             RetVal.Add(lsd.minEffectiveAltitude, lsd);
     }
     return RetVal;
 }
 public void SendWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID)
 {
     ScenePresence Sc;
     if (m_scene.TryGetScenePresence(pUUID, out Sc))
     {
         SendProfileToClient(Sc, wl);
     }
 }
Exemple #29
0
        /// <summary>
        /// Get the current Windlight scene
        /// </summary>
        /// <returns>List of windlight parameters</returns>
        public LSL_List lsGetWindlightScene(LSL_List rules)
        {
            if (!m_LSFunctionsEnabled)
            {
                LSShoutError("LightShare functions are not enabled.");
                return(new LSL_List());
            }
            m_host.AddScriptLPS(1);
            RegionLightShareData wl = m_host.ParentGroup.Scene.RegionInfo.WindlightSettings;

            LSL_List values = new LSL_List();
            int      idx    = 0;

            while (idx < rules.Length)
            {
                uint     rule  = (uint)rules.GetLSLIntegerItem(idx);
                LSL_List toadd = new LSL_List();

                switch (rule)
                {
                case (int)ScriptBaseClass.WL_AMBIENT:
                    toadd.Add(new LSL_Rotation(wl.ambient.X, wl.ambient.Y, wl.ambient.Z, wl.ambient.W));
                    break;

                case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
                    toadd.Add(new LSL_Vector(wl.bigWaveDirection.X, wl.bigWaveDirection.Y, 0.0f));
                    break;

                case (int)ScriptBaseClass.WL_BLUE_DENSITY:
                    toadd.Add(new LSL_Rotation(wl.blueDensity.X, wl.blueDensity.Y, wl.blueDensity.Z, wl.blueDensity.W));
                    break;

                case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
                    toadd.Add(new LSL_Float(wl.blurMultiplier));
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_COLOR:
                    toadd.Add(new LSL_Rotation(wl.cloudColor.X, wl.cloudColor.Y, wl.cloudColor.Z, wl.cloudColor.W));
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
                    toadd.Add(new LSL_Float(wl.cloudCoverage));
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
                    toadd.Add(new LSL_Vector(wl.cloudDetailXYDensity.X, wl.cloudDetailXYDensity.Y, wl.cloudDetailXYDensity.Z));
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCALE:
                    toadd.Add(new LSL_Float(wl.cloudScale));
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
                    toadd.Add(new LSL_Float(wl.cloudScrollX));
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
                    toadd.Add(new LSL_Integer(wl.cloudScrollXLock ? 1 : 0));
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
                    toadd.Add(new LSL_Float(wl.cloudScrollY));
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
                    toadd.Add(new LSL_Integer(wl.cloudScrollYLock ? 1 : 0));
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
                    toadd.Add(new LSL_Vector(wl.cloudXYDensity.X, wl.cloudXYDensity.Y, wl.cloudXYDensity.Z));
                    break;

                case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
                    toadd.Add(new LSL_Float(wl.densityMultiplier));
                    break;

                case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
                    toadd.Add(new LSL_Float(wl.distanceMultiplier));
                    break;

                case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
                    toadd.Add(new LSL_Integer(wl.drawClassicClouds ? 1 : 0));
                    break;

                case (int)ScriptBaseClass.WL_EAST_ANGLE:
                    toadd.Add(new LSL_Float(wl.eastAngle));
                    break;

                case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
                    toadd.Add(new LSL_Float(wl.fresnelOffset));
                    break;

                case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
                    toadd.Add(new LSL_Float(wl.fresnelScale));
                    break;

                case (int)ScriptBaseClass.WL_HAZE_DENSITY:
                    toadd.Add(new LSL_Float(wl.hazeDensity));
                    break;

                case (int)ScriptBaseClass.WL_HAZE_HORIZON:
                    toadd.Add(new LSL_Float(wl.hazeHorizon));
                    break;

                case (int)ScriptBaseClass.WL_HORIZON:
                    toadd.Add(new LSL_Rotation(wl.horizon.X, wl.horizon.Y, wl.horizon.Z, wl.horizon.W));
                    break;

                case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
                    toadd.Add(new LSL_Vector(wl.littleWaveDirection.X, wl.littleWaveDirection.Y, 0.0f));
                    break;

                case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
                    toadd.Add(new LSL_Integer(wl.maxAltitude));
                    break;

                case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
                    toadd.Add(new LSL_Key(wl.normalMapTexture.ToString()));
                    break;

                case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
                    toadd.Add(new LSL_Vector(wl.reflectionWaveletScale.X, wl.reflectionWaveletScale.Y, wl.reflectionWaveletScale.Z));
                    break;

                case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
                    toadd.Add(new LSL_Float(wl.refractScaleAbove));
                    break;

                case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
                    toadd.Add(new LSL_Float(wl.refractScaleBelow));
                    break;

                case (int)ScriptBaseClass.WL_SCENE_GAMMA:
                    toadd.Add(new LSL_Float(wl.sceneGamma));
                    break;

                case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
                    toadd.Add(new LSL_Float(wl.starBrightness));
                    break;

                case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
                    toadd.Add(new LSL_Float(wl.sunGlowFocus));
                    break;

                case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
                    toadd.Add(new LSL_Float(wl.sunGlowSize));
                    break;

                case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
                    toadd.Add(new LSL_Rotation(wl.sunMoonColor.X, wl.sunMoonColor.Y, wl.sunMoonColor.Z, wl.sunMoonColor.W));
                    break;

                case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
                    toadd.Add(new LSL_Float(wl.underwaterFogModifier));
                    break;

                case (int)ScriptBaseClass.WL_WATER_COLOR:
                    toadd.Add(new LSL_Vector(wl.waterColor.X, wl.waterColor.Y, wl.waterColor.Z));
                    break;

                case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
                    toadd.Add(new LSL_Float(wl.waterFogDensityExponent));
                    break;
                }

                if (toadd.Length > 0)
                {
                    values.Add(rule);
                    values.Add(toadd.Data[0]);
                }
                idx++;
            }


            return(values);
        }
 public void SendProfileToClientEQ(ScenePresence presence, RegionLightShareData wl)
 {
     OSD item = BuildSendEQMessage(wl.ToOSD());
     IEventQueue eq = presence.Scene.RequestModuleInterface<IEventQueue>();
     if (eq != null)
         eq.Enqueue(item, presence.UUID);
 }
        private Hashtable RetrieveWindLightSettings(Hashtable m_dhttpMethod, UUID capuuid, UUID agentID)
        {
            Hashtable responsedata = new Hashtable();
            responsedata["int_response_code"] = 200; //501; //410; //404;
            responsedata["content_type"] = "text/plain";
            responsedata["keepalive"] = false;
            responsedata["str_response_string"] = "";

            ScenePresence SP = m_scene.GetScenePresence(agentID);
            if (SP == null)
                return responsedata; //They don't exist

            OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml((string)m_dhttpMethod["requestbody"]);
            OSDMap retVal = new OSDMap();
            if (rm.ContainsKey("RegionID"))
            {
                //For the region, just add all of them
                OSDArray array = new OSDArray();
                foreach (RegionLightShareData rlsd in m_WindlightSettings.Values)
                {
                    OSDMap m = rlsd.ToOSD();
                    m.Add("Name", OSD.FromString("(Region Settings), Min: " + rlsd.minEffectiveAltitude + ", Max: " + rlsd.maxEffectiveAltitude));
                    array.Add(m);
                }
                retVal.Add("WindLight", array);
                retVal.Add("Type", OSD.FromInteger(1));
            }
            else if (rm.ContainsKey("ParcelID"))
            {
                OSDArray retVals = new OSDArray();
                //-1 is all parcels
                if (rm["ParcelID"].AsInteger() == -1)
                {
                    //All parcels
                    foreach(ILandObject land in SP.Scene.LandChannel.AllParcels())
                    {
                        OSDMap map = land.LandData.GenericDataMap;
                        if (map.ContainsKey("WindLight"))
                        {
                            OSDMap parcelWindLight = (OSDMap)map["WindLight"];
                            foreach (OSD innerMap in parcelWindLight.Values)
                            {
                                RegionLightShareData rlsd = new RegionLightShareData();
                                rlsd.FromOSD((OSDMap)innerMap);
                                OSDMap imap = new OSDMap();
                                imap = rlsd.ToOSD();
                                imap.Add("Name", OSD.FromString(land.LandData.Name + ", Min: " + rlsd.minEffectiveAltitude + ", Max: " + rlsd.maxEffectiveAltitude));
                                retVals.Add(imap);
                            }
                        }
                    }
                }
                else
                {
                    //Only the given parcel parcel given by localID
                    ILandObject land = SP.Scene.LandChannel.GetLandObject(rm["ParcelID"].AsInteger());
                    OSDMap map = land.LandData.GenericDataMap;
                    if (map.ContainsKey("WindLight"))
                    {
                        OSDMap parcelWindLight = (OSDMap)map["WindLight"];
                        foreach (OSD innerMap in parcelWindLight.Values)
                        {
                            RegionLightShareData rlsd = new RegionLightShareData();
                            rlsd.FromOSD((OSDMap)innerMap);
                            OSDMap imap = new OSDMap();
                            imap = rlsd.ToOSD();
                            imap.Add("Name", OSD.FromString(land.LandData.Name + ", Min: " + rlsd.minEffectiveAltitude + ", Max: " + rlsd.maxEffectiveAltitude));
                            retVals.Add(imap);
                        }
                    }
                }
                retVal.Add("WindLight", retVals);
                retVal.Add("Type", OSD.FromInteger(2));
            }

            responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(retVal);
            return responsedata;
        }
 public void RegionLightShareDataSaveFired(RegionLightShareData settings)
 {
     m_RegionLightShareDataOnSaveEventFired = true;
 }
Exemple #33
0
        private Hashtable DispatchWindLightSettings(Hashtable m_dhttpMethod, UUID agentID)
        {
            Hashtable responsedata = new Hashtable();

            responsedata["int_response_code"]   = 200; //501; //410; //404;
            responsedata["content_type"]        = "text/plain";
            responsedata["keepalive"]           = false;
            responsedata["str_response_string"] = "";

            IScenePresence SP = m_scene.GetScenePresence(agentID);

            if (SP == null)
            {
                return(responsedata); //They don't exist
            }
            m_log.Info("[WindLightSettings]: Got a request to update WindLight from " + SP.Name);

            OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml((string)m_dhttpMethod["requestbody"]);

            RegionLightShareData lsd = new RegionLightShareData();

            lsd.FromOSD(rm);
            lsd.regionID = SP.Scene.RegionInfo.RegionID;
            bool remove = false;

            if (rm.ContainsKey("remove"))
            {
                remove = rm["remove"].AsBoolean();
            }

            if (remove)
            {
                if (lsd.type == 0) //Region
                {
                    if (!SP.Scene.Permissions.CanIssueEstateCommand(SP.UUID, false))
                    {
                        return(responsedata); // No permissions
                    }
                    bool found = false;
                    foreach (RegionLightShareData regionLSD in m_WindlightSettings.Values)
                    {
                        if (lsd.minEffectiveAltitude == regionLSD.minEffectiveAltitude &&
                            lsd.maxEffectiveAltitude == regionLSD.maxEffectiveAltitude)
                        {
                            //it exists
                            found = true;
                            break;
                        }
                    }

                    //Set to default
                    if (found)
                    {
                        SaveWindLightSettings(lsd.minEffectiveAltitude, new RegionLightShareData());
                    }
                }
                else if (lsd.type == 1) //Parcel
                {
                    IParcelManagementModule parcelManagement = SP.Scene.RequestModuleInterface <IParcelManagementModule>();
                    if (parcelManagement != null)
                    {
                        ILandObject land = parcelManagement.GetLandObject((int)SP.AbsolutePosition.X, (int)SP.AbsolutePosition.Y);
                        if (!SP.Scene.Permissions.GenericParcelPermission(SP.UUID, land, (ulong)GroupPowers.LandOptions))
                        {
                            return(responsedata); // No permissions
                        }
                        IOpenRegionSettingsModule ORSM = SP.Scene.RequestModuleInterface <IOpenRegionSettingsModule>();
                        if (ORSM == null || !ORSM.AllowParcelWindLight)
                        {
                            SP.ControllingClient.SendAlertMessage("Parcel WindLight is disabled in this region.");
                            return(responsedata);
                        }

                        OSDMap map = land.LandData.GenericDataMap;

                        OSDMap innerMap = new OSDMap();
                        if (land.LandData.GenericDataMap.ContainsKey("WindLight"))
                        {
                            innerMap = (OSDMap)map["WindLight"];
                        }

                        if (innerMap.ContainsKey(lsd.minEffectiveAltitude.ToString()))
                        {
                            innerMap.Remove(lsd.minEffectiveAltitude.ToString());
                        }

                        land.LandData.AddGenericData("WindLight", innerMap);
                        //Update the client
                        SendProfileToClient(SP);
                    }
                }
            }
            else
            {
                if (lsd.type == 0) //Region
                {
                    if (!SP.Scene.Permissions.CanIssueEstateCommand(SP.UUID, false))
                    {
                        return(responsedata); // No permissions
                    }
                    foreach (RegionLightShareData regionLSD in m_WindlightSettings.Values)
                    {
                        string message = "";
                        if (checkAltitude(lsd, regionLSD, out message))
                        {
                            SP.ControllingClient.SendAlertMessage(message);
                            return(responsedata);
                        }
                    }
                    SaveWindLightSettings(lsd.minEffectiveAltitude, lsd);
                }
                else if (lsd.type == 1) //Parcel
                {
                    IParcelManagementModule parcelManagement = SP.Scene.RequestModuleInterface <IParcelManagementModule>();
                    if (parcelManagement != null)
                    {
                        ILandObject land = parcelManagement.GetLandObject((int)SP.AbsolutePosition.X, (int)SP.AbsolutePosition.Y);
                        if (!SP.Scene.Permissions.GenericParcelPermission(SP.UUID, land, (ulong)GroupPowers.LandOptions))
                        {
                            return(responsedata); // No permissions
                        }
                        IOpenRegionSettingsModule ORSM = SP.Scene.RequestModuleInterface <IOpenRegionSettingsModule>();
                        if (ORSM == null || !ORSM.AllowParcelWindLight)
                        {
                            SP.ControllingClient.SendAlertMessage("Parcel WindLight is disabled in this region.");
                            return(responsedata);
                        }

                        OSDMap map = land.LandData.GenericDataMap;

                        OSDMap innerMap = new OSDMap();
                        if (land.LandData.GenericDataMap.ContainsKey("WindLight"))
                        {
                            innerMap = (OSDMap)map["WindLight"];
                        }

                        string removeThisMap = "";

                        foreach (KeyValuePair <string, OSD> kvp in innerMap)
                        {
                            OSDMap lsdMap = (OSDMap)kvp.Value;
                            RegionLightShareData parcelLSD = new RegionLightShareData();
                            parcelLSD.FromOSD(lsdMap);

                            string message = "";
                            if (checkAltitude(lsd, parcelLSD, out message))
                            {
                                SP.ControllingClient.SendAlertMessage(message);
                                return(responsedata);
                            }
                        }

                        if (removeThisMap != "")
                        {
                            innerMap.Remove(removeThisMap);
                        }

                        innerMap[lsd.minEffectiveAltitude.ToString()] = lsd.ToOSD();

                        land.LandData.AddGenericData("WindLight", innerMap);
                        //Update the client
                        SendProfileToClient(SP, lsd);
                    }
                }
            }
            SP.ControllingClient.SendAlertMessage("WindLight Settings updated.");
            return(responsedata);
        }
Exemple #34
0
        private Hashtable RetrieveWindLightSettings(Hashtable m_dhttpMethod, UUID agentID)
        {
            Hashtable responsedata = new Hashtable();

            responsedata["int_response_code"]   = 200; //501; //410; //404;
            responsedata["content_type"]        = "text/plain";
            responsedata["keepalive"]           = false;
            responsedata["str_response_string"] = "";

            IScenePresence SP = m_scene.GetScenePresence(agentID);

            if (SP == null)
            {
                return(responsedata); //They don't exist
            }
            IParcelManagementModule parcelManagement = m_scene.RequestModuleInterface <IParcelManagementModule>();

            OSDMap rm     = (OSDMap)OSDParser.DeserializeLLSDXml((string)m_dhttpMethod["requestbody"]);
            OSDMap retVal = new OSDMap();

            if (rm.ContainsKey("RegionID"))
            {
                //For the region, just add all of them
                OSDArray array = new OSDArray();
                foreach (RegionLightShareData rlsd in m_WindlightSettings.Values)
                {
                    OSDMap m = rlsd.ToOSD();
                    m.Add("Name", OSD.FromString("(Region Settings), Min: " + rlsd.minEffectiveAltitude + ", Max: " + rlsd.maxEffectiveAltitude));
                    array.Add(m);
                }
                retVal.Add("WindLight", array);
                retVal.Add("Type", OSD.FromInteger(1));
            }
            else if (rm.ContainsKey("ParcelID"))
            {
                OSDArray retVals = new OSDArray();
                //-1 is all parcels
                if (rm["ParcelID"].AsInteger() == -1)
                {
                    //All parcels
                    if (parcelManagement != null)
                    {
                        foreach (ILandObject land in parcelManagement.AllParcels())
                        {
                            OSDMap map = land.LandData.GenericDataMap;
                            if (map.ContainsKey("WindLight"))
                            {
                                OSDMap parcelWindLight = (OSDMap)map["WindLight"];
                                foreach (OSD innerMap in parcelWindLight.Values)
                                {
                                    RegionLightShareData rlsd = new RegionLightShareData();
                                    rlsd.FromOSD((OSDMap)innerMap);
                                    OSDMap imap = new OSDMap();
                                    imap = rlsd.ToOSD();
                                    imap.Add("Name", OSD.FromString(land.LandData.Name + ", Min: " + rlsd.minEffectiveAltitude + ", Max: " + rlsd.maxEffectiveAltitude));
                                    retVals.Add(imap);
                                }
                            }
                        }
                    }
                }
                else
                {
                    //Only the given parcel parcel given by localID
                    if (parcelManagement != null)
                    {
                        ILandObject land = parcelManagement.GetLandObject(rm["ParcelID"].AsInteger());
                        OSDMap      map  = land.LandData.GenericDataMap;
                        if (map.ContainsKey("WindLight"))
                        {
                            OSDMap parcelWindLight = (OSDMap)map["WindLight"];
                            foreach (OSD innerMap in parcelWindLight.Values)
                            {
                                RegionLightShareData rlsd = new RegionLightShareData();
                                rlsd.FromOSD((OSDMap)innerMap);
                                OSDMap imap = new OSDMap();
                                imap = rlsd.ToOSD();
                                imap.Add("Name", OSD.FromString(land.LandData.Name + ", Min: " + rlsd.minEffectiveAltitude + ", Max: " + rlsd.maxEffectiveAltitude));
                                retVals.Add(imap);
                            }
                        }
                    }
                }
                retVal.Add("WindLight", retVals);
                retVal.Add("Type", OSD.FromInteger(2));
            }

            responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(retVal);
            return(responsedata);
        }
 public bool checkAltitude(RegionLightShareData lsd, RegionLightShareData regionLSD, out string message)
 {
     message = "";
     if (lsd.minEffectiveAltitude == regionLSD.minEffectiveAltitude &&
                     lsd.maxEffectiveAltitude == regionLSD.maxEffectiveAltitude)
     {
         //Updating, break
         return false;
     }
     //Ex lsd.min = 0, regionLSD.min = 100
     if (lsd.minEffectiveAltitude < regionLSD.minEffectiveAltitude)
     {
         //new one is below somewhere
         //Ex lsd.max = 100, regionLSD.min = 101
         //Ex lsd.max = 100, regionLSD.min = 200
         if (lsd.maxEffectiveAltitude <= regionLSD.minEffectiveAltitude)
         {
             return false;
         }
         else
         {
             //Ex lsd.max = 100, regionLSD.min = 99 ERROR
             message = "Altitudes collide. Set maximum height lower than " + regionLSD.minEffectiveAltitude + ".";
             return true;
         }
     }// Ex. lsd.min = 200, regionLSD.min = 100
     else if (lsd.minEffectiveAltitude > regionLSD.minEffectiveAltitude)
     {
         //Check against max
         // Ex. lsd.min = 200, regionLSD.max = 200
         if (lsd.minEffectiveAltitude >= regionLSD.maxEffectiveAltitude)
         {
             return false;
         }
         else
         {
             //Ex lsd.min = 200, regionLSD.max = 201 ERROR
             message = "Altitudes collide. Set min height higher than " + regionLSD.maxEffectiveAltitude + ".";
             return true;
         }
     }
     else
     {
         //Equal min val, fail
         message = "Altitudes collide. There is another setting that already uses this minimum.";
         return true;
     }
 }
Exemple #36
0
 public void StoreRegionWindlightSettings(RegionLightShareData wl)
 {
     //This connector doesn't support the windlight module yet
 }
 public void StoreRegionWindlightSettings(RegionLightShareData wl)
 {
     m_database.StoreRegionWindlightSettings(wl);
 }
Exemple #38
0
 public override IDataTransferable Duplicate()
 {
     RegionLightShareData m = new RegionLightShareData();
     m.FromOSD(ToOSD());
     return m;
 }
Exemple #39
0
        private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
        {
            RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();

            LSL_List values = new LSL_List();
            int      idx    = 0;

            while (idx < rules.Length)
            {
                uint rule = (uint)rules.GetLSLIntegerItem(idx);
                LSL_Types.Quaternion iQ;
                LSL_Types.Vector3    iV;
                switch (rule)
                {
                case (int)ScriptBaseClass.WL_SUN_MOON_POSITION:
                    idx++;
                    wl.sunMoonPosition = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_AMBIENT:
                    idx++;
                    iQ         = rules.GetQuaternionItem(idx);
                    wl.ambient = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
                    break;

                case (int)ScriptBaseClass.WL_BIG_WAVE_DIRECTION:
                    idx++;
                    iV = rules.GetVector3Item(idx);
                    wl.bigWaveDirection = new Vector2((float)iV.x, (float)iV.y);
                    break;

                case (int)ScriptBaseClass.WL_BLUE_DENSITY:
                    idx++;
                    iQ             = rules.GetQuaternionItem(idx);
                    wl.blueDensity = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
                    break;

                case (int)ScriptBaseClass.WL_BLUR_MULTIPLIER:
                    idx++;
                    wl.blurMultiplier = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_COLOR:
                    idx++;
                    iQ            = rules.GetQuaternionItem(idx);
                    wl.cloudColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_COVERAGE:
                    idx++;
                    wl.cloudCoverage = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_DETAIL_XY_DENSITY:
                    idx++;
                    iV = rules.GetVector3Item(idx);
                    wl.cloudDetailXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCALE:
                    idx++;
                    wl.cloudScale = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X:
                    idx++;
                    wl.cloudScrollX = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_X_LOCK:
                    idx++;
                    wl.cloudScrollXLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y:
                    idx++;
                    wl.cloudScrollY = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_SCROLL_Y_LOCK:
                    idx++;
                    wl.cloudScrollYLock = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
                    break;

                case (int)ScriptBaseClass.WL_CLOUD_XY_DENSITY:
                    idx++;
                    iV = rules.GetVector3Item(idx);
                    wl.cloudXYDensity = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
                    break;

                case (int)ScriptBaseClass.WL_DENSITY_MULTIPLIER:
                    idx++;
                    wl.densityMultiplier = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_DISTANCE_MULTIPLIER:
                    idx++;
                    wl.distanceMultiplier = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_DRAW_CLASSIC_CLOUDS:
                    idx++;
                    wl.drawClassicClouds = rules.GetLSLIntegerItem(idx).value == 1 ? true : false;
                    break;

                case (int)ScriptBaseClass.WL_EAST_ANGLE:
                    idx++;
                    wl.eastAngle = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_FRESNEL_OFFSET:
                    idx++;
                    wl.fresnelOffset = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_FRESNEL_SCALE:
                    idx++;
                    wl.fresnelScale = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_HAZE_DENSITY:
                    idx++;
                    wl.hazeDensity = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_HAZE_HORIZON:
                    idx++;
                    wl.hazeHorizon = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_HORIZON:
                    idx++;
                    iQ         = rules.GetQuaternionItem(idx);
                    wl.horizon = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
                    break;

                case (int)ScriptBaseClass.WL_LITTLE_WAVE_DIRECTION:
                    idx++;
                    iV = rules.GetVector3Item(idx);
                    wl.littleWaveDirection = new Vector2((float)iV.x, (float)iV.y);
                    break;

                case (int)ScriptBaseClass.WL_MAX_ALTITUDE:
                    idx++;
                    wl.maxAltitude = (ushort)rules.GetLSLIntegerItem(idx).value;
                    break;

                case (int)ScriptBaseClass.WL_NORMAL_MAP_TEXTURE:
                    idx++;
                    wl.normalMapTexture = new UUID(rules.GetLSLStringItem(idx).m_string);
                    break;

                case (int)ScriptBaseClass.WL_REFLECTION_WAVELET_SCALE:
                    idx++;
                    iV = rules.GetVector3Item(idx);
                    wl.reflectionWaveletScale = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
                    break;

                case (int)ScriptBaseClass.WL_REFRACT_SCALE_ABOVE:
                    idx++;
                    wl.refractScaleAbove = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_REFRACT_SCALE_BELOW:
                    idx++;
                    wl.refractScaleBelow = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_SCENE_GAMMA:
                    idx++;
                    wl.sceneGamma = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_STAR_BRIGHTNESS:
                    idx++;
                    wl.starBrightness = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_SUN_GLOW_FOCUS:
                    idx++;
                    wl.sunGlowFocus = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_SUN_GLOW_SIZE:
                    idx++;
                    wl.sunGlowSize = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_SUN_MOON_COLOR:
                    idx++;
                    iQ = rules.GetQuaternionItem(idx);
                    wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s);
                    break;

                case (int)ScriptBaseClass.WL_UNDERWATER_FOG_MODIFIER:
                    idx++;
                    wl.underwaterFogModifier = (float)rules.GetLSLFloatItem(idx);
                    break;

                case (int)ScriptBaseClass.WL_WATER_COLOR:
                    idx++;
                    iV            = rules.GetVector3Item(idx);
                    wl.waterColor = new Vector3((float)iV.x, (float)iV.y, (float)iV.z);
                    break;

                case (int)ScriptBaseClass.WL_WATER_FOG_DENSITY_EXPONENT:
                    idx++;
                    wl.waterFogDensityExponent = (float)rules.GetLSLFloatItem(idx);
                    break;
                }
                idx++;
            }
            return(wl);
        }
 public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl)
 {
     if (m_enableWindlight)
     {
         if (!presence.IsChildAgent)
         {
             //Check the cache so that we don't kill the client with updates as this can lag the client 
             if (m_preivouslySentWindLight.ContainsKey(presence.UUID))
             {
                 if (m_preivouslySentWindLight[presence.UUID] == wl.UUID)
                     return;
             }
             //Update the cache
             m_preivouslySentWindLight[presence.UUID] = wl.UUID;
             SendProfileToClientEQ(presence, wl);
         }
     }
 }
        public void SaveWindLightSettings(float MinEffectiveHeight, RegionLightShareData wl)
        {
            UUID oldUUID = UUID.Random();
            if(m_WindlightSettings.ContainsKey(wl.minEffectiveAltitude))
                oldUUID = m_WindlightSettings[wl.minEffectiveAltitude].UUID;

            m_WindlightSettings[wl.minEffectiveAltitude] = wl;
            IRegionInfoConnector RegionInfoConnector = Aurora.DataManager.DataManager.RequestPlugin<IRegionInfoConnector>();
            if (RegionInfoConnector != null)
            {
                RegionInfoConnector.StoreRegionWindlightSettings(wl.regionID, oldUUID, wl);
            }
            m_scene.ForEachScenePresence(SendProfileToClient);
        }
 public void StoreRegionWindlightSettings(UUID RegionID, UUID ID, RegionLightShareData map)
 {
     GenericUtils.AddGeneric(RegionID, "RegionWindLightData", ID.ToString(), map.ToOSD(), GD);
 }