diff options
author | Chris Hart | 2011-06-01 04:01:18 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-06-01 21:01:04 +0100 |
commit | 5fb0455e929d96efb41d23f67653b329792ab834 (patch) | |
tree | b28593f324ba685cd3c4d23036438a4890bb7bb8 /OpenSim/Data/MSSQL/MSSQLSimulationData.cs | |
parent | a few minor formatting tweaks (diff) | |
download | opensim-SC-5fb0455e929d96efb41d23f67653b329792ab834.zip opensim-SC-5fb0455e929d96efb41d23f67653b329792ab834.tar.gz opensim-SC-5fb0455e929d96efb41d23f67653b329792ab834.tar.bz2 opensim-SC-5fb0455e929d96efb41d23f67653b329792ab834.tar.xz |
Updates to MSSQL to most recent compatibility, also included Windlight support. Needs plenty of testing but clean install and migration from 0.6.9 have been tested and work, a few indexes still need to be added for performance.
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLSimulationData.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 513 |
1 files changed, 499 insertions, 14 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index 5155e56..78f80e1 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs | |||
@@ -55,6 +55,10 @@ namespace OpenSim.Data.MSSQL | |||
55 | /// </summary> | 55 | /// </summary> |
56 | private MSSQLManager _Database; | 56 | private MSSQLManager _Database; |
57 | private string m_connectionString; | 57 | private string m_connectionString; |
58 | protected virtual Assembly Assembly | ||
59 | { | ||
60 | get { return GetType().Assembly; } | ||
61 | } | ||
58 | 62 | ||
59 | public MSSQLSimulationData() | 63 | public MSSQLSimulationData() |
60 | { | 64 | { |
@@ -74,9 +78,28 @@ namespace OpenSim.Data.MSSQL | |||
74 | m_connectionString = connectionString; | 78 | m_connectionString = connectionString; |
75 | _Database = new MSSQLManager(connectionString); | 79 | _Database = new MSSQLManager(connectionString); |
76 | 80 | ||
81 | using (SqlConnection conn = new SqlConnection(connectionString)) | ||
82 | { | ||
83 | conn.Open(); | ||
84 | //New Migration settings | ||
85 | Migration m = new Migration(conn, Assembly, "RegionStore"); | ||
86 | m.Update(); | ||
77 | 87 | ||
78 | //Migration settings | 88 | // Clean dropped attachments |
79 | _Database.CheckMigration(_migrationStore); | 89 | // |
90 | try | ||
91 | { | ||
92 | using (SqlCommand cmd = conn.CreateCommand()) | ||
93 | { | ||
94 | cmd.CommandText = "delete from prims where prims.UUID in (select UUID from primshapes where PCode = 9 and State <> 0); delete from primshapes where PCode = 9 and State <> 0"; | ||
95 | cmd.ExecuteNonQuery(); | ||
96 | } | ||
97 | } | ||
98 | catch (Exception ex) | ||
99 | { | ||
100 | _Log.Error("[REGION DB]: Error cleaning up dropped attachments: " + ex.Message); | ||
101 | } | ||
102 | } | ||
80 | } | 103 | } |
81 | 104 | ||
82 | /// <summary> | 105 | /// <summary> |
@@ -214,7 +237,7 @@ namespace OpenSim.Data.MSSQL | |||
214 | { | 237 | { |
215 | command.Parameters.Clear(); | 238 | command.Parameters.Clear(); |
216 | command.Parameters.Add(_Database.CreateParameter("@PrimID", objectPart.UUID)); | 239 | command.Parameters.Add(_Database.CreateParameter("@PrimID", objectPart.UUID)); |
217 | 240 | ||
218 | List<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); | 241 | List<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); |
219 | 242 | ||
220 | using (SqlDataReader reader = command.ExecuteReader()) | 243 | using (SqlDataReader reader = command.ExecuteReader()) |
@@ -241,6 +264,14 @@ namespace OpenSim.Data.MSSQL | |||
241 | /// <param name="regionUUID"></param> | 264 | /// <param name="regionUUID"></param> |
242 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) | 265 | public void StoreObject(SceneObjectGroup obj, UUID regionUUID) |
243 | { | 266 | { |
267 | uint flags = obj.RootPart.GetEffectiveObjectFlags(); | ||
268 | // Eligibility check | ||
269 | // | ||
270 | if ((flags & (uint)PrimFlags.Temporary) != 0) | ||
271 | return; | ||
272 | if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0) | ||
273 | return; | ||
274 | |||
244 | _Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Parts.Length); | 275 | _Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Parts.Length); |
245 | 276 | ||
246 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | 277 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
@@ -700,16 +731,470 @@ VALUES | |||
700 | } | 731 | } |
701 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) | 732 | public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) |
702 | { | 733 | { |
703 | //This connector doesn't support the windlight module yet | 734 | RegionLightShareData nWP = new RegionLightShareData(); |
704 | //Return default LL windlight settings | 735 | nWP.OnSave += StoreRegionWindlightSettings; |
705 | return new RegionLightShareData(); | 736 | string sql = "select * from [regionwindlight] where region_id = @regionID"; |
737 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
738 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
739 | { | ||
740 | cmd.Parameters.Add(_Database.CreateParameter("@regionID", regionUUID)); | ||
741 | conn.Open(); | ||
742 | using (SqlDataReader result = cmd.ExecuteReader()) | ||
743 | { | ||
744 | if (!result.Read()) | ||
745 | { | ||
746 | //No result, so store our default windlight profile and return it | ||
747 | nWP.regionID = regionUUID; | ||
748 | StoreRegionWindlightSettings(nWP); | ||
749 | return nWP; | ||
750 | } | ||
751 | else | ||
752 | { | ||
753 | nWP.regionID = DBGuid.FromDB(result["region_id"]); | ||
754 | nWP.waterColor.X = Convert.ToSingle(result["water_color_r"]); | ||
755 | nWP.waterColor.Y = Convert.ToSingle(result["water_color_g"]); | ||
756 | nWP.waterColor.Z = Convert.ToSingle(result["water_color_b"]); | ||
757 | nWP.waterFogDensityExponent = Convert.ToSingle(result["water_fog_density_exponent"]); | ||
758 | nWP.underwaterFogModifier = Convert.ToSingle(result["underwater_fog_modifier"]); | ||
759 | nWP.reflectionWaveletScale.X = Convert.ToSingle(result["reflection_wavelet_scale_1"]); | ||
760 | nWP.reflectionWaveletScale.Y = Convert.ToSingle(result["reflection_wavelet_scale_2"]); | ||
761 | nWP.reflectionWaveletScale.Z = Convert.ToSingle(result["reflection_wavelet_scale_3"]); | ||
762 | nWP.fresnelScale = Convert.ToSingle(result["fresnel_scale"]); | ||
763 | nWP.fresnelOffset = Convert.ToSingle(result["fresnel_offset"]); | ||
764 | nWP.refractScaleAbove = Convert.ToSingle(result["refract_scale_above"]); | ||
765 | nWP.refractScaleBelow = Convert.ToSingle(result["refract_scale_below"]); | ||
766 | nWP.blurMultiplier = Convert.ToSingle(result["blur_multiplier"]); | ||
767 | nWP.bigWaveDirection.X = Convert.ToSingle(result["big_wave_direction_x"]); | ||
768 | nWP.bigWaveDirection.Y = Convert.ToSingle(result["big_wave_direction_y"]); | ||
769 | nWP.littleWaveDirection.X = Convert.ToSingle(result["little_wave_direction_x"]); | ||
770 | nWP.littleWaveDirection.Y = Convert.ToSingle(result["little_wave_direction_y"]); | ||
771 | UUID.TryParse(result["normal_map_texture"].ToString(), out nWP.normalMapTexture); | ||
772 | nWP.horizon.X = Convert.ToSingle(result["horizon_r"]); | ||
773 | nWP.horizon.Y = Convert.ToSingle(result["horizon_g"]); | ||
774 | nWP.horizon.Z = Convert.ToSingle(result["horizon_b"]); | ||
775 | nWP.horizon.W = Convert.ToSingle(result["horizon_i"]); | ||
776 | nWP.hazeHorizon = Convert.ToSingle(result["haze_horizon"]); | ||
777 | nWP.blueDensity.X = Convert.ToSingle(result["blue_density_r"]); | ||
778 | nWP.blueDensity.Y = Convert.ToSingle(result["blue_density_g"]); | ||
779 | nWP.blueDensity.Z = Convert.ToSingle(result["blue_density_b"]); | ||
780 | nWP.blueDensity.W = Convert.ToSingle(result["blue_density_i"]); | ||
781 | nWP.hazeDensity = Convert.ToSingle(result["haze_density"]); | ||
782 | nWP.densityMultiplier = Convert.ToSingle(result["density_multiplier"]); | ||
783 | nWP.distanceMultiplier = Convert.ToSingle(result["distance_multiplier"]); | ||
784 | nWP.maxAltitude = Convert.ToUInt16(result["max_altitude"]); | ||
785 | nWP.sunMoonColor.X = Convert.ToSingle(result["sun_moon_color_r"]); | ||
786 | nWP.sunMoonColor.Y = Convert.ToSingle(result["sun_moon_color_g"]); | ||
787 | nWP.sunMoonColor.Z = Convert.ToSingle(result["sun_moon_color_b"]); | ||
788 | nWP.sunMoonColor.W = Convert.ToSingle(result["sun_moon_color_i"]); | ||
789 | nWP.sunMoonPosition = Convert.ToSingle(result["sun_moon_position"]); | ||
790 | nWP.ambient.X = Convert.ToSingle(result["ambient_r"]); | ||
791 | nWP.ambient.Y = Convert.ToSingle(result["ambient_g"]); | ||
792 | nWP.ambient.Z = Convert.ToSingle(result["ambient_b"]); | ||
793 | nWP.ambient.W = Convert.ToSingle(result["ambient_i"]); | ||
794 | nWP.eastAngle = Convert.ToSingle(result["east_angle"]); | ||
795 | nWP.sunGlowFocus = Convert.ToSingle(result["sun_glow_focus"]); | ||
796 | nWP.sunGlowSize = Convert.ToSingle(result["sun_glow_size"]); | ||
797 | nWP.sceneGamma = Convert.ToSingle(result["scene_gamma"]); | ||
798 | nWP.starBrightness = Convert.ToSingle(result["star_brightness"]); | ||
799 | nWP.cloudColor.X = Convert.ToSingle(result["cloud_color_r"]); | ||
800 | nWP.cloudColor.Y = Convert.ToSingle(result["cloud_color_g"]); | ||
801 | nWP.cloudColor.Z = Convert.ToSingle(result["cloud_color_b"]); | ||
802 | nWP.cloudColor.W = Convert.ToSingle(result["cloud_color_i"]); | ||
803 | nWP.cloudXYDensity.X = Convert.ToSingle(result["cloud_x"]); | ||
804 | nWP.cloudXYDensity.Y = Convert.ToSingle(result["cloud_y"]); | ||
805 | nWP.cloudXYDensity.Z = Convert.ToSingle(result["cloud_density"]); | ||
806 | nWP.cloudCoverage = Convert.ToSingle(result["cloud_coverage"]); | ||
807 | nWP.cloudScale = Convert.ToSingle(result["cloud_scale"]); | ||
808 | nWP.cloudDetailXYDensity.X = Convert.ToSingle(result["cloud_detail_x"]); | ||
809 | nWP.cloudDetailXYDensity.Y = Convert.ToSingle(result["cloud_detail_y"]); | ||
810 | nWP.cloudDetailXYDensity.Z = Convert.ToSingle(result["cloud_detail_density"]); | ||
811 | nWP.cloudScrollX = Convert.ToSingle(result["cloud_scroll_x"]); | ||
812 | nWP.cloudScrollXLock = Convert.ToBoolean(result["cloud_scroll_x_lock"]); | ||
813 | nWP.cloudScrollY = Convert.ToSingle(result["cloud_scroll_y"]); | ||
814 | nWP.cloudScrollYLock = Convert.ToBoolean(result["cloud_scroll_y_lock"]); | ||
815 | nWP.drawClassicClouds = Convert.ToBoolean(result["draw_classic_clouds"]); | ||
816 | nWP.valid = true; | ||
817 | } | ||
818 | } | ||
819 | } | ||
820 | return nWP; | ||
706 | } | 821 | } |
822 | |||
707 | public void RemoveRegionWindlightSettings(UUID regionID) | 823 | public void RemoveRegionWindlightSettings(UUID regionID) |
708 | { | 824 | { |
825 | string sql = "delete from [regionwindlight] where region_id = @region_id"; | ||
826 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
827 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
828 | { | ||
829 | conn.Open(); | ||
830 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", regionID)); | ||
831 | cmd.ExecuteNonQuery(); | ||
832 | } | ||
709 | } | 833 | } |
834 | |||
710 | public void StoreRegionWindlightSettings(RegionLightShareData wl) | 835 | public void StoreRegionWindlightSettings(RegionLightShareData wl) |
711 | { | 836 | { |
712 | //This connector doesn't support the windlight module yet | 837 | string sql = "select count (region_id) from regionwindlight where region_id = @region_id"; |
838 | bool exists = false; | ||
839 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
840 | { | ||
841 | conn.Open(); | ||
842 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
843 | { | ||
844 | cmd.Parameters.Add(_Database.CreateParameter("@region_id", wl.regionID)); | ||
845 | exists = (int)cmd.ExecuteScalar() > 0; | ||
846 | } | ||
847 | } | ||
848 | if (exists) | ||
849 | { | ||
850 | RemoveRegionWindlightSettings(wl.regionID); | ||
851 | } | ||
852 | |||
853 | // sql insert | ||
854 | sql = @"INSERT INTO [regionwindlight] | ||
855 | ([region_id] | ||
856 | ,[water_color_r] | ||
857 | ,[water_color_g] | ||
858 | ,[water_color_b] | ||
859 | ,[water_fog_density_exponent] | ||
860 | ,[underwater_fog_modifier] | ||
861 | ,[reflection_wavelet_scale_1] | ||
862 | ,[reflection_wavelet_scale_2] | ||
863 | ,[reflection_wavelet_scale_3] | ||
864 | ,[fresnel_scale] | ||
865 | ,[fresnel_offset] | ||
866 | ,[refract_scale_above] | ||
867 | ,[refract_scale_below] | ||
868 | ,[blur_multiplier] | ||
869 | ,[big_wave_direction_x] | ||
870 | ,[big_wave_direction_y] | ||
871 | ,[little_wave_direction_x] | ||
872 | ,[little_wave_direction_y] | ||
873 | ,[normal_map_texture] | ||
874 | ,[horizon_r] | ||
875 | ,[horizon_g] | ||
876 | ,[horizon_b] | ||
877 | ,[horizon_i] | ||
878 | ,[haze_horizon] | ||
879 | ,[blue_density_r] | ||
880 | ,[blue_density_g] | ||
881 | ,[blue_density_b] | ||
882 | ,[blue_density_i] | ||
883 | ,[haze_density] | ||
884 | ,[density_multiplier] | ||
885 | ,[distance_multiplier] | ||
886 | ,[max_altitude] | ||
887 | ,[sun_moon_color_r] | ||
888 | ,[sun_moon_color_g] | ||
889 | ,[sun_moon_color_b] | ||
890 | ,[sun_moon_color_i] | ||
891 | ,[sun_moon_position] | ||
892 | ,[ambient_r] | ||
893 | ,[ambient_g] | ||
894 | ,[ambient_b] | ||
895 | ,[ambient_i] | ||
896 | ,[east_angle] | ||
897 | ,[sun_glow_focus] | ||
898 | ,[sun_glow_size] | ||
899 | ,[scene_gamma] | ||
900 | ,[star_brightness] | ||
901 | ,[cloud_color_r] | ||
902 | ,[cloud_color_g] | ||
903 | ,[cloud_color_b] | ||
904 | ,[cloud_color_i] | ||
905 | ,[cloud_x] | ||
906 | ,[cloud_y] | ||
907 | ,[cloud_density] | ||
908 | ,[cloud_coverage] | ||
909 | ,[cloud_scale] | ||
910 | ,[cloud_detail_x] | ||
911 | ,[cloud_detail_y] | ||
912 | ,[cloud_detail_density] | ||
913 | ,[cloud_scroll_x] | ||
914 | ,[cloud_scroll_x_lock] | ||
915 | ,[cloud_scroll_y] | ||
916 | ,[cloud_scroll_y_lock] | ||
917 | ,[draw_classic_clouds]) | ||
918 | VALUES | ||
919 | (@region_id | ||
920 | ,@water_color_r | ||
921 | ,@water_color_g | ||
922 | ,@water_color_b | ||
923 | ,@water_fog_density_exponent | ||
924 | ,@underwater_fog_modifier | ||
925 | ,@reflection_wavelet_scale_1 | ||
926 | ,@reflection_wavelet_scale_2 | ||
927 | ,@reflection_wavelet_scale_3 | ||
928 | ,@fresnel_scale | ||
929 | ,@fresnel_offset | ||
930 | ,@refract_scale_above | ||
931 | ,@refract_scale_below | ||
932 | ,@blur_multiplier | ||
933 | ,@big_wave_direction_x | ||
934 | ,@big_wave_direction_y | ||
935 | ,@little_wave_direction_x | ||
936 | ,@little_wave_direction_y | ||
937 | ,@normal_map_texture | ||
938 | ,@horizon_r | ||
939 | ,@horizon_g | ||
940 | ,@horizon_b | ||
941 | ,@horizon_i | ||
942 | ,@haze_horizon | ||
943 | ,@blue_density_r | ||
944 | ,@blue_density_g | ||
945 | ,@blue_density_b | ||
946 | ,@blue_density_i | ||
947 | ,@haze_density | ||
948 | ,@density_multiplier | ||
949 | ,@distance_multiplier | ||
950 | ,@max_altitude | ||
951 | ,@sun_moon_color_r | ||
952 | ,@sun_moon_color_g | ||
953 | ,@sun_moon_color_b | ||
954 | ,@sun_moon_color_i | ||
955 | ,@sun_moon_position | ||
956 | ,@ambient_r | ||
957 | ,@ambient_g | ||
958 | ,@ambient_b | ||
959 | ,@ambient_i | ||
960 | ,@east_angle | ||
961 | ,@sun_glow_focus | ||
962 | ,@sun_glow_size | ||
963 | ,@scene_gamma | ||
964 | ,@star_brightness | ||
965 | ,@cloud_color_r | ||
966 | ,@cloud_color_g | ||
967 | ,@cloud_color_b | ||
968 | ,@cloud_color_i | ||
969 | ,@cloud_x | ||
970 | ,@cloud_y | ||
971 | ,@cloud_density | ||
972 | ,@cloud_coverage | ||
973 | ,@cloud_scale | ||
974 | ,@cloud_detail_x | ||
975 | ,@cloud_detail_y | ||
976 | ,@cloud_detail_density | ||
977 | ,@cloud_scroll_x | ||
978 | ,@cloud_scroll_x_lock | ||
979 | ,@cloud_scroll_y | ||
980 | ,@cloud_scroll_y_lock | ||
981 | ,@draw_classic_clouds)"; | ||
982 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
983 | { | ||
984 | conn.Open(); | ||
985 | using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
986 | { | ||
987 | cmd.Parameters.Add(_Database.CreateParameter("region_id", wl.regionID)); | ||
988 | cmd.Parameters.Add(_Database.CreateParameter("water_color_r", wl.waterColor.X)); | ||
989 | cmd.Parameters.Add(_Database.CreateParameter("water_color_g", wl.waterColor.Y)); | ||
990 | cmd.Parameters.Add(_Database.CreateParameter("water_color_b", wl.waterColor.Z)); | ||
991 | cmd.Parameters.Add(_Database.CreateParameter("water_fog_density_exponent", wl.waterFogDensityExponent)); | ||
992 | cmd.Parameters.Add(_Database.CreateParameter("underwater_fog_modifier", wl.underwaterFogModifier)); | ||
993 | cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X)); | ||
994 | cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y)); | ||
995 | cmd.Parameters.Add(_Database.CreateParameter("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z)); | ||
996 | cmd.Parameters.Add(_Database.CreateParameter("fresnel_scale", wl.fresnelScale)); | ||
997 | cmd.Parameters.Add(_Database.CreateParameter("fresnel_offset", wl.fresnelOffset)); | ||
998 | cmd.Parameters.Add(_Database.CreateParameter("refract_scale_above", wl.refractScaleAbove)); | ||
999 | cmd.Parameters.Add(_Database.CreateParameter("refract_scale_below", wl.refractScaleBelow)); | ||
1000 | cmd.Parameters.Add(_Database.CreateParameter("blur_multiplier", wl.blurMultiplier)); | ||
1001 | cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_x", wl.bigWaveDirection.X)); | ||
1002 | cmd.Parameters.Add(_Database.CreateParameter("big_wave_direction_y", wl.bigWaveDirection.Y)); | ||
1003 | cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_x", wl.littleWaveDirection.X)); | ||
1004 | cmd.Parameters.Add(_Database.CreateParameter("little_wave_direction_y", wl.littleWaveDirection.Y)); | ||
1005 | cmd.Parameters.Add(_Database.CreateParameter("normal_map_texture", wl.normalMapTexture)); | ||
1006 | cmd.Parameters.Add(_Database.CreateParameter("horizon_r", wl.horizon.X)); | ||
1007 | cmd.Parameters.Add(_Database.CreateParameter("horizon_g", wl.horizon.Y)); | ||
1008 | cmd.Parameters.Add(_Database.CreateParameter("horizon_b", wl.horizon.Z)); | ||
1009 | cmd.Parameters.Add(_Database.CreateParameter("horizon_i", wl.horizon.W)); | ||
1010 | cmd.Parameters.Add(_Database.CreateParameter("haze_horizon", wl.hazeHorizon)); | ||
1011 | cmd.Parameters.Add(_Database.CreateParameter("blue_density_r", wl.blueDensity.X)); | ||
1012 | cmd.Parameters.Add(_Database.CreateParameter("blue_density_g", wl.blueDensity.Y)); | ||
1013 | cmd.Parameters.Add(_Database.CreateParameter("blue_density_b", wl.blueDensity.Z)); | ||
1014 | cmd.Parameters.Add(_Database.CreateParameter("blue_density_i", wl.blueDensity.W)); | ||
1015 | cmd.Parameters.Add(_Database.CreateParameter("haze_density", wl.hazeDensity)); | ||
1016 | cmd.Parameters.Add(_Database.CreateParameter("density_multiplier", wl.densityMultiplier)); | ||
1017 | cmd.Parameters.Add(_Database.CreateParameter("distance_multiplier", wl.distanceMultiplier)); | ||
1018 | cmd.Parameters.Add(_Database.CreateParameter("max_altitude", wl.maxAltitude)); | ||
1019 | cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_r", wl.sunMoonColor.X)); | ||
1020 | cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_g", wl.sunMoonColor.Y)); | ||
1021 | cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_b", wl.sunMoonColor.Z)); | ||
1022 | cmd.Parameters.Add(_Database.CreateParameter("sun_moon_color_i", wl.sunMoonColor.W)); | ||
1023 | cmd.Parameters.Add(_Database.CreateParameter("sun_moon_position", wl.sunMoonPosition)); | ||
1024 | cmd.Parameters.Add(_Database.CreateParameter("ambient_r", wl.ambient.X)); | ||
1025 | cmd.Parameters.Add(_Database.CreateParameter("ambient_g", wl.ambient.Y)); | ||
1026 | cmd.Parameters.Add(_Database.CreateParameter("ambient_b", wl.ambient.Z)); | ||
1027 | cmd.Parameters.Add(_Database.CreateParameter("ambient_i", wl.ambient.W)); | ||
1028 | cmd.Parameters.Add(_Database.CreateParameter("east_angle", wl.eastAngle)); | ||
1029 | cmd.Parameters.Add(_Database.CreateParameter("sun_glow_focus", wl.sunGlowFocus)); | ||
1030 | cmd.Parameters.Add(_Database.CreateParameter("sun_glow_size", wl.sunGlowSize)); | ||
1031 | cmd.Parameters.Add(_Database.CreateParameter("scene_gamma", wl.sceneGamma)); | ||
1032 | cmd.Parameters.Add(_Database.CreateParameter("star_brightness", wl.starBrightness)); | ||
1033 | cmd.Parameters.Add(_Database.CreateParameter("cloud_color_r", wl.cloudColor.X)); | ||
1034 | cmd.Parameters.Add(_Database.CreateParameter("cloud_color_g", wl.cloudColor.Y)); | ||
1035 | cmd.Parameters.Add(_Database.CreateParameter("cloud_color_b", wl.cloudColor.Z)); | ||
1036 | cmd.Parameters.Add(_Database.CreateParameter("cloud_color_i", wl.cloudColor.W)); | ||
1037 | cmd.Parameters.Add(_Database.CreateParameter("cloud_x", wl.cloudXYDensity.X)); | ||
1038 | cmd.Parameters.Add(_Database.CreateParameter("cloud_y", wl.cloudXYDensity.Y)); | ||
1039 | cmd.Parameters.Add(_Database.CreateParameter("cloud_density", wl.cloudXYDensity.Z)); | ||
1040 | cmd.Parameters.Add(_Database.CreateParameter("cloud_coverage", wl.cloudCoverage)); | ||
1041 | cmd.Parameters.Add(_Database.CreateParameter("cloud_scale", wl.cloudScale)); | ||
1042 | cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_x", wl.cloudDetailXYDensity.X)); | ||
1043 | cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_y", wl.cloudDetailXYDensity.Y)); | ||
1044 | cmd.Parameters.Add(_Database.CreateParameter("cloud_detail_density", wl.cloudDetailXYDensity.Z)); | ||
1045 | cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x", wl.cloudScrollX)); | ||
1046 | cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_x_lock", wl.cloudScrollXLock)); | ||
1047 | cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y", wl.cloudScrollY)); | ||
1048 | cmd.Parameters.Add(_Database.CreateParameter("cloud_scroll_y_lock", wl.cloudScrollYLock)); | ||
1049 | cmd.Parameters.Add(_Database.CreateParameter("draw_classic_clouds", wl.drawClassicClouds)); | ||
1050 | |||
1051 | cmd.ExecuteNonQuery(); | ||
1052 | } | ||
1053 | } | ||
1054 | #region update | ||
1055 | // } | ||
1056 | // else | ||
1057 | // { | ||
1058 | // // sql update | ||
1059 | // sql = @"UPDATE [OpenSim].[dbo].[regionwindlight] | ||
1060 | // SET [region_id] = @region_id | ||
1061 | // ,[water_color_r] = @water_color_r | ||
1062 | // ,[water_color_g] = @water_color_g | ||
1063 | // ,[water_color_b] = @water_color_b | ||
1064 | // ,[water_fog_density_exponent] = @water_fog_density_exponent | ||
1065 | // ,[underwater_fog_modifier] = @underwater_fog_modifier | ||
1066 | // ,[reflection_wavelet_scale_1] = @reflection_wavelet_scale_1 | ||
1067 | // ,[reflection_wavelet_scale_2] = @reflection_wavelet_scale_2 | ||
1068 | // ,[reflection_wavelet_scale_3] = @reflection_wavelet_scale_3 | ||
1069 | // ,[fresnel_scale] = @fresnel_scale | ||
1070 | // ,[fresnel_offset] = @fresnel_offset | ||
1071 | // ,[refract_scale_above] = @refract_scale_above | ||
1072 | // ,[refract_scale_below] = @refract_scale_below | ||
1073 | // ,[blur_multiplier] = @blur_multiplier | ||
1074 | // ,[big_wave_direction_x] = @big_wave_direction_x | ||
1075 | // ,[big_wave_direction_y] = @big_wave_direction_y | ||
1076 | // ,[little_wave_direction_x] = @little_wave_direction_x | ||
1077 | // ,[little_wave_direction_y] = @little_wave_direction_y | ||
1078 | // ,[normal_map_texture] = @normal_map_texture | ||
1079 | // ,[horizon_r] = @horizon_r | ||
1080 | // ,[horizon_g] = @horizon_g | ||
1081 | // ,[horizon_b] = @horizon_b | ||
1082 | // ,[horizon_i] = @horizon_i | ||
1083 | // ,[haze_horizon] = @haze_horizon | ||
1084 | // ,[blue_density_r] = @blue_density_r | ||
1085 | // ,[blue_density_g] = @blue_density_g | ||
1086 | // ,[blue_density_b] = @blue_density_b | ||
1087 | // ,[blue_density_i] = @blue_density_i | ||
1088 | // ,[haze_density] = @haze_density | ||
1089 | // ,[density_multiplier] = @density_multiplier | ||
1090 | // ,[distance_multiplier] = @distance_multiplier | ||
1091 | // ,[max_altitude] = @max_altitude | ||
1092 | // ,[sun_moon_color_r] = @sun_moon_color_r | ||
1093 | // ,[sun_moon_color_g] = @sun_moon_color_g | ||
1094 | // ,[sun_moon_color_b] = @sun_moon_color_b | ||
1095 | // ,[sun_moon_color_i] = @sun_moon_color_i | ||
1096 | // ,[sun_moon_position] = @sun_moon_position | ||
1097 | // ,[ambient_r] = @ambient_r | ||
1098 | // ,[ambient_g] = @ambient_g | ||
1099 | // ,[ambient_b] = @ambient_b | ||
1100 | // ,[ambient_i] = @ambient_i | ||
1101 | // ,[east_angle] = @east_angle | ||
1102 | // ,[sun_glow_focus] = @sun_glow_focus | ||
1103 | // ,[sun_glow_size] = @sun_glow_size | ||
1104 | // ,[scene_gamma] = @scene_gamma | ||
1105 | // ,[star_brightness] = @star_brightness | ||
1106 | // ,[cloud_color_r] = @cloud_color_r | ||
1107 | // ,[cloud_color_g] = @cloud_color_g | ||
1108 | // ,[cloud_color_b] = @cloud_color_b | ||
1109 | // ,[cloud_color_i] = @cloud_color_i | ||
1110 | // ,[cloud_x] = @cloud_x | ||
1111 | // ,[cloud_y] = @cloud_y | ||
1112 | // ,[cloud_density] = @cloud_density | ||
1113 | // ,[cloud_coverage] = @cloud_coverage | ||
1114 | // ,[cloud_scale] = @cloud_scale | ||
1115 | // ,[cloud_detail_x] = @cloud_detail_x | ||
1116 | // ,[cloud_detail_y] = @cloud_detail_y | ||
1117 | // ,[cloud_detail_density] = @cloud_detail_density | ||
1118 | // ,[cloud_scroll_x] = @cloud_scroll_x | ||
1119 | // ,[cloud_scroll_x_lock] = @cloud_scroll_x_lock | ||
1120 | // ,[cloud_scroll_y] = @cloud_scroll_y | ||
1121 | // ,[cloud_scroll_y_lock] = @cloud_scroll_y_lock | ||
1122 | // ,[draw_classic_clouds] = @draw_classic_clouds | ||
1123 | // WHERE region_id = @region_id"; | ||
1124 | // using (SqlConnection conn = new SqlConnection(m_connectionString)) | ||
1125 | // { | ||
1126 | // conn.Open(); | ||
1127 | // using (SqlCommand cmd = new SqlCommand(sql, conn)) | ||
1128 | // { | ||
1129 | // cmd.Parameters.AddWithValue("region_id", wl.regionID); | ||
1130 | // cmd.Parameters.AddWithValue("water_color_r", wl.waterColor.X); | ||
1131 | // cmd.Parameters.AddWithValue("water_color_g", wl.waterColor.Y); | ||
1132 | // cmd.Parameters.AddWithValue("water_color_b", wl.waterColor.Z); | ||
1133 | // cmd.Parameters.AddWithValue("water_fog_density_exponent", wl.waterFogDensityExponent); | ||
1134 | // cmd.Parameters.AddWithValue("underwater_fog_modifier", wl.underwaterFogModifier); | ||
1135 | // cmd.Parameters.AddWithValue("reflection_wavelet_scale_1", wl.reflectionWaveletScale.X); | ||
1136 | // cmd.Parameters.AddWithValue("reflection_wavelet_scale_2", wl.reflectionWaveletScale.Y); | ||
1137 | // cmd.Parameters.AddWithValue("reflection_wavelet_scale_3", wl.reflectionWaveletScale.Z); | ||
1138 | // cmd.Parameters.AddWithValue("fresnel_scale", wl.fresnelScale); | ||
1139 | // cmd.Parameters.AddWithValue("fresnel_offset", wl.fresnelOffset); | ||
1140 | // cmd.Parameters.AddWithValue("refract_scale_above", wl.refractScaleAbove); | ||
1141 | // cmd.Parameters.AddWithValue("refract_scale_below", wl.refractScaleBelow); | ||
1142 | // cmd.Parameters.AddWithValue("blur_multiplier", wl.blurMultiplier); | ||
1143 | // cmd.Parameters.AddWithValue("big_wave_direction_x", wl.bigWaveDirection.X); | ||
1144 | // cmd.Parameters.AddWithValue("big_wave_direction_y", wl.bigWaveDirection.Y); | ||
1145 | // cmd.Parameters.AddWithValue("little_wave_direction_x", wl.littleWaveDirection.X); | ||
1146 | // cmd.Parameters.AddWithValue("little_wave_direction_y", wl.littleWaveDirection.Y); | ||
1147 | // cmd.Parameters.AddWithValue("normal_map_texture", wl.normalMapTexture); | ||
1148 | // cmd.Parameters.AddWithValue("horizon_r", wl.horizon.X); | ||
1149 | // cmd.Parameters.AddWithValue("horizon_g", wl.horizon.Y); | ||
1150 | // cmd.Parameters.AddWithValue("horizon_b", wl.horizon.Z); | ||
1151 | // cmd.Parameters.AddWithValue("horizon_i", wl.horizon.W); | ||
1152 | // cmd.Parameters.AddWithValue("haze_horizon", wl.hazeHorizon); | ||
1153 | // cmd.Parameters.AddWithValue("blue_density_r", wl.blueDensity.X); | ||
1154 | // cmd.Parameters.AddWithValue("blue_density_g", wl.blueDensity.Y); | ||
1155 | // cmd.Parameters.AddWithValue("blue_density_b", wl.blueDensity.Z); | ||
1156 | // cmd.Parameters.AddWithValue("blue_density_i", wl.blueDensity.W); | ||
1157 | // cmd.Parameters.AddWithValue("haze_density", wl.hazeDensity); | ||
1158 | // cmd.Parameters.AddWithValue("density_multiplier", wl.densityMultiplier); | ||
1159 | // cmd.Parameters.AddWithValue("distance_multiplier", wl.distanceMultiplier); | ||
1160 | // cmd.Parameters.AddWithValue("max_altitude", wl.maxAltitude); | ||
1161 | // cmd.Parameters.AddWithValue("sun_moon_color_r", wl.sunMoonColor.X); | ||
1162 | // cmd.Parameters.AddWithValue("sun_moon_color_g", wl.sunMoonColor.Y); | ||
1163 | // cmd.Parameters.AddWithValue("sun_moon_color_b", wl.sunMoonColor.Z); | ||
1164 | // cmd.Parameters.AddWithValue("sun_moon_color_i", wl.sunMoonColor.W); | ||
1165 | // cmd.Parameters.AddWithValue("sun_moon_position", wl.sunMoonPosition); | ||
1166 | // cmd.Parameters.AddWithValue("ambient_r", wl.ambient.X); | ||
1167 | // cmd.Parameters.AddWithValue("ambient_g", wl.ambient.Y); | ||
1168 | // cmd.Parameters.AddWithValue("ambient_b", wl.ambient.Z); | ||
1169 | // cmd.Parameters.AddWithValue("ambient_i", wl.ambient.W); | ||
1170 | // cmd.Parameters.AddWithValue("east_angle", wl.eastAngle); | ||
1171 | // cmd.Parameters.AddWithValue("sun_glow_focus", wl.sunGlowFocus); | ||
1172 | // cmd.Parameters.AddWithValue("sun_glow_size", wl.sunGlowSize); | ||
1173 | // cmd.Parameters.AddWithValue("scene_gamma", wl.sceneGamma); | ||
1174 | // cmd.Parameters.AddWithValue("star_brightness", wl.starBrightness); | ||
1175 | // cmd.Parameters.AddWithValue("cloud_color_r", wl.cloudColor.X); | ||
1176 | // cmd.Parameters.AddWithValue("cloud_color_g", wl.cloudColor.Y); | ||
1177 | // cmd.Parameters.AddWithValue("cloud_color_b", wl.cloudColor.Z); | ||
1178 | // cmd.Parameters.AddWithValue("cloud_color_i", wl.cloudColor.W); | ||
1179 | // cmd.Parameters.AddWithValue("cloud_x", wl.cloudXYDensity.X); | ||
1180 | // cmd.Parameters.AddWithValue("cloud_y", wl.cloudXYDensity.Y); | ||
1181 | // cmd.Parameters.AddWithValue("cloud_density", wl.cloudXYDensity.Z); | ||
1182 | // cmd.Parameters.AddWithValue("cloud_coverage", wl.cloudCoverage); | ||
1183 | // cmd.Parameters.AddWithValue("cloud_scale", wl.cloudScale); | ||
1184 | // cmd.Parameters.AddWithValue("cloud_detail_x", wl.cloudDetailXYDensity.X); | ||
1185 | // cmd.Parameters.AddWithValue("cloud_detail_y", wl.cloudDetailXYDensity.Y); | ||
1186 | // cmd.Parameters.AddWithValue("cloud_detail_density", wl.cloudDetailXYDensity.Z); | ||
1187 | // cmd.Parameters.AddWithValue("cloud_scroll_x", wl.cloudScrollX); | ||
1188 | // cmd.Parameters.AddWithValue("cloud_scroll_x_lock", wl.cloudScrollXLock); | ||
1189 | // cmd.Parameters.AddWithValue("cloud_scroll_y", wl.cloudScrollY); | ||
1190 | // cmd.Parameters.AddWithValue("cloud_scroll_y_lock", wl.cloudScrollYLock); | ||
1191 | // cmd.Parameters.AddWithValue("draw_classic_clouds", wl.drawClassicClouds); | ||
1192 | |||
1193 | // cmd.ExecuteNonQuery(); | ||
1194 | // } | ||
1195 | // } | ||
1196 | // } | ||
1197 | #endregion | ||
713 | } | 1198 | } |
714 | /// <summary> | 1199 | /// <summary> |
715 | /// Loads the settings of a region. | 1200 | /// Loads the settings of a region. |
@@ -1136,7 +1621,7 @@ VALUES | |||
1136 | if (Convert.ToInt16(primRow["PassTouches"]) != 0) | 1621 | if (Convert.ToInt16(primRow["PassTouches"]) != 0) |
1137 | prim.PassTouches = true; | 1622 | prim.PassTouches = true; |
1138 | prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); | 1623 | prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); |
1139 | 1624 | ||
1140 | if (!(primRow["MediaURL"] is System.DBNull)) | 1625 | if (!(primRow["MediaURL"] is System.DBNull)) |
1141 | prim.MediaUrl = (string)primRow["MediaURL"]; | 1626 | prim.MediaUrl = (string)primRow["MediaURL"]; |
1142 | 1627 | ||
@@ -1192,11 +1677,11 @@ VALUES | |||
1192 | { | 1677 | { |
1193 | } | 1678 | } |
1194 | 1679 | ||
1195 | if (!(shapeRow["Media"] is System.DBNull) ) | 1680 | if (!(shapeRow["Media"] is System.DBNull)) |
1196 | { | 1681 | { |
1197 | baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); | 1682 | baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); |
1198 | } | 1683 | } |
1199 | 1684 | ||
1200 | 1685 | ||
1201 | return baseShape; | 1686 | return baseShape; |
1202 | } | 1687 | } |
@@ -1576,15 +2061,15 @@ VALUES | |||
1576 | parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams)); | 2061 | parameters.Add(_Database.CreateParameter("ExtraParams", s.ExtraParams)); |
1577 | parameters.Add(_Database.CreateParameter("State", s.State)); | 2062 | parameters.Add(_Database.CreateParameter("State", s.State)); |
1578 | 2063 | ||
1579 | if(null == s.Media ) | 2064 | if (null == s.Media) |
1580 | { | 2065 | { |
1581 | parameters.Add(_Database.CreateParameter("Media", DBNull.Value)); | 2066 | parameters.Add(_Database.CreateParameter("Media", DBNull.Value)); |
1582 | } | 2067 | } |
1583 | else | 2068 | else |
1584 | { | 2069 | { |
1585 | parameters.Add(_Database.CreateParameter("Media", s.Media.ToXml())); | 2070 | parameters.Add(_Database.CreateParameter("Media", s.Media.ToXml())); |
1586 | } | 2071 | } |
1587 | 2072 | ||
1588 | 2073 | ||
1589 | return parameters.ToArray(); | 2074 | return parameters.ToArray(); |
1590 | } | 2075 | } |