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