diff options
Diffstat (limited to 'OpenSim')
13 files changed, 499 insertions, 285 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 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2dcc9cb..7e51638 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -4525,7 +4525,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4525 | { | 4525 | { |
4526 | returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock(); | 4526 | returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock(); |
4527 | } | 4527 | } |
4528 | j = 0; | 4528 | j = 0; |
4529 | 4529 | ||
4530 | returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; | 4530 | returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; |
4531 | returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; | 4531 | returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; |
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 13b7498..3eedf49 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs | |||
@@ -186,63 +186,79 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
186 | public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, | 186 | public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, |
187 | string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face) | 187 | string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face) |
188 | { | 188 | { |
189 | if (RenderPlugins.ContainsKey(contentType)) | 189 | if (!RenderPlugins.ContainsKey(contentType)) |
190 | { | 190 | return UUID.Zero; |
191 | // If we want to reuse dynamic textures then we have to ignore any request from the caller to expire | ||
192 | // them. | ||
193 | if (ReuseTextures) | ||
194 | disp = disp & ~DISP_EXPIRE; | ||
195 | 191 | ||
196 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | 192 | Scene scene; |
197 | updater.SimUUID = simID; | 193 | RegisteredScenes.TryGetValue(simID, out scene); |
198 | updater.PrimID = primID; | ||
199 | updater.ContentType = contentType; | ||
200 | updater.BodyData = data; | ||
201 | updater.UpdateTimer = updateTimer; | ||
202 | updater.UpdaterID = UUID.Random(); | ||
203 | updater.Params = extraParams; | ||
204 | updater.BlendWithOldTexture = SetBlending; | ||
205 | updater.FrontAlpha = AlphaValue; | ||
206 | updater.Face = face; | ||
207 | updater.Url = "Local image"; | ||
208 | updater.Disp = disp; | ||
209 | 194 | ||
210 | object reusableTextureUUID = null; | 195 | if (scene == null) |
196 | return UUID.Zero; | ||
211 | 197 | ||
212 | if (ReuseTextures) | 198 | SceneObjectPart part = scene.GetSceneObjectPart(primID); |
213 | reusableTextureUUID | 199 | |
214 | = m_reuseableDynamicTextures.Get(GenerateReusableTextureKey(data, extraParams)); | 200 | if (part == null) |
201 | return UUID.Zero; | ||
202 | |||
203 | // If we want to reuse dynamic textures then we have to ignore any request from the caller to expire | ||
204 | // them. | ||
205 | if (ReuseTextures) | ||
206 | disp = disp & ~DISP_EXPIRE; | ||
207 | |||
208 | DynamicTextureUpdater updater = new DynamicTextureUpdater(); | ||
209 | updater.SimUUID = simID; | ||
210 | updater.PrimID = primID; | ||
211 | updater.ContentType = contentType; | ||
212 | updater.BodyData = data; | ||
213 | updater.UpdateTimer = updateTimer; | ||
214 | updater.UpdaterID = UUID.Random(); | ||
215 | updater.Params = extraParams; | ||
216 | updater.BlendWithOldTexture = SetBlending; | ||
217 | updater.FrontAlpha = AlphaValue; | ||
218 | updater.Face = face; | ||
219 | updater.Url = "Local image"; | ||
220 | updater.Disp = disp; | ||
221 | |||
222 | object objReusableTextureUUID = null; | ||
223 | |||
224 | if (ReuseTextures && !updater.BlendWithOldTexture) | ||
225 | { | ||
226 | string reuseableTextureKey = GenerateReusableTextureKey(data, extraParams); | ||
227 | objReusableTextureUUID = m_reuseableDynamicTextures.Get(reuseableTextureKey); | ||
215 | 228 | ||
216 | // We cannot reuse a dynamic texture if the data is going to be blended with something already there. | 229 | if (objReusableTextureUUID != null) |
217 | if (reusableTextureUUID == null || updater.BlendWithOldTexture) | ||
218 | { | 230 | { |
219 | lock (Updaters) | 231 | // If something else has removed this temporary asset from the cache, detect and invalidate |
232 | // our cached uuid. | ||
233 | if (scene.AssetService.GetMetadata(objReusableTextureUUID.ToString()) == null) | ||
220 | { | 234 | { |
221 | if (!Updaters.ContainsKey(updater.UpdaterID)) | 235 | m_reuseableDynamicTextures.Invalidate(reuseableTextureKey); |
222 | { | 236 | objReusableTextureUUID = null; |
223 | Updaters.Add(updater.UpdaterID, updater); | ||
224 | } | ||
225 | } | 237 | } |
226 | |||
227 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); | ||
228 | } | 238 | } |
229 | else | 239 | } |
240 | |||
241 | // We cannot reuse a dynamic texture if the data is going to be blended with something already there. | ||
242 | if (objReusableTextureUUID == null) | ||
243 | { | ||
244 | lock (Updaters) | ||
230 | { | 245 | { |
231 | // No need to add to updaters as the texture is always the same. Not that this functionality | 246 | if (!Updaters.ContainsKey(updater.UpdaterID)) |
232 | // apppears to be implemented anyway. | ||
233 | if (RegisteredScenes.ContainsKey(updater.SimUUID)) | ||
234 | { | 247 | { |
235 | SceneObjectPart part = RegisteredScenes[updater.SimUUID].GetSceneObjectPart(updater.PrimID); | 248 | Updaters.Add(updater.UpdaterID, updater); |
236 | |||
237 | if (part != null) | ||
238 | updater.UpdatePart(part, (UUID)reusableTextureUUID); | ||
239 | } | 249 | } |
240 | } | 250 | } |
241 | 251 | ||
242 | return updater.UpdaterID; | 252 | RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); |
243 | } | 253 | } |
244 | 254 | else | |
245 | return UUID.Zero; | 255 | { |
256 | // No need to add to updaters as the texture is always the same. Not that this functionality | ||
257 | // apppears to be implemented anyway. | ||
258 | updater.UpdatePart(part, (UUID)objReusableTextureUUID); | ||
259 | } | ||
260 | |||
261 | return updater.UpdaterID; | ||
246 | } | 262 | } |
247 | 263 | ||
248 | private string GenerateReusableTextureKey(string data, string extraParams) | 264 | private string GenerateReusableTextureKey(string data, string extraParams) |
@@ -267,6 +283,10 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
267 | 283 | ||
268 | public void Initialise(Scene scene, IConfigSource config) | 284 | public void Initialise(Scene scene, IConfigSource config) |
269 | { | 285 | { |
286 | IConfig texturesConfig = config.Configs["Textures"]; | ||
287 | if (texturesConfig != null) | ||
288 | ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false); | ||
289 | |||
270 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) | 290 | if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) |
271 | { | 291 | { |
272 | RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); | 292 | RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); |
@@ -276,7 +296,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture | |||
276 | 296 | ||
277 | public void PostInitialise() | 297 | public void PostInitialise() |
278 | { | 298 | { |
279 | // ReuseTextures = true; | ||
280 | if (ReuseTextures) | 299 | if (ReuseTextures) |
281 | { | 300 | { |
282 | m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); | 301 | m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index e0e358a..32a4c88 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -58,6 +58,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
58 | public string body; | 58 | public string body; |
59 | public int responseCode; | 59 | public int responseCode; |
60 | public string responseBody; | 60 | public string responseBody; |
61 | public string responseType = "text/plain"; | ||
61 | //public ManualResetEvent ev; | 62 | //public ManualResetEvent ev; |
62 | public bool requestDone; | 63 | public bool requestDone; |
63 | public int startTime; | 64 | public int startTime; |
@@ -270,6 +271,22 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
270 | } | 271 | } |
271 | } | 272 | } |
272 | 273 | ||
274 | public void HttpContentType(UUID request, string type) | ||
275 | { | ||
276 | lock (m_UrlMap) | ||
277 | { | ||
278 | if (m_RequestMap.ContainsKey(request)) | ||
279 | { | ||
280 | UrlData urlData = m_RequestMap[request]; | ||
281 | urlData.requests[request].responseType = type; | ||
282 | } | ||
283 | else | ||
284 | { | ||
285 | m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString()); | ||
286 | } | ||
287 | } | ||
288 | } | ||
289 | |||
273 | public void HttpResponse(UUID request, int status, string body) | 290 | public void HttpResponse(UUID request, int status, string body) |
274 | { | 291 | { |
275 | lock (m_RequestMap) | 292 | lock (m_RequestMap) |
diff --git a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs index 457444c..79e9f9d 100644 --- a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs | |||
@@ -39,6 +39,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
39 | UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); | 39 | UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); |
40 | void ReleaseURL(string url); | 40 | void ReleaseURL(string url); |
41 | void HttpResponse(UUID request, int status, string body); | 41 | void HttpResponse(UUID request, int status, string body); |
42 | void HttpContentType(UUID request, string type); | ||
43 | |||
42 | string GetHttpHeader(UUID request, string header); | 44 | string GetHttpHeader(UUID request, string header); |
43 | int GetFreeUrls(); | 45 | int GetFreeUrls(); |
44 | 46 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4335592..d528160 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -10903,31 +10903,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10903 | public LSL_Float llListStatistics(int operation, LSL_List src) | 10903 | public LSL_Float llListStatistics(int operation, LSL_List src) |
10904 | { | 10904 | { |
10905 | m_host.AddScriptLPS(1); | 10905 | m_host.AddScriptLPS(1); |
10906 | LSL_List nums = LSL_List.ToDoubleList(src); | ||
10907 | switch (operation) | 10906 | switch (operation) |
10908 | { | 10907 | { |
10909 | case ScriptBaseClass.LIST_STAT_RANGE: | 10908 | case ScriptBaseClass.LIST_STAT_RANGE: |
10910 | return nums.Range(); | 10909 | return src.Range(); |
10911 | case ScriptBaseClass.LIST_STAT_MIN: | 10910 | case ScriptBaseClass.LIST_STAT_MIN: |
10912 | return nums.Min(); | 10911 | return src.Min(); |
10913 | case ScriptBaseClass.LIST_STAT_MAX: | 10912 | case ScriptBaseClass.LIST_STAT_MAX: |
10914 | return nums.Max(); | 10913 | return src.Max(); |
10915 | case ScriptBaseClass.LIST_STAT_MEAN: | 10914 | case ScriptBaseClass.LIST_STAT_MEAN: |
10916 | return nums.Mean(); | 10915 | return src.Mean(); |
10917 | case ScriptBaseClass.LIST_STAT_MEDIAN: | 10916 | case ScriptBaseClass.LIST_STAT_MEDIAN: |
10918 | return nums.Median(); | 10917 | return LSL_List.ToDoubleList(src).Median(); |
10919 | case ScriptBaseClass.LIST_STAT_NUM_COUNT: | 10918 | case ScriptBaseClass.LIST_STAT_NUM_COUNT: |
10920 | return nums.NumericLength(); | 10919 | return src.NumericLength(); |
10921 | case ScriptBaseClass.LIST_STAT_STD_DEV: | 10920 | case ScriptBaseClass.LIST_STAT_STD_DEV: |
10922 | return nums.StdDev(); | 10921 | return src.StdDev(); |
10923 | case ScriptBaseClass.LIST_STAT_SUM: | 10922 | case ScriptBaseClass.LIST_STAT_SUM: |
10924 | return nums.Sum(); | 10923 | return src.Sum(); |
10925 | case ScriptBaseClass.LIST_STAT_SUM_SQUARES: | 10924 | case ScriptBaseClass.LIST_STAT_SUM_SQUARES: |
10926 | return nums.SumSqrs(); | 10925 | return src.SumSqrs(); |
10927 | case ScriptBaseClass.LIST_STAT_GEOMETRIC_MEAN: | 10926 | case ScriptBaseClass.LIST_STAT_GEOMETRIC_MEAN: |
10928 | return nums.GeometricMean(); | 10927 | return src.GeometricMean(); |
10929 | case ScriptBaseClass.LIST_STAT_HARMONIC_MEAN: | 10928 | case ScriptBaseClass.LIST_STAT_HARMONIC_MEAN: |
10930 | return nums.HarmonicMean(); | 10929 | return src.HarmonicMean(); |
10931 | default: | 10930 | default: |
10932 | return 0.0; | 10931 | return 0.0; |
10933 | } | 10932 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ceff889..7aacfd4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -141,6 +141,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
141 | internal bool m_debuggerSafe = false; | 141 | internal bool m_debuggerSafe = false; |
142 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); | 142 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); |
143 | 143 | ||
144 | protected IUrlModule m_UrlModule = null; | ||
145 | |||
144 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 146 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
145 | { | 147 | { |
146 | m_ScriptEngine = ScriptEngine; | 148 | m_ScriptEngine = ScriptEngine; |
@@ -148,6 +150,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
148 | m_item = item; | 150 | m_item = item; |
149 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); | 151 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); |
150 | 152 | ||
153 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | ||
154 | |||
151 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) | 155 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) |
152 | m_OSFunctionsEnabled = true; | 156 | m_OSFunctionsEnabled = true; |
153 | 157 | ||
@@ -3406,5 +3410,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3406 | 3410 | ||
3407 | return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); | 3411 | return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); |
3408 | } | 3412 | } |
3413 | |||
3414 | /// <summary> | ||
3415 | /// Sets the response type for an HTTP request/response | ||
3416 | /// </summary> | ||
3417 | /// <returns></returns> | ||
3418 | public void osSetContentType(LSL_Key id, string type) | ||
3419 | { | ||
3420 | CheckThreatLevel(ThreatLevel.High,"osSetResponseType"); | ||
3421 | if (m_UrlModule != null) | ||
3422 | m_UrlModule.HttpContentType(new UUID(id),type); | ||
3423 | } | ||
3409 | } | 3424 | } |
3410 | } | 3425 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index d0e041c..07149b6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -365,5 +365,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
365 | /// </summary> | 365 | /// </summary> |
366 | /// <returns>Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.</returns> | 366 | /// <returns>Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.</returns> |
367 | LSL_Key osGetRezzingObject(); | 367 | LSL_Key osGetRezzingObject(); |
368 | |||
369 | /// <summary> | ||
370 | /// Sets the response type for an HTTP request/response | ||
371 | /// </summary> | ||
372 | /// <returns></returns> | ||
373 | void osSetContentType(LSL_Key id, string type); | ||
368 | } | 374 | } |
369 | } | 375 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e9131e4..ba1ade2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -955,5 +955,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
955 | { | 955 | { |
956 | return m_OSSL_Functions.osGetRezzingObject(); | 956 | return m_OSSL_Functions.osGetRezzingObject(); |
957 | } | 957 | } |
958 | |||
959 | public void osSetContentType(LSL_Key id, string type) | ||
960 | { | ||
961 | m_OSSL_Functions.osSetContentType(id,type); | ||
962 | } | ||
958 | } | 963 | } |
959 | } | 964 | } |
diff --git a/OpenSim/Tests/Torture/NPCTortureTests.cs b/OpenSim/Tests/Performance/NPCPerformanceTests.cs index 731df68..627765b 100644 --- a/OpenSim/Tests/Torture/NPCTortureTests.cs +++ b/OpenSim/Tests/Performance/NPCPerformanceTests.cs | |||
@@ -47,10 +47,10 @@ using OpenSim.Services.AvatarService; | |||
47 | using OpenSim.Tests.Common; | 47 | using OpenSim.Tests.Common; |
48 | using OpenSim.Tests.Common.Mock; | 48 | using OpenSim.Tests.Common.Mock; |
49 | 49 | ||
50 | namespace OpenSim.Tests.Torture | 50 | namespace OpenSim.Tests.Performance |
51 | { | 51 | { |
52 | /// <summary> | 52 | /// <summary> |
53 | /// NPC torture tests | 53 | /// NPC performance tests |
54 | /// </summary> | 54 | /// </summary> |
55 | /// <remarks> | 55 | /// <remarks> |
56 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, | 56 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, |
@@ -58,7 +58,7 @@ namespace OpenSim.Tests.Torture | |||
58 | /// earlier tests. | 58 | /// earlier tests. |
59 | /// </remarks> | 59 | /// </remarks> |
60 | [TestFixture] | 60 | [TestFixture] |
61 | public class NPCTortureTests | 61 | public class NPCPerformanceTests |
62 | { | 62 | { |
63 | private TestScene scene; | 63 | private TestScene scene; |
64 | private AvatarFactoryModule afm; | 64 | private AvatarFactoryModule afm; |
diff --git a/OpenSim/Tests/Torture/ObjectTortureTests.cs b/OpenSim/Tests/Performance/ObjectPerformanceTests.cs index 195d47b..2264d86 100644 --- a/OpenSim/Tests/Torture/ObjectTortureTests.cs +++ b/OpenSim/Tests/Performance/ObjectPerformanceTests.cs | |||
@@ -36,10 +36,10 @@ using OpenSim.Region.Framework.Scenes; | |||
36 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | 37 | using OpenSim.Tests.Common.Mock; |
38 | 38 | ||
39 | namespace OpenSim.Tests.Torture | 39 | namespace OpenSim.Tests.Performance |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// Object torture tests | 42 | /// Object performance tests |
43 | /// </summary> | 43 | /// </summary> |
44 | /// <remarks> | 44 | /// <remarks> |
45 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, | 45 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, |
@@ -47,7 +47,7 @@ namespace OpenSim.Tests.Torture | |||
47 | /// earlier tests. | 47 | /// earlier tests. |
48 | /// </remarks> | 48 | /// </remarks> |
49 | [TestFixture] | 49 | [TestFixture] |
50 | public class ObjectTortureTests | 50 | public class ObjectPerformanceTests |
51 | { | 51 | { |
52 | [TearDown] | 52 | [TearDown] |
53 | public void TearDown() | 53 | public void TearDown() |
diff --git a/OpenSim/Tests/Torture/ScriptTortureTests.cs b/OpenSim/Tests/Performance/ScriptPerformanceTests.cs index 24f278f..d708abd 100644 --- a/OpenSim/Tests/Torture/ScriptTortureTests.cs +++ b/OpenSim/Tests/Performance/ScriptPerformanceTests.cs | |||
@@ -42,10 +42,10 @@ using OpenSim.Region.ScriptEngine.XEngine; | |||
42 | using OpenSim.Tests.Common; | 42 | using OpenSim.Tests.Common; |
43 | using OpenSim.Tests.Common.Mock; | 43 | using OpenSim.Tests.Common.Mock; |
44 | 44 | ||
45 | namespace OpenSim.Tests.Torture | 45 | namespace OpenSim.Tests.Performance |
46 | { | 46 | { |
47 | /// <summary> | 47 | /// <summary> |
48 | /// Script torture tests | 48 | /// Script performance tests |
49 | /// </summary> | 49 | /// </summary> |
50 | /// <remarks> | 50 | /// <remarks> |
51 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, | 51 | /// Don't rely on the numbers given by these tests - they will vary a lot depending on what is already cached, |
@@ -53,7 +53,7 @@ namespace OpenSim.Tests.Torture | |||
53 | /// earlier tests. | 53 | /// earlier tests. |
54 | /// </remarks> | 54 | /// </remarks> |
55 | [TestFixture] | 55 | [TestFixture] |
56 | public class ScriptTortureTests | 56 | public class ScriptPerformanceTests |
57 | { | 57 | { |
58 | private TestScene m_scene; | 58 | private TestScene m_scene; |
59 | private XEngine m_xEngine; | 59 | private XEngine m_xEngine; |
diff --git a/OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs b/OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs new file mode 100644 index 0000000..1f220c0 --- /dev/null +++ b/OpenSim/Tests/Stress/VectorRenderModuleStressTests.cs | |||
@@ -0,0 +1,132 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using System.Linq; | ||
32 | using System.Reflection; | ||
33 | using System.Threading; | ||
34 | using log4net.Config; | ||
35 | using NUnit.Framework; | ||
36 | using OpenMetaverse; | ||
37 | using OpenMetaverse.Assets; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Region.CoreModules.Scripting.DynamicTexture; | ||
40 | using OpenSim.Region.CoreModules.Scripting.VectorRender; | ||
41 | using OpenSim.Region.Framework.Scenes; | ||
42 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
43 | using OpenSim.Tests.Common; | ||
44 | using OpenSim.Tests.Common.Mock; | ||
45 | |||
46 | namespace OpenSim.Tests.Stress | ||
47 | { | ||
48 | [TestFixture] | ||
49 | public class VectorRenderModuleStressTests : OpenSimTestCase | ||
50 | { | ||
51 | public Scene Scene { get; private set; } | ||
52 | public DynamicTextureModule Dtm { get; private set; } | ||
53 | public VectorRenderModule Vrm { get; private set; } | ||
54 | |||
55 | private void SetupScene(bool reuseTextures) | ||
56 | { | ||
57 | Scene = new SceneHelpers().SetupScene(); | ||
58 | |||
59 | Dtm = new DynamicTextureModule(); | ||
60 | Dtm.ReuseTextures = reuseTextures; | ||
61 | |||
62 | Vrm = new VectorRenderModule(); | ||
63 | |||
64 | SceneHelpers.SetupSceneModules(Scene, Dtm, Vrm); | ||
65 | } | ||
66 | |||
67 | [Test] | ||
68 | public void TestConcurrentRepeatedDraw() | ||
69 | { | ||
70 | int threads = 4; | ||
71 | TestHelpers.InMethod(); | ||
72 | |||
73 | SetupScene(false); | ||
74 | |||
75 | List<Drawer> drawers = new List<Drawer>(); | ||
76 | |||
77 | for (int i = 0; i < threads; i++) | ||
78 | { | ||
79 | Drawer d = new Drawer(this, i); | ||
80 | drawers.Add(d); | ||
81 | Console.WriteLine("Starting drawer {0}", i); | ||
82 | Util.FireAndForget(o => d.Draw()); | ||
83 | } | ||
84 | |||
85 | Thread.Sleep(10 * 60 * 1000); | ||
86 | |||
87 | drawers.ForEach(d => d.Ready = false); | ||
88 | drawers.ForEach(d => Console.WriteLine("Drawer {0} drew {1} textures", d.Number, d.Pass + 1)); | ||
89 | } | ||
90 | |||
91 | class Drawer | ||
92 | { | ||
93 | public int Number { get; private set; } | ||
94 | public int Pass { get; private set; } | ||
95 | public bool Ready { get; set; } | ||
96 | |||
97 | private VectorRenderModuleStressTests m_tests; | ||
98 | |||
99 | public Drawer(VectorRenderModuleStressTests tests, int number) | ||
100 | { | ||
101 | m_tests = tests; | ||
102 | Number = number; | ||
103 | Ready = true; | ||
104 | } | ||
105 | |||
106 | public void Draw() | ||
107 | { | ||
108 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_tests.Scene); | ||
109 | |||
110 | while (Ready) | ||
111 | { | ||
112 | UUID originalTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | ||
113 | |||
114 | // Ensure unique text | ||
115 | string text = string.Format("{0:D2}{1}", Number, Pass); | ||
116 | |||
117 | m_tests.Dtm.AddDynamicTextureData( | ||
118 | m_tests.Scene.RegionInfo.RegionID, | ||
119 | so.UUID, | ||
120 | m_tests.Vrm.GetContentType(), | ||
121 | string.Format("PenColour BLACK; MoveTo 40,220; FontSize 32; Text {0};", text), | ||
122 | "", | ||
123 | 0); | ||
124 | |||
125 | Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | ||
126 | |||
127 | Pass++; | ||
128 | } | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | } \ No newline at end of file | ||