aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs13
-rw-r--r--OpenSim/Data/MySQL/MySQLLegacyRegionData.cs199
-rw-r--r--OpenSim/Data/Null/NullDataStore.cs11
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs13
4 files changed, 231 insertions, 5 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
index c849f38..d6cb91f 100644
--- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
@@ -691,7 +691,16 @@ VALUES
691 cmd.ExecuteNonQuery(); 691 cmd.ExecuteNonQuery();
692 } 692 }
693 } 693 }
694 694 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
695 {
696 //This connector doesn't support the windlight module yet
697 //Return default LL windlight settings
698 return new RegionLightShareData();
699 }
700 public void StoreRegionWindlightSettings(RegionLightShareData wl)
701 {
702 //This connector doesn't support the windlight module yet
703 }
695 /// <summary> 704 /// <summary>
696 /// Loads the settings of a region. 705 /// Loads the settings of a region.
697 /// </summary> 706 /// </summary>
@@ -718,7 +727,7 @@ VALUES
718 } 727 }
719 } 728 }
720 729
721 //If comes here then there is now region setting for that region 730 //If we reach this point then there are new region settings for that region
722 regionSettings = new RegionSettings(); 731 regionSettings = new RegionSettings();
723 regionSettings.RegionUUID = regionUUID; 732 regionSettings.RegionUUID = regionUUID;
724 regionSettings.OnSave += StoreRegionSettings; 733 regionSettings.OnSave += StoreRegionSettings;
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
index a06eec3..a395ddc 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -711,6 +711,102 @@ namespace OpenSim.Data.MySQL
711 } 711 }
712 } 712 }
713 713
714 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
715 {
716 RegionLightShareData nWP = new RegionLightShareData();
717 nWP.OnSave += StoreRegionWindlightSettings;
718
719 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
720 {
721 dbcon.Open();
722
723 string command = "select * from `regionwindlight` where region_id = ?regionID";
724
725 using(MySqlCommand cmd = new MySqlCommand(command))
726 {
727 cmd.Connection = dbcon;
728
729 cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
730
731 IDataReader result = ExecuteReader(cmd);
732 if (!result.Read())
733 {
734 //No result, so store our default windlight profile and return it
735 nWP.regionID = regionUUID;
736 StoreRegionWindlightSettings(nWP);
737 return nWP;
738 }
739 else
740 {
741 UUID.TryParse(result["region_id"].ToString(), out nWP.regionID);
742 nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
743 nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
744 nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
745 nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
746 nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
747 nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
748 nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
749 nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
750 nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
751 nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
752 nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
753 nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
754 nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
755 nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
756 nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
757 nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
758 nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
759 UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
760 nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
761 nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
762 nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
763 nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
764 nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
765 nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
766 nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
767 nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
768 nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
769 nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
770 nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
771 nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
772 nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
773 nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
774 nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
775 nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
776 nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
777 nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
778 nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
779 nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
780 nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
781 nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
782 nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
783 nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
784 nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
785 nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
786 nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
787 nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
788 nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
789 nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
790 nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
791 nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
792 nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
793 nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
794 nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
795 nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
796 nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
797 nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
798 nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
799 nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
800 nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
801 nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
802 nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
803 nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
804 }
805 }
806 }
807 return nWP;
808 }
809
714 public RegionSettings LoadRegionSettings(UUID regionUUID) 810 public RegionSettings LoadRegionSettings(UUID regionUUID)
715 { 811 {
716 RegionSettings rs = null; 812 RegionSettings rs = null;
@@ -749,6 +845,109 @@ namespace OpenSim.Data.MySQL
749 return rs; 845 return rs;
750 } 846 }
751 847
848 public void StoreRegionWindlightSettings(RegionLightShareData wl)
849 {
850 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
851 {
852 dbcon.Open();
853
854 using (MySqlCommand cmd = dbcon.CreateCommand())
855 {
856 cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
857 cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
858 cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
859 cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
860 cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
861 cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
862 cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
863 cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
864 cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
865 cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
866 cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
867 cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
868 cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
869 cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
870 cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
871 cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
872 cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
873 cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
874 cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
875 cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
876 cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
877 cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
878 cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
879 cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
880 cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
881
882 cmd.Parameters.AddWithValue("region_id", wl.regionID);
883 cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
884 cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
885 cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
886 cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
887 cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
888 cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
889 cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
890 cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
891 cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
892 cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
893 cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
894 cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
895 cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
896 cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
897 cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
898 cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
899 cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
900 cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
901 cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
902 cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
903 cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
904 cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
905 cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
906 cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
907 cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
908 cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
909 cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
910 cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
911 cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
912 cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
913 cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
914 cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
915 cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
916 cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
917 cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
918 cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
919 cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
920 cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
921 cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
922 cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
923 cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
924 cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
925 cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
926 cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
927 cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
928 cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
929 cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
930 cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
931 cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
932 cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
933 cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
934 cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
935 cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
936 cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
937 cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
938 cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
939 cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
940 cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
941 cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
942 cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
943 cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
944 cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
945
946 ExecuteNonQuery(cmd);
947 }
948 }
949 }
950
752 public void StoreRegionSettings(RegionSettings rs) 951 public void StoreRegionSettings(RegionSettings rs)
753 { 952 {
754 lock (m_dbLock) 953 lock (m_dbLock)
diff --git a/OpenSim/Data/Null/NullDataStore.cs b/OpenSim/Data/Null/NullDataStore.cs
index 427fa0a..3ba44bb 100644
--- a/OpenSim/Data/Null/NullDataStore.cs
+++ b/OpenSim/Data/Null/NullDataStore.cs
@@ -50,7 +50,16 @@ namespace OpenSim.Data.Null
50 public void StoreRegionSettings(RegionSettings rs) 50 public void StoreRegionSettings(RegionSettings rs)
51 { 51 {
52 } 52 }
53 53 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
54 {
55 //This connector doesn't support the windlight module yet
56 //Return default LL windlight settings
57 return new RegionLightShareData();
58 }
59 public void StoreRegionWindlightSettings(RegionLightShareData wl)
60 {
61 //This connector doesn't support the windlight module yet
62 }
54 public RegionSettings LoadRegionSettings(UUID regionUUID) 63 public RegionSettings LoadRegionSettings(UUID regionUUID)
55 { 64 {
56 return null; 65 return null;
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 5a4ee2a..d2ba9ae 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -272,7 +272,16 @@ namespace OpenSim.Data.SQLite
272 Commit(); 272 Commit();
273 } 273 }
274 } 274 }
275 275 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
276 {
277 //This connector doesn't support the windlight module yet
278 //Return default LL windlight settings
279 return new RegionLightShareData();
280 }
281 public void StoreRegionWindlightSettings(RegionLightShareData wl)
282 {
283 //This connector doesn't support the windlight module yet
284 }
276 public RegionSettings LoadRegionSettings(UUID regionUUID) 285 public RegionSettings LoadRegionSettings(UUID regionUUID)
277 { 286 {
278 lock (ds) 287 lock (ds)
@@ -320,7 +329,7 @@ namespace OpenSim.Data.SQLite
320 { 329 {
321 foreach (SceneObjectPart prim in obj.Children.Values) 330 foreach (SceneObjectPart prim in obj.Children.Values)
322 { 331 {
323 m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); 332// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
324 addPrim(prim, obj.UUID, regionUUID); 333 addPrim(prim, obj.UUID, regionUUID);
325 } 334 }
326 } 335 }