diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLSimulationData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 457 |
1 files changed, 238 insertions, 219 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 4d7c0c9..12c979a 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -747,95 +747,99 @@ namespace OpenSim.Data.MySQL | |||
747 | RegionLightShareData nWP = new RegionLightShareData(); | 747 | RegionLightShareData nWP = new RegionLightShareData(); |
748 | nWP.OnSave += StoreRegionWindlightSettings; | 748 | nWP.OnSave += StoreRegionWindlightSettings; |
749 | 749 | ||
750 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 750 | lock (m_dbLock) |
751 | { | 751 | { |
752 | dbcon.Open(); | 752 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
753 | |||
754 | string command = "select * from `regionwindlight` where region_id = ?regionID"; | ||
755 | |||
756 | using (MySqlCommand cmd = new MySqlCommand(command)) | ||
757 | { | 753 | { |
758 | cmd.Connection = dbcon; | 754 | dbcon.Open(); |
759 | 755 | ||
760 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); | 756 | string command = "select * from `regionwindlight` where region_id = ?regionID"; |
761 | 757 | ||
762 | IDataReader result = ExecuteReader(cmd); | 758 | using (MySqlCommand cmd = new MySqlCommand(command)) |
763 | if (!result.Read()) | ||
764 | { | ||
765 | //No result, so store our default windlight profile and return it | ||
766 | nWP.regionID = regionUUID; | ||
767 | // StoreRegionWindlightSettings(nWP); | ||
768 | return nWP; | ||
769 | } | ||
770 | else | ||
771 | { | 759 | { |
772 | nWP.regionID = DBGuid.FromDB(result["region_id"]); | 760 | cmd.Connection = dbcon; |
773 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); | 761 | |
774 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); | 762 | cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString()); |
775 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); | 763 | |
776 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); | 764 | IDataReader result = ExecuteReader(cmd); |
777 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); | 765 | if (!result.Read()) |
778 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); | 766 | { |
779 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); | 767 | //No result, so store our default windlight profile and return it |
780 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); | 768 | nWP.regionID = regionUUID; |
781 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); | 769 | // StoreRegionWindlightSettings(nWP); |
782 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); | 770 | return nWP; |
783 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); | 771 | } |
784 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); | 772 | else |
785 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); | 773 | { |
786 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); | 774 | nWP.regionID = DBGuid.FromDB(result["region_id"]); |
787 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); | 775 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); |
788 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); | 776 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); |
789 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); | 777 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); |
790 | UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); | 778 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); |
791 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); | 779 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); |
792 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); | 780 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); |
793 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); | 781 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); |
794 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); | 782 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); |
795 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); | 783 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); |
796 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); | 784 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); |
797 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); | 785 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); |
798 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); | 786 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); |
799 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); | 787 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); |
800 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); | 788 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); |
801 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); | 789 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); |
802 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); | 790 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); |
803 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); | 791 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); |
804 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); | 792 | UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); |
805 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); | 793 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); |
806 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); | 794 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); |
807 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); | 795 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); |
808 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); | 796 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); |
809 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); | 797 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); |
810 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); | 798 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); |
811 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); | 799 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); |
812 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); | 800 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); |
813 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); | 801 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); |
814 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); | 802 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); |
815 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); | 803 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); |
816 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); | 804 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); |
817 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); | 805 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); |
818 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); | 806 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); |
819 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); | 807 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); |
820 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); | 808 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); |
821 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); | 809 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); |
822 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); | 810 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); |
823 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); | 811 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); |
824 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); | 812 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); |
825 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); | 813 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); |
826 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); | 814 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); |
827 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); | 815 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); |
828 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); | 816 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); |
829 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); | 817 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); |
830 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); | 818 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); |
831 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); | 819 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); |
832 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); | 820 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); |
833 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); | 821 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); |
834 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | 822 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); |
835 | nWP.valid = true; | 823 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); |
824 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); | ||
825 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); | ||
826 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); | ||
827 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); | ||
828 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); | ||
829 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); | ||
830 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); | ||
831 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); | ||
832 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); | ||
833 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); | ||
834 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); | ||
835 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); | ||
836 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | ||
837 | nWP.valid = true; | ||
838 | } | ||
836 | } | 839 | } |
837 | } | 840 | } |
838 | } | 841 | } |
842 | |||
839 | return nWP; | 843 | return nWP; |
840 | } | 844 | } |
841 | 845 | ||
@@ -881,118 +885,124 @@ namespace OpenSim.Data.MySQL | |||
881 | 885 | ||
882 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) | 886 | public virtual void StoreRegionWindlightSettings(RegionLightShareData wl) |
883 | { | 887 | { |
884 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 888 | lock (m_dbLock) |
885 | { | 889 | { |
886 | dbcon.Open(); | 890 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
887 | |||
888 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
889 | { | 891 | { |
890 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; | 892 | dbcon.Open(); |
891 | cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; | 893 | |
892 | cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "; | 894 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
893 | cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "; | 895 | { |
894 | cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "; | 896 | cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, "; |
895 | cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "; | 897 | cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, "; |
896 | cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "; | 898 | cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, "; |
897 | cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "; | 899 | cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, "; |
898 | cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "; | 900 | cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, "; |
899 | cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "; | 901 | cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, "; |
900 | cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "; | 902 | cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, "; |
901 | cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "; | 903 | cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, "; |
902 | cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "; | 904 | cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, "; |
903 | cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "; | 905 | cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, "; |
904 | cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "; | 906 | cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, "; |
905 | cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "; | 907 | cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, "; |
906 | cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "; | 908 | cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, "; |
907 | cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "; | 909 | cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, "; |
908 | cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "; | 910 | cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, "; |
909 | cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "; | 911 | cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, "; |
910 | cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "; | 912 | cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, "; |
911 | cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "; | 913 | cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, "; |
912 | cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "; | 914 | cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, "; |
913 | cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "; | 915 | cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, "; |
914 | cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"; | 916 | cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, "; |
915 | 917 | cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, "; | |
916 | cmd.Parameters.AddWithValue("region_id", wl.regionID); | 918 | cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, "; |
917 | cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); | 919 | cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, "; |
918 | cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y); | 920 | cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)"; |
919 | cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z); | 921 | |
920 | cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent); | 922 | cmd.Parameters.AddWithValue("region_id", wl.regionID); |
921 | cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier); | 923 | cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); |
922 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X); | 924 | cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y); |
923 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y); | 925 | cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z); |
924 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z); | 926 | cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent); |
925 | cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale); | 927 | cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier); |
926 | cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset); | 928 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X); |
927 | cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove); | 929 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y); |
928 | cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow); | 930 | cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z); |
929 | cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier); | 931 | cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale); |
930 | cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X); | 932 | cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset); |
931 | cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y); | 933 | cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove); |
932 | cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X); | 934 | cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow); |
933 | cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y); | 935 | cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier); |
934 | cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture); | 936 | cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X); |
935 | cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X); | 937 | cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y); |
936 | cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y); | 938 | cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X); |
937 | cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z); | 939 | cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y); |
938 | cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W); | 940 | cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture); |
939 | cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon); | 941 | cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X); |
940 | cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X); | 942 | cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y); |
941 | cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y); | 943 | cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z); |
942 | cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z); | 944 | cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W); |
943 | cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W); | 945 | cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon); |
944 | cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity); | 946 | cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X); |
945 | cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier); | 947 | cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y); |
946 | cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier); | 948 | cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z); |
947 | cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude); | 949 | cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W); |
948 | cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X); | 950 | cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity); |
949 | cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y); | 951 | cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier); |
950 | cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z); | 952 | cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier); |
951 | cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W); | 953 | cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude); |
952 | cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition); | 954 | cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X); |
953 | cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X); | 955 | cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y); |
954 | cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y); | 956 | cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z); |
955 | cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z); | 957 | cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W); |
956 | cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W); | 958 | cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition); |
957 | cmd.Parameters.AddWithValue("east_angle", wl.eastAngle); | 959 | cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X); |
958 | cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus); | 960 | cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y); |
959 | cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize); | 961 | cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z); |
960 | cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma); | 962 | cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W); |
961 | cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness); | 963 | cmd.Parameters.AddWithValue("east_angle", wl.eastAngle); |
962 | cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X); | 964 | cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus); |
963 | cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y); | 965 | cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize); |
964 | cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z); | 966 | cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma); |
965 | cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W); | 967 | cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness); |
966 | cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X); | 968 | cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X); |
967 | cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y); | 969 | cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y); |
968 | cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z); | 970 | cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z); |
969 | cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage); | 971 | cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W); |
970 | cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale); | 972 | cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X); |
971 | cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X); | 973 | cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y); |
972 | cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y); | 974 | cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z); |
973 | cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z); | 975 | cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage); |
974 | cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX); | 976 | cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale); |
975 | cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock); | 977 | cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X); |
976 | cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); | 978 | cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y); |
977 | cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); | 979 | cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z); |
978 | cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); | 980 | cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX); |
979 | 981 | cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock); | |
980 | ExecuteNonQuery(cmd); | 982 | cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); |
983 | cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); | ||
984 | cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); | ||
985 | |||
986 | ExecuteNonQuery(cmd); | ||
987 | } | ||
981 | } | 988 | } |
982 | } | 989 | } |
983 | } | 990 | } |
984 | 991 | ||
985 | public virtual void RemoveRegionWindlightSettings(UUID regionID) | 992 | public virtual void RemoveRegionWindlightSettings(UUID regionID) |
986 | { | 993 | { |
987 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 994 | lock (m_dbLock) |
988 | { | 995 | { |
989 | dbcon.Open(); | 996 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
990 | |||
991 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
992 | { | 997 | { |
993 | cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID"; | 998 | dbcon.Open(); |
994 | cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); | 999 | |
995 | ExecuteNonQuery(cmd); | 1000 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
1001 | { | ||
1002 | cmd.CommandText = "delete from `regionwindlight` where `region_id`=?regionID"; | ||
1003 | cmd.Parameters.AddWithValue("?regionID", regionID.ToString()); | ||
1004 | ExecuteNonQuery(cmd); | ||
1005 | } | ||
996 | } | 1006 | } |
997 | } | 1007 | } |
998 | } | 1008 | } |
@@ -1000,26 +1010,29 @@ namespace OpenSim.Data.MySQL | |||
1000 | #region RegionEnvironmentSettings | 1010 | #region RegionEnvironmentSettings |
1001 | public string LoadRegionEnvironmentSettings(UUID regionUUID) | 1011 | public string LoadRegionEnvironmentSettings(UUID regionUUID) |
1002 | { | 1012 | { |
1003 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1013 | lock (m_dbLock) |
1004 | { | 1014 | { |
1005 | dbcon.Open(); | 1015 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
1006 | |||
1007 | string command = "select * from `regionenvironment` where region_id = ?region_id"; | ||
1008 | |||
1009 | using (MySqlCommand cmd = new MySqlCommand(command)) | ||
1010 | { | 1016 | { |
1011 | cmd.Connection = dbcon; | 1017 | dbcon.Open(); |
1012 | 1018 | ||
1013 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | 1019 | string command = "select * from `regionenvironment` where region_id = ?region_id"; |
1014 | 1020 | ||
1015 | IDataReader result = ExecuteReader(cmd); | 1021 | using (MySqlCommand cmd = new MySqlCommand(command)) |
1016 | if (!result.Read()) | ||
1017 | { | ||
1018 | return String.Empty; | ||
1019 | } | ||
1020 | else | ||
1021 | { | 1022 | { |
1022 | return Convert.ToString(result["llsd_settings"]); | 1023 | cmd.Connection = dbcon; |
1024 | |||
1025 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | ||
1026 | |||
1027 | IDataReader result = ExecuteReader(cmd); | ||
1028 | if (!result.Read()) | ||
1029 | { | ||
1030 | return String.Empty; | ||
1031 | } | ||
1032 | else | ||
1033 | { | ||
1034 | return Convert.ToString(result["llsd_settings"]); | ||
1035 | } | ||
1023 | } | 1036 | } |
1024 | } | 1037 | } |
1025 | } | 1038 | } |
@@ -1027,33 +1040,39 @@ namespace OpenSim.Data.MySQL | |||
1027 | 1040 | ||
1028 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) | 1041 | public void StoreRegionEnvironmentSettings(UUID regionUUID, string settings) |
1029 | { | 1042 | { |
1030 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1043 | lock (m_dbLock) |
1031 | { | 1044 | { |
1032 | dbcon.Open(); | 1045 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
1033 | |||
1034 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1035 | { | 1046 | { |
1036 | cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)"; | 1047 | dbcon.Open(); |
1037 | 1048 | ||
1038 | cmd.Parameters.AddWithValue("region_id", regionUUID); | 1049 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
1039 | cmd.Parameters.AddWithValue("llsd_settings", settings); | 1050 | { |
1040 | 1051 | cmd.CommandText = "REPLACE INTO `regionenvironment` (`region_id`, `llsd_settings`) VALUES (?region_id, ?llsd_settings)"; | |
1041 | ExecuteNonQuery(cmd); | 1052 | |
1053 | cmd.Parameters.AddWithValue("region_id", regionUUID); | ||
1054 | cmd.Parameters.AddWithValue("llsd_settings", settings); | ||
1055 | |||
1056 | ExecuteNonQuery(cmd); | ||
1057 | } | ||
1042 | } | 1058 | } |
1043 | } | 1059 | } |
1044 | } | 1060 | } |
1045 | 1061 | ||
1046 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) | 1062 | public void RemoveRegionEnvironmentSettings(UUID regionUUID) |
1047 | { | 1063 | { |
1048 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 1064 | lock (m_dbLock) |
1049 | { | 1065 | { |
1050 | dbcon.Open(); | 1066 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
1051 | |||
1052 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
1053 | { | 1067 | { |
1054 | cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id"; | 1068 | dbcon.Open(); |
1055 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | 1069 | |
1056 | ExecuteNonQuery(cmd); | 1070 | using (MySqlCommand cmd = dbcon.CreateCommand()) |
1071 | { | ||
1072 | cmd.CommandText = "delete from `regionenvironment` where region_id = ?region_id"; | ||
1073 | cmd.Parameters.AddWithValue("?region_id", regionUUID.ToString()); | ||
1074 | ExecuteNonQuery(cmd); | ||
1075 | } | ||
1057 | } | 1076 | } |
1058 | } | 1077 | } |
1059 | } | 1078 | } |