aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs47
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs34
-rw-r--r--OpenSim/Region/CoreModules/LightShare/LightShareModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs31
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs60
-rw-r--r--OpenSim/Region/Framework/Interfaces/ITerrain.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs44
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneViewer.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs6
-rw-r--r--OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml1
-rw-r--r--OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs122
-rw-r--r--OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs148
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs1
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs8
25 files changed, 457 insertions, 106 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
index e43f7cf..4cb4aee 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -139,28 +139,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP
139 private void ProcessQueues() 139 private void ProcessQueues()
140 { 140 {
141 // Process all the pending adds 141 // Process all the pending adds
142 OutgoingPacket pendingAdd;
143 while (m_pendingAdds.Dequeue(out pendingAdd))
144 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
145 142
143 OutgoingPacket pendingAdd;
144 if (m_pendingAdds != null)
145 {
146 while (m_pendingAdds.TryDequeue(out pendingAdd))
147 {
148 if (pendingAdd != null && m_packets != null)
149 {
150 m_packets[pendingAdd.SequenceNumber] = pendingAdd;
151 }
152 }
153 }
154
146 // Process all the pending removes, including updating statistics and round-trip times 155 // Process all the pending removes, including updating statistics and round-trip times
147 PendingAck pendingRemove; 156 PendingAck pendingRemove;
148 OutgoingPacket ackedPacket; 157 OutgoingPacket ackedPacket;
149 while (m_pendingRemoves.Dequeue(out pendingRemove)) 158 if (m_pendingRemoves != null)
150 { 159 {
151 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket)) 160 while (m_pendingRemoves.TryDequeue(out pendingRemove))
152 { 161 {
153 m_packets.Remove(pendingRemove.SequenceNumber); 162 if (m_pendingRemoves != null && m_packets != null)
154
155 // Update stats
156 System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
157
158 if (!pendingRemove.FromResend)
159 { 163 {
160 // Calculate the round-trip time for this packet and its ACK 164 if (m_packets.TryGetValue(pendingRemove.SequenceNumber, out ackedPacket))
161 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount; 165 {
162 if (rtt > 0) 166 m_packets.Remove(pendingRemove.SequenceNumber);
163 ackedPacket.Client.UpdateRoundTrip(rtt); 167
168 // Update stats
169 System.Threading.Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength);
170
171 if (!pendingRemove.FromResend)
172 {
173 // Calculate the round-trip time for this packet and its ACK
174 int rtt = pendingRemove.RemoveTime - ackedPacket.TickCount;
175 if (rtt > 0)
176 ackedPacket.Client.UpdateRoundTrip(rtt);
177 }
178 }
164 } 179 }
165 } 180 }
166 } 181 }
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 9eaa758..6ed4867 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -252,7 +252,7 @@ namespace Flotsam.RegionModules.AssetCache
252 } 252 }
253 else 253 else
254 { 254 {
255 m_MemoryCache.AddOrUpdate(key, asset, DateTime.MaxValue); 255 m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue);
256 } 256 }
257 } 257 }
258 } 258 }
@@ -863,4 +863,4 @@ namespace Flotsam.RegionModules.AssetCache
863 863
864 #endregion 864 #endregion
865 } 865 }
866} \ No newline at end of file 866}
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
index a3238df..97581e5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
@@ -187,8 +187,16 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
187 int start, end; 187 int start, end;
188 if (TryParseRange(range, out start, out end)) 188 if (TryParseRange(range, out start, out end))
189 { 189 {
190 end = Utils.Clamp(end, 1, texture.Data.Length - 1); 190 // Before clamping start make sure we can satisfy it in order to avoid
191 start = Utils.Clamp(start, 0, end - 1); 191 // sending back the last byte instead of an error status
192 if (start >= texture.Data.Length)
193 {
194 response.StatusCode = (int)System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
195 return;
196 }
197
198 end = Utils.Clamp(end, 0, texture.Data.Length - 1);
199 start = Utils.Clamp(start, 0, end);
192 int len = end - start + 1; 200 int len = end - start + 1;
193 201
194 //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID); 202 //m_log.Debug("Serving " + start + " to " + end + " of " + texture.Data.Length + " bytes for texture " + texture.ID);
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 28c50ab..457e0bb 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -307,7 +307,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
307 /// <param name="remoteClient"></param> 307 /// <param name="remoteClient"></param>
308 /// <param name="itemID"></param> 308 /// <param name="itemID"></param>
309 /// <param name="AttachmentPt"></param> 309 /// <param name="AttachmentPt"></param>
310 /// <returns></returns> 310 /// <returns></returns>
311 protected UUID ShowAttachInUserInventory( 311 protected UUID ShowAttachInUserInventory(
312 SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 312 SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
313 { 313 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index 7a21d5e..b3f0a25 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -318,12 +318,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
318 318
319 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID); 319 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
320 320
321 PresenceInfo presence = null; 321 PresenceInfo presence = null;
322 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); 322 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
323 if (presences != null && presences.Length > 0) 323 if (presences != null && presences.Length > 0)
324 presence = presences[0]; 324 presence = presences[0];
325 if (presence != null) 325 if (presence != null)
326 im.offline = 0; 326 im.offline = 0;
327 327
328 im.fromAgentID = fromAgentID.Guid; 328 im.fromAgentID = fromAgentID.Guid;
329 im.fromAgentName = account.FirstName + " " + account.LastName; 329 im.fromAgentName = account.FirstName + " " + account.LastName;
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index c1d6cd3..7a175ea 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -196,13 +196,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
196 // currently calls this with multiple items. 196 // currently calls this with multiple items.
197 UUID ret = UUID.Zero; 197 UUID ret = UUID.Zero;
198 198
199 Dictionary<UUID, List<SceneObjectGroup>> deletes =
200 new Dictionary<UUID, List<SceneObjectGroup>>();
201
199 foreach (SceneObjectGroup g in objectGroups) 202 foreach (SceneObjectGroup g in objectGroups)
200 ret = DeleteToInventory(action, folderID, g, remoteClient); 203 {
204 if (!deletes.ContainsKey(g.OwnerID))
205 deletes[g.OwnerID] = new List<SceneObjectGroup>();
206
207 deletes[g.OwnerID].Add(g);
208 }
209
210 foreach (List<SceneObjectGroup> objlist in deletes.Values)
211 {
212 foreach (SceneObjectGroup g in objlist)
213 ret = DeleteToInventory(action, folderID, g, remoteClient);
214 }
201 215
202 return ret; 216 return ret;
203 } 217 }
204 218
205 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, 219 private UUID DeleteToInventory(DeRezAction action, UUID folderID,
206 SceneObjectGroup objectGroup, IClientAPI remoteClient) 220 SceneObjectGroup objectGroup, IClientAPI remoteClient)
207 { 221 {
208 UUID assetID = UUID.Zero; 222 UUID assetID = UUID.Zero;
@@ -315,10 +329,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
315 } 329 }
316 else 330 else
317 { 331 {
318 // Catch all. Use lost & found 332 if (remoteClient == null ||
319 // 333 objectGroup.OwnerID != remoteClient.AgentId)
334 {
335 // Taking copy of another person's item. Take to
336 // Objects folder.
337 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object);
338 }
339 else
340 {
341 // Catch all. Use lost & found
342 //
320 343
321 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); 344 folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
345 }
322 } 346 }
323 } 347 }
324 348
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
index e6cab1d..412dbb6 100644
--- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
+++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
@@ -91,6 +91,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
91 m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; 91 m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent;
92 m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile; 92 m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile;
93 m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted; 93 m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted;
94 m_scene.LoadWindlightProfile();
94 } 95 }
95 96
96 InstallCommands(); 97 InstallCommands();
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index e85e4e9..df23eac 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -76,6 +76,8 @@
76 <RegionModule id="GridInfoServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.GridInfoServiceInConnectorModule" /> \ 76 <RegionModule id="GridInfoServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.GridInfoServiceInConnectorModule" /> \
77 <RegionModule id="AuthenticationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication.AuthenticationServiceInConnectorModule" /> 77 <RegionModule id="AuthenticationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Authentication.AuthenticationServiceInConnectorModule" />
78 <RegionModule id="AccessModule" type="OpenSim.Region.CoreModules.World.AccessModule" /> \ 78 <RegionModule id="AccessModule" type="OpenSim.Region.CoreModules.World.AccessModule" /> \
79 <RegionModule id="MapImageModule" type="OpenSim.Region.CoreModules.World.LegacyMap.MapImageModule" /> \
80 <RegionModule id="Warp3DImageModule" type="OpenSim.Region.CoreModules.World.Warp3DMap.Warp3DImageModule" /> \
79 81
80 </Extension> 82 </Extension>
81 83
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
index 7c12b8c..e7cfda1 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
@@ -53,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
53 public void Cache(UUID userID, UserAccount account) 53 public void Cache(UUID userID, UserAccount account)
54 { 54 {
55 // Cache even null accounts 55 // Cache even null accounts
56 m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); 56 m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS);
57 if (account != null) 57 if (account != null)
58 m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); 58 m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS);
59 59
60 m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); 60 m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
61 } 61 }
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index 9e6e366..f86c790 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
59 public face[] trns; 59 public face[] trns;
60 } 60 }
61 61
62 public class MapImageModule : IMapImageGenerator, IRegionModule 62 public class MapImageModule : IMapImageGenerator, INonSharedRegionModule
63 { 63 {
64 private static readonly ILog m_log = 64 private static readonly ILog m_log =
65 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 65 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -67,6 +67,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
67 private Scene m_scene; 67 private Scene m_scene;
68 private IConfigSource m_config; 68 private IConfigSource m_config;
69 private IMapTileTerrainRenderer terrainRenderer; 69 private IMapTileTerrainRenderer terrainRenderer;
70 private bool m_Enabled = false;
70 71
71 #region IMapImageGenerator Members 72 #region IMapImageGenerator Members
72 73
@@ -132,9 +133,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
132 133
133 #region IRegionModule Members 134 #region IRegionModule Members
134 135
135 public void Initialise(Scene scene, IConfigSource source) 136 public void Initialise(IConfigSource source)
136 { 137 {
137 m_scene = scene;
138 m_config = source; 138 m_config = source;
139 139
140 IConfig startupConfig = m_config.Configs["Startup"]; 140 IConfig startupConfig = m_config.Configs["Startup"];
@@ -142,10 +142,24 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
142 "MapImageModule") 142 "MapImageModule")
143 return; 143 return;
144 144
145 m_Enabled = true;
146 }
147
148 public void AddRegion(Scene scene)
149 {
150 if (!m_Enabled)
151 return;
152
153 m_scene = scene;
154
145 m_scene.RegisterModuleInterface<IMapImageGenerator>(this); 155 m_scene.RegisterModuleInterface<IMapImageGenerator>(this);
146 } 156 }
147 157
148 public void PostInitialise() 158 public void RegionLoaded(Scene scene)
159 {
160 }
161
162 public void RemoveRegion(Scene scene)
149 { 163 {
150 } 164 }
151 165
@@ -158,9 +172,9 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
158 get { return "MapImageModule"; } 172 get { return "MapImageModule"; }
159 } 173 }
160 174
161 public bool IsSharedModule 175 public Type ReplaceableInterface
162 { 176 {
163 get { return false; } 177 get { return null; }
164 } 178 }
165 179
166 #endregion 180 #endregion
@@ -545,5 +559,10 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
545 559
546 return returnpt; 560 return returnpt;
547 } 561 }
562
563 public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures)
564 {
565 return null;
566 }
548 } 567 }
549} 568}
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
index a99b20c..00b506e 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs
@@ -49,7 +49,7 @@ using WarpRenderer = global::Warp3D.Warp3D;
49 49
50namespace OpenSim.Region.CoreModules.World.Warp3DMap 50namespace OpenSim.Region.CoreModules.World.Warp3DMap
51{ 51{
52 public class Warp3DImageModule : IMapImageGenerator, IRegionModule 52 public class Warp3DImageModule : IMapImageGenerator, INonSharedRegionModule
53 { 53 {
54 private static readonly UUID TEXTURE_METADATA_MAGIC = new UUID("802dc0e0-f080-4931-8b57-d1be8611c4f3"); 54 private static readonly UUID TEXTURE_METADATA_MAGIC = new UUID("802dc0e0-f080-4931-8b57-d1be8611c4f3");
55 private static readonly Color4 WATER_COLOR = new Color4(29, 71, 95, 216); 55 private static readonly Color4 WATER_COLOR = new Color4(29, 71, 95, 216);
@@ -62,18 +62,28 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
62 private IConfigSource m_config; 62 private IConfigSource m_config;
63 private Dictionary<UUID, Color4> m_colors = new Dictionary<UUID, Color4>(); 63 private Dictionary<UUID, Color4> m_colors = new Dictionary<UUID, Color4>();
64 private bool m_useAntiAliasing = true; // TODO: Make this a config option 64 private bool m_useAntiAliasing = true; // TODO: Make this a config option
65 private bool m_Enabled = false;
65 66
66 #region IRegionModule Members 67 #region IRegionModule Members
67 68
68 public void Initialise(Scene scene, IConfigSource source) 69 public void Initialise(IConfigSource source)
69 { 70 {
70 m_scene = scene;
71 m_config = source; 71 m_config = source;
72 72
73 IConfig startupConfig = m_config.Configs["Startup"]; 73 IConfig startupConfig = m_config.Configs["Startup"];
74 if (startupConfig.GetString("MapImageModule", "MapImageModule") != "Warp3DImageModule") 74 if (startupConfig.GetString("MapImageModule", "MapImageModule") != "Warp3DImageModule")
75 return; 75 return;
76 76
77 m_Enabled = true;
78 }
79
80 public void AddRegion(Scene scene)
81 {
82 if (!m_Enabled)
83 return;
84
85 m_scene = scene;
86
77 List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); 87 List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory());
78 if (renderers.Count > 0) 88 if (renderers.Count > 0)
79 { 89 {
@@ -88,7 +98,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
88 m_scene.RegisterModuleInterface<IMapImageGenerator>(this); 98 m_scene.RegisterModuleInterface<IMapImageGenerator>(this);
89 } 99 }
90 100
91 public void PostInitialise() 101 public void RegionLoaded(Scene scene)
102 {
103 }
104
105 public void RemoveRegion(Scene scene)
92 { 106 {
93 } 107 }
94 108
@@ -101,9 +115,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
101 get { return "Warp3DImageModule"; } 115 get { return "Warp3DImageModule"; }
102 } 116 }
103 117
104 public bool IsSharedModule 118 public Type ReplaceableInterface
105 { 119 {
106 get { return false; } 120 get { return null; }
107 } 121 }
108 122
109 #endregion 123 #endregion
@@ -112,6 +126,19 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
112 126
113 public Bitmap CreateMapTile() 127 public Bitmap CreateMapTile()
114 { 128 {
129 Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f);
130 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)Constants.RegionSize, (int)Constants.RegionSize, (float)Constants.RegionSize, (float)Constants.RegionSize);
131 return CreateMapTile(viewport, false);
132 }
133
134 public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures)
135 {
136 Viewport viewport = new Viewport(camPos, camDir, fov, (float)Constants.RegionSize, 0.1f, width, height);
137 return CreateMapTile(viewport, useTextures);
138 }
139
140 public Bitmap CreateMapTile(Viewport viewport, bool useTextures)
141 {
115 bool drawPrimVolume = true; 142 bool drawPrimVolume = true;
116 bool textureTerrain = true; 143 bool textureTerrain = true;
117 144
@@ -128,9 +155,6 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
128 155
129 m_colors.Clear(); 156 m_colors.Clear();
130 157
131 Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f);
132 Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)Constants.RegionSize, (int)Constants.RegionSize, (float)Constants.RegionSize, (float)Constants.RegionSize);
133
134 int width = viewport.Width; 158 int width = viewport.Width;
135 int height = viewport.Height; 159 int height = viewport.Height;
136 160
@@ -174,7 +198,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
174 CreateWater(renderer); 198 CreateWater(renderer);
175 CreateTerrain(renderer, textureTerrain); 199 CreateTerrain(renderer, textureTerrain);
176 if (drawPrimVolume) 200 if (drawPrimVolume)
177 CreateAllPrims(renderer); 201 CreateAllPrims(renderer, useTextures);
178 202
179 renderer.Render(); 203 renderer.Render();
180 Bitmap bitmap = renderer.Scene.getImage(); 204 Bitmap bitmap = renderer.Scene.getImage();
@@ -301,7 +325,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
301 renderer.SetObjectMaterial("Terrain", "TerrainColor"); 325 renderer.SetObjectMaterial("Terrain", "TerrainColor");
302 } 326 }
303 327
304 private void CreateAllPrims(WarpRenderer renderer) 328 private void CreateAllPrims(WarpRenderer renderer, bool useTextures)
305 { 329 {
306 if (m_primMesher == null) 330 if (m_primMesher == null)
307 return; 331 return;
@@ -309,14 +333,15 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
309 m_scene.ForEachSOG( 333 m_scene.ForEachSOG(
310 delegate(SceneObjectGroup group) 334 delegate(SceneObjectGroup group)
311 { 335 {
312 CreatePrim(renderer, group.RootPart); 336 CreatePrim(renderer, group.RootPart, useTextures);
313 foreach (SceneObjectPart child in group.Parts) 337 foreach (SceneObjectPart child in group.Parts)
314 CreatePrim(renderer, child); 338 CreatePrim(renderer, child, useTextures);
315 } 339 }
316 ); 340 );
317 } 341 }
318 342
319 private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim) 343 private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim,
344 bool useTextures)
320 { 345 {
321 const float MIN_SIZE = 2f; 346 const float MIN_SIZE = 2f;
322 347
@@ -347,11 +372,18 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
347 string primID = prim.UUID.ToString(); 372 string primID = prim.UUID.ToString();
348 373
349 // Create the prim faces 374 // Create the prim faces
375 // TODO: Implement the useTextures flag behavior
350 for (int i = 0; i < renderMesh.Faces.Count; i++) 376 for (int i = 0; i < renderMesh.Faces.Count; i++)
351 { 377 {
352 Face face = renderMesh.Faces[i]; 378 Face face = renderMesh.Faces[i];
353 string meshName = primID + "-Face-" + i.ToString(); 379 string meshName = primID + "-Face-" + i.ToString();
354 380
381 // Avoid adding duplicate meshes to the scene
382 if (renderer.Scene.objectData.ContainsKey(meshName))
383 {
384 continue;
385 }
386
355 warp_Object faceObj = new warp_Object(face.Vertices.Count, face.Indices.Count / 3); 387 warp_Object faceObj = new warp_Object(face.Vertices.Count, face.Indices.Count / 3);
356 388
357 for (int j = 0; j < face.Vertices.Count; j++) 389 for (int j = 0; j < face.Vertices.Count; j++)
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrain.cs b/OpenSim/Region/Framework/Interfaces/ITerrain.cs
index 8aacb35..815a2d8 100644
--- a/OpenSim/Region/Framework/Interfaces/ITerrain.cs
+++ b/OpenSim/Region/Framework/Interfaces/ITerrain.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using OpenSim.Framework; 28using OpenSim.Framework;
29using OpenMetaverse;
29 30
30namespace OpenSim.Region.Framework.Interfaces 31namespace OpenSim.Region.Framework.Interfaces
31{ 32{
@@ -74,6 +75,7 @@ namespace OpenSim.Region.Framework.Interfaces
74 public interface IMapImageGenerator 75 public interface IMapImageGenerator
75 { 76 {
76 System.Drawing.Bitmap CreateMapTile(); 77 System.Drawing.Bitmap CreateMapTile();
78 System.Drawing.Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures);
77 byte[] WriteJpeg2000Image(); 79 byte[] WriteJpeg2000Image();
78 } 80 }
79} 81}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 1bf6b87..4cc797b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1689,37 +1689,6 @@ namespace OpenSim.Region.Framework.Scenes
1689 } 1689 }
1690 } 1690 }
1691 1691
1692 /// <summary>
1693 /// Called when one or more objects are removed from the environment into inventory.
1694 /// </summary>
1695 /// <param name="remoteClient"></param>
1696 /// <param name="localID"></param>
1697 /// <param name="groupID"></param>
1698 /// <param name="action"></param>
1699 /// <param name="destinationID"></param>
1700 public virtual void DeRezObject(IClientAPI remoteClient, List<uint> localIDs,
1701 UUID groupID, DeRezAction action, UUID destinationID)
1702 {
1703 foreach (uint localID in localIDs)
1704 {
1705 DeRezObject(remoteClient, localID, groupID, action, destinationID);
1706 }
1707 }
1708
1709 /// <summary>
1710 /// Called when an object is removed from the environment into inventory.
1711 /// </summary>
1712 /// <param name="remoteClient"></param>
1713 /// <param name="localID"></param>
1714 /// <param name="groupID"></param>
1715 /// <param name="action"></param>
1716 /// <param name="destinationID"></param>
1717 public virtual void DeRezObject(IClientAPI remoteClient, uint localID,
1718 UUID groupID, DeRezAction action, UUID destinationID)
1719 {
1720 DeRezObjects(remoteClient, new List<uint>() { localID }, groupID, action, destinationID);
1721 }
1722
1723 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs, 1692 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs,
1724 UUID groupID, DeRezAction action, UUID destinationID) 1693 UUID groupID, DeRezAction action, UUID destinationID)
1725 { 1694 {
@@ -1990,14 +1959,19 @@ namespace OpenSim.Region.Framework.Scenes
1990 return group; 1959 return group;
1991 } 1960 }
1992 1961
1993 public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId) 1962 public virtual bool returnObjects(SceneObjectGroup[] returnobjects,
1963 UUID AgentId)
1994 { 1964 {
1965 List<uint> localIDs = new List<uint>();
1966
1995 foreach (SceneObjectGroup grp in returnobjects) 1967 foreach (SceneObjectGroup grp in returnobjects)
1996 { 1968 {
1997 AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); 1969 AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition,
1998 DeRezObject(null, grp.RootPart.LocalId, 1970 "parcel owner return");
1999 grp.RootPart.GroupID, DeRezAction.Return, UUID.Zero); 1971 localIDs.Add(grp.RootPart.LocalId);
2000 } 1972 }
1973 DeRezObjects(null, localIDs, UUID.Zero, DeRezAction.Return,
1974 UUID.Zero);
2001 1975
2002 return true; 1976 return true;
2003 } 1977 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index fe0ab5b..0cfc235 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2735,7 +2735,7 @@ namespace OpenSim.Region.Framework.Scenes
2735 client.OnGrabUpdate += m_sceneGraph.MoveObject; 2735 client.OnGrabUpdate += m_sceneGraph.MoveObject;
2736 client.OnSpinStart += m_sceneGraph.SpinStart; 2736 client.OnSpinStart += m_sceneGraph.SpinStart;
2737 client.OnSpinUpdate += m_sceneGraph.SpinObject; 2737 client.OnSpinUpdate += m_sceneGraph.SpinObject;
2738 client.OnDeRezObject += DeRezObject; 2738 client.OnDeRezObject += DeRezObjects;
2739 2739
2740 client.OnObjectName += m_sceneGraph.PrimName; 2740 client.OnObjectName += m_sceneGraph.PrimName;
2741 client.OnObjectClickAction += m_sceneGraph.PrimClickAction; 2741 client.OnObjectClickAction += m_sceneGraph.PrimClickAction;
@@ -2864,7 +2864,7 @@ namespace OpenSim.Region.Framework.Scenes
2864 client.OnGrabUpdate -= m_sceneGraph.MoveObject; 2864 client.OnGrabUpdate -= m_sceneGraph.MoveObject;
2865 client.OnSpinStart -= m_sceneGraph.SpinStart; 2865 client.OnSpinStart -= m_sceneGraph.SpinStart;
2866 client.OnSpinUpdate -= m_sceneGraph.SpinObject; 2866 client.OnSpinUpdate -= m_sceneGraph.SpinObject;
2867 client.OnDeRezObject -= DeRezObject; 2867 client.OnDeRezObject -= DeRezObjects;
2868 client.OnObjectName -= m_sceneGraph.PrimName; 2868 client.OnObjectName -= m_sceneGraph.PrimName;
2869 client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; 2869 client.OnObjectClickAction -= m_sceneGraph.PrimClickAction;
2870 client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; 2870 client.OnObjectMaterial -= m_sceneGraph.PrimMaterial;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 5513584..5f00f84 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1304,8 +1304,8 @@ namespace OpenSim.Region.Framework.Scenes
1304 DetachFromBackup(); 1304 DetachFromBackup();
1305 m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString()); 1305 m_log.InfoFormat("[SCENE]: Returning object {0} due to parcel auto return", RootPart.UUID.ToString());
1306 m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return"); 1306 m_scene.AddReturn(OwnerID, Name, AbsolutePosition, "parcel auto return");
1307 m_scene.DeRezObject(null, RootPart.LocalId, 1307 m_scene.DeRezObjects(null, new List<uint>() { RootPart.LocalId }, UUID.Zero,
1308 RootPart.GroupID, DeRezAction.Return, UUID.Zero); 1308 DeRezAction.Return, UUID.Zero);
1309 1309
1310 return; 1310 return;
1311 } 1311 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index a8e76e3..8140d42 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2763,7 +2763,7 @@ namespace OpenSim.Region.Framework.Scenes
2763 UUID = UUID.Random(); 2763 UUID = UUID.Random();
2764 LinkNum = linkNum; 2764 LinkNum = linkNum;
2765 LocalId = 0; 2765 LocalId = 0;
2766 Inventory.ResetInventoryIDs(); 2766 Inventory.ResetInventoryIDs();
2767 } 2767 }
2768 2768
2769 /// <summary> 2769 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a4533fa..13d9964 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1523,7 +1523,7 @@ namespace OpenSim.Region.Framework.Scenes
1523 } 1523 }
1524 1524
1525 // If the agent update does move the avatar, then calculate the force ready for the velocity update, 1525 // If the agent update does move the avatar, then calculate the force ready for the velocity update,
1526 // which occurs later in the main scene loop 1526 // which occurs later in the main scene loop
1527 if (update_movementflag || (update_rotation && DCFlagKeyPressed)) 1527 if (update_movementflag || (update_rotation && DCFlagKeyPressed))
1528 { 1528 {
1529 // m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed)); 1529 // m_log.DebugFormat("{0} {1}", update_movementflag, (update_rotation && DCFlagKeyPressed));
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index b45291f..b44a010 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -179,11 +179,13 @@ namespace OpenSim.Region.Framework.Scenes
179 179
180 public void Reset() 180 public void Reset()
181 { 181 {
182 if (m_pendingObjects != null) 182 if (m_pendingObjects == null)
183 return;
184
185 lock (m_pendingObjects)
183 { 186 {
184 lock (m_pendingObjects) 187 if (m_pendingObjects != null)
185 { 188 {
186
187 m_pendingObjects.Clear(); 189 m_pendingObjects.Clear();
188 m_pendingObjects = null; 190 m_pendingObjects = null;
189 } 191 }
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index e6ff0c0..4969b09 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -142,7 +142,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
142 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 142 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene);
143 143
144 IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); 144 IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId);
145 scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero); 145 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
146 146
147 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 147 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
148 148
@@ -210,7 +210,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
210 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 210 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
211 { Name = childPartName, UUID = childPartUuid }; 211 { Name = childPartName, UUID = childPartUuid };
212 212
213 SceneObjectGroup sog = new SceneObjectGroup(rootPart); 213 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
214 sog.AddPart(linkPart); 214 sog.AddPart(linkPart);
215 215
216 Assert.That(sog.UUID, Is.EqualTo(rootPartUuid)); 216 Assert.That(sog.UUID, Is.EqualTo(rootPartUuid));
@@ -221,7 +221,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
221 sog.UUID = newRootPartUuid; 221 sog.UUID = newRootPartUuid;
222 222
223 Assert.That(sog.UUID, Is.EqualTo(newRootPartUuid)); 223 Assert.That(sog.UUID, Is.EqualTo(newRootPartUuid));
224 Assert.That(sog.RootPart.UUID, Is.EqualTo(newRootPartUuid)); 224 Assert.That(sog.RootPart.UUID, Is.EqualTo(newRootPartUuid));
225 Assert.That(sog.Parts.Length, Is.EqualTo(2)); 225 Assert.That(sog.Parts.Length, Is.EqualTo(2));
226 } 226 }
227 } 227 }
diff --git a/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml b/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml
index 352052a..5eea286 100644
--- a/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml
+++ b/OpenSim/Region/OptionalModules/Resources/OptionalModules.addin.xml
@@ -12,5 +12,6 @@
12 <RegionModule id="IRCBridge" type="OpenSim.Region.OptionalModules.Avatar.Chat.IRCBridgeModule" /> 12 <RegionModule id="IRCBridge" type="OpenSim.Region.OptionalModules.Avatar.Chat.IRCBridgeModule" />
13 <RegionModule id="Concierge" type="OpenSim.Region.OptionalModules.Avatar.Concierge.ConciergeModule" /> 13 <RegionModule id="Concierge" type="OpenSim.Region.OptionalModules.Avatar.Concierge.ConciergeModule" />
14 <RegionModule id="VivoxVoice" type="OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice.VivoxVoiceModule" /> 14 <RegionModule id="VivoxVoice" type="OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice.VivoxVoiceModule" />
15 <RegionModule id="WorldViewModule" type="OpenSim.Region.OptionalModules.World.WorldView.WorldViewModule" />
15 </Extension> 16 </Extension>
16</Addin> 17</Addin>
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
index e42dbf2..7e1b5ac 100644
--- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
+++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
@@ -812,7 +812,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
812 // gets the object data. If the data sent by the client doesn't match the object, the viewer probably has an 812 // gets the object data. If the data sent by the client doesn't match the object, the viewer probably has an
813 // old idea of what the object properties are. Viewer developer Hazim informed us that the base module 813 // old idea of what the object properties are. Viewer developer Hazim informed us that the base module
814 // didn't check the client sent data against the object do any. Since the base modules are the 814 // didn't check the client sent data against the object do any. Since the base modules are the
815 // 'crowning glory' examples of good practice.. 815 // 'crowning glory' examples of good practice..
816 816
817 // Validate that the object exists in the scene the user is in 817 // Validate that the object exists in the scene the user is in
818 SceneObjectPart part = s.GetSceneObjectPart(localID); 818 SceneObjectPart part = s.GetSceneObjectPart(localID);
diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs
new file mode 100644
index 0000000..d4b7020
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs
@@ -0,0 +1,122 @@
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
28using System;
29using System.Collections.Generic;
30using System.Drawing;
31using System.Drawing.Imaging;
32using System.Reflection;
33using System.IO;
34using log4net;
35using Nini.Config;
36using OpenMetaverse;
37using OpenMetaverse.Imaging;
38using OpenSim.Framework;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Server.Base;
42using OpenSim.Framework.Servers.HttpServer;
43using OpenSim.Services.Interfaces;
44
45namespace OpenSim.Region.OptionalModules.World.WorldView
46{
47 public class WorldViewModule : INonSharedRegionModule
48 {
49 private static readonly ILog m_log =
50 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
52
53 private bool m_Enabled = false;
54 private IMapImageGenerator m_Generator;
55
56 public void Initialise(IConfigSource config)
57 {
58 IConfig moduleConfig = config.Configs["Modules"];
59 if (moduleConfig == null)
60 return;
61
62 if (moduleConfig.GetString("WorldViewModule", String.Empty) != Name)
63 return;
64
65 m_Enabled = true;
66 }
67
68 public void AddRegion(Scene scene)
69 {
70 }
71
72 public void RegionLoaded(Scene scene)
73 {
74 m_Generator = scene.RequestModuleInterface<IMapImageGenerator>();
75 if (m_Generator == null)
76 {
77 m_Enabled = false;
78 return;
79 }
80
81 m_log.Info("[WORLDVIEW]: Configured and enabled");
82
83 IHttpServer server = MainServer.GetHttpServer(0);
84 server.AddStreamHandler(new WorldViewRequestHandler(this,
85 scene.RegionInfo.RegionID.ToString()));
86 }
87
88 public void RemoveRegion(Scene scene)
89 {
90 }
91
92 public string Name
93 {
94 get { return "WorldViewModule"; }
95 }
96
97 public Type ReplaceableInterface
98 {
99 get { return null; }
100 }
101
102 public void Close()
103 {
104 }
105
106 public byte[] GenerateWorldView(Vector3 pos, Vector3 rot, float fov,
107 int width, int height, bool usetex)
108 {
109 if (!m_Enabled)
110 return new Byte[0];
111
112 Bitmap bmp = m_Generator.CreateViewImage(pos, rot, fov, width,
113 height, usetex);
114
115 MemoryStream str = new MemoryStream();
116
117 bmp.Save(str, ImageFormat.Jpeg);
118
119 return str.ToArray();
120 }
121 }
122}
diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs
new file mode 100644
index 0000000..f47d9c7
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs
@@ -0,0 +1,148 @@
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
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Xml;
33
34using OpenSim.Framework;
35using OpenSim.Server.Base;
36using OpenSim.Framework.Servers.HttpServer;
37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Region.Framework.Interfaces;
39
40using OpenMetaverse;
41using log4net;
42
43namespace OpenSim.Region.OptionalModules.World.WorldView
44{
45 public class WorldViewRequestHandler : BaseStreamHandler
46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48
49 protected WorldViewModule m_WorldViewModule;
50 protected Object m_RequestLock = new Object();
51
52 public WorldViewRequestHandler(WorldViewModule fmodule, string rid)
53 : base("GET", "/worldview/" + rid)
54 {
55 m_WorldViewModule = fmodule;
56 }
57
58 public override byte[] Handle(string path, Stream requestData,
59 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
60 {
61 httpResponse.ContentType = "image/jpeg";
62
63// StreamReader sr = new StreamReader(requestData);
64// string body = sr.ReadToEnd();
65// sr.Close();
66// body = body.Trim();
67
68 try
69 {
70 lock (m_RequestLock)
71 {
72 Dictionary<string, object> request =
73 new Dictionary<string, object>();
74 foreach (string name in httpRequest.QueryString)
75 request[name] = httpRequest.QueryString[name];
76
77 return SendWorldView(request);
78 }
79 }
80 catch (Exception e)
81 {
82 m_log.Debug("[WORLDVIEW]: Exception: " + e.ToString());
83 }
84
85 return new Byte[0];
86 }
87
88 public Byte[] SendWorldView(Dictionary<string, object> request)
89 {
90 float posX;
91 float posY;
92 float posZ;
93 float rotX;
94 float rotY;
95 float rotZ;
96 float fov;
97 int width;
98 int height;
99 bool usetex;
100
101 if (!request.ContainsKey("posX"))
102 return new Byte[0];
103 if (!request.ContainsKey("posY"))
104 return new Byte[0];
105 if (!request.ContainsKey("posZ"))
106 return new Byte[0];
107 if (!request.ContainsKey("rotX"))
108 return new Byte[0];
109 if (!request.ContainsKey("rotY"))
110 return new Byte[0];
111 if (!request.ContainsKey("rotZ"))
112 return new Byte[0];
113 if (!request.ContainsKey("fov"))
114 return new Byte[0];
115 if (!request.ContainsKey("width"))
116 return new Byte[0];
117 if (!request.ContainsKey("height"))
118 return new Byte[0];
119 if (!request.ContainsKey("usetex"))
120 return new Byte[0];
121
122 try
123 {
124 posX = Convert.ToSingle(request["posX"]);
125 posY = Convert.ToSingle(request["posY"]);
126 posZ = Convert.ToSingle(request["posZ"]);
127 rotX = Convert.ToSingle(request["rotX"]);
128 rotY = Convert.ToSingle(request["rotY"]);
129 rotZ = Convert.ToSingle(request["rotZ"]);
130 fov = Convert.ToSingle(request["fov"]);
131 width = Convert.ToInt32(request["width"]);
132 height = Convert.ToInt32(request["height"]);
133 usetex = Convert.ToBoolean(request["usetex"]);
134 }
135 catch
136 {
137 return new Byte[0];
138 }
139
140 Vector3 pos = new Vector3(posX, posY, posZ);
141 Vector3 rot = new Vector3(rotX, rotY, rotZ);
142
143 return m_WorldViewModule.GenerateWorldView(pos, rot, fov, width,
144 height, usetex);
145 }
146 }
147}
148
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index 20a5bb4..cf57c0a 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -82,6 +82,7 @@ namespace OpenSim.Region.Physics.Meshing
82 IConfig start_config = config.Configs["Startup"]; 82 IConfig start_config = config.Configs["Startup"];
83 83
84 decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); 84 decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache");
85 cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps);
85 86
86 try 87 try
87 { 88 {
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index c37c9bd..c91658e 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -188,7 +188,7 @@ namespace OpenSim.Region.Physics.OdePlugin
188 public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, 188 public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
189 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode) 189 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical, CollisionLocker dode)
190 { 190 {
191 Name = primName; 191 Name = primName;
192 m_vehicle = new ODEDynamics(); 192 m_vehicle = new ODEDynamics();
193 //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned); 193 //gc = GCHandle.Alloc(prim_geom, GCHandleType.Pinned);
194 ode = dode; 194 ode = dode;
@@ -620,7 +620,7 @@ namespace OpenSim.Region.Physics.OdePlugin
620 volume *= (1.0f - hollowVolume); 620 volume *= (1.0f - hollowVolume);
621 } 621 }
622 } 622 }
623 break; 623 break;
624 624
625 default: 625 default:
626 break; 626 break;
@@ -658,7 +658,7 @@ namespace OpenSim.Region.Physics.OdePlugin
658 658
659 taperY = _pbs.PathTaperY * 0.01f; 659 taperY = _pbs.PathTaperY * 0.01f;
660 if (taperY < 0.0f) 660 if (taperY < 0.0f)
661 taperY = -taperY; 661 taperY = -taperY;
662 taperY1 = 1.0f - taperY; 662 taperY1 = 1.0f - taperY;
663 663
664 } 664 }
@@ -1059,7 +1059,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1059 } 1059 }
1060 1060
1061 foreach (OdePrim prm in childrenPrim) 1061 foreach (OdePrim prm in childrenPrim)
1062 { 1062 {
1063 prm.m_collisionCategories |= CollisionCategories.Body; 1063 prm.m_collisionCategories |= CollisionCategories.Body;
1064 prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); 1064 prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind);
1065 1065