aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2013-01-31 20:16:45 +0000
committerMelanie2013-01-31 20:16:45 +0000
commite497cf6f046f962815a216335cc9a6f7f2d9924f (patch)
tree594872079760aab626dab1ad71eeca52cee7b10d /OpenSim/Region
parentMerge branch 'master' into careminster (diff)
parentMerge branch 'master' of git://opensimulator.org/git/opensim (diff)
downloadopensim-SC_OLD-e497cf6f046f962815a216335cc9a6f7f2d9924f.zip
opensim-SC_OLD-e497cf6f046f962815a216335cc9a6f7f2d9924f.tar.gz
opensim-SC_OLD-e497cf6f046f962815a216335cc9a6f7f2d9924f.tar.bz2
opensim-SC_OLD-e497cf6f046f962815a216335cc9a6f7f2d9924f.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs81
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs214
3 files changed, 173 insertions, 126 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs
index 4004135..b9786ae 100644
--- a/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs
+++ b/OpenSim/Region/CoreModules/Framework/InterfaceCommander/Command.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Region.Framework.Interfaces; 30using OpenSim.Region.Framework.Interfaces;
31using OpenMetaverse;
31 32
32namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander 33namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander
33{ 34{
@@ -152,6 +153,9 @@ namespace OpenSim.Region.CoreModules.Framework.InterfaceCommander
152 case "Boolean": 153 case "Boolean":
153 m_args[i].ArgumentValue = Boolean.Parse(arg.ToString()); 154 m_args[i].ArgumentValue = Boolean.Parse(arg.ToString());
154 break; 155 break;
156 case "UUID":
157 m_args[i].ArgumentValue = UUID.Parse(arg.ToString());
158 break;
155 default: 159 default:
156 Console.WriteLine("ERROR: Unknown desired type for argument " + m_args[i].Name + " on command " + m_name); 160 Console.WriteLine("ERROR: Unknown desired type for argument " + m_args[i].Name + " on command " + m_name);
157 break; 161 break;
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index 8a422b0..d412efc 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -77,42 +77,52 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
77 { 77 {
78 bool drawPrimVolume = true; 78 bool drawPrimVolume = true;
79 bool textureTerrain = false; 79 bool textureTerrain = false;
80 bool generateMaptiles = true;
81 Bitmap mapbmp;
80 82
81 try 83 try
82 { 84 {
83 IConfig startupConfig = m_config.Configs["Startup"]; 85 IConfig startupConfig = m_config.Configs["Startup"];
84 drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume); 86 drawPrimVolume = startupConfig.GetBoolean("DrawPrimOnMapTile", drawPrimVolume);
85 textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain); 87 textureTerrain = startupConfig.GetBoolean("TextureOnMapTile", textureTerrain);
88 generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", generateMaptiles);
86 } 89 }
87 catch 90 catch
88 { 91 {
89 m_log.Warn("[MAPTILE]: Failed to load StartupConfig"); 92 m_log.Warn("[MAPTILE]: Failed to load StartupConfig");
90 } 93 }
91 94
92 if (textureTerrain) 95 if (generateMaptiles)
93 { 96 {
94 terrainRenderer = new TexturedMapTileRenderer(); 97 if (textureTerrain)
95 } 98 {
96 else 99 terrainRenderer = new TexturedMapTileRenderer();
97 { 100 }
98 terrainRenderer = new ShadedMapTileRenderer(); 101 else
99 } 102 {
100 terrainRenderer.Initialise(m_scene, m_config); 103 terrainRenderer = new ShadedMapTileRenderer();
104 }
105
106 terrainRenderer.Initialise(m_scene, m_config);
101 107
102 Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb); 108 mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
103 //long t = System.Environment.TickCount; 109 //long t = System.Environment.TickCount;
104 //for (int i = 0; i < 10; ++i) { 110 //for (int i = 0; i < 10; ++i) {
105 terrainRenderer.TerrainToBitmap(mapbmp); 111 terrainRenderer.TerrainToBitmap(mapbmp);
106 //} 112 //}
107 //t = System.Environment.TickCount - t; 113 //t = System.Environment.TickCount - t;
108 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); 114 //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t);
109 115
110 116
111 if (drawPrimVolume) 117 if (drawPrimVolume)
118 {
119 DrawObjectVolume(m_scene, mapbmp);
120 }
121 }
122 else
112 { 123 {
113 DrawObjectVolume(m_scene, mapbmp); 124 mapbmp = fetchTexture(m_scene.RegionInfo.RegionSettings.TerrainImageID);
114 } 125 }
115
116 return mapbmp; 126 return mapbmp;
117 } 127 }
118 128
@@ -222,6 +232,41 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
222// } 232// }
223// } 233// }
224 234
235 private Bitmap fetchTexture(UUID id)
236 {
237 AssetBase asset = m_scene.AssetService.Get(id.ToString());
238 m_log.DebugFormat("[MAPTILE]: Fetched static texture {0}, found: {1}", id, asset != null);
239 if (asset == null) return null;
240
241 ManagedImage managedImage;
242 Image image;
243
244 try
245 {
246 if (OpenJPEG.DecodeToImage(asset.Data, out managedImage, out image))
247 return new Bitmap(image);
248 else
249 return null;
250 }
251 catch (DllNotFoundException)
252 {
253 m_log.ErrorFormat("[MAPTILE]: OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", id);
254
255 }
256 catch (IndexOutOfRangeException)
257 {
258 m_log.ErrorFormat("[MAPTILE]: OpenJpeg was unable to decode this. Asset Data is empty for {0}", id);
259
260 }
261 catch (Exception)
262 {
263 m_log.ErrorFormat("[MAPTILE]: OpenJpeg was unable to decode this. Asset Data is empty for {0}", id);
264
265 }
266 return null;
267
268 }
269
225 private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) 270 private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp)
226 { 271 {
227 int tc = 0; 272 int tc = 0;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0bed66e..40a57a4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -847,141 +847,139 @@ namespace OpenSim.Region.Framework.Scenes
847 847
848 // Region config overrides global config 848 // Region config overrides global config
849 // 849 //
850 try 850 if (m_config.Configs["Startup"] != null)
851 { 851 {
852 if (m_config.Configs["Startup"] != null) 852 IConfig startupConfig = m_config.Configs["Startup"];
853 {
854 IConfig startupConfig = m_config.Configs["Startup"];
855 853
856 StartDisabled = startupConfig.GetBoolean("StartDisabled", false); 854 StartDisabled = startupConfig.GetBoolean("StartDisabled", false);
857 855
858 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); 856 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
859 UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup); 857 UseBackup = startupConfig.GetBoolean("UseSceneBackup", UseBackup);
860 if (!UseBackup) 858 if (!UseBackup)
861 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName); 859 m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
862 860
863 //Animation states 861 //Animation states
864 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 862 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
865 863
866 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 864 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true);
867 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 865 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true);
868 866
869 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys); 867 m_minNonphys = startupConfig.GetFloat("NonPhysicalPrimMin", m_minNonphys);
870 if (RegionInfo.NonphysPrimMin > 0) 868 if (RegionInfo.NonphysPrimMin > 0)
871 { 869 {
872 m_minNonphys = RegionInfo.NonphysPrimMin; 870 m_minNonphys = RegionInfo.NonphysPrimMin;
873 } 871 }
874 872
875 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); 873 m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys);
876 if (RegionInfo.NonphysPrimMax > 0) 874 if (RegionInfo.NonphysPrimMax > 0)
877 { 875 {
878 m_maxNonphys = RegionInfo.NonphysPrimMax; 876 m_maxNonphys = RegionInfo.NonphysPrimMax;
879 } 877 }
880 878
881 m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); 879 m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys);
882 if (RegionInfo.PhysPrimMin > 0) 880 if (RegionInfo.PhysPrimMin > 0)
883 { 881 {
884 m_minPhys = RegionInfo.PhysPrimMin; 882 m_minPhys = RegionInfo.PhysPrimMin;
885 } 883 }
886 884
887 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); 885 m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys);
888 886
889 if (RegionInfo.PhysPrimMax > 0) 887 if (RegionInfo.PhysPrimMax > 0)
890 { 888 {
891 m_maxPhys = RegionInfo.PhysPrimMax; 889 m_maxPhys = RegionInfo.PhysPrimMax;
892 } 890 }
893 891
894 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); 892 m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity);
895 if (RegionInfo.LinksetCapacity > 0) 893 if (RegionInfo.LinksetCapacity > 0)
896 { 894 {
897 m_linksetCapacity = RegionInfo.LinksetCapacity; 895 m_linksetCapacity = RegionInfo.LinksetCapacity;
898 } 896 }
899 897
900 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); 898 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
901 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); 899 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
902 900
903 // Here, if clamping is requested in either global or 901 // Here, if clamping is requested in either global or
904 // local config, it will be used 902 // local config, it will be used
905 // 903 //
906 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize); 904 m_clampPrimSize = startupConfig.GetBoolean("ClampPrimSize", m_clampPrimSize);
907 if (RegionInfo.ClampPrimSize) 905 if (RegionInfo.ClampPrimSize)
906 {
907 m_clampPrimSize = true;
908 }
909
910 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete);
911 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
912 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
913 m_dontPersistBefore =
914 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
915 m_dontPersistBefore *= 10000000;
916 m_persistAfter =
917 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
918 m_persistAfter *= 10000000;
919
920 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
921 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
922
923 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
924 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
925 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
926
927 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
928 if (m_generateMaptiles)
929 {
930 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0);
931 if (maptileRefresh != 0)
908 { 932 {
909 m_clampPrimSize = true; 933 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
934 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
935 m_mapGenerationTimer.AutoReset = true;
936 m_mapGenerationTimer.Start();
910 } 937 }
938 }
939 else
940 {
941 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString());
942 UUID tileID;
911 943
912 m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete",m_useTrashOnDelete); 944 if ((tile!=UUID.Zero.ToString()) && UUID.TryParse(tile, out tileID))
913 m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries);
914 m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings);
915 m_dontPersistBefore =
916 startupConfig.GetLong("MinimumTimeBeforePersistenceConsidered", DEFAULT_MIN_TIME_FOR_PERSISTENCE);
917 m_dontPersistBefore *= 10000000;
918 m_persistAfter =
919 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
920 m_persistAfter *= 10000000;
921
922 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
923 m_log.InfoFormat("[SCENE]: Default script engine {0}", m_defaultScriptEngine);
924
925 m_strictAccessControl = startupConfig.GetBoolean("StrictAccessControl", m_strictAccessControl);
926 m_seeIntoBannedRegion = startupConfig.GetBoolean("SeeIntoBannedRegion", m_seeIntoBannedRegion);
927 CombineRegions = startupConfig.GetBoolean("CombineContiguousRegions", false);
928
929 m_generateMaptiles = startupConfig.GetBoolean("GenerateMaptiles", true);
930 if (m_generateMaptiles)
931 { 945 {
932 int maptileRefresh = startupConfig.GetInt("MaptileRefresh", 0); 946 RegionInfo.RegionSettings.TerrainImageID = tileID;
933 if (maptileRefresh != 0)
934 {
935 m_mapGenerationTimer.Interval = maptileRefresh * 1000;
936 m_mapGenerationTimer.Elapsed += RegenerateMaptileAndReregister;
937 m_mapGenerationTimer.AutoReset = true;
938 m_mapGenerationTimer.Start();
939 }
940 } 947 }
941 else 948 else
942 { 949 {
943 string tile = startupConfig.GetString("MaptileStaticUUID", UUID.Zero.ToString()); 950 RegionInfo.RegionSettings.TerrainImageID = RegionInfo.MaptileStaticUUID;
944 UUID tileID; 951 m_log.InfoFormat("[SCENE]: Region {0}, maptile set to {1}", RegionInfo.RegionName, RegionInfo.MaptileStaticUUID.ToString());
945
946 if (UUID.TryParse(tile, out tileID))
947 {
948 RegionInfo.RegionSettings.TerrainImageID = tileID;
949 }
950 } 952 }
953 }
951 954
952 string grant = startupConfig.GetString("AllowedClients", String.Empty); 955 string grant = startupConfig.GetString("AllowedClients", String.Empty);
953 if (grant.Length > 0) 956 if (grant.Length > 0)
957 {
958 foreach (string viewer in grant.Split(','))
954 { 959 {
955 foreach (string viewer in grant.Split(',')) 960 m_AllowedViewers.Add(viewer.Trim().ToLower());
956 {
957 m_AllowedViewers.Add(viewer.Trim().ToLower());
958 }
959 } 961 }
962 }
960 963
961 grant = startupConfig.GetString("BannedClients", String.Empty); 964 grant = startupConfig.GetString("BannedClients", String.Empty);
962 if (grant.Length > 0) 965 if (grant.Length > 0)
966 {
967 foreach (string viewer in grant.Split(','))
963 { 968 {
964 foreach (string viewer in grant.Split(',')) 969 m_BannedViewers.Add(viewer.Trim().ToLower());
965 {
966 m_BannedViewers.Add(viewer.Trim().ToLower());
967 }
968 } 970 }
969
970 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
971 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
972 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
973 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
974 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
975 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
976 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
977 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
978 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
979 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
980 } 971 }
981 } 972
982 catch (Exception e) 973 MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime);
983 { 974 m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup);
984 m_log.Error("[SCENE]: Failed to load StartupConfig: " + e.ToString()); 975 m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
976 m_update_entitymovement = startupConfig.GetInt( "UpdateEntityMovementEveryNFrames", m_update_entitymovement);
977 m_update_events = startupConfig.GetInt( "UpdateEventsEveryNFrames", m_update_events);
978 m_update_objects = startupConfig.GetInt( "UpdateObjectsEveryNFrames", m_update_objects);
979 m_update_physics = startupConfig.GetInt( "UpdatePhysicsEveryNFrames", m_update_physics);
980 m_update_presences = startupConfig.GetInt( "UpdateAgentsEveryNFrames", m_update_presences);
981 m_update_terrain = startupConfig.GetInt( "UpdateTerrainEveryNFrames", m_update_terrain);
982 m_update_temp_cleaning = startupConfig.GetInt( "UpdateTempCleaningEveryNFrames", m_update_temp_cleaning);
985 } 983 }
986 984
987 // FIXME: Ultimately this should be in a module. 985 // FIXME: Ultimately this should be in a module.