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 9a4a4bb..e57e929 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
@@ -693,6 +693,97 @@ namespace OpenSim.Data.MySQL
693 } 693 }
694 } 694 }
695 695
696 public RegionMeta7WindlightData LoadRegionWindlightSettings(UUID regionUUID)
697 {
698 RegionMeta7WindlightData nWP = new RegionMeta7WindlightData();
699 nWP.OnSave += StoreRegionWindlightSettings;
700 lock (m_Connection)
701 {
702
703 string command = "select * from `regionwindlight` where region_id = ?regionID";
704
705 MySqlCommand cmd = new MySqlCommand(command);
706
707 cmd.Parameters.AddWithValue("?regionID", regionUUID.ToString());
708
709 IDataReader result = ExecuteReader(cmd);
710 if (!result.Read())
711 {
712 //No result, so store our default windlight profile and return it
713 nWP.regionID = regionUUID;
714 StoreRegionWindlightSettings(nWP);
715 return nWP;
716 }
717 else
718 {
719 UUID.TryParse(result["region_id"].ToString(), out nWP.regionID);
720 nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]);
721 nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]);
722 nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]);
723 nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]);
724 nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]);
725 nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]);
726 nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]);
727 nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]);
728 nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]);
729 nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]);
730 nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]);
731 nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]);
732 nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]);
733 nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]);
734 nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]);
735 nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]);
736 nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]);
737 UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture);
738 nWP.horizon.X = Convert.ToSingle(result["horizon_r"]);
739 nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]);
740 nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]);
741 nWP.horizon.W = Convert.ToSingle(result["horizon_i"]);
742 nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]);
743 nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]);
744 nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]);
745 nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]);
746 nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]);
747 nWP.hazeDensity = Convert.ToSingle(result["haze_density"]);
748 nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]);
749 nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]);
750 nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]);
751 nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]);
752 nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]);
753 nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]);
754 nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]);
755 nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]);
756 nWP.ambient.X = Convert.ToSingle(result["ambient_r"]);
757 nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]);
758 nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]);
759 nWP.ambient.W = Convert.ToSingle(result["ambient_i"]);
760 nWP.eastAngle = Convert.ToSingle(result["east_angle"]);
761 nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]);
762 nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]);
763 nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]);
764 nWP.starBrightness = Convert.ToSingle(result["star_brightness"]);
765 nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]);
766 nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]);
767 nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]);
768 nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]);
769 nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]);
770 nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]);
771 nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]);
772 nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]);
773 nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]);
774 nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]);
775 nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]);
776 nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]);
777 nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]);
778 nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]);
779 nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]);
780 nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]);
781 nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]);
782 }
783 }
784 return nWP;
785 }
786
696 public RegionSettings LoadRegionSettings(UUID regionUUID) 787 public RegionSettings LoadRegionSettings(UUID regionUUID)
697 { 788 {
698 RegionSettings rs = null; 789 RegionSettings rs = null;
@@ -726,6 +817,107 @@ namespace OpenSim.Data.MySQL
726 return rs; 817 return rs;
727 } 818 }
728 819
820 public void StoreRegionWindlightSettings(RegionMeta7WindlightData wl)
821 {
822 lock (m_Connection)
823 {
824 using (MySqlCommand cmd = m_Connection.CreateCommand())
825 {
826 cmd.CommandText = "REPLACE INTO `regionwindlight` (`region_id`, `water_color_r`, `water_color_g`, ";
827 cmd.CommandText += "`water_color_b`, `water_fog_density_exponent`, `underwater_fog_modifier`, ";
828 cmd.CommandText += "`reflection_wavelet_scale_1`, `reflection_wavelet_scale_2`, `reflection_wavelet_scale_3`, ";
829 cmd.CommandText += "`fresnel_scale`, `fresnel_offset`, `refract_scale_above`, `refract_scale_below`, ";
830 cmd.CommandText += "`blur_multiplier`, `big_wave_direction_x`, `big_wave_direction_y`, `little_wave_direction_x`, ";
831 cmd.CommandText += "`little_wave_direction_y`, `normal_map_texture`, `horizon_r`, `horizon_g`, `horizon_b`, ";
832 cmd.CommandText += "`horizon_i`, `haze_horizon`, `blue_density_r`, `blue_density_g`, `blue_density_b`, ";
833 cmd.CommandText += "`blue_density_i`, `haze_density`, `density_multiplier`, `distance_multiplier`, `max_altitude`, ";
834 cmd.CommandText += "`sun_moon_color_r`, `sun_moon_color_g`, `sun_moon_color_b`, `sun_moon_color_i`, `sun_moon_position`, ";
835 cmd.CommandText += "`ambient_r`, `ambient_g`, `ambient_b`, `ambient_i`, `east_angle`, `sun_glow_focus`, `sun_glow_size`, ";
836 cmd.CommandText += "`scene_gamma`, `star_brightness`, `cloud_color_r`, `cloud_color_g`, `cloud_color_b`, `cloud_color_i`, ";
837 cmd.CommandText += "`cloud_x`, `cloud_y`, `cloud_density`, `cloud_coverage`, `cloud_scale`, `cloud_detail_x`, ";
838 cmd.CommandText += "`cloud_detail_y`, `cloud_detail_density`, `cloud_scroll_x`, `cloud_scroll_x_lock`, `cloud_scroll_y`, ";
839 cmd.CommandText += "`cloud_scroll_y_lock`, `draw_classic_clouds`) VALUES (?region_id, ?water_color_r, ";
840 cmd.CommandText += "?water_color_g, ?water_color_b, ?water_fog_density_exponent, ?underwater_fog_modifier, ?reflection_wavelet_scale_1, ";
841 cmd.CommandText += "?reflection_wavelet_scale_2, ?reflection_wavelet_scale_3, ?fresnel_scale, ?fresnel_offset, ?refract_scale_above, ";
842 cmd.CommandText += "?refract_scale_below, ?blur_multiplier, ?big_wave_direction_x, ?big_wave_direction_y, ?little_wave_direction_x, ";
843 cmd.CommandText += "?little_wave_direction_y, ?normal_map_texture, ?horizon_r, ?horizon_g, ?horizon_b, ?horizon_i, ?haze_horizon, ";
844 cmd.CommandText += "?blue_density_r, ?blue_density_g, ?blue_density_b, ?blue_density_i, ?haze_density, ?density_multiplier, ";
845 cmd.CommandText += "?distance_multiplier, ?max_altitude, ?sun_moon_color_r, ?sun_moon_color_g, ?sun_moon_color_b, ";
846 cmd.CommandText += "?sun_moon_color_i, ?sun_moon_position, ?ambient_r, ?ambient_g, ?ambient_b, ?ambient_i, ?east_angle, ";
847 cmd.CommandText += "?sun_glow_focus, ?sun_glow_size, ?scene_gamma, ?star_brightness, ?cloud_color_r, ?cloud_color_g, ";
848 cmd.CommandText += "?cloud_color_b, ?cloud_color_i, ?cloud_x, ?cloud_y, ?cloud_density, ?cloud_coverage, ?cloud_scale, ";
849 cmd.CommandText += "?cloud_detail_x, ?cloud_detail_y, ?cloud_detail_density, ?cloud_scroll_x, ?cloud_scroll_x_lock, ";
850 cmd.CommandText += "?cloud_scroll_y, ?cloud_scroll_y_lock, ?draw_classic_clouds)";
851
852 cmd.Parameters.AddWithValue("region_id", wl.regionID);
853 cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X);
854 cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y);
855 cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z);
856 cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent);
857 cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier);
858 cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X);
859 cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y);
860 cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z);
861 cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale);
862 cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset);
863 cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove);
864 cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow);
865 cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier);
866 cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X);
867 cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y);
868 cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X);
869 cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y);
870 cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture);
871 cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X);
872 cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y);
873 cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z);
874 cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W);
875 cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon);
876 cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X);
877 cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y);
878 cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z);
879 cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W);
880 cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity);
881 cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier);
882 cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier);
883 cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude);
884 cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X);
885 cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y);
886 cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z);
887 cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W);
888 cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition);
889 cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X);
890 cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y);
891 cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z);
892 cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W);
893 cmd.Parameters.AddWithValue("east_angle", wl.eastAngle);
894 cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus);
895 cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize);
896 cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma);
897 cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness);
898 cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X);
899 cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y);
900 cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z);
901 cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W);
902 cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X);
903 cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y);
904 cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z);
905 cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage);
906 cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale);
907 cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X);
908 cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y);
909 cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z);
910 cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX);
911 cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock);
912 cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY);
913 cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock);
914 cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds);
915
916 ExecuteNonQuery(cmd);
917 }
918 }
919 }
920
729 public void StoreRegionSettings(RegionSettings rs) 921 public void StoreRegionSettings(RegionSettings rs)
730 { 922 {
731 lock (m_Connection) 923 lock (m_Connection)