Пример #1
0
        bool ISimulationDataLightShareStorageInterface.TryGetValue(UUID regionID, out EnvController.WindlightSkyData skyData, out EnvController.WindlightWaterData waterData)
        {
            using (var conn = new MySqlConnection(m_ConnectionString))
            {
                conn.Open();
                using (var cmd = new MySqlCommand("SELECT * FROM lightshare WHERE RegionID = @regionid LIMIT 1", conn))
                {
                    cmd.Parameters.AddWithValue("@regionid", regionID.ToString());
                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        if (!reader.Read())
                        {
                            skyData   = EnvController.WindlightSkyData.Defaults;
                            waterData = EnvController.WindlightWaterData.Defaults;
                            return(false);
                        }

                        skyData = new EnvController.WindlightSkyData
                        {
                            Ambient              = reader.GetWLVector4("Ambient"),
                            CloudColor           = reader.GetWLVector4("CloudColor"),
                            CloudCoverage        = reader.GetDouble("CloudCoverage"),
                            BlueDensity          = reader.GetWLVector4("BlueDensity"),
                            CloudDetailXYDensity = reader.GetVector3("CloudDetailXYDensity"),
                            CloudScale           = reader.GetDouble("CloudScale"),
                            CloudScroll          = reader.GetWLVector2("CloudScroll"),
                            CloudScrollXLock     = reader.GetBool("CloudScrollXLock"),
                            CloudScrollYLock     = reader.GetBool("CloudScrollYLock"),
                            CloudXYDensity       = reader.GetVector3("CloudXYDensity"),
                            DensityMultiplier    = reader.GetDouble("DensityMultiplier"),
                            DistanceMultiplier   = reader.GetDouble("DistanceMultiplier"),
                            DrawClassicClouds    = reader.GetBool("DrawClassicClouds"),
                            EastAngle            = reader.GetDouble("EastAngle"),
                            HazeDensity          = reader.GetDouble("HazeDensity"),
                            HazeHorizon          = reader.GetDouble("HazeHorizon"),
                            Horizon              = reader.GetWLVector4("Horizon"),
                            MaxAltitude          = reader.GetInt32("MaxAltitude"),
                            SceneGamma           = reader.GetDouble("SceneGamma"),
                            SunGlowFocus         = reader.GetDouble("SunGlowFocus"),
                            SunGlowSize          = reader.GetDouble("SunGlowSize"),
                            SunMoonColor         = reader.GetWLVector4("SunMoonColor"),
                            SunMoonPosition      = reader.GetDouble("SunMoonPosition")
                        };
                        waterData = new EnvController.WindlightWaterData
                        {
                            BigWaveDirection       = reader.GetWLVector2("BigWaveDirection"),
                            LittleWaveDirection    = reader.GetWLVector2("LittleWaveDirection"),
                            BlurMultiplier         = reader.GetDouble("BlurMultiplier"),
                            FresnelScale           = reader.GetDouble("FresnelScale"),
                            FresnelOffset          = reader.GetDouble("FresnelOffset"),
                            NormalMapTexture       = reader.GetUUID("NormalMapTexture"),
                            ReflectionWaveletScale = reader.GetVector3("ReflectionWaveletScale"),
                            RefractScaleAbove      = reader.GetDouble("RefractScaleAbove"),
                            RefractScaleBelow      = reader.GetDouble("RefractScaleBelow"),
                            UnderwaterFogModifier  = reader.GetDouble("UnderwaterFogModifier"),
                            Color = reader.GetColor("WaterColor"),
                            FogDensityExponent = reader.GetDouble("FogDensityExponent")
                        };
                        return(true);
                    }
                }
            }
        }