aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLLegacyRegionData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs192
1 files changed, 192 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index a06eec3..f4485df 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -711,6 +711,97 @@ namespace OpenSim.Data.MySQL
711 } 711 }
712 } 712 }
713 713
714 public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
715 {
716 RegionMeta7WindlightData nWP = new RegionMeta7WindlightData();
717 nWP.OnSave += StoreRegionWindlightSettings;
718 lock (m_Connection)
719 {
720
721 string command = "select * from `regionwindlight` where region_id = ?regionID";
722
723 MySqlCommand cmd = new MySqlCommand(command);
724
725 cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
726
727 IDataReader result = ExecuteReader(cmd);
728 if (!result.Read())
729 {
730 //No result, so store our default windlight profile and return it
731 nWP.regionID = regionUUID;
732 StoreRegionWindlightSettings(nWP);
733 return nWP;
734 }
735 else
736 {
737 UUID.TryParse(result["region_id"].ToString(), out nWP.regionID);
738 nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
739 nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
740 nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
741 nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
742 nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
743 nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
744 nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
745 nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
746 nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
747 nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
748 nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
749 nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
750 nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
751 nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
752 nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
753 nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
754 nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
755 UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
756 nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
757 nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
758 nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
759 nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
760 nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
761 nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
762 nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
763 nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
764 nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
765 nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
766 nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
767 nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
768 nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
769 nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
770 nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
771 nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
772 nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
773 nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
774 nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
775 nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
776 nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
777 nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
778 nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
779 nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
780 nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
781 nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
782 nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
783 nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
784 nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
785 nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
786 nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
787 nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
788 nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
789 nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
790 nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
791 nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
792 nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
793 nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
794 nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
795 nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
796 nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
797 nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
798 nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
799 nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
800 }
801 }
802 return nWP;
803 }
804
714 public RegionSettings LoadRegionSettings(UUID regionUUID) 805 public RegionSettings LoadRegionSettings(UUID regionUUID)
715 { 806 {
716 RegionSettings rs = null; 807 RegionSettings rs = null;
@@ -749,6 +840,107 @@ namespace OpenSim.Data.MySQL
749 return rs; 840 return rs;
750 } 841 }
751 842
843 public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
844 {
845 lock (m_Connection)
846 {
847 using (MySqlCommand cmd = m_Connection.CreateCommand())
848 {
849 cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
850 cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
851 cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
852 cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
853 cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
854 cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
855 cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
856 cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
857 cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
858 cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
859 cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
860 cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
861 cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
862 cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
863 cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
864 cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
865 cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
866 cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
867 cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
868 cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
869 cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
870 cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
871 cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
872 cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
873 cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
874
875 cmd.Parameters.AddWithValue("region_id", wl.regionID);
876 cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
877 cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
878 cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
879 cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
880 cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
881 cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
882 cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
883 cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
884 cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
885 cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
886 cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
887 cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
888 cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
889 cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
890 cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
891 cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
892 cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
893 cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
894 cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
895 cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
896 cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
897 cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
898 cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
899 cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
900 cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
901 cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
902 cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
903 cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
904 cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
905 cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
906 cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
907 cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
908 cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
909 cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
910 cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
911 cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
912 cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
913 cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
914 cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
915 cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
916 cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
917 cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
918 cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
919 cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
920 cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
921 cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
922 cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
923 cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
924 cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
925 cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
926 cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
927 cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
928 cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
929 cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
930 cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
931 cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
932 cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
933 cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
934 cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
935 cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
936 cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
937 cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
938
939 ExecuteNonQuery(cmd);
940 }
941 }
942 }
943
752 public void StoreRegionSettings(RegionSettings rs) 944 public void StoreRegionSettings(RegionSettings rs)
753 { 945 {
754 lock (m_dbLock) 946 lock (m_dbLock)