diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index e14e5efcc1..41c22b8436 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -4,8 +4,7 @@ The following people have contributed to OpenSim (Thank you for your effort!) These folks represent the current core team for OpenSim, and are the people that make the day to day of OpenSim happen. -* justincc (OSVW Consulting, justincc.org) -* dahlia +* justincc (OSVW Consulting, justincc.org) * Melanie Thielker * Diva (Crista Lopes, University of California, Irvine) * BlueWall (James Hughes) @@ -56,6 +55,7 @@ where we are today. * nlin (3Di) * John Hurliman * chi11ken (Genkii) +* dahlia = Additional OpenSim Contributors = diff --git a/OpenSim/Framework/IRegionLoader.cs b/OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs similarity index 95% rename from OpenSim/Framework/IRegionLoader.cs rename to OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs index c566fc7916..2d1505dbe5 100644 --- a/OpenSim/Framework/IRegionLoader.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs @@ -26,8 +26,9 @@ */ using Nini.Config; +using OpenSim.Framework; -namespace OpenSim.Framework +namespace OpenSim.ApplicationPlugins.LoadRegions { public interface IRegionLoader { diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 74d9ae4bbf..89224a64a8 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -32,8 +32,6 @@ using System.Threading; using log4net; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.RegionLoader.Filesystem; -using OpenSim.Framework.RegionLoader.Web; using OpenSim.Region.CoreModules.Agent.AssetTransaction; using OpenSim.Region.CoreModules.Avatar.InstantMessage; using OpenSim.Region.CoreModules.Scripting.DynamicTexture; diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs similarity index 98% rename from OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs rename to OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs index 8332c14478..1873a0658e 100644 --- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs @@ -31,8 +31,9 @@ using System.Collections.Generic; using System.IO; using System.Reflection; using Nini.Config; +using OpenSim.Framework; -namespace OpenSim.Framework.RegionLoader.Filesystem +namespace OpenSim.ApplicationPlugins.LoadRegions { public class RegionLoaderFileSystem : IRegionLoader { diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs similarity index 98% rename from OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs rename to OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs index 098c4b9ea6..13d7a8ad4e 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs @@ -32,8 +32,9 @@ using System.Reflection; using System.Xml; using log4net; using Nini.Config; +using OpenSim.Framework; -namespace OpenSim.Framework.RegionLoader.Web +namespace OpenSim.ApplicationPlugins.LoadRegions { public class RegionLoaderWebServer : IRegionLoader { diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 9664433635..bae15820dd 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -42,7 +42,6 @@ using OpenMetaverse; using Mono.Addins; using OpenSim; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; diff --git a/OpenSim/Framework/Communications/GenericAsyncResult.cs b/OpenSim/Framework/Communications/GenericAsyncResult.cs deleted file mode 100644 index 8e3f62b40e..0000000000 --- a/OpenSim/Framework/Communications/GenericAsyncResult.cs +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Threading; - -namespace OpenSim.Framework.Communications -{ - internal class SimpleAsyncResult : IAsyncResult - { - private readonly AsyncCallback m_callback; - - /// - /// Is process completed? - /// - /// Should really be boolean, but VolatileRead has no boolean method - private byte m_completed; - - /// - /// Did process complete synchronously? - /// - /// I have a hard time imagining a scenario where this is the case, again, same issue about - /// booleans and VolatileRead as m_completed - /// - private byte m_completedSynchronously; - - private readonly object m_asyncState; - private ManualResetEvent m_waitHandle; - private Exception m_exception; - - internal SimpleAsyncResult(AsyncCallback cb, object state) - { - m_callback = cb; - m_asyncState = state; - m_completed = 0; - m_completedSynchronously = 1; - } - - #region IAsyncResult Members - - public object AsyncState - { - get { return m_asyncState; } - } - - public WaitHandle AsyncWaitHandle - { - get - { - if (m_waitHandle == null) - { - bool done = IsCompleted; - ManualResetEvent mre = new ManualResetEvent(done); - if (Interlocked.CompareExchange(ref m_waitHandle, mre, null) != null) - { - mre.Close(); - } - else - { - if (!done && IsCompleted) - { - m_waitHandle.Set(); - } - } - } - - return m_waitHandle; - } - } - - - public bool CompletedSynchronously - { - get { return Thread.VolatileRead(ref m_completedSynchronously) == 1; } - } - - - public bool IsCompleted - { - get { return Thread.VolatileRead(ref m_completed) == 1; } - } - - #endregion - - #region class Methods - - internal void SetAsCompleted(bool completedSynchronously) - { - m_completed = 1; - if (completedSynchronously) - m_completedSynchronously = 1; - else - m_completedSynchronously = 0; - - SignalCompletion(); - } - - internal void HandleException(Exception e, bool completedSynchronously) - { - m_completed = 1; - if (completedSynchronously) - m_completedSynchronously = 1; - else - m_completedSynchronously = 0; - m_exception = e; - - SignalCompletion(); - } - - private void SignalCompletion() - { - if (m_waitHandle != null) m_waitHandle.Set(); - - if (m_callback != null) m_callback(this); - } - - public void EndInvoke() - { - // This method assumes that only 1 thread calls EndInvoke - if (!IsCompleted) - { - // If the operation isn't done, wait for it - AsyncWaitHandle.WaitOne(); - AsyncWaitHandle.Close(); - m_waitHandle.Close(); - m_waitHandle = null; // Allow early GC - } - - // Operation is done: if an exception occured, throw it - if (m_exception != null) throw m_exception; - } - - #endregion - } - - internal class AsyncResult : SimpleAsyncResult - { - private T m_result = default(T); - - public AsyncResult(AsyncCallback asyncCallback, Object state) : - base(asyncCallback, state) - { - } - - public void SetAsCompleted(T result, bool completedSynchronously) - { - // Save the asynchronous operation's result - m_result = result; - - // Tell the base class that the operation completed - // sucessfully (no exception) - base.SetAsCompleted(completedSynchronously); - } - - public new T EndInvoke() - { - base.EndInvoke(); - return m_result; - } - } -} \ No newline at end of file diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs deleted file mode 100644 index dfa059d929..0000000000 --- a/OpenSim/Framework/Communications/IUserService.cs +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using OpenMetaverse; -using OpenSim.Services.Interfaces; - -namespace OpenSim.Framework.Communications -{ - public interface IUserService - { - /// - /// Add a temporary user profile. - /// - /// A temporary user profile is one that should exist only for the lifetime of the process. - /// - void AddTemporaryUserProfile(UserProfileData userProfile); - - /// - /// Loads a user profile by name - /// - /// First name - /// Last name - /// A user profile. Returns null if no profile is found - UserProfileData GetUserProfile(string firstName, string lastName); - - /// - /// Loads a user profile from a database by UUID - /// - /// The target UUID - /// A user profile. Returns null if no user profile is found. - UserProfileData GetUserProfile(UUID userId); - - UserProfileData GetUserProfile(Uri uri); - - Uri GetUserUri(UserProfileData userProfile); - - UserAgentData GetAgentByUUID(UUID userId); - - void ClearUserAgent(UUID avatarID); - List GenerateAgentPickerRequestResponse(UUID QueryID, string Query); - - UserProfileData SetupMasterUser(string firstName, string lastName); - UserProfileData SetupMasterUser(string firstName, string lastName, string password); - UserProfileData SetupMasterUser(UUID userId); - - /// - /// Update the user's profile. - /// - /// UserProfileData object with updated data. Should be obtained - /// via a call to GetUserProfile(). - /// true if the update could be applied, false if it could not be applied. - bool UpdateUserProfile(UserProfileData data); - - /// - /// Adds a new friend to the database for XUser - /// - /// The agent that who's friends list is being added to - /// The agent that being added to the friends list of the friends list owner - /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects - void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms); - - /// - /// Delete friend on friendlistowner's friendlist. - /// - /// The agent that who's friends list is being updated - /// The Ex-friend agent - void RemoveUserFriend(UUID friendlistowner, UUID friend); - - /// - /// Update permissions for friend on friendlistowner's friendlist. - /// - /// The agent that who's friends list is being updated - /// The agent that is getting or loosing permissions - /// A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects - void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms); - - /// - /// Logs off a user on the user server - /// - /// UUID of the user - /// UUID of the Region - /// regionhandle - /// final position - /// final lookat - void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, Vector3 position, Vector3 lookat); - - /// - /// Logs off a user on the user server (deprecated as of 2008-08-27) - /// - /// UUID of the user - /// UUID of the Region - /// regionhandle - /// final position x - /// final position y - /// final position z - void LogOffUser(UUID userid, UUID regionid, ulong regionhandle, float posx, float posy, float posz); - - /// - /// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship - /// for UUID friendslistowner - /// - /// - /// The agent for whom we're retreiving the friends Data. - /// - /// A List of FriendListItems that contains info about the user's friends. - /// Always returns a list even if the user has no friends - /// - List GetUserFriendList(UUID friendlistowner); - - // This probably shouldn't be here, it belongs to IAuthentication - // But since Scenes only have IUserService references, I'm placing it here for now. - bool VerifySession(UUID userID, UUID sessionID); - - /// - /// Authenticate a user by their password. - /// - /// - /// This is used by callers outside the login process that want to - /// verify a user who has given their password. - /// - /// This should probably also be in IAuthentication but is here for the same reasons as VerifySession() is - /// - /// - /// - /// - bool AuthenticateUserByPassword(UUID userID, string password); - - // Temporary Hack until we move everything to the new service model - void SetInventoryService(IInventoryService invService); - } -} diff --git a/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs deleted file mode 100644 index 070d106252..0000000000 --- a/OpenSim/Framework/Communications/Limit/IRequestLimitStrategy.cs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -namespace OpenSim.Framework.Communications.Limit -{ - /// - /// Interface for strategies that can limit requests from the client. Currently only used in the - /// texture modules to deal with repeated requests for certain textures. However, limiting strategies - /// could be used with other requests. - /// - public interface IRequestLimitStrategy - { - /// - /// Should the request be allowed? If the id is not monitored, then the request is always allowed. - /// Otherwise, the strategy criteria will be applied. - /// - /// - /// - bool AllowRequest(TId id); - - /// - /// Has the request been refused just once? - /// - /// False if the request has not yet been refused, or if the request has been refused more - /// than once. - bool IsFirstRefusal(TId id); - - /// - /// Start monitoring for future AllowRequest calls. If the id is already monitored, then monitoring - /// continues. - /// - /// - void MonitorRequests(TId id); - - /// - /// Is the id being monitored? - /// - /// - /// - bool IsMonitoringRequests(TId id); - } -} diff --git a/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs deleted file mode 100644 index 76726531a8..0000000000 --- a/OpenSim/Framework/Communications/Limit/NullLimitStrategy.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -namespace OpenSim.Framework.Communications.Limit -{ - /// - /// Strategy which polices no limits - /// - public class NullLimitStrategy : IRequestLimitStrategy - { - public bool AllowRequest(TId id) { return true; } - public bool IsFirstRefusal(TId id) { return false; } - public void MonitorRequests(TId id) { /* intentionally blank */ } - public bool IsMonitoringRequests(TId id) { return false; } - } -} diff --git a/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs deleted file mode 100644 index 44dd5927a3..0000000000 --- a/OpenSim/Framework/Communications/Limit/RepeatLimitStrategy.cs +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; - -namespace OpenSim.Framework.Communications.Limit -{ - /// - /// Limit requests by discarding them after they've been repeated a certain number of times. - /// - public class RepeatLimitStrategy : IRequestLimitStrategy - { - /// - /// Record each asset request that we're notified about. - /// - private readonly Dictionary requestCounts = new Dictionary(); - - /// - /// The maximum number of requests that can be made before we drop subsequent requests. - /// - private readonly int m_maxRequests; - public int MaxRequests - { - get { return m_maxRequests; } - } - - /// - /// The maximum number of requests that may be served before all further - /// requests are dropped. - public RepeatLimitStrategy(int maxRequests) - { - m_maxRequests = maxRequests; - } - - /// - /// - /// - public bool AllowRequest(TId id) - { - if (requestCounts.ContainsKey(id)) - { - requestCounts[id] += 1; - - if (requestCounts[id] > m_maxRequests) - { - return false; - } - } - - return true; - } - - /// - /// - /// - public bool IsFirstRefusal(TId id) - { - if (requestCounts.ContainsKey(id) && m_maxRequests + 1 == requestCounts[id]) - { - return true; - } - - return false; - } - - /// - /// - /// - public void MonitorRequests(TId id) - { - if (!IsMonitoringRequests(id)) - { - requestCounts.Add(id, 1); - } - } - - /// - /// - /// - public bool IsMonitoringRequests(TId id) - { - return requestCounts.ContainsKey(id); - } - } -} diff --git a/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs b/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs deleted file mode 100644 index 7ac8293b77..0000000000 --- a/OpenSim/Framework/Communications/Limit/TimeLimitStrategy.cs +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; - -namespace OpenSim.Framework.Communications.Limit -{ - /// - /// Limit requests by discarding repeat attempts that occur within a given time period - /// - /// XXX Don't use this for limiting texture downloading, at least not until we better handle multiple requests - /// for the same texture at different resolutions. - /// - public class TimeLimitStrategy : IRequestLimitStrategy - { - /// - /// Record the time at which an asset request occurs. - /// - private readonly Dictionary requests = new Dictionary(); - - /// - /// The minimum time period between which requests for the same data will be serviced. - /// - private readonly TimeSpan m_repeatPeriod; - public TimeSpan RepeatPeriod - { - get { return m_repeatPeriod; } - } - - /// - /// - public TimeLimitStrategy(TimeSpan repeatPeriod) - { - m_repeatPeriod = repeatPeriod; - } - - /// - /// - /// - public bool AllowRequest(TId id) - { - if (IsMonitoringRequests(id)) - { - DateTime now = DateTime.Now; - TimeSpan elapsed = now - requests[id].Time; - - if (elapsed < RepeatPeriod) - { - requests[id].Refusals += 1; - return false; - } - - requests[id].Time = now; - } - - return true; - } - - /// - /// - /// - public bool IsFirstRefusal(TId id) - { - if (IsMonitoringRequests(id)) - { - if (1 == requests[id].Refusals) - { - return true; - } - } - - return false; - } - - /// - /// - /// - public void MonitorRequests(TId id) - { - if (!IsMonitoringRequests(id)) - { - requests.Add(id, new Request(DateTime.Now)); - } - } - - /// - /// - /// - public bool IsMonitoringRequests(TId id) - { - return requests.ContainsKey(id); - } - } - - /// - /// Private request details. - /// - class Request - { - /// - /// Time of last request - /// - public DateTime Time; - - /// - /// Number of refusals associated with this request - /// - public int Refusals; - - public Request(DateTime time) - { - Time = time; - } - } -} diff --git a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs b/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs deleted file mode 100644 index b398167211..0000000000 --- a/OpenSim/Framework/Communications/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Reflection; -using System.Runtime.InteropServices; - -// General information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly : AssemblyTitle("OpenSim.Framework.Communications")] -[assembly : AssemblyDescription("")] -[assembly : AssemblyConfiguration("")] -[assembly : AssemblyCompany("http://opensimulator.org")] -[assembly : AssemblyProduct("OpenSim")] -[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")] -[assembly : AssemblyTrademark("")] -[assembly : AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. - -[assembly : ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM - -[assembly : Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly : AssemblyVersion("0.8.2.*")] - diff --git a/OpenSim/Framework/Communications/XMPP/XmppError.cs b/OpenSim/Framework/Communications/XMPP/XmppError.cs deleted file mode 100644 index 3d36e9c8cf..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppError.cs +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - [XmlRoot("error")] - public class XmppErrorStanza - { - public XmppErrorStanza() - { - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs deleted file mode 100644 index 12263f4e89..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppIqStanza.cs +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - /// - /// An IQ needs to have one of the follow types set. - /// - public enum XmppIqType - { - [XmlEnum("set")] set, - [XmlEnum("get")] get, - [XmlEnum("result")] result, - [XmlEnum("error")] error, - } - - /// - /// XmppIqStanza needs to be subclassed as the query content is - /// specific to the query type. - /// - [XmlRoot("iq")] - public abstract class XmppIqStanza: XmppStanza - { - /// - /// IQ type: one of set, get, result, error - /// - [XmlAttribute("type")] - public XmppIqType Type; - - public XmppIqStanza(): base() - { - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs deleted file mode 100644 index 1e8c33e52d..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppMessageStanza.cs +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - /// - /// Message types. - /// - public enum XmppMessageType - { - [XmlEnum("chat")] chat, - [XmlEnum("error")] error, - [XmlEnum("groupchat")] groupchat, - [XmlEnum("headline")] headline, - [XmlEnum("normal")] normal, - } - - /// - /// Message body. - /// - public class XmppMessageBody - { - [XmlText] - public string Text; - - public XmppMessageBody() - { - } - - public XmppMessageBody(string message) - { - Text = message; - } - - new public string ToString() - { - return Text; - } - } - - [XmlRoot("message")] - public class XmppMessageStanza: XmppStanza - { - /// - /// IQ type: one of set, get, result, error - /// - [XmlAttribute("type")] - public XmppMessageType MessageType; - - // [XmlAttribute("error")] - // public XmppError Error; - - [XmlElement("body")] - public XmppMessageBody Body; - - public XmppMessageStanza() : base() - { - } - - public XmppMessageStanza(string fromJid, string toJid, XmppMessageType mType, string message) : - base(fromJid, toJid) - { - MessageType = mType; - Body = new XmppMessageBody(message); - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs deleted file mode 100644 index 4d45ac0663..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppPresenceStanza.cs +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - /// - /// Message types. - /// - public enum XmppPresenceType - { - [XmlEnum("unavailable")] unavailable, - [XmlEnum("subscribe")] subscribe, - [XmlEnum("subscribed")] subscribed, - [XmlEnum("unsubscribe")] unsubscribe, - [XmlEnum("unsubscribed")] unsubscribed, - [XmlEnum("probe")] probe, - [XmlEnum("error")] error, - } - - - [XmlRoot("message")] - public class XmppPresenceStanza: XmppStanza - { - /// - /// IQ type: one of set, get, result, error - /// - [XmlAttribute("type")] - public XmppPresenceType PresenceType; - - // [XmlAttribute("error")] - // public XmppError Error; - - public XmppPresenceStanza() : base() - { - } - - public XmppPresenceStanza(string fromJid, string toJid, XmppPresenceType pType) : - base(fromJid, toJid) - { - PresenceType = pType; - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs b/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs deleted file mode 100644 index e37ef2853d..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppSerializer.cs +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Xml; -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - public class XmppSerializer - { - // private static readonly ILog _log = - // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - // need to do it this way, as XmlSerializer(type, extratypes) - // does not work on mono (at least). - private Dictionary _serializerForType = new Dictionary(); - private Dictionary _serializerForName = new Dictionary(); - private XmlSerializerNamespaces _xmlNs; - private string _defaultNS; - - public XmppSerializer(bool server) - { - _xmlNs = new XmlSerializerNamespaces(); - _xmlNs.Add(String.Empty, String.Empty); - if (server) - _defaultNS = "jabber:server"; - else - _defaultNS = "jabber:client"; - - // TODO: do this via reflection - _serializerForType[typeof(XmppMessageStanza)] = _serializerForName["message"] = - new XmlSerializer(typeof(XmppMessageStanza), _defaultNS); - } - - public void Serialize(XmlWriter xw, object o) - { - if (!_serializerForType.ContainsKey(o.GetType())) - throw new ArgumentException(String.Format("no serializer available for type {0}", o.GetType())); - - _serializerForType[o.GetType()].Serialize(xw, o, _xmlNs); - } - - public object Deserialize(XmlReader xr) - { - // position on next element - xr.Read(); - if (!_serializerForName.ContainsKey(xr.LocalName)) - throw new ArgumentException(String.Format("no serializer available for name {0}", xr.LocalName)); - - return _serializerForName[xr.LocalName].Deserialize(xr); - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppStanza.cs b/OpenSim/Framework/Communications/XMPP/XmppStanza.cs deleted file mode 100644 index 5312a31bb6..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppStanza.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Xml.Serialization; - -namespace OpenSim.Framework.Communications.XMPP -{ - public abstract class XmppStanza - { - /// - /// counter used for generating ID - /// - [XmlIgnore] - private static ulong _ctr = 0; - - /// - /// recipient JID - /// - [XmlAttribute("to")] - public string ToJid; - - /// - /// sender JID - /// - [XmlAttribute("from")] - public string FromJid; - - /// - /// unique ID. - /// - [XmlAttribute("id")] - public string MessageId; - - public XmppStanza() - { - } - - public XmppStanza(string fromJid, string toJid) - { - ToJid = toJid; - FromJid = fromJid; - MessageId = String.Format("OpenSim_{0}{1}", DateTime.UtcNow.Ticks, _ctr++); - } - } -} diff --git a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs b/OpenSim/Framework/Communications/XMPP/XmppWriter.cs deleted file mode 100644 index 415d808c2f..0000000000 --- a/OpenSim/Framework/Communications/XMPP/XmppWriter.cs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.IO; -using System.Text; -using System.Xml; -using IOStream = System.IO.Stream; - -namespace OpenSim.Framework.Communications.XMPP -{ - public class XMPPWriter: XmlTextWriter - { - public XMPPWriter(TextWriter textWriter) : base(textWriter) - { - } - - public XMPPWriter(IOStream stream) : this(stream, Util.UTF8) - { - } - - public XMPPWriter(IOStream stream, Encoding enc) : base(stream, enc) - { - } - - public override void WriteStartDocument() - { - } - - public override void WriteStartDocument(bool standalone) - { - } - } -} diff --git a/OpenSim/Framework/ForeignUserProfileData.cs b/OpenSim/Framework/ForeignUserProfileData.cs deleted file mode 100644 index 2beaf80f80..0000000000 --- a/OpenSim/Framework/ForeignUserProfileData.cs +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; - -namespace OpenSim.Framework -{ - public class ForeignUserProfileData : UserProfileData - { - /// - /// The address of the users home sim, used for foreigners. - /// - private string _userUserServerURI = String.Empty; - - /// - /// The address of the users home sim, used for foreigners. - /// - private string _userHomeAddress = String.Empty; - - /// - /// The port of the users home sim, used for foreigners. - /// - private string _userHomePort = String.Empty; - /// - /// The remoting port of the users home sim, used for foreigners. - /// - private string _userHomeRemotingPort = String.Empty; - - public string UserServerURI - { - get { return _userUserServerURI; } - set { _userUserServerURI = value; } - } - - public string UserHomeAddress - { - get { return _userHomeAddress; } - set { _userHomeAddress = value; } - } - - public string UserHomePort - { - get { return _userHomePort; } - set { _userHomePort = value; } - } - - public string UserHomeRemotingPort - { - get { return _userHomeRemotingPort; } - set { _userHomeRemotingPort = value; } - } - } -} diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs b/OpenSim/Framework/LogWriter.cs similarity index 99% rename from OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs rename to OpenSim/Framework/LogWriter.cs index a176958669..2e0bf4a354 100755 --- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/LogWriter.cs +++ b/OpenSim/Framework/LogWriter.cs @@ -30,7 +30,7 @@ using System.IO; using System.Text; using log4net; -namespace OpenSim.Region.CoreModules.Framework.Statistics.Logging +namespace OpenSim.Framework { /// /// Class for writing a high performance, high volume log file. diff --git a/OpenSim/Framework/Communications/OutboundUrlFilter.cs b/OpenSim/Framework/OutboundUrlFilter.cs similarity index 99% rename from OpenSim/Framework/Communications/OutboundUrlFilter.cs rename to OpenSim/Framework/OutboundUrlFilter.cs index 8b572d1c58..baa3647677 100644 --- a/OpenSim/Framework/Communications/OutboundUrlFilter.cs +++ b/OpenSim/Framework/OutboundUrlFilter.cs @@ -34,7 +34,7 @@ using log4net; using LukeSkywalker.IPNetwork; using Nini.Config; -namespace OpenSim.Framework.Communications +namespace OpenSim.Framework { public class OutboundUrlFilter { @@ -62,7 +62,7 @@ namespace OpenSim.Framework.Communications } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// Name of the filter for logging purposes. /// Filter configuration diff --git a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs deleted file mode 100644 index 3bcbe2fa71..0000000000 --- a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Filesystem")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("OpenSim")] -[assembly: AssemblyCopyright("OpenSimulator developers")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4ab5c74b-e886-40a1-b67d-a04df285e706")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.8.2.*")] - diff --git a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs deleted file mode 100644 index 1b2519cb61..0000000000 --- a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Web")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("OpenSim")] -[assembly: AssemblyCopyright("OpenSimulator developers")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("985afff8-e7ed-4056-acce-39abf7a43d33")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.8.2.*")] - diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/RestClient.cs similarity index 81% rename from OpenSim/Framework/Communications/RestClient.cs rename to OpenSim/Framework/RestClient.cs index 807222bd63..ca1939218b 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/RestClient.cs @@ -37,7 +37,7 @@ using log4net; using OpenSim.Framework.ServiceAuth; -namespace OpenSim.Framework.Communications +namespace OpenSim.Framework { /// /// Implementation of a generic REST client @@ -524,4 +524,158 @@ namespace OpenSim.Framework.Communications #endregion Async Invocation } + + internal class SimpleAsyncResult : IAsyncResult + { + private readonly AsyncCallback m_callback; + + /// + /// Is process completed? + /// + /// Should really be boolean, but VolatileRead has no boolean method + private byte m_completed; + + /// + /// Did process complete synchronously? + /// + /// I have a hard time imagining a scenario where this is the case, again, same issue about + /// booleans and VolatileRead as m_completed + /// + private byte m_completedSynchronously; + + private readonly object m_asyncState; + private ManualResetEvent m_waitHandle; + private Exception m_exception; + + internal SimpleAsyncResult(AsyncCallback cb, object state) + { + m_callback = cb; + m_asyncState = state; + m_completed = 0; + m_completedSynchronously = 1; + } + + #region IAsyncResult Members + + public object AsyncState + { + get { return m_asyncState; } + } + + public WaitHandle AsyncWaitHandle + { + get + { + if (m_waitHandle == null) + { + bool done = IsCompleted; + ManualResetEvent mre = new ManualResetEvent(done); + if (Interlocked.CompareExchange(ref m_waitHandle, mre, null) != null) + { + mre.Close(); + } + else + { + if (!done && IsCompleted) + { + m_waitHandle.Set(); + } + } + } + + return m_waitHandle; + } + } + + + public bool CompletedSynchronously + { + get { return Thread.VolatileRead(ref m_completedSynchronously) == 1; } + } + + + public bool IsCompleted + { + get { return Thread.VolatileRead(ref m_completed) == 1; } + } + + #endregion + + #region class Methods + + internal void SetAsCompleted(bool completedSynchronously) + { + m_completed = 1; + if (completedSynchronously) + m_completedSynchronously = 1; + else + m_completedSynchronously = 0; + + SignalCompletion(); + } + + internal void HandleException(Exception e, bool completedSynchronously) + { + m_completed = 1; + if (completedSynchronously) + m_completedSynchronously = 1; + else + m_completedSynchronously = 0; + m_exception = e; + + SignalCompletion(); + } + + private void SignalCompletion() + { + if (m_waitHandle != null) m_waitHandle.Set(); + + if (m_callback != null) m_callback(this); + } + + public void EndInvoke() + { + // This method assumes that only 1 thread calls EndInvoke + if (!IsCompleted) + { + // If the operation isn't done, wait for it + AsyncWaitHandle.WaitOne(); + AsyncWaitHandle.Close(); + m_waitHandle.Close(); + m_waitHandle = null; // Allow early GC + } + + // Operation is done: if an exception occured, throw it + if (m_exception != null) throw m_exception; + } + + #endregion + } + + internal class AsyncResult : SimpleAsyncResult + { + private T m_result = default(T); + + public AsyncResult(AsyncCallback asyncCallback, Object state) : + base(asyncCallback, state) + { + } + + public void SetAsCompleted(T result, bool completedSynchronously) + { + // Save the asynchronous operation's result + m_result = result; + + // Tell the base class that the operation completed + // sucessfully (no exception) + base.SetAsCompleted(completedSynchronously); + } + + public new T EndInvoke() + { + base.EndInvoke(); + return m_result; + } + } + } diff --git a/OpenSim/Region/Application/OpenSimBackground.cs b/OpenSim/Region/Application/OpenSimBackground.cs index 008c6b07b5..15d9065af3 100644 --- a/OpenSim/Region/Application/OpenSimBackground.cs +++ b/OpenSim/Region/Application/OpenSimBackground.cs @@ -55,7 +55,7 @@ namespace OpenSim base.Startup(); m_log.InfoFormat("[OPENSIM MAIN]: Startup complete, serving {0} region{1}", - m_clientServers.Count.ToString(), m_clientServers.Count > 1 ? "s" : ""); + SceneManager.Scenes.Count, SceneManager.Scenes.Count > 1 ? "s" : ""); WorldHasComeToAnEnd.WaitOne(); WorldHasComeToAnEnd.Close(); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 9108e5d609..a7ebff3f97 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -36,17 +36,15 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Monitoring; -using OpenSim.Region.ClientStack; using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Server.Base; using OpenSim.Services.Base; using OpenSim.Services.Interfaces; @@ -121,19 +119,12 @@ namespace OpenSim /// public OpenSimConfigSource ConfigSource { get; private set; } - public List ClientServers - { - get { return m_clientServers; } - } - protected EnvConfigSource m_EnvConfigSource = new EnvConfigSource(); public EnvConfigSource envConfigSource { get { return m_EnvConfigSource; } } - - protected List m_clientServers = new List(); public uint HttpServerPort { @@ -371,9 +362,9 @@ namespace OpenSim /// /// /// - public List CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) + public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, out IScene scene) { - return CreateRegion(regionInfo, portadd_flag, false, out scene); + CreateRegion(regionInfo, portadd_flag, false, out scene); } /// @@ -381,9 +372,9 @@ namespace OpenSim /// /// /// - public List CreateRegion(RegionInfo regionInfo, out IScene scene) + public void CreateRegion(RegionInfo regionInfo, out IScene scene) { - return CreateRegion(regionInfo, false, true, out scene); + CreateRegion(regionInfo, false, true, out scene); } /// @@ -393,7 +384,7 @@ namespace OpenSim /// /// /// - public List CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) + public void CreateRegion(RegionInfo regionInfo, bool portadd_flag, bool do_post_init, out IScene mscene) { int port = regionInfo.InternalEndPoint.Port; @@ -418,8 +409,7 @@ namespace OpenSim Util.XmlRpcCommand(proxyUrl, "AddPort", port, port + proxyOffset, regionInfo.ExternalHostName); } - List clientServers; - Scene scene = SetupScene(regionInfo, proxyOffset, Config, out clientServers); + Scene scene = SetupScene(regionInfo, proxyOffset, Config); m_log.Info("[MODULES]: Loading Region's modules (old style)"); @@ -511,14 +501,14 @@ namespace OpenSim SceneManager.Add(scene); - if (m_autoCreateClientStack) - { - foreach (IClientNetworkServer clientserver in clientServers) - { - m_clientServers.Add(clientserver); - clientserver.Start(); - } - } + //if (m_autoCreateClientStack) + //{ + // foreach (IClientNetworkServer clientserver in clientServers) + // { + // m_clientServers.Add(clientserver); + // clientserver.Start(); + // } + //} if (scene.SnmpService != null) { @@ -534,7 +524,7 @@ namespace OpenSim scene.SnmpService.LinkUp(scene); } - return clientServers; + //return clientServers; } /// @@ -673,7 +663,7 @@ namespace OpenSim scene.DeleteAllSceneObjects(); SceneManager.CloseScene(scene); - ShutdownClientServer(scene.RegionInfo); + //ShutdownClientServer(scene.RegionInfo); if (!cleanup) return; @@ -734,7 +724,7 @@ namespace OpenSim } SceneManager.CloseScene(scene); - ShutdownClientServer(scene.RegionInfo); + //ShutdownClientServer(scene.RegionInfo); } /// @@ -755,9 +745,9 @@ namespace OpenSim /// /// /// - protected Scene SetupScene(RegionInfo regionInfo, out List clientServer) + protected Scene SetupScene(RegionInfo regionInfo) { - return SetupScene(regionInfo, 0, null, out clientServer); + return SetupScene(regionInfo, 0, null); } /// @@ -768,55 +758,18 @@ namespace OpenSim /// /// /// - protected Scene SetupScene( - RegionInfo regionInfo, int proxyOffset, IConfigSource configSource, out List clientServer) + protected Scene SetupScene(RegionInfo regionInfo, int proxyOffset, IConfigSource configSource) { - List clientNetworkServers = null; + //List clientNetworkServers = null; AgentCircuitManager circuitManager = new AgentCircuitManager(); - IPAddress listenIP = regionInfo.InternalEndPoint.Address; - //if (!IPAddress.TryParse(regionInfo.InternalEndPoint, out listenIP)) - // listenIP = IPAddress.Parse("0.0.0.0"); - - uint port = (uint) regionInfo.InternalEndPoint.Port; - - if (m_autoCreateClientStack) - { - clientNetworkServers = m_clientStackManager.CreateServers( - listenIP, ref port, proxyOffset, regionInfo.m_allow_alternate_ports, configSource, - circuitManager); - } - else - { - clientServer = null; - } - - regionInfo.InternalEndPoint.Port = (int) port; - Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager); - if (m_autoCreateClientStack) - { - foreach (IClientNetworkServer clientnetserver in clientNetworkServers) - { - clientnetserver.AddScene(scene); - } - } - clientServer = clientNetworkServers; scene.LoadWorldMap(); - scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset; - scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); - scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight); - return scene; } - protected override ClientStackManager CreateClientStackManager() - { - return new ClientStackManager(m_configSettings.ClientstackDll); - } - protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager) { @@ -825,42 +778,18 @@ namespace OpenSim SceneCommunicationService sceneGridService = new SceneCommunicationService(); return new Scene( - regionInfo, circuitManager, physicsScene, sceneGridService, + regionInfo, circuitManager, simDataService, estateDataService, Config, m_version); } - protected void ShutdownClientServer(RegionInfo whichRegion) - { - // Close and remove the clientserver for a region - bool foundClientServer = false; - int clientServerElement = 0; - Location location = new Location(whichRegion.RegionHandle); - - for (int i = 0; i < m_clientServers.Count; i++) - { - if (m_clientServers[i].HandlesRegion(location)) - { - clientServerElement = i; - foundClientServer = true; - break; - } - } - - if (foundClientServer) - { - m_clientServers[clientServerElement].Stop(); - m_clientServers.RemoveAt(clientServerElement); - } - } - protected virtual void HandleRestartRegion(RegionInfo whichRegion) { m_log.InfoFormat( "[OPENSIM]: Got restart signal from SceneManager for region {0} ({1},{2})", whichRegion.RegionName, whichRegion.RegionLocX, whichRegion.RegionLocY); - ShutdownClientServer(whichRegion); + //ShutdownClientServer(whichRegion); IScene scene; CreateRegion(whichRegion, true, out scene); scene.Start(); @@ -868,12 +797,6 @@ namespace OpenSim # region Setup methods - protected override PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent) - { - return GetPhysicsScene( - m_configSettings.PhysicsEngine, m_configSettings.MeshEngineName, Config, osSceneIdentifier, regionExtent); - } - /// /// Handler to supply the current status of this sim /// diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/Application/RegionApplicationBase.cs similarity index 74% rename from OpenSim/Region/ClientStack/RegionApplicationBase.cs rename to OpenSim/Region/Application/RegionApplicationBase.cs index 332bff9b40..ba92fd6345 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/Application/RegionApplicationBase.cs @@ -32,16 +32,15 @@ using log4net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; -namespace OpenSim.Region.ClientStack +namespace OpenSim { public abstract class RegionApplicationBase : BaseOpenSimServer { @@ -53,7 +52,6 @@ namespace OpenSim.Region.ClientStack protected uint m_httpServerPort; protected ISimulationDataService m_simulationDataService; protected IEstateDataService m_estateDataService; - protected ClientStackManager m_clientStackManager; public SceneManager SceneManager { get; protected set; } public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } @@ -62,23 +60,11 @@ namespace OpenSim.Region.ClientStack protected abstract void Initialize(); - /// - /// Get a new physics scene. - /// - /// - /// - /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. - /// - /// - protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier, Vector3 regionExtent); - - protected abstract ClientStackManager CreateClientStackManager(); protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager); protected override void StartupSpecific() { SceneManager = SceneManager.Instance; - m_clientStackManager = CreateClientStackManager(); Initialize(); @@ -125,23 +111,5 @@ namespace OpenSim.Region.ClientStack base.StartupSpecific(); } - /// - /// Get a new physics scene. - /// - /// The name of the physics engine to use - /// The name of the mesh engine to use - /// The configuration data to pass to the physics and mesh engines - /// - /// The name of the OpenSim scene this physics scene is serving. This will be used in log messages. - /// - /// - protected PhysicsScene GetPhysicsScene( - string engine, string meshEngine, IConfigSource config, string osSceneIdentifier, Vector3 regionExtent) - { - PhysicsPluginManager physicsPluginManager; - physicsPluginManager = new PhysicsPluginManager(); - physicsPluginManager.LoadPluginsFromAssemblies("Physics"); - return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent); - } } } diff --git a/OpenSim/Region/ClientStack/ClientStackManager.cs b/OpenSim/Region/ClientStack/ClientStackManager.cs deleted file mode 100644 index 3ec968f706..0000000000 --- a/OpenSim/Region/ClientStack/ClientStackManager.cs +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Net; -using System.Reflection; -using log4net; -using Nini.Config; -using OpenSim.Framework; - -namespace OpenSim.Region.ClientStack -{ - public class ClientStackManager - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private List plugin = new List(); - private List pluginAssembly = new List(); - - public ClientStackManager(string pDllName) - { - List clientstacks = new List(); - if (pDllName.Contains(",")) - { - clientstacks = new List(pDllName.Split(',')); - } - else - { - clientstacks.Add(pDllName); - } - foreach (string dllName in clientstacks) - { - m_log.Info("[CLIENTSTACK]: Attempting to load " + dllName); - - try - { - //plugin = null; - Assembly itemAssembly = Assembly.LoadFrom(dllName); - pluginAssembly.Add(itemAssembly); - - foreach (Type pluginType in itemAssembly.GetTypes()) - { - if (pluginType.IsPublic) - { - Type typeInterface = pluginType.GetInterface("IClientNetworkServer"); - - if (typeInterface != null) - { - m_log.Info("[CLIENTSTACK]: Added IClientNetworkServer Interface"); - plugin.Add(pluginType); - break; - } - } - } - } - catch (ReflectionTypeLoadException e) - { - foreach (Exception e2 in e.LoaderExceptions) - { - m_log.Error(e2.ToString()); - } - throw e; - } - } - } - - /// - /// Create a server that can set up sessions for virtual world client <-> server communications - /// - /// - /// - /// - /// - /// - /// - /// - public List CreateServers( - IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, - AgentCircuitManager authenticateClass) - { - return CreateServers( - _listenIP, ref port, proxyPortOffset, allow_alternate_port, null, authenticateClass); - } - - /// - /// Create a server that can set up sessions for virtual world client <-> server communications - /// - /// - /// - /// - /// - /// - /// Can be null, in which case default values are used - /// - /// - /// - /// - public List CreateServers( - IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, IConfigSource configSource, - AgentCircuitManager authenticateClass) - { - List servers = new List(); - if (plugin != null) - { - for (int i = 0; i < plugin.Count; i++) - { - IClientNetworkServer server = - (IClientNetworkServer) Activator.CreateInstance(pluginAssembly[i].GetType(plugin[i].ToString())); - - server.Initialise( - _listenIP, ref port, proxyPortOffset, allow_alternate_port, - configSource, authenticateClass); - servers.Add(server); - } - return servers; - } - - m_log.Error("[CLIENTSTACK]: Couldn't initialize a new server"); - return null; - } - } -} diff --git a/OpenSim/Region/ClientStack/IClientNetworkServer.cs b/OpenSim/Region/ClientStack/IClientNetworkServer.cs deleted file mode 100644 index bb7e6d0e6f..0000000000 --- a/OpenSim/Region/ClientStack/IClientNetworkServer.cs +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Net; -using System.Net.Sockets; -using Nini.Config; -using OpenSim.Framework; - -namespace OpenSim.Region.ClientStack -{ - public interface IClientNetworkServer - { - void Initialise( - IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, - AgentCircuitManager authenticateClass); - - bool HandlesRegion(Location x); - - /// - /// Add the given scene to be handled by this IClientNetworkServer. - /// - /// - void AddScene(IScene scene); - - /// - /// Start sending and receiving data. - /// - void Start(); - - /// - /// Stop sending and receiving data. - /// - void Stop(); - } -} diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index cb05e8f19c..b5bdd469c6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -40,8 +40,9 @@ using OpenSim.Framework; using OpenSim.Framework.Console; using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; using OpenMetaverse; - +using Mono.Addins; using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket; namespace OpenSim.Region.ClientStack.LindenUDP @@ -49,14 +50,55 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// A shim around LLUDPServer that implements the IClientNetworkServer interface /// - public sealed class LLUDPServerShim : IClientNetworkServer + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LLUDPServerShim")] + public sealed class LLUDPServerShim : INonSharedRegionModule { + private bool m_Enabled = true; + private IConfigSource m_Config; LLUDPServer m_udpServer; - public LLUDPServerShim() + #region INonSharedRegionModule + public string Name + { + get { return "LLUDPServerShim"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + m_Config = source; + } + + public void Close() { } + public void AddRegion(Scene scene) + { + uint port = (uint)scene.RegionInfo.InternalEndPoint.Port; + + IPAddress listenIP = scene.RegionInfo.InternalEndPoint.Address; + Initialise(listenIP, ref port, scene.RegionInfo.ProxyOffset, scene.RegionInfo.m_allow_alternate_ports, m_Config, scene.AuthenticateHandler); + scene.RegionInfo.InternalEndPoint.Port = (int)port; + + AddScene(scene); + } + + public void RemoveRegion(Scene scene) + { + Stop(); + } + + public void RegionLoaded(Scene scene) + { + Start(); + } + #endregion + public void Initialise(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager) { m_udpServer = new LLUDPServer(listenIP, ref port, proxyPortOffsetParm, allow_alternate_port, configSource, circuitManager); @@ -200,6 +242,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_udpServer.Stop(); } + } /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs index 8795c0c07a..a1ff69e115 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/Properties/AssemblyInfo.cs @@ -1,6 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using Mono.Addins; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -31,3 +32,5 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("0.8.2.*")] +[assembly: Addin("LindenUDP", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index b632774ead..7d9609fbf4 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -37,7 +37,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.CoreModules.Avatar.Attachments; diff --git a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs index b8a1dba359..7bec18f228 100644 --- a/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/BakedTextures/XBakesModule.cs @@ -38,7 +38,6 @@ using System.Reflection; using log4net; using OpenSim.Framework; using OpenSim.Framework.ServiceAuth; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 7ab568e8e5..08e7dd2cbc 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -38,7 +38,6 @@ using OpenMetaverse; using Mono.Addins; using OpenSim.Framework; using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs index 7ce2813139..315d372a60 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs @@ -32,7 +32,6 @@ using Nini.Config; using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 1650097f0e..ac89f52940 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -32,7 +32,6 @@ using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 5295ba38ad..8d11d200c7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -34,7 +34,6 @@ using NDesk.Options; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs index 84f9f3f6bd..c2e645f0c1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs @@ -36,7 +36,6 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs index d5f3a22742..57b4f8067a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs @@ -36,7 +36,6 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs index b614c180d7..7265405c3c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs @@ -36,7 +36,6 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index 4b015d7488..519c697483 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs @@ -36,7 +36,6 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 9a57599c98..3cbde620ea 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Client; using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs index 54ec75141e..e3c6c0d0b6 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferStateMachine.cs @@ -38,7 +38,7 @@ using OpenSim.Framework.Capabilities; using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs index c64ab44a8d..1d9116542a 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs @@ -37,7 +37,6 @@ using OpenSim.Data; using OpenSim.Framework; using OpenSim.Framework.Serialization; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.CoreModules.Framework.InventoryAccess; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs index d10c9b427a..862f0b7eb5 100644 --- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs @@ -30,7 +30,6 @@ using System.IO; using System.Reflection; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; using OpenSim.Region.Framework; @@ -159,7 +158,7 @@ namespace OpenSim.Region.CoreModules.Framework.Library } RegionInfo regInfo = new RegionInfo(); - Scene m_MockScene = new Scene(regInfo, null); + Scene m_MockScene = new Scene(regInfo); LocalInventoryService invService = new LocalInventoryService(lib); m_MockScene.RegisterModuleInterface(invService); m_MockScene.RegisterModuleInterface(m_Scene.AssetService); diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index c0faad89a3..87f479828d 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -37,7 +37,6 @@ using System.Security.Cryptography.X509Certificates; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 7462ebd182..d45962f520 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -32,7 +32,7 @@ using System.Net; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; -using OpenSim.Framework.Communications; +using OpenSim.Framework; using OpenSim.Region.CoreModules.Scripting.DynamicTexture; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index 8df30d42b5..c33f7f5083 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs @@ -85,7 +85,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests r1.ExternalHostName = "127.0.0.1"; r1.HttpPort = 9001; r1.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); - Scene s = new Scene(new RegionInfo(), null); + Scene s = new Scene(new RegionInfo()); s.RegionInfo.RegionID = r1.RegionID; m_LocalConnector.AddRegion(s); @@ -97,7 +97,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests r2.ExternalHostName = "127.0.0.1"; r2.HttpPort = 9002; r2.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); - s = new Scene(new RegionInfo(), null); + s = new Scene(new RegionInfo()); s.RegionInfo.RegionID = r2.RegionID; m_LocalConnector.AddRegion(s); @@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests r3.ExternalHostName = "127.0.0.1"; r3.HttpPort = 9003; r3.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); - s = new Scene(new RegionInfo(), null); + s = new Scene(new RegionInfo()); s.RegionInfo.RegionID = r3.RegionID; m_LocalConnector.AddRegion(s); @@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests r4.ExternalHostName = "127.0.0.1"; r4.HttpPort = 9004; r4.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), 0); - s = new Scene(new RegionInfo(), null); + s = new Scene(new RegionInfo()); s.RegionInfo.RegionID = r4.RegionID; m_LocalConnector.AddRegion(s); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 12ffc010c4..c1daae9985 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -38,7 +38,6 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; diff --git a/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs b/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs index f54ab2c13e..4bb3799dc9 100644 --- a/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/XEstateModule.cs @@ -34,7 +34,6 @@ using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs index d17c517289..70c6028176 100644 --- a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs @@ -45,7 +45,7 @@ using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 749c2cc66c..ad6793f863 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -44,7 +44,7 @@ using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; using Caps = OpenSim.Framework.Capabilities.Caps; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index 8e843eedcf..443eee1da7 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -41,7 +41,7 @@ using Mono.Addins; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; using OpenMetaverse; diff --git a/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs b/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs deleted file mode 100644 index e60d3ae0a0..0000000000 --- a/OpenSim/Region/DataSnapshot/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Region.DataSnapshot")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("OpenSim")] -[assembly: AssemblyCopyright("OpenSimulator developers")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("06c36944-a28d-470e-912c-654c3edaba6b")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.8.2.*")] - diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index ade908d657..e80a33bcbf 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -35,7 +35,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.Framework.Scenes.Animation { diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 22b8e4d901..0a6bca4c4e 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -635,8 +635,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptColliderStart; @@ -649,8 +649,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptColliding; @@ -662,8 +662,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptCollidingEnd; @@ -675,8 +675,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptLandColliderStart; @@ -688,8 +688,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptLandColliding; @@ -701,8 +701,8 @@ namespace OpenSim.Region.Framework.Scenes /// Triggered by /// in /// via - /// via - /// via + /// via + /// via /// public event ScriptColliding OnScriptLandColliderEnd; diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs index c00190a7cc..cdd8d2de67 100644 --- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs +++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs @@ -36,7 +36,7 @@ using System.Threading; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.Framework.Scenes.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization; diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index c0405adde4..bd9d580662 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs @@ -31,7 +31,7 @@ using log4net; using Nini.Config; using OpenSim.Framework; using OpenMetaverse; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; /* * Steps to add a new prioritization policy: diff --git a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs index f208afb758..3b31281cbe 100644 --- a/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs +++ b/OpenSim/Region/Framework/Scenes/RegionStatsHandler.cs @@ -35,7 +35,6 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 20767e5416..0b0e458906 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -31,7 +31,6 @@ using System.Threading; using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Services.Interfaces; namespace OpenSim.Region.Framework.Scenes diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 52e03b20ad..05edd20f8d 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -42,12 +42,11 @@ using OpenMetaverse.Imaging; using OpenSim.Framework; using OpenSim.Framework.Monitoring; using OpenSim.Services.Interfaces; -using OpenSim.Framework.Communications; using OpenSim.Framework.Console; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Scripting; using OpenSim.Region.Framework.Scenes.Serialization; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using Timer = System.Timers.Timer; using TPFlags = OpenSim.Framework.Constants.TeleportFlags; using GridRegion = OpenSim.Services.Interfaces.GridRegion; @@ -855,11 +854,10 @@ namespace OpenSim.Region.Framework.Scenes #region Constructors - public Scene(RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, - SceneCommunicationService sceneGridService, + public Scene(RegionInfo regInfo, AgentCircuitManager authen, ISimulationDataService simDataService, IEstateDataService estateDataService, IConfigSource config, string simulatorVersion) - : this(regInfo, physicsScene) + : this(regInfo) { m_config = config; MinFrameTime = 0.089f; @@ -870,7 +868,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue / 2)) + (uint)(uint.MaxValue / 4); m_authenticateHandler = authen; - m_sceneGridService = sceneGridService; + m_sceneGridService = new SceneCommunicationService(); m_SimulationDataService = simDataService; m_EstateDataService = estateDataService; @@ -1088,11 +1086,11 @@ namespace OpenSim.Region.Framework.Scenes } } - string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "Startup" }; + string[] possibleAccessControlConfigSections = new string[] { "Startup", "AccessControl"}; string grant = Util.GetConfigVarFromSections( - config, "AllowedClients", possibleAccessControlConfigSections, ""); + config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); if (grant.Length > 0) { @@ -1104,7 +1102,11 @@ namespace OpenSim.Region.Framework.Scenes grant = Util.GetConfigVarFromSections( - config, "BannedClients", possibleAccessControlConfigSections, ""); + config, "DeniedClients", possibleAccessControlConfigSections, String.Empty); + // Deal with the mess of someone having used a different word at some point + if (grant == String.Empty) + grant = Util.GetConfigVarFromSections( + config, "BannedClients", possibleAccessControlConfigSections, String.Empty); if (grant.Length > 0) { @@ -1201,11 +1203,10 @@ namespace OpenSim.Region.Framework.Scenes MainConsole.Instance.Commands.AddCommand("scene", false, "gc collect", "gc collect", "gc collect", "Cause the garbage collector to make a single pass", HandleGcCollect); } - public Scene(RegionInfo regInfo, PhysicsScene physicsScene) + public Scene(RegionInfo regInfo) : base(regInfo) { m_sceneGraph = new SceneGraph(this); - m_sceneGraph.PhysicsScene = physicsScene; // If the scene graph has an Unrecoverable error, restart this sim. // Currently the only thing that causes it to happen is two kinds of specific diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index df7a72a0b0..28df1c1afd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -35,7 +35,6 @@ using OpenMetaverse.StructuredData; using log4net; using OpenSim.Framework; using OpenSim.Framework.Client; -using OpenSim.Framework.Communications; using OpenSim.Framework.Capabilities; using OpenSim.Region.Framework.Interfaces; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index c9c88d301b..0a22bb36ed 100755 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -34,7 +34,7 @@ using OpenMetaverse.Packets; using log4net; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes.Types; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.Framework.Scenes @@ -121,7 +121,12 @@ namespace OpenSim.Region.Framework.Scenes public PhysicsScene PhysicsScene { - get { return _PhyScene; } + get + { + if (_PhyScene == null) + _PhyScene = m_parentScene.RequestModuleInterface(); + return _PhyScene; + } set { // If we're not doing the initial set @@ -172,9 +177,9 @@ namespace OpenSim.Region.Framework.Scenes // PhysX does this (runs in the background). - if (_PhyScene.IsThreaded) + if (PhysicsScene.IsThreaded) { - _PhyScene.GetResults(); + PhysicsScene.GetResults(); } } @@ -214,7 +219,7 @@ namespace OpenSim.Region.Framework.Scenes // position). // // Therefore, JointMoved and JointDeactivated events will be fired as a result of the following Simulate(). - return _PhyScene.Simulate((float)elapsed); + return PhysicsScene.Simulate((float)elapsed); } protected internal void UpdateScenePresenceMovement() diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5e1801a8ac..b3bd7e0d7a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -39,7 +39,7 @@ using OpenMetaverse; using OpenMetaverse.Packets; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.Framework.Scenes.Serialization; using PermissionMask = OpenSim.Framework.PermissionMask; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c300b9603d..ea96d9e6e6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -42,7 +42,7 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Scripting; using OpenSim.Region.Framework.Scenes.Serialization; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using PermissionMask = OpenSim.Framework.PermissionMask; namespace OpenSim.Region.Framework.Scenes diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4c346b786d..29362d7ccd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -41,7 +41,7 @@ using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Animation; using OpenSim.Region.Framework.Scenes.Types; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using GridRegion = OpenSim.Services.Interfaces.GridRegion; using OpenSim.Services.Interfaces; using TeleportFlags = OpenSim.Framework.Constants.TeleportFlags; diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index a3485d29e6..3c03130bd2 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs @@ -34,7 +34,7 @@ using OpenMetaverse; using log4net; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.Framework.Scenes.Serialization { diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs index 766ce8399a..da1894143e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs @@ -34,7 +34,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs index b6b3344cf1..ee7c8a917e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs @@ -32,7 +32,6 @@ using System.Text; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs index 6118004bf9..31722278a9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneManagerTests.cs @@ -32,7 +32,6 @@ using System.Threading; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index bdf0700846..098f1b4b96 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -33,7 +33,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs index 93ac34f69d..dc3b717f83 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectCopyTests.cs @@ -32,7 +32,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Framework.EntityTransfer; using OpenSim.Region.CoreModules.Framework.InventoryAccess; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs index b7e9499b38..f9802090a6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs @@ -32,7 +32,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Framework.EntityTransfer; using OpenSim.Region.CoreModules.Framework.InventoryAccess; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index c2e0ae318f..e6d5a2f676 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -31,7 +31,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; using log4net; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index ce7fc0e188..9a665f646c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -30,7 +30,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs index fdbe7aedfa..8a2d2af90f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs @@ -31,7 +31,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs index 927d8e88d3..e3ceb04e88 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSerializationTests.cs @@ -36,7 +36,6 @@ using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Serialization.External; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs index 974529ae13..e00defd383 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs @@ -31,7 +31,6 @@ using System.Threading; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs index 5ba754cbb0..1737e3c40c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs @@ -31,7 +31,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs index cdebe2547b..af3ce8e50a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUndoRedoTests.cs @@ -30,7 +30,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs index 32d66496be..a92e3641cb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs @@ -32,7 +32,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.InstantMessage; using OpenSim.Region.CoreModules.World.Permissions; using OpenSim.Region.Framework.Interfaces; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 06e6423141..96d112d9f1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -36,7 +36,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.ClientStack.Linden; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs index 42cfa1b4c4..42d91b954a 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAnimationTests.cs @@ -35,13 +35,12 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Framework.EntityTransfer; using OpenSim.Region.CoreModules.World.Serialiser; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Tests.Common; namespace OpenSim.Region.Framework.Scenes.Tests diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs index c6e3b8b7d6..e5c847e3eb 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs @@ -33,7 +33,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs index 45bfbffb87..aa2676768c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCapabilityTests.cs @@ -36,7 +36,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.ClientStack.Linden; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs index c193a97af8..37eec52ce8 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs @@ -32,7 +32,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Framework; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index 0025e9b7b2..64f11cda96 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs @@ -32,7 +32,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 42276dd368..226ed6ee4c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs @@ -35,7 +35,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Framework; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs index 2d36214e16..045fd3cec5 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneStatisticsTests.cs @@ -31,7 +31,6 @@ using System.Reflection; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Tests.Common; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs index 33ef83b7ef..517faf14d6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs @@ -36,7 +36,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.World.Serialiser; diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index 3caea8b5a7..33a630c43e 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -37,7 +37,6 @@ using NUnit.Framework; using OpenMetaverse; using OpenMetaverse.Assets; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; diff --git a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs index edc0a5299a..8250e6c892 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UserInventoryTests.cs @@ -37,7 +37,6 @@ using NUnit.Framework; using OpenMetaverse; using OpenMetaverse.Assets; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index ed1bab4b27..eef3c92f71 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -35,7 +35,6 @@ using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs index 8095b28f5e..1cb4747a58 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs @@ -42,7 +42,6 @@ using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs index e03e71dd71..9a42bacc59 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs @@ -37,7 +37,6 @@ using OpenMetaverse.Messages.Linden; using OpenMetaverse.Packets; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.ClientStack.Linden; diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index a040f43d66..20555e4fb6 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -41,7 +41,6 @@ using OpenMetaverse; using OpenMetaverse.StructuredData; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.Framework.Interfaces; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/DataRequestHandler.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/DataRequestHandler.cs diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs similarity index 98% rename from OpenSim/Region/DataSnapshot/DataSnapshotManager.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs index 0f392731c1..4e766ebf8d 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/OptionalModules/DataSnapshot/DataSnapshotManager.cs @@ -39,14 +39,10 @@ using Nini.Config; using OpenMetaverse; using Mono.Addins; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.DataSnapshot.Interfaces; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -[assembly: Addin("DataSnapshot", OpenSim.VersionInfo.VersionNumber)] -[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] - namespace OpenSim.Region.DataSnapshot { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DataSnapshotManager")] diff --git a/OpenSim/Region/DataSnapshot/EstateSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/EstateSnapshot.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/EstateSnapshot.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/EstateSnapshot.cs diff --git a/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshot.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshot.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshot.cs diff --git a/OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshotProvider.cs b/OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshotProvider.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/Interfaces/IDataSnapshotProvider.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/Interfaces/IDataSnapshotProvider.cs diff --git a/OpenSim/Region/DataSnapshot/LLSDDiscovery.cs b/OpenSim/Region/OptionalModules/DataSnapshot/LLSDDiscovery.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/LLSDDiscovery.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/LLSDDiscovery.cs diff --git a/OpenSim/Region/DataSnapshot/LandSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/LandSnapshot.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/LandSnapshot.cs diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/ObjectSnapshot.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/ObjectSnapshot.cs diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/OptionalModules/DataSnapshot/SnapshotStore.cs similarity index 100% rename from OpenSim/Region/DataSnapshot/SnapshotStore.cs rename to OpenSim/Region/OptionalModules/DataSnapshot/SnapshotStore.cs diff --git a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs index 3083a337ff..1d9179cbf8 100755 --- a/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs +++ b/OpenSim/Region/OptionalModules/PhysicsParameters/PhysicsParameters.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Console; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.OptionalModules.PhysicsParameters { diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionCombinerClientEventForwarder.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerClientEventForwarder.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerLargeLandChannel.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs similarity index 99% rename from OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs index 0fe3ab01c8..98b0ae1d10 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerModule.cs @@ -36,7 +36,7 @@ using OpenSim.Framework.Client; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Framework.Console; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using Mono.Addins; namespace OpenSim.Region.RegionCombinerModule diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionCombinerPermissionModule.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCombinerPermissionModule.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionConnections.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionConnections.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionConnections.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionCourseLocation.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionCourseLocation.cs diff --git a/OpenSim/Region/RegionCombinerModule/RegionData.cs b/OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs similarity index 100% rename from OpenSim/Region/RegionCombinerModule/RegionData.cs rename to OpenSim/Region/OptionalModules/RegionCombinerModule/RegionData.cs diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs deleted file mode 100755 index ff4afbf90e..0000000000 --- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyrightD - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading; - -using OpenSim.Framework; -using OpenSim.Region.CoreModules; -using OpenSim.Region.Framework; -using OpenSim.Region.Framework.Interfaces; -using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; - -using Mono.Addins; -using Nini.Config; -using log4net; -using OpenMetaverse; - -namespace OpenSim.Region.OptionalModules.Scripting -{ -[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] -public class ExtendedPhysics : INonSharedRegionModule -{ - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static string LogHeader = "[EXTENDED PHYSICS]"; - - // ============================================================= - // Since BulletSim is a plugin, this these values aren't defined easily in one place. - // This table must correspond to an identical table in BSScene. - - // Per scene functions. See BSScene. - - // Per avatar functions. See BSCharacter. - - // Per prim functions. See BSPrim. - public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType"; - public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; - public const string PhysFunctChangeLinkFixed = "BulletSim.ChangeLinkFixed"; - public const string PhysFunctChangeLinkType = "BulletSim.ChangeLinkType"; - public const string PhysFunctGetLinkType = "BulletSim.GetLinkType"; - public const string PhysFunctChangeLinkParams = "BulletSim.ChangeLinkParams"; - public const string PhysFunctAxisLockLimits = "BulletSim.AxisLockLimits"; - - // ============================================================= - - private IConfig Configuration { get; set; } - private bool Enabled { get; set; } - private Scene BaseScene { get; set; } - private IScriptModuleComms Comms { get; set; } - - #region INonSharedRegionModule - - public string Name { get { return this.GetType().Name; } } - - public void Initialise(IConfigSource config) - { - BaseScene = null; - Enabled = false; - Configuration = null; - Comms = null; - - try - { - if ((Configuration = config.Configs["ExtendedPhysics"]) != null) - { - Enabled = Configuration.GetBoolean("Enabled", Enabled); - } - } - catch (Exception e) - { - m_log.ErrorFormat("{0} Initialization error: {0}", LogHeader, e); - } - - m_log.InfoFormat("{0} module {1} enabled", LogHeader, (Enabled ? "is" : "is not")); - } - - public void Close() - { - if (BaseScene != null) - { - BaseScene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene; - BaseScene.EventManager.OnSceneObjectPartUpdated -= EventManager_OnSceneObjectPartUpdated; - BaseScene = null; - } - } - - public void AddRegion(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (BaseScene != null && BaseScene == scene) - { - Close(); - } - } - - public void RegionLoaded(Scene scene) - { - if (!Enabled) return; - - BaseScene = scene; - - Comms = BaseScene.RequestModuleInterface(); - if (Comms == null) - { - m_log.WarnFormat("{0} ScriptModuleComms interface not defined", LogHeader); - Enabled = false; - - return; - } - - // Register as LSL functions all the [ScriptInvocation] marked methods. - Comms.RegisterScriptInvocations(this); - Comms.RegisterConstants(this); - - // When an object is modified, we might need to update its extended physics parameters - BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; - BaseScene.EventManager.OnSceneObjectPartUpdated += EventManager_OnSceneObjectPartUpdated; - - } - - public Type ReplaceableInterface { get { return null; } } - - #endregion // INonSharedRegionModule - - private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) - { - } - - // Event generated when some property of a prim changes. - private void EventManager_OnSceneObjectPartUpdated(SceneObjectPart sop, bool isFullUpdate) - { - } - - [ScriptConstant] - public const int PHYS_CENTER_OF_MASS = 1 << 0; - - [ScriptInvocation] - public string physGetEngineType(UUID hostID, UUID scriptID) - { - string ret = string.Empty; - - if (BaseScene.PhysicsScene != null) - { - ret = BaseScene.PhysicsScene.EngineType; - } - - return ret; - } - - // Code for specifying params. - // The choice if 14700 is arbitrary and only serves to catch parameter code misuse. - [ScriptConstant] - public const int PHYS_AXIS_LOCK_LINEAR = 14700; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_LINEAR_X = 14701; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_LINEAR_X = 14702; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_LINEAR_Y = 14703; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_LINEAR_Y = 14704; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_LINEAR_Z = 14705; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_LINEAR_Z = 14706; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_ANGULAR = 14707; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_ANGULAR_X = 14708; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_ANGULAR_X = 14709; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_ANGULAR_Y = 14710; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_ANGULAR_Y = 14711; - [ScriptConstant] - public const int PHYS_AXIS_LOCK_ANGULAR_Z = 14712; - [ScriptConstant] - public const int PHYS_AXIS_LIMIT_ANGULAR_Z = 14713; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_LINEAR = 14714; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_LINEAR_X = 14715; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_LINEAR_Y = 14716; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_LINEAR_Z = 14717; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_ANGULAR = 14718; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_ANGULAR_X = 14719; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_ANGULAR_Y = 14720; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK_ANGULAR_Z = 14721; - [ScriptConstant] - public const int PHYS_AXIS_UNLOCK = 14722; - // physAxisLockLimits() - [ScriptInvocation] - public int physAxisLock(UUID hostID, UUID scriptID, object[] parms) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - if (GetRootPhysActor(hostID, out rootPhysActor)) - { - object[] parms2 = AddToBeginningOfArray(rootPhysActor, null, parms); - ret = MakeIntError(rootPhysActor.Extension(PhysFunctAxisLockLimits, parms2)); - } - - return ret; - } - - [ScriptConstant] - public const int PHYS_LINKSET_TYPE_CONSTRAINT = 0; - [ScriptConstant] - public const int PHYS_LINKSET_TYPE_COMPOUND = 1; - [ScriptConstant] - public const int PHYS_LINKSET_TYPE_MANUAL = 2; - - [ScriptInvocation] - public int physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) - { - int ret = -1; - if (!Enabled) return ret; - - // The part that is requesting the change. - SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); - - if (requestingPart != null) - { - // The change is always made to the root of a linkset. - SceneObjectGroup containingGroup = requestingPart.ParentGroup; - SceneObjectPart rootPart = containingGroup.RootPart; - - if (rootPart != null) - { - PhysicsActor rootPhysActor = rootPart.PhysActor; - if (rootPhysActor != null) - { - if (rootPhysActor.IsPhysical) - { - // Change a physical linkset by making non-physical, waiting for one heartbeat so all - // the prim and linkset state is updated, changing the type and making the - // linkset physical again. - containingGroup.ScriptSetPhysicsStatus(false); - Thread.Sleep(150); // longer than one heartbeat tick - - // A kludge for the moment. - // Since compound linksets move the children but don't generate position updates to the - // simulator, it is possible for compound linkset children to have out-of-sync simulator - // and physical positions. The following causes the simulator to push the real child positions - // down into the physics engine to get everything synced. - containingGroup.UpdateGroupPosition(containingGroup.AbsolutePosition); - containingGroup.UpdateGroupRotationR(containingGroup.GroupRotation); - - object[] parms2 = { rootPhysActor, null, linksetType }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2)); - Thread.Sleep(150); // longer than one heartbeat tick - - containingGroup.ScriptSetPhysicsStatus(true); - } - else - { - // Non-physical linksets don't have a physical instantiation so there is no state to - // worry about being updated. - object[] parms2 = { rootPhysActor, null, linksetType }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2)); - } - } - else - { - m_log.WarnFormat("{0} physSetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}", - LogHeader, rootPart.Name, hostID); - } - } - else - { - m_log.WarnFormat("{0} physSetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}", - LogHeader, requestingPart.Name, hostID); - } - } - else - { - m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); - } - return ret; - } - - [ScriptInvocation] - public int physGetLinksetType(UUID hostID, UUID scriptID) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - if (GetRootPhysActor(hostID, out rootPhysActor)) - { - object[] parms2 = { rootPhysActor, null }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinksetType, parms2)); - } - else - { - m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); - } - return ret; - } - - [ScriptConstant] - public const int PHYS_LINK_TYPE_FIXED = 1234; - [ScriptConstant] - public const int PHYS_LINK_TYPE_HINGE = 4; - [ScriptConstant] - public const int PHYS_LINK_TYPE_SPRING = 9; - [ScriptConstant] - public const int PHYS_LINK_TYPE_6DOF = 6; - [ScriptConstant] - public const int PHYS_LINK_TYPE_SLIDER = 7; - - // physChangeLinkType(integer linkNum, integer typeCode) - [ScriptInvocation] - public int physChangeLinkType(UUID hostID, UUID scriptID, int linkNum, int typeCode) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - PhysicsActor childPhysActor; - - if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) - { - object[] parms2 = { rootPhysActor, childPhysActor, typeCode }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2)); - } - - return ret; - } - - // physGetLinkType(integer linkNum) - [ScriptInvocation] - public int physGetLinkType(UUID hostID, UUID scriptID, int linkNum) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - PhysicsActor childPhysActor; - - if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) - { - object[] parms2 = { rootPhysActor, childPhysActor }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinkType, parms2)); - } - - return ret; - } - - // physChangeLinkFixed(integer linkNum) - // Change the link between the root and the linkNum into a fixed, static physical connection. - [ScriptInvocation] - public int physChangeLinkFixed(UUID hostID, UUID scriptID, int linkNum) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - PhysicsActor childPhysActor; - - if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) - { - object[] parms2 = { rootPhysActor, childPhysActor , PHYS_LINK_TYPE_FIXED }; - ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2)); - } - - return ret; - } - - // Code for specifying params. - // The choice if 14400 is arbitrary and only serves to catch parameter code misuse. - public const int PHYS_PARAM_MIN = 14401; - - [ScriptConstant] - public const int PHYS_PARAM_FRAMEINA_LOC = 14401; - [ScriptConstant] - public const int PHYS_PARAM_FRAMEINA_ROT = 14402; - [ScriptConstant] - public const int PHYS_PARAM_FRAMEINB_LOC = 14403; - [ScriptConstant] - public const int PHYS_PARAM_FRAMEINB_ROT = 14404; - [ScriptConstant] - public const int PHYS_PARAM_LINEAR_LIMIT_LOW = 14405; - [ScriptConstant] - public const int PHYS_PARAM_LINEAR_LIMIT_HIGH = 14406; - [ScriptConstant] - public const int PHYS_PARAM_ANGULAR_LIMIT_LOW = 14407; - [ScriptConstant] - public const int PHYS_PARAM_ANGULAR_LIMIT_HIGH = 14408; - [ScriptConstant] - public const int PHYS_PARAM_USE_FRAME_OFFSET = 14409; - [ScriptConstant] - public const int PHYS_PARAM_ENABLE_TRANSMOTOR = 14410; - [ScriptConstant] - public const int PHYS_PARAM_TRANSMOTOR_MAXVEL = 14411; - [ScriptConstant] - public const int PHYS_PARAM_TRANSMOTOR_MAXFORCE = 14412; - [ScriptConstant] - public const int PHYS_PARAM_CFM = 14413; - [ScriptConstant] - public const int PHYS_PARAM_ERP = 14414; - [ScriptConstant] - public const int PHYS_PARAM_SOLVER_ITERATIONS = 14415; - [ScriptConstant] - public const int PHYS_PARAM_SPRING_AXIS_ENABLE = 14416; - [ScriptConstant] - public const int PHYS_PARAM_SPRING_DAMPING = 14417; - [ScriptConstant] - public const int PHYS_PARAM_SPRING_STIFFNESS = 14418; - [ScriptConstant] - public const int PHYS_PARAM_LINK_TYPE = 14419; - [ScriptConstant] - public const int PHYS_PARAM_USE_LINEAR_FRAMEA = 14420; - [ScriptConstant] - public const int PHYS_PARAM_SPRING_EQUILIBRIUM_POINT = 14421; - - public const int PHYS_PARAM_MAX = 14421; - - // Used when specifying a parameter that has settings for the three linear and three angular axis - [ScriptConstant] - public const int PHYS_AXIS_ALL = -1; - [ScriptConstant] - public const int PHYS_AXIS_LINEAR_ALL = -2; - [ScriptConstant] - public const int PHYS_AXIS_ANGULAR_ALL = -3; - [ScriptConstant] - public const int PHYS_AXIS_LINEAR_X = 0; - [ScriptConstant] - public const int PHYS_AXIS_LINEAR_Y = 1; - [ScriptConstant] - public const int PHYS_AXIS_LINEAR_Z = 2; - [ScriptConstant] - public const int PHYS_AXIS_ANGULAR_X = 3; - [ScriptConstant] - public const int PHYS_AXIS_ANGULAR_Y = 4; - [ScriptConstant] - public const int PHYS_AXIS_ANGULAR_Z = 5; - - // physChangeLinkParams(integer linkNum, [ PHYS_PARAM_*, value, PHYS_PARAM_*, value, ...]) - [ScriptInvocation] - public int physChangeLinkParams(UUID hostID, UUID scriptID, int linkNum, object[] parms) - { - int ret = -1; - if (!Enabled) return ret; - - PhysicsActor rootPhysActor; - PhysicsActor childPhysActor; - - if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) - { - object[] parms2 = AddToBeginningOfArray(rootPhysActor, childPhysActor, parms); - ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkParams, parms2)); - } - - return ret; - } - - private bool GetRootPhysActor(UUID hostID, out PhysicsActor rootPhysActor) - { - SceneObjectGroup containingGroup; - SceneObjectPart rootPart; - return GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor); - } - - private bool GetRootPhysActor(UUID hostID, out SceneObjectGroup containingGroup, out SceneObjectPart rootPart, out PhysicsActor rootPhysActor) - { - bool ret = false; - rootPhysActor = null; - containingGroup = null; - rootPart = null; - - SceneObjectPart requestingPart; - - requestingPart = BaseScene.GetSceneObjectPart(hostID); - if (requestingPart != null) - { - // The type is is always on the root of a linkset. - containingGroup = requestingPart.ParentGroup; - if (containingGroup != null && !containingGroup.IsDeleted) - { - rootPart = containingGroup.RootPart; - if (rootPart != null) - { - rootPhysActor = rootPart.PhysActor; - if (rootPhysActor != null) - { - ret = true; - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}", - LogHeader, rootPart.Name, hostID); - } - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not exist. RequestingPartName={1}, hostID={2}", - LogHeader, requestingPart.Name, hostID); - } - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Containing group missing or deleted. hostID={1}", LogHeader, hostID); - } - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: cannot find script object in scene. hostID={1}", LogHeader, hostID); - } - - return ret; - } - - // Find the root and child PhysActors based on the linkNum. - // Return 'true' if both are found and returned. - private bool GetRootAndChildPhysActors(UUID hostID, int linkNum, out PhysicsActor rootPhysActor, out PhysicsActor childPhysActor) - { - bool ret = false; - rootPhysActor = null; - childPhysActor = null; - - SceneObjectGroup containingGroup; - SceneObjectPart rootPart; - - if (GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor)) - { - SceneObjectPart linkPart = containingGroup.GetLinkNumPart(linkNum); - if (linkPart != null) - { - childPhysActor = linkPart.PhysActor; - if (childPhysActor != null) - { - ret = true; - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Link part has no physical actor. rootName={1}, hostID={2}, linknum={3}", - LogHeader, rootPart.Name, hostID, linkNum); - } - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Could not find linknum part. rootName={1}, hostID={2}, linknum={3}", - LogHeader, rootPart.Name, hostID, linkNum); - } - } - else - { - m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}", - LogHeader, rootPart.Name, hostID); - } - - return ret; - } - - // Return an array of objects with the passed object as the first object of a new array - private object[] AddToBeginningOfArray(object firstOne, object secondOne, object[] prevArray) - { - object[] newArray = new object[2 + prevArray.Length]; - newArray[0] = firstOne; - newArray[1] = secondOne; - prevArray.CopyTo(newArray, 2); - return newArray; - } - - // Extension() returns an object. Convert that object into the integer error we expect to return. - private int MakeIntError(object extensionRet) - { - int ret = -1; - if (extensionRet != null) - { - try - { - ret = (int)extensionRet; - } - catch - { - ret = -1; - } - } - return ret; - } -} -} diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index 5ed1514ad4..47b9c090a8 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs @@ -34,7 +34,7 @@ using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.OptionalModules.Scripting.Minimodule.Object; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using PrimType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.PrimType; using SculptType=OpenSim.Region.OptionalModules.Scripting.Minimodule.Object.SculptType; diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs index 97133c05a4..4b7295d6dc 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs @@ -35,7 +35,6 @@ using OpenMetaverse; using Mono.Addins; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Client; diff --git a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs b/OpenSim/Region/OptionalModules/UserStatistics/ActiveConnectionsAJAX.cs similarity index 100% rename from OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs rename to OpenSim/Region/OptionalModules/UserStatistics/ActiveConnectionsAJAX.cs diff --git a/OpenSim/Region/UserStatistics/Clients_report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs similarity index 100% rename from OpenSim/Region/UserStatistics/Clients_report.cs rename to OpenSim/Region/OptionalModules/UserStatistics/Clients_report.cs diff --git a/OpenSim/Region/UserStatistics/Default_Report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs similarity index 100% rename from OpenSim/Region/UserStatistics/Default_Report.cs rename to OpenSim/Region/OptionalModules/UserStatistics/Default_Report.cs diff --git a/OpenSim/Region/UserStatistics/HTMLUtil.cs b/OpenSim/Region/OptionalModules/UserStatistics/HTMLUtil.cs similarity index 100% rename from OpenSim/Region/UserStatistics/HTMLUtil.cs rename to OpenSim/Region/OptionalModules/UserStatistics/HTMLUtil.cs diff --git a/OpenSim/Region/UserStatistics/IStatsReport.cs b/OpenSim/Region/OptionalModules/UserStatistics/IStatsReport.cs similarity index 100% rename from OpenSim/Region/UserStatistics/IStatsReport.cs rename to OpenSim/Region/OptionalModules/UserStatistics/IStatsReport.cs diff --git a/OpenSim/Region/UserStatistics/LogLinesAJAX.cs b/OpenSim/Region/OptionalModules/UserStatistics/LogLinesAJAX.cs similarity index 100% rename from OpenSim/Region/UserStatistics/LogLinesAJAX.cs rename to OpenSim/Region/OptionalModules/UserStatistics/LogLinesAJAX.cs diff --git a/OpenSim/Region/UserStatistics/Prototype_distributor.cs b/OpenSim/Region/OptionalModules/UserStatistics/Prototype_distributor.cs similarity index 100% rename from OpenSim/Region/UserStatistics/Prototype_distributor.cs rename to OpenSim/Region/OptionalModules/UserStatistics/Prototype_distributor.cs diff --git a/OpenSim/Region/UserStatistics/Sessions_Report.cs b/OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs similarity index 100% rename from OpenSim/Region/UserStatistics/Sessions_Report.cs rename to OpenSim/Region/OptionalModules/UserStatistics/Sessions_Report.cs diff --git a/OpenSim/Region/UserStatistics/SimStatsAJAX.cs b/OpenSim/Region/OptionalModules/UserStatistics/SimStatsAJAX.cs similarity index 100% rename from OpenSim/Region/UserStatistics/SimStatsAJAX.cs rename to OpenSim/Region/OptionalModules/UserStatistics/SimStatsAJAX.cs diff --git a/OpenSim/Region/UserStatistics/Updater_distributor.cs b/OpenSim/Region/OptionalModules/UserStatistics/Updater_distributor.cs similarity index 100% rename from OpenSim/Region/UserStatistics/Updater_distributor.cs rename to OpenSim/Region/OptionalModules/UserStatistics/Updater_distributor.cs diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs similarity index 99% rename from OpenSim/Region/UserStatistics/WebStatsModule.cs rename to OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs index 8ccb751682..bd5289f793 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/OptionalModules/UserStatistics/WebStatsModule.cs @@ -50,9 +50,6 @@ using Caps = OpenSim.Framework.Capabilities.Caps; using OSD = OpenMetaverse.StructuredData.OSD; using OSDMap = OpenMetaverse.StructuredData.OSDMap; -[assembly: Addin("WebStats", OpenSim.VersionInfo.VersionNumber)] -[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] - namespace OpenSim.Region.UserStatistics { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WebStatsModule")] diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 2345e384a5..a892cf4ab6 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -33,7 +33,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Region.CoreModules.Avatar.Attachments; using OpenSim.Region.CoreModules.Avatar.AvatarFactory; using OpenSim.Region.CoreModules.Framework.InventoryAccess; diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs deleted file mode 100644 index 373c7e0015..0000000000 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; - -namespace OpenSim.Region.Physics.BasicPhysicsPlugin -{ - /// - /// Effectively a physics plugin that simulates no physics at all. - /// - public class BasicPhysicsPlugin : IPhysicsPlugin - { - public BasicPhysicsPlugin() - { - } - - public bool Init() - { - return true; - } - - public PhysicsScene GetScene(string sceneIdentifier) - { - return new BasicScene(GetName(), sceneIdentifier); - } - - public string GetName() - { - return ("basicphysics"); - } - - public void Dispose() - { - } - } -} diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs deleted file mode 100644 index 944285414d..0000000000 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyrightD - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using System.Collections.Generic; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.BulletSPlugin -{ - /// - /// Entry for a port of Bullet (http://bulletphysics.org/) to OpenSim. - /// This module interfaces to an unmanaged C++ library which makes the - /// actual calls into the Bullet physics engine. - /// The unmanaged library is found in opensim-libs::trunk/unmanaged/BulletSim/. - /// The unmanaged library is compiled and linked statically with Bullet - /// to create BulletSim.dll and libBulletSim.so (for both 32 and 64 bit). - /// -public class BSPlugin : IPhysicsPlugin -{ - //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - private BSScene _mScene; - - public BSPlugin() - { - } - - public bool Init() - { - return true; - } - - public PhysicsScene GetScene(String sceneIdentifier) - { - if (_mScene == null) - { - _mScene = new BSScene(GetName(), sceneIdentifier); - } - return (_mScene); - } - - public string GetName() - { - return ("BulletSim"); - } - - public void Dispose() - { - } -} -} diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs deleted file mode 100644 index 0bace144cb..0000000000 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ /dev/null @@ -1,1283 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyrightD - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading; -using OpenSim.Framework; -using OpenSim.Framework.Monitoring; -using OpenSim.Region.Framework; -using OpenSim.Region.CoreModules; -using Logging = OpenSim.Region.CoreModules.Framework.Statistics.Logging; -using OpenSim.Region.Physics.Manager; -using Nini.Config; -using log4net; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.BulletSPlugin -{ -public sealed class BSScene : PhysicsScene, IPhysicsParameters -{ - internal static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - internal static readonly string LogHeader = "[BULLETS SCENE]"; - - // The name of the region we're working for. - public string RegionName { get; private set; } - - public string BulletSimVersion = "?"; - - // The handle to the underlying managed or unmanaged version of Bullet being used. - public string BulletEngineName { get; private set; } - public BSAPITemplate PE; - - // If the physics engine is running on a separate thread - public Thread m_physicsThread; - - public Dictionary PhysObjects; - public BSShapeCollection Shapes; - - // Keeping track of the objects with collisions so we can report begin and end of a collision - public HashSet ObjectsWithCollisions = new HashSet(); - public HashSet ObjectsWithNoMoreCollisions = new HashSet(); - - // All the collision processing is protected with this lock object - public Object CollisionLock = new Object(); - - // Properties are updated here - public Object UpdateLock = new Object(); - public HashSet ObjectsWithUpdates = new HashSet(); - - // Keep track of all the avatars so we can send them a collision event - // every tick so OpenSim will update its animation. - private HashSet AvatarsInScene = new HashSet(); - private Object AvatarsInSceneLock = new Object(); - - // let my minuions use my logger - public ILog Logger { get { return m_log; } } - - public IMesher mesher; - public uint WorldID { get; private set; } - public BulletWorld World { get; private set; } - - // All the constraints that have been allocated in this instance. - public BSConstraintCollection Constraints { get; private set; } - - // Simulation parameters - //internal float m_physicsStepTime; // if running independently, the interval simulated by default - - internal int m_maxSubSteps; - internal float m_fixedTimeStep; - - internal float m_simulatedTime; // the time simulated previously. Used for physics framerate calc. - - internal long m_simulationStep = 0; // The current simulation step. - public long SimulationStep { get { return m_simulationStep; } } - // A number to use for SimulationStep that is probably not any step value - // Used by the collision code (which remembers the step when a collision happens) to remember not any simulation step. - public static long NotASimulationStep = -1234; - - internal float LastTimeStep { get; private set; } // The simulation time from the last invocation of Simulate() - - internal float NominalFrameRate { get; set; } // Parameterized ideal frame rate that simulation is scaled to - - // Physical objects can register for prestep or poststep events - public delegate void PreStepAction(float timeStep); - public delegate void PostStepAction(float timeStep); - public event PreStepAction BeforeStep; - public event PostStepAction AfterStep; - - // A value of the time 'now' so all the collision and update routines do not have to get their own - // Set to 'now' just before all the prims and actors are called for collisions and updates - public int SimulationNowTime { get; private set; } - - // True if initialized and ready to do simulation steps - private bool m_initialized = false; - - // Flag which is true when processing taints. - // Not guaranteed to be correct all the time (don't depend on this) but good for debugging. - public bool InTaintTime { get; private set; } - - // Pinned memory used to pass step information between managed and unmanaged - internal int m_maxCollisionsPerFrame; - internal CollisionDesc[] m_collisionArray; - - internal int m_maxUpdatesPerFrame; - internal EntityProperties[] m_updateArray; - - /// - /// Used to control physics simulation timing if Bullet is running on its own thread. - /// - private ManualResetEvent m_updateWaitEvent; - - public const uint TERRAIN_ID = 0; // OpenSim senses terrain with a localID of zero - public const uint GROUNDPLANE_ID = 1; - public const uint CHILDTERRAIN_ID = 2; // Terrain allocated based on our mega-prim childre start here - - public float SimpleWaterLevel { get; set; } - public BSTerrainManager TerrainManager { get; private set; } - - public ConfigurationParameters Params - { - get { return UnmanagedParams[0]; } - } - public Vector3 DefaultGravity - { - get { return new Vector3(0f, 0f, Params.gravity); } - } - // Just the Z value of the gravity - public float DefaultGravityZ - { - get { return Params.gravity; } - } - - // When functions in the unmanaged code must be called, it is only - // done at a known time just before the simulation step. The taint - // system saves all these function calls and executes them in - // order before the simulation. - public delegate void TaintCallback(); - private struct TaintCallbackEntry - { - public String originator; - public String ident; - public TaintCallback callback; - public TaintCallbackEntry(string pIdent, TaintCallback pCallBack) - { - originator = BSScene.DetailLogZero; - ident = pIdent; - callback = pCallBack; - } - public TaintCallbackEntry(string pOrigin, string pIdent, TaintCallback pCallBack) - { - originator = pOrigin; - ident = pIdent; - callback = pCallBack; - } - } - private Object _taintLock = new Object(); // lock for using the next object - private List _taintOperations; - private Dictionary _postTaintOperations; - private List _postStepOperations; - - // A pointer to an instance if this structure is passed to the C++ code - // Used to pass basic configuration values to the unmanaged code. - internal ConfigurationParameters[] UnmanagedParams; - - // Sometimes you just have to log everything. - public Logging.LogWriter PhysicsLogging; - private bool m_physicsLoggingEnabled; - private string m_physicsLoggingDir; - private string m_physicsLoggingPrefix; - private int m_physicsLoggingFileMinutes; - private bool m_physicsLoggingDoFlush; - private bool m_physicsPhysicalDumpEnabled; - public int PhysicsMetricDumpFrames { get; set; } - // 'true' of the vehicle code is to log lots of details - public bool VehicleLoggingEnabled { get; private set; } - public bool VehiclePhysicalLoggingEnabled { get; private set; } - - #region Construction and Initialization - public BSScene(string engineType, string identifier) - { - m_initialized = false; - - // The name of the region we're working for is passed to us. Keep for identification. - RegionName = identifier; - - // Set identifying variables in the PhysicsScene interface. - EngineType = engineType; - Name = EngineType + "/" + RegionName; - } - - // Old version of initialization that assumes legacy sized regions (256x256) - public override void Initialise(IMesher meshmerizer, IConfigSource config) - { - m_log.ErrorFormat("{0} WARNING WARNING WARNING! BulletSim initialized without region extent specification. Terrain will be messed up."); - Vector3 regionExtent = new Vector3( Constants.RegionSize, Constants.RegionSize, Constants.RegionSize); - Initialise(meshmerizer, config, regionExtent); - - } - - public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) - { - mesher = meshmerizer; - _taintOperations = new List(); - _postTaintOperations = new Dictionary(); - _postStepOperations = new List(); - PhysObjects = new Dictionary(); - Shapes = new BSShapeCollection(this); - - m_simulatedTime = 0f; - LastTimeStep = 0.1f; - - // Allocate pinned memory to pass parameters. - UnmanagedParams = new ConfigurationParameters[1]; - - // Set default values for physics parameters plus any overrides from the ini file - GetInitialParameterValues(config); - - // Force some parameters to values depending on other configurations - // Only use heightmap terrain implementation if terrain larger than legacy size - if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize) - { - m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader); - BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; - } - - // Get the connection to the physics engine (could be native or one of many DLLs) - PE = SelectUnderlyingBulletEngine(BulletEngineName); - - // Enable very detailed logging. - // By creating an empty logger when not logging, the log message invocation code - // can be left in and every call doesn't have to check for null. - if (m_physicsLoggingEnabled) - { - PhysicsLogging = new Logging.LogWriter(m_physicsLoggingDir, m_physicsLoggingPrefix, m_physicsLoggingFileMinutes, m_physicsLoggingDoFlush); - PhysicsLogging.ErrorLogger = m_log; // for DEBUG. Let's the logger output its own error messages. - } - else - { - PhysicsLogging = new Logging.LogWriter(); - } - - // Allocate memory for returning of the updates and collisions from the physics engine - m_collisionArray = new CollisionDesc[m_maxCollisionsPerFrame]; - m_updateArray = new EntityProperties[m_maxUpdatesPerFrame]; - - // The bounding box for the simulated world. The origin is 0,0,0 unless we're - // a child in a mega-region. - // Bullet actually doesn't care about the extents of the simulated - // area. It tracks active objects no matter where they are. - Vector3 worldExtent = regionExtent; - - World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray); - - Constraints = new BSConstraintCollection(World); - - TerrainManager = new BSTerrainManager(this, worldExtent); - TerrainManager.CreateInitialGroundPlaneAndTerrain(); - - // Put some informational messages into the log file. - m_log.InfoFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation); - - InTaintTime = false; - m_initialized = true; - - // If the physics engine runs on its own thread, start same. - if (BSParam.UseSeparatePhysicsThread) - { - // The physics simulation should happen independently of the heartbeat loop - m_physicsThread - = WorkManager.StartThread( - BulletSPluginPhysicsThread, - string.Format("{0} ({1})", BulletEngineName, RegionName), - ThreadPriority.Normal, - true, - true); - } - } - - // All default parameter values are set here. There should be no values set in the - // variable definitions. - private void GetInitialParameterValues(IConfigSource config) - { - ConfigurationParameters parms = new ConfigurationParameters(); - UnmanagedParams[0] = parms; - - BSParam.SetParameterDefaultValues(this); - - if (config != null) - { - // If there are specifications in the ini file, use those values - IConfig pConfig = config.Configs["BulletSim"]; - if (pConfig != null) - { - BSParam.SetParameterConfigurationValues(this, pConfig); - - // There are two Bullet implementations to choose from - BulletEngineName = pConfig.GetString("BulletEngine", "BulletUnmanaged"); - - // Very detailed logging for physics debugging - // TODO: the boolean values can be moved to the normal parameter processing. - m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false); - m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", "."); - m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-"); - m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5); - m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false); - m_physicsPhysicalDumpEnabled = pConfig.GetBoolean("PhysicsPhysicalDumpEnabled", false); - // Very detailed logging for vehicle debugging - VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); - VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false); - - // Do any replacements in the parameters - m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName); - } - else - { - // Nothing in the configuration INI file so assume unmanaged and other defaults. - BulletEngineName = "BulletUnmanaged"; - m_physicsLoggingEnabled = false; - VehicleLoggingEnabled = false; - } - - // The material characteristics. - BSMaterials.InitializeFromDefaults(Params); - if (pConfig != null) - { - // Let the user add new and interesting material property values. - BSMaterials.InitializefromParameters(pConfig); - } - } - } - - // A helper function that handles a true/false parameter and returns the proper float number encoding - float ParamBoolean(IConfig config, string parmName, float deflt) - { - float ret = deflt; - if (config.Contains(parmName)) - { - ret = ConfigurationParameters.numericFalse; - if (config.GetBoolean(parmName, false)) - { - ret = ConfigurationParameters.numericTrue; - } - } - return ret; - } - - // Select the connection to the actual Bullet implementation. - // The main engine selection is the engineName up to the first hypen. - // So "Bullet-2.80-OpenCL-Intel" specifies the 'bullet' class here and the whole name - // is passed to the engine to do its special selection, etc. - private BSAPITemplate SelectUnderlyingBulletEngine(string engineName) - { - // For the moment, do a simple switch statement. - // Someday do fancyness with looking up the interfaces in the assembly. - BSAPITemplate ret = null; - - string selectionName = engineName.ToLower(); - int hyphenIndex = engineName.IndexOf("-"); - if (hyphenIndex > 0) - selectionName = engineName.ToLower().Substring(0, hyphenIndex - 1); - - switch (selectionName) - { - case "bullet": - case "bulletunmanaged": - ret = new BSAPIUnman(engineName, this); - break; - case "bulletxna": - ret = new BSAPIXNA(engineName, this); - // Disable some features that are not implemented in BulletXNA - m_log.InfoFormat("{0} Disabling some physics features not implemented by BulletXNA", LogHeader); - m_log.InfoFormat("{0} Disabling ShouldUseBulletHACD", LogHeader); - BSParam.ShouldUseBulletHACD = false; - m_log.InfoFormat("{0} Disabling ShouldUseSingleConvexHullForPrims", LogHeader); - BSParam.ShouldUseSingleConvexHullForPrims = false; - m_log.InfoFormat("{0} Disabling ShouldUseGImpactShapeForPrims", LogHeader); - BSParam.ShouldUseGImpactShapeForPrims = false; - m_log.InfoFormat("{0} Setting terrain implimentation to Heightmap", LogHeader); - BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; - break; - } - - if (ret == null) - { - m_log.ErrorFormat("{0} COULD NOT SELECT BULLET ENGINE: '[BulletSim]PhysicsEngine' must be either 'BulletUnmanaged-*' or 'BulletXNA-*'", LogHeader); - } - else - { - m_log.InfoFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion); - } - - return ret; - } - - public override void Dispose() - { - // m_log.DebugFormat("{0}: Dispose()", LogHeader); - - // make sure no stepping happens while we're deleting stuff - m_initialized = false; - - lock (PhysObjects) - { - foreach (KeyValuePair kvp in PhysObjects) - { - kvp.Value.Destroy(); - } - PhysObjects.Clear(); - } - - // Now that the prims are all cleaned up, there should be no constraints left - if (Constraints != null) - { - Constraints.Dispose(); - Constraints = null; - } - - if (Shapes != null) - { - Shapes.Dispose(); - Shapes = null; - } - - if (TerrainManager != null) - { - TerrainManager.ReleaseGroundPlaneAndTerrain(); - TerrainManager.Dispose(); - TerrainManager = null; - } - - // Anything left in the unmanaged code should be cleaned out - PE.Shutdown(World); - - // Not logging any more - PhysicsLogging.Close(); - } - #endregion // Construction and Initialization - - #region Prim and Avatar addition and removal - - public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) - { - m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader); - return null; - } - - public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) - { - // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName); - - if (!m_initialized) return null; - - BSCharacter actor = new BSCharacter(localID, avName, this, position, velocity, size, isFlying); - lock (PhysObjects) - PhysObjects.Add(localID, actor); - - // TODO: Remove kludge someday. - // We must generate a collision for avatars whether they collide or not. - // This is required by OpenSim to update avatar animations, etc. - lock (AvatarsInSceneLock) - AvatarsInScene.Add(actor); - - return actor; - } - - public override void RemoveAvatar(PhysicsActor actor) - { - // m_log.DebugFormat("{0}: RemoveAvatar", LogHeader); - - if (!m_initialized) return; - - BSCharacter bsactor = actor as BSCharacter; - if (bsactor != null) - { - try - { - lock (PhysObjects) - PhysObjects.Remove(bsactor.LocalID); - // Remove kludge someday - lock (AvatarsInSceneLock) - AvatarsInScene.Remove(bsactor); - } - catch (Exception e) - { - m_log.WarnFormat("{0}: Attempt to remove avatar that is not in physics scene: {1}", LogHeader, e); - } - bsactor.Destroy(); - // bsactor.dispose(); - } - else - { - m_log.ErrorFormat("{0}: Requested to remove avatar that is not a BSCharacter. ID={1}, type={2}", - LogHeader, actor.LocalID, actor.GetType().Name); - } - } - - public override void RemovePrim(PhysicsActor prim) - { - if (!m_initialized) return; - - BSPhysObject bsprim = prim as BSPhysObject; - if (bsprim != null) - { - DetailLog("{0},RemovePrim,call", bsprim.LocalID); - // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID); - try - { - lock (PhysObjects) PhysObjects.Remove(bsprim.LocalID); - } - catch (Exception e) - { - m_log.ErrorFormat("{0}: Attempt to remove prim that is not in physics scene: {1}", LogHeader, e); - } - bsprim.Destroy(); - // bsprim.dispose(); - } - else - { - m_log.ErrorFormat("{0}: Attempt to remove prim that is not a BSPrim type.", LogHeader); - } - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical, uint localID) - { - // m_log.DebugFormat("{0}: AddPrimShape2: {1}", LogHeader, primName); - - if (!m_initialized) return null; - - // DetailLog("{0},BSScene.AddPrimShape,call", localID); - - BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical); - lock (PhysObjects) PhysObjects.Add(localID, prim); - return prim; - } - - // This is a call from the simulator saying that some physical property has been updated. - // The BulletSim driver senses the changing of relevant properties so this taint - // information call is not needed. - public override void AddPhysicsActorTaint(PhysicsActor prim) { } - - #endregion // Prim and Avatar addition and removal - - #region Simulation - - // Call from the simulator to send physics information to the simulator objects. - // This pushes all the collision and property update events into the objects in - // the simulator and, since it is on the heartbeat thread, there is an implicit - // locking of those data structures from other heartbeat events. - // If the physics engine is running on a separate thread, the update information - // will be in the ObjectsWithCollions and ObjectsWithUpdates structures. - public override float Simulate(float timeStep) - { - if (!BSParam.UseSeparatePhysicsThread) - { - DoPhysicsStep(timeStep); - } - return SendUpdatesToSimulator(timeStep); - } - - // Call the physics engine to do one 'timeStep' and collect collisions and updates - // into ObjectsWithCollisions and ObjectsWithUpdates data structures. - private void DoPhysicsStep(float timeStep) - { - // prevent simulation until we've been initialized - if (!m_initialized) return; - - LastTimeStep = timeStep; - - int updatedEntityCount = 0; - int collidersCount = 0; - - int beforeTime = Util.EnvironmentTickCount(); - int simTime = 0; - - int numTaints = _taintOperations.Count; - InTaintTime = true; // Only used for debugging so locking is not necessary. - - // update the prim states while we know the physics engine is not busy - ProcessTaints(); - - // Some of the physical objects requre individual, pre-step calls - // (vehicles and avatar movement, in particular) - TriggerPreStepEvent(timeStep); - - // the prestep actions might have added taints - numTaints += _taintOperations.Count; - ProcessTaints(); - - InTaintTime = false; // Only used for debugging so locking is not necessary. - - // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. - // Only enable this in a limited test world with few objects. - if (m_physicsPhysicalDumpEnabled) - PE.DumpAllInfo(World); - - // step the physical world one interval - m_simulationStep++; - int numSubSteps = 0; - try - { - numSubSteps = PE.PhysicsStep(World, timeStep, m_maxSubSteps, m_fixedTimeStep, out updatedEntityCount, out collidersCount); - - } - catch (Exception e) - { - m_log.WarnFormat("{0},PhysicsStep Exception: nTaints={1}, substeps={2}, updates={3}, colliders={4}, e={5}", - LogHeader, numTaints, numSubSteps, updatedEntityCount, collidersCount, e); - DetailLog("{0},PhysicsStepException,call, nTaints={1}, substeps={2}, updates={3}, colliders={4}", - DetailLogZero, numTaints, numSubSteps, updatedEntityCount, collidersCount); - updatedEntityCount = 0; - collidersCount = 0; - } - - // Make the physics engine dump useful statistics periodically - if (PhysicsMetricDumpFrames != 0 && ((m_simulationStep % PhysicsMetricDumpFrames) == 0)) - PE.DumpPhysicsStatistics(World); - - // Get a value for 'now' so all the collision and update routines don't have to get their own. - SimulationNowTime = Util.EnvironmentTickCount(); - - // Send collision information to the colliding objects. The objects decide if the collision - // is 'real' (like linksets don't collide with themselves) and the individual objects - // know if the simulator has subscribed to collisions. - lock (CollisionLock) - { - if (collidersCount > 0) - { - lock (PhysObjects) - { - for (int ii = 0; ii < collidersCount; ii++) - { - uint cA = m_collisionArray[ii].aID; - uint cB = m_collisionArray[ii].bID; - Vector3 point = m_collisionArray[ii].point; - Vector3 normal = m_collisionArray[ii].normal; - float penetration = m_collisionArray[ii].penetration; - SendCollision(cA, cB, point, normal, penetration); - SendCollision(cB, cA, point, -normal, penetration); - } - } - } - } - - // If any of the objects had updated properties, tell the managed objects about the update - // and remember that there was a change so it will be passed to the simulator. - lock (UpdateLock) - { - if (updatedEntityCount > 0) - { - lock (PhysObjects) - { - for (int ii = 0; ii < updatedEntityCount; ii++) - { - EntityProperties entprop = m_updateArray[ii]; - BSPhysObject pobj; - if (PhysObjects.TryGetValue(entprop.ID, out pobj)) - { - if (pobj.IsInitialized) - pobj.UpdateProperties(entprop); - } - } - } - } - } - - // Some actors want to know when the simulation step is complete. - TriggerPostStepEvent(timeStep); - - simTime = Util.EnvironmentTickCountSubtract(beforeTime); - if (PhysicsLogging.Enabled) - { - DetailLog("{0},DoPhysicsStep,complete,frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}", - DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, - updatedEntityCount, collidersCount, ObjectsWithCollisions.Count); - } - - // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. - // Only enable this in a limited test world with few objects. - if (m_physicsPhysicalDumpEnabled) - PE.DumpAllInfo(World); - - // The physics engine returns the number of milliseconds it simulated this call. - // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS. - // Multiply by a fixed nominal frame rate to give a rate similar to the simulator (usually 55). -// m_simulatedTime += (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate; - m_simulatedTime += (float)numSubSteps * m_fixedTimeStep; - } - - // Called by a BSPhysObject to note that it has changed properties and this information - // should be passed up to the simulator at the proper time. - // Note: this is called by the BSPhysObject from invocation via DoPhysicsStep() above so - // this is is under UpdateLock. - public void PostUpdate(BSPhysObject updatee) - { - lock (UpdateLock) - { - ObjectsWithUpdates.Add(updatee); - } - } - - // The simulator thinks it is physics time so return all the collisions and position - // updates that were collected in actual physics simulation. - private float SendUpdatesToSimulator(float timeStep) - { - if (!m_initialized) return 5.0f; - - DetailLog("{0},SendUpdatesToSimulator,collisions={1},updates={2},simedTime={3}", - BSScene.DetailLogZero, ObjectsWithCollisions.Count, ObjectsWithUpdates.Count, m_simulatedTime); - // Push the collisions into the simulator. - lock (CollisionLock) - { - if (ObjectsWithCollisions.Count > 0) - { - foreach (BSPhysObject bsp in ObjectsWithCollisions) - if (!bsp.SendCollisions()) - { - // If the object is done colliding, see that it's removed from the colliding list - ObjectsWithNoMoreCollisions.Add(bsp); - } - } - - // This is a kludge to get avatar movement updates. - // The simulator expects collisions for avatars even if there are have been no collisions. - // The event updates avatar animations and stuff. - // If you fix avatar animation updates, remove this overhead and let normal collision processing happen. - // Note that we get a copy of the list to search because SendCollision() can take a while. - HashSet tempAvatarsInScene; - lock (AvatarsInSceneLock) - { - tempAvatarsInScene = new HashSet(AvatarsInScene); - } - foreach (BSPhysObject actor in tempAvatarsInScene) - { - if (!ObjectsWithCollisions.Contains(actor)) // don't call avatars twice - actor.SendCollisions(); - } - tempAvatarsInScene = null; - - // Objects that are done colliding are removed from the ObjectsWithCollisions list. - // Not done above because it is inside an iteration of ObjectWithCollisions. - // This complex collision processing is required to create an empty collision - // event call after all real collisions have happened on an object. This allows - // the simulator to generate the 'collision end' event. - if (ObjectsWithNoMoreCollisions.Count > 0) - { - foreach (BSPhysObject po in ObjectsWithNoMoreCollisions) - ObjectsWithCollisions.Remove(po); - ObjectsWithNoMoreCollisions.Clear(); - } - } - - // Call the simulator for each object that has physics property updates. - HashSet updatedObjects = null; - lock (UpdateLock) - { - if (ObjectsWithUpdates.Count > 0) - { - updatedObjects = ObjectsWithUpdates; - ObjectsWithUpdates = new HashSet(); - } - } - if (updatedObjects != null) - { - foreach (BSPhysObject obj in updatedObjects) - { - obj.RequestPhysicsterseUpdate(); - } - updatedObjects.Clear(); - } - - // Return the framerate simulated to give the above returned results. - // (Race condition here but this is just bookkeeping so rare mistakes do not merit a lock). - // undo math above - float simTime = m_simulatedTime / timeStep; - m_simulatedTime = 0f; - return simTime; - } - - // Something has collided - private void SendCollision(uint localID, uint collidingWith, Vector3 collidePoint, Vector3 collideNormal, float penetration) - { - if (localID <= TerrainManager.HighestTerrainID) - { - return; // don't send collisions to the terrain - } - - BSPhysObject collider; - // NOTE that PhysObjects was locked before the call to SendCollision(). - if (!PhysObjects.TryGetValue(localID, out collider)) - { - // If the object that is colliding cannot be found, just ignore the collision. - DetailLog("{0},BSScene.SendCollision,colliderNotInObjectList,id={1},with={2}", DetailLogZero, localID, collidingWith); - return; - } - - // Note: the terrain is not in the physical object list so 'collidee' can be null when Collide() is called. - BSPhysObject collidee = null; - PhysObjects.TryGetValue(collidingWith, out collidee); - - // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); - - if (collider.IsInitialized) - { - if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration)) - { - // If a collision was 'good', remember to send it to the simulator - lock (CollisionLock) - { - ObjectsWithCollisions.Add(collider); - } - } - } - - return; - } - - public void BulletSPluginPhysicsThread() - { - Thread.CurrentThread.Priority = ThreadPriority.Highest; - m_updateWaitEvent = new ManualResetEvent(false); - - while (m_initialized) - { - int beginSimulationRealtimeMS = Util.EnvironmentTickCount(); - - if (BSParam.Active) - DoPhysicsStep(BSParam.PhysicsTimeStep); - - int simulationRealtimeMS = Util.EnvironmentTickCountSubtract(beginSimulationRealtimeMS); - int simulationTimeVsRealtimeDifferenceMS = ((int)(BSParam.PhysicsTimeStep*1000f)) - simulationRealtimeMS; - - if (simulationTimeVsRealtimeDifferenceMS > 0) - { - // The simulation of the time interval took less than realtime. - // Do a wait for the rest of realtime. - m_updateWaitEvent.WaitOne(simulationTimeVsRealtimeDifferenceMS); - //Thread.Sleep(simulationTimeVsRealtimeDifferenceMS); - } - else - { - // The simulation took longer than realtime. - // Do some scaling of simulation time. - // TODO. - DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS); - } - - Watchdog.UpdateThread(); - } - - Watchdog.RemoveThread(); - } - - #endregion // Simulation - - public override void GetResults() { } - - #region Terrain - - public override void SetTerrain(float[] heightMap) { - TerrainManager.SetTerrain(heightMap); - } - - public override void SetWaterLevel(float baseheight) - { - SimpleWaterLevel = baseheight; - } - - public override void DeleteTerrain() - { - // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); - } - - // Although no one seems to check this, I do support combining. - public override bool SupportsCombining() - { - return TerrainManager.SupportsCombining(); - } - // This call says I am a child to region zero in a mega-region. 'pScene' is that - // of region zero, 'offset' is my offset from regions zero's origin, and - // 'extents' is the largest XY that is handled in my region. - public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) - { - TerrainManager.Combine(pScene, offset, extents); - } - - // Unhook all the combining that I know about. - public override void UnCombine(PhysicsScene pScene) - { - TerrainManager.UnCombine(pScene); - } - - #endregion // Terrain - - public override Dictionary GetTopColliders() - { - Dictionary topColliders; - - lock (PhysObjects) - { - foreach (KeyValuePair kvp in PhysObjects) - { - kvp.Value.ComputeCollisionScore(); - } - - List orderedPrims = new List(PhysObjects.Values); - orderedPrims.OrderByDescending(p => p.CollisionScore); - topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore); - } - - return topColliders; - } - - public override bool IsThreaded { get { return false; } } - - #region Extensions - public override object Extension(string pFunct, params object[] pParams) - { - DetailLog("{0} BSScene.Extension,op={1}", DetailLogZero, pFunct); - return base.Extension(pFunct, pParams); - } - #endregion // Extensions - - public static string PrimitiveBaseShapeToString(PrimitiveBaseShape pbs) - { - float pathShearX = pbs.PathShearX < 128 ? (float)pbs.PathShearX * 0.01f : (float)(pbs.PathShearX - 256) * 0.01f; - float pathShearY = pbs.PathShearY < 128 ? (float)pbs.PathShearY * 0.01f : (float)(pbs.PathShearY - 256) * 0.01f; - float pathBegin = (float)pbs.PathBegin * 2.0e-5f; - float pathEnd = 1.0f - (float)pbs.PathEnd * 2.0e-5f; - float pathScaleX = (float)(200 - pbs.PathScaleX) * 0.01f; - float pathScaleY = (float)(200 - pbs.PathScaleY) * 0.01f; - float pathTaperX = pbs.PathTaperX * 0.01f; - float pathTaperY = pbs.PathTaperY * 0.01f; - - float profileBegin = (float)pbs.ProfileBegin * 2.0e-5f; - float profileEnd = 1.0f - (float)pbs.ProfileEnd * 2.0e-5f; - float profileHollow = (float)pbs.ProfileHollow * 2.0e-5f; - if (profileHollow > 0.95f) - profileHollow = 0.95f; - - StringBuilder buff = new StringBuilder(); - buff.Append("shape="); - buff.Append(((ProfileShape)pbs.ProfileShape).ToString()); - buff.Append(","); - buff.Append("hollow="); - buff.Append(((HollowShape)pbs.HollowShape).ToString()); - buff.Append(","); - buff.Append("pathCurve="); - buff.Append(((Extrusion)pbs.PathCurve).ToString()); - buff.Append(","); - buff.Append("profCurve="); - buff.Append(((Extrusion)pbs.ProfileCurve).ToString()); - buff.Append(","); - buff.Append("profHollow="); - buff.Append(profileHollow.ToString()); - buff.Append(","); - buff.Append("pathBegEnd="); - buff.Append(pathBegin.ToString()); - buff.Append("/"); - buff.Append(pathEnd.ToString()); - buff.Append(","); - buff.Append("profileBegEnd="); - buff.Append(profileBegin.ToString()); - buff.Append("/"); - buff.Append(profileEnd.ToString()); - buff.Append(","); - buff.Append("scaleXY="); - buff.Append(pathScaleX.ToString()); - buff.Append("/"); - buff.Append(pathScaleY.ToString()); - buff.Append(","); - buff.Append("shearXY="); - buff.Append(pathShearX.ToString()); - buff.Append("/"); - buff.Append(pathShearY.ToString()); - buff.Append(","); - buff.Append("taperXY="); - buff.Append(pbs.PathTaperX.ToString()); - buff.Append("/"); - buff.Append(pbs.PathTaperY.ToString()); - buff.Append(","); - buff.Append("skew="); - buff.Append(pbs.PathSkew.ToString()); - buff.Append(","); - buff.Append("twist/Beg="); - buff.Append(pbs.PathTwist.ToString()); - buff.Append("/"); - buff.Append(pbs.PathTwistBegin.ToString()); - - return buff.ToString(); - } - - #region Taints - // The simulation execution order is: - // Simulate() - // DoOneTimeTaints - // TriggerPreStepEvent - // DoOneTimeTaints - // Step() - // ProcessAndSendToSimulatorCollisions - // ProcessAndSendToSimulatorPropertyUpdates - // TriggerPostStepEvent - - // Calls to the PhysicsActors can't directly call into the physics engine - // because it might be busy. We delay changes to a known time. - // We rely on C#'s closure to save and restore the context for the delegate. - public void TaintedObject(string pOriginator, string pIdent, TaintCallback pCallback) - { - TaintedObject(false /*inTaintTime*/, pOriginator, pIdent, pCallback); - } - public void TaintedObject(uint pOriginator, String pIdent, TaintCallback pCallback) - { - TaintedObject(false /*inTaintTime*/, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); - } - public void TaintedObject(bool inTaintTime, String pIdent, TaintCallback pCallback) - { - TaintedObject(inTaintTime, BSScene.DetailLogZero, pIdent, pCallback); - } - public void TaintedObject(bool inTaintTime, uint pOriginator, String pIdent, TaintCallback pCallback) - { - TaintedObject(inTaintTime, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); - } - // Sometimes a potentially tainted operation can be used in and out of taint time. - // This routine executes the command immediately if in taint-time otherwise it is queued. - public void TaintedObject(bool inTaintTime, string pOriginator, string pIdent, TaintCallback pCallback) - { - if (!m_initialized) return; - - if (inTaintTime) - pCallback(); - else - { - lock (_taintLock) - { - _taintOperations.Add(new TaintCallbackEntry(pOriginator, pIdent, pCallback)); - } - } - } - - private void TriggerPreStepEvent(float timeStep) - { - PreStepAction actions = BeforeStep; - if (actions != null) - actions(timeStep); - - } - - private void TriggerPostStepEvent(float timeStep) - { - PostStepAction actions = AfterStep; - if (actions != null) - actions(timeStep); - - } - - // When someone tries to change a property on a BSPrim or BSCharacter, the object queues - // a callback into itself to do the actual property change. That callback is called - // here just before the physics engine is called to step the simulation. - public void ProcessTaints() - { - ProcessRegularTaints(); - ProcessPostTaintTaints(); - } - - private void ProcessRegularTaints() - { - if (m_initialized && _taintOperations.Count > 0) // save allocating new list if there is nothing to process - { - // swizzle a new list into the list location so we can process what's there - List oldList; - lock (_taintLock) - { - oldList = _taintOperations; - _taintOperations = new List(); - } - - foreach (TaintCallbackEntry tcbe in oldList) - { - try - { - DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", tcbe.originator, tcbe.ident); // DEBUG DEBUG DEBUG - tcbe.callback(); - } - catch (Exception e) - { - m_log.ErrorFormat("{0}: ProcessTaints: {1}: Exception: {2}", LogHeader, tcbe.ident, e); - } - } - oldList.Clear(); - } - } - - // Schedule an update to happen after all the regular taints are processed. - // Note that new requests for the same operation ("ident") for the same object ("ID") - // will replace any previous operation by the same object. - public void PostTaintObject(String ident, uint ID, TaintCallback callback) - { - string IDAsString = ID.ToString(); - string uniqueIdent = ident + "-" + IDAsString; - lock (_taintLock) - { - _postTaintOperations[uniqueIdent] = new TaintCallbackEntry(IDAsString, uniqueIdent, callback); - } - - return; - } - - // Taints that happen after the normal taint processing but before the simulation step. - private void ProcessPostTaintTaints() - { - if (m_initialized && _postTaintOperations.Count > 0) - { - Dictionary oldList; - lock (_taintLock) - { - oldList = _postTaintOperations; - _postTaintOperations = new Dictionary(); - } - - foreach (KeyValuePair kvp in oldList) - { - try - { - DetailLog("{0},BSScene.ProcessPostTaintTaints,doTaint,id={1}", DetailLogZero, kvp.Key); // DEBUG DEBUG DEBUG - kvp.Value.callback(); - } - catch (Exception e) - { - m_log.ErrorFormat("{0}: ProcessPostTaintTaints: {1}: Exception: {2}", LogHeader, kvp.Key, e); - } - } - oldList.Clear(); - } - } - - // Only used for debugging. Does not change state of anything so locking is not necessary. - public bool AssertInTaintTime(string whereFrom) - { - if (!InTaintTime) - { - DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom); - m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom); - // Util.PrintCallStack(DetailLog); - } - return InTaintTime; - } - - #endregion // Taints - - #region IPhysicsParameters - // Get the list of parameters this physics engine supports - public PhysParameterEntry[] GetParameterList() - { - BSParam.BuildParameterTable(); - return BSParam.SettableParameters; - } - - // Set parameter on a specific or all instances. - // Return 'false' if not able to set the parameter. - // Setting the value in the m_params block will change the value the physics engine - // will use the next time since it's pinned and shared memory. - // Some of the values require calling into the physics engine to get the new - // value activated ('terrainFriction' for instance). - public bool SetPhysicsParameter(string parm, string val, uint localID) - { - bool ret = false; - - BSParam.ParameterDefnBase theParam; - if (BSParam.TryGetParameter(parm, out theParam)) - { - // Set the value in the C# code - theParam.SetValue(this, val); - - // Optionally set the parameter in the unmanaged code - if (theParam.HasSetOnObject) - { - // update all the localIDs specified - // If the local ID is APPLY_TO_NONE, just change the default value - // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs - // If the localID is a specific object, apply the parameter change to only that object - List objectIDs = new List(); - switch (localID) - { - case PhysParameterEntry.APPLY_TO_NONE: - // This will cause a call into the physical world if some operation is specified (SetOnObject). - objectIDs.Add(TERRAIN_ID); - TaintedUpdateParameter(parm, objectIDs, val); - break; - case PhysParameterEntry.APPLY_TO_ALL: - lock (PhysObjects) objectIDs = new List(PhysObjects.Keys); - TaintedUpdateParameter(parm, objectIDs, val); - break; - default: - // setting only one localID - objectIDs.Add(localID); - TaintedUpdateParameter(parm, objectIDs, val); - break; - } - } - - ret = true; - } - return ret; - } - - // schedule the actual updating of the paramter to when the phys engine is not busy - private void TaintedUpdateParameter(string parm, List lIDs, string val) - { - string xval = val; - List xlIDs = lIDs; - string xparm = parm; - TaintedObject(DetailLogZero, "BSScene.UpdateParameterSet", delegate() { - BSParam.ParameterDefnBase thisParam; - if (BSParam.TryGetParameter(xparm, out thisParam)) - { - if (thisParam.HasSetOnObject) - { - foreach (uint lID in xlIDs) - { - BSPhysObject theObject = null; - if (PhysObjects.TryGetValue(lID, out theObject)) - thisParam.SetOnObject(this, theObject); - } - } - } - }); - } - - // Get parameter. - // Return 'false' if not able to get the parameter. - public bool GetPhysicsParameter(string parm, out string value) - { - string val = String.Empty; - bool ret = false; - BSParam.ParameterDefnBase theParam; - if (BSParam.TryGetParameter(parm, out theParam)) - { - val = theParam.GetValue(this); - ret = true; - } - value = val; - return ret; - } - - #endregion IPhysicsParameters - - // Invoke the detailed logger and output something if it's enabled. - public void DetailLog(string msg, params Object[] args) - { - PhysicsLogging.Write(msg, args); - } - // Used to fill in the LocalID when there isn't one. It's the correct number of characters. - public const string DetailLogZero = "0000000000"; - -} -} diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs deleted file mode 100644 index ddbe80bf95..0000000000 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using Nini.Config; -using log4net; -using OpenSim.Framework; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.Manager -{ - /// - /// Description of MyClass. - /// - public class PhysicsPluginManager - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private Dictionary _PhysPlugins = new Dictionary(); - private Dictionary _MeshPlugins = new Dictionary(); - - /// - /// Constructor. - /// - public PhysicsPluginManager() - { - // Load "plugins", that are hard coded and not existing in form of an external lib, and hence always - // available - IMeshingPlugin plugHard; - plugHard = new ZeroMesherPlugin(); - _MeshPlugins.Add(plugHard.GetName(), plugHard); - - m_log.Info("[PHYSICS]: Added meshing engine: " + plugHard.GetName()); - } - - // Legacy method for simulators before extent was passed - public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, - IConfigSource config, string regionName) - { - Vector3 extent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); - return GetPhysicsScene(physEngineName, meshEngineName, config, regionName, extent); - } - - /// - /// Get a physics scene for the given physics engine and mesher. - /// - /// - /// - /// - /// - public PhysicsScene GetPhysicsScene(string physEngineName, string meshEngineName, - IConfigSource config, string regionName, Vector3 regionExtent) - { - if (String.IsNullOrEmpty(physEngineName)) - { - return PhysicsScene.Null; - } - - if (String.IsNullOrEmpty(meshEngineName)) - { - return PhysicsScene.Null; - } - - IMesher meshEngine = null; - if (_MeshPlugins.ContainsKey(meshEngineName)) - { - m_log.Info("[PHYSICS]: creating meshing engine " + meshEngineName); - meshEngine = _MeshPlugins[meshEngineName].GetMesher(config); - } - else - { - m_log.WarnFormat("[PHYSICS]: couldn't find meshingEngine: {0}", meshEngineName); - throw new ArgumentException(String.Format("couldn't find meshingEngine: {0}", meshEngineName)); - } - - if (_PhysPlugins.ContainsKey(physEngineName)) - { - m_log.Info("[PHYSICS]: creating " + physEngineName); - PhysicsScene result = _PhysPlugins[physEngineName].GetScene(regionName); - result.Initialise(meshEngine, config, regionExtent); - return result; - } - else - { - m_log.WarnFormat("[PHYSICS]: couldn't find physicsEngine: {0}", physEngineName); - throw new ArgumentException(String.Format("couldn't find physicsEngine: {0}", physEngineName)); - } - } - - /// - /// Load all plugins in assemblies at the given path - /// - /// - public void LoadPluginsFromAssemblies(string assembliesPath) - { - // Walk all assemblies (DLLs effectively) and see if they are home - // of a plugin that is of interest for us - string[] pluginFiles = Directory.GetFiles(assembliesPath, "*.dll"); - - for (int i = 0; i < pluginFiles.Length; i++) - { - LoadPluginsFromAssembly(pluginFiles[i]); - } - } - - /// - /// Load plugins from an assembly at the given path - /// - /// - public void LoadPluginsFromAssembly(string assemblyPath) - { - // TODO / NOTE - // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from - // 'file:///C:/OpenSim/trunk2/bin/Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll' - // using the LoadFrom context. The use of this context can result in unexpected behavior - // for serialization, casting and dependency resolution. In almost all cases, it is recommended - // that the LoadFrom context be avoided. This can be done by installing assemblies in the - // Global Assembly Cache or in the ApplicationBase directory and using Assembly. - // Load when explicitly loading assemblies. - Assembly pluginAssembly = null; - Type[] types = null; - - try - { - pluginAssembly = Assembly.LoadFrom(assemblyPath); - } - catch (Exception ex) - { - m_log.Error("[PHYSICS]: Failed to load plugin from " + assemblyPath, ex); - } - - if (pluginAssembly != null) - { - try - { - types = pluginAssembly.GetTypes(); - } - catch (ReflectionTypeLoadException ex) - { - m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath + ": " + - ex.LoaderExceptions[0].Message, ex); - } - catch (Exception ex) - { - m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath, ex); - } - - if (types != null) - { - foreach (Type pluginType in types) - { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin"); - - if (physTypeInterface != null) - { - IPhysicsPlugin plug = - (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Init(); - if (!_PhysPlugins.ContainsKey(plug.GetName())) - { - _PhysPlugins.Add(plug.GetName(), plug); - m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName()); - } - } - - Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin"); - - if (meshTypeInterface != null) - { - IMeshingPlugin plug = - (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - if (!_MeshPlugins.ContainsKey(plug.GetName())) - { - _MeshPlugins.Add(plug.GetName(), plug); - m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName()); - } - } - - physTypeInterface = null; - meshTypeInterface = null; - } - } - } - } - } - - pluginAssembly = null; - } - - //--- - public static void PhysicsPluginMessage(string message, bool isWarning) - { - if (isWarning) - { - m_log.Warn("[PHYSICS]: " + message); - } - else - { - m_log.Info("[PHYSICS]: " + message); - } - } - - //--- - } - - public interface IPhysicsPlugin - { - bool Init(); - PhysicsScene GetScene(String sceneIdentifier); - string GetName(); - void Dispose(); - } - - public interface IMeshingPlugin - { - string GetName(); - IMesher GetMesher(IConfigSource config); - } -} diff --git a/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs b/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs deleted file mode 100644 index ec968c0b65..0000000000 --- a/OpenSim/Region/Physics/Meshing/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Region.Physics.Meshing")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("OpenSim")] -[assembly: AssemblyCopyright("OpenSimulator developers")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4b7e35c2-a9dd-4b10-b778-eb417f4f6884")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.8.2.*")] - diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs deleted file mode 100644 index 7e652fc022..0000000000 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Threading; -using System.IO; -using System.Diagnostics; -using log4net; -using Nini.Config; -using Ode.NET; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.OdePlugin -{ - /// - /// ODE plugin - /// - public class OdePlugin : IPhysicsPlugin - { -// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - - private OdeScene m_scene; - - public bool Init() - { - return true; - } - - public PhysicsScene GetScene(String sceneIdentifier) - { - if (m_scene == null) - { - // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether - // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports - // will find it already loaded later on. - // - // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be - // controlled in Ode.NET.dll.config - if (Util.IsWindows()) - Util.LoadArchSpecificWindowsDll("ode.dll"); - - // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to - // http://opensimulator.org/mantis/view.php?id=2750). - d.InitODE(); - - m_scene = new OdeScene(GetName(), sceneIdentifier); - } - - return m_scene; - } - - public string GetName() - { - return ("OpenDynamicsEngine"); - } - - public void Dispose() - { - } - } -} \ No newline at end of file diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs deleted file mode 100644 index ed086dd7ef..0000000000 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; - -namespace OpenSim.Region.Physics.POSPlugin -{ - /// - /// for now will be a very POS physics engine - /// - public class POSPlugin : IPhysicsPlugin - { - public POSPlugin() - { - } - - public bool Init() - { - return true; - } - - public PhysicsScene GetScene(string sceneIdentifier) - { - return new POSScene(GetName(), sceneIdentifier); - } - - public string GetName() - { - return ("POS"); - } - - public void Dispose() - { - } - } -} diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs similarity index 89% rename from OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs index 7d054ddac2..1765ae0867 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/AssemblyInfo.cs @@ -27,6 +27,7 @@ using System.Reflection; using System.Runtime.InteropServices; +using Mono.Addins; // Information about this assembly is defined by the following // attributes. @@ -34,11 +35,11 @@ using System.Runtime.InteropServices; // change them to the information which is associated with the assembly // you compile. -[assembly : AssemblyTitle("BasicPhysicsPlugin")] +[assembly : AssemblyTitle("BasicPhysicsModule")] [assembly : AssemblyDescription("")] [assembly : AssemblyConfiguration("")] [assembly : AssemblyCompany("http://opensimulator.org")] -[assembly : AssemblyProduct("BasicPhysicsPlugin")] +[assembly : AssemblyProduct("BasicPhysicsModule")] [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers")] [assembly : AssemblyTrademark("")] [assembly : AssemblyCulture("")] @@ -56,3 +57,6 @@ using System.Runtime.InteropServices; // numbers with the '*' character (the default): [assembly : AssemblyVersion("0.8.2.*")] + +[assembly: Addin("OpenSim.Region.PhysicsModule.BasicPhysics", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs similarity index 98% rename from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs rename to OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs index 43fba7b994..e7b30bac68 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsActor.cs @@ -30,9 +30,9 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.BasicPhysicsPlugin +namespace OpenSim.Region.PhysicsModule.BasicPhysics { public class BasicActor : PhysicsActor { diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs similarity index 98% rename from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs rename to OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs index dfe4c19d88..5383f1b090 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsPrim.cs @@ -30,9 +30,9 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.BasicPhysicsPlugin +namespace OpenSim.Region.PhysicsModule.BasicPhysics { public class BasicPhysicsPrim : PhysicsActor { diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs similarity index 76% rename from OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs rename to OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs index 0d28c8efae..ac2c1f3138 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs @@ -28,11 +28,14 @@ using System; using System.Collections.Generic; using Nini.Config; +using Mono.Addins; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; -namespace OpenSim.Region.Physics.BasicPhysicsPlugin +namespace OpenSim.Region.PhysicsModule.BasicPhysics { /// /// This is an incomplete extremely basic physics implementation @@ -41,32 +44,74 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin /// Not useful for anything at the moment apart from some regression testing in other components where some form /// of physics plugin is needed. /// - public class BasicScene : PhysicsScene + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BasicPhysicsScene")] + public class BasicScene : PhysicsScene, INonSharedRegionModule { private List _actors = new List(); private List _prims = new List(); private float[] _heightMap; private Vector3 m_regionExtent; + private bool m_Enabled = false; + //protected internal string sceneIdentifier; - - public BasicScene(string engineType, string _sceneIdentifier) + #region INonSharedRegionModule + public string Name { - EngineType = engineType; - Name = EngineType + "/" + _sceneIdentifier; - //sceneIdentifier = _sceneIdentifier; + get { return "basicphysics"; } } - public override void Initialise(IMesher meshmerizer, IConfigSource config) + public Type ReplaceableInterface { - throw new Exception("Should not be called."); + get { return null; } } - public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) + public void Initialise(IConfigSource source) { - m_regionExtent = regionExtent; + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + string physics = config.GetString("physics", string.Empty); + if (physics == Name) + m_Enabled = true; + } + } + public void Close() + { + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + EngineType = Name; + PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; + + scene.RegisterModuleInterface(this); + m_regionExtent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); + base.Initialise(scene.PhysicsRequestAsset, + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[scene.RegionInfo.RegionSizeX * scene.RegionInfo.RegionSizeY]), + (float)scene.RegionInfo.RegionSettings.WaterHeight); + + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + } + #endregion + public override void Dispose() {} public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, @@ -119,8 +164,8 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin Vector3 actorPosition = actor.Position; Vector3 actorVelocity = actor.Velocity; -// Console.WriteLine( -// "Processing actor {0}, starting pos {1}, starting vel {2}", i, actorPosition, actorVelocity); + //Console.WriteLine( + // "Processing actor {0}, starting pos {1}, starting vel {2}", i, actorPosition, actorVelocity); actorPosition.X += actor.Velocity.X * timeStep; actorPosition.Y += actor.Velocity.Y * timeStep; @@ -206,5 +251,6 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin Dictionary returncolliders = new Dictionary(); return returncolliders; } + } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs index 3bd81d4fd0..c4a923c39c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSAPIUnman.cs @@ -35,7 +35,7 @@ using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSAPIUnman : BSAPITemplate { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs b/OpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs index 741f8dbf1d..887311d723 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIXNA.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSAPIXNA.cs @@ -40,7 +40,7 @@ using BulletXNA.BulletCollision; using BulletXNA.BulletDynamics; using BulletXNA.BulletCollision.CollisionDispatch; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSAPIXNA : BSAPITemplate { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs index bde4557800..0191893781 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorAvatarMove.cs @@ -31,11 +31,11 @@ using System.Linq; using System.Text; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorAvatarMove : BSActor { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs similarity index 98% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs index e54c27b266..7ff171ed08 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorHover.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorHover.cs @@ -30,11 +30,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorHover : BSActor { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs index 3b3c161763..78c1b6aacb 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorLockAxis.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorLockAxis.cs @@ -32,7 +32,7 @@ using System.Text; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorLockAxis : BSActor { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs index 114500632a..3db8f2cf25 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorMoveToTarget.cs @@ -30,11 +30,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorMoveToTarget : BSActor { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs similarity index 98% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs index 4e81363024..ecb4b7ff55 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetForce.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetForce.cs @@ -30,11 +30,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorSetForce : BSActor { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs similarity index 98% rename from OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs index 79e1d38612..a1cf4db95b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorSetTorque.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActorSetTorque.cs @@ -30,11 +30,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorSetTorque : BSActor { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs b/OpenSim/Region/PhysicsModules/BulletS/BSActors.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSActors.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSActors.cs index 7f45e2cc4e..851347b493 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActors.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSActors.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSActorCollection { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs b/OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs index 8491c0f548..7756b10a8c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSApiTemplate.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSApiTemplate.cs @@ -31,7 +31,7 @@ using System.Security; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin { +namespace OpenSim.Region.PhysicsModule.BulletS { // Constraint type values as defined by Bullet public enum ConstraintType : int diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs index 9c3f160300..83fc3a6d9b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSCharacter.cs @@ -30,9 +30,9 @@ using System.Reflection; using log4net; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSCharacter : BSPhysObject { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs index b47e9a85f6..e42e868853 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public abstract class BSConstraint : IDisposable diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs index 7fcb75c178..4bcde2bb27 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraint6Dof.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSConstraint6Dof : BSConstraint diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs index 5c8d94e07e..5746ac1746 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintCollection.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintCollection.cs @@ -30,7 +30,7 @@ using System.Text; using log4net; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSConstraintCollection : IDisposable diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs similarity index 98% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs index 7a76a9a8e9..e7566a83dd 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintConeTwist.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSConstraintConeTwist : BSConstraint diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs similarity index 98% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs index ed89f630e1..d20538d58d 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintHinge.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintHinge.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSConstraintHinge : BSConstraint diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs similarity index 98% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs index 37cfa07ae8..83d42af912 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSlider.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSConstraintSlider : BSConstraint diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs index 8e7ddff102..563a1b1ef5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSConstraintSpring.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSConstraintSpring : BSConstraint6Dof diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs index c6d6331825..0fc55776a4 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSDynamics.cs @@ -36,9 +36,9 @@ using System.Reflection; using System.Runtime.InteropServices; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSDynamics : BSActor { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs index 87eba33860..83122398e2 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSLinkset.cs @@ -30,7 +30,7 @@ using System.Text; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public abstract class BSLinkset diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs index cae9efad58..953ddee0dd 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetCompound.cs @@ -32,7 +32,7 @@ using OpenSim.Framework; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSLinksetCompound : BSLinkset diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs index 4384cdc36e..c4b4c86ec8 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSLinksetConstraints.cs @@ -28,11 +28,9 @@ using System; using System.Collections.Generic; using System.Text; -using OpenSim.Region.OptionalModules.Scripting; - using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSLinksetConstraints : BSLinkset { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs b/OpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs index ee77d6e3f8..0e44d03770 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSMaterials.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSMaterials.cs @@ -30,7 +30,7 @@ using System.Text; using System.Reflection; using Nini.Config; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public struct MaterialAttributes diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs b/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs index 7693195763..2faf2d4c0c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSMotors.cs @@ -31,7 +31,7 @@ using System.Text; using OpenMetaverse; using OpenSim.Framework; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public abstract class BSMotor { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSParam.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSParam.cs index 6d46fe690a..c2960086bf 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSParam.cs @@ -29,12 +29,12 @@ using System.Collections.Generic; using System.Reflection; using System.Text; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenMetaverse; using Nini.Config; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public static class BSParam { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs index 90da7a676c..da3fc18aa8 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs @@ -30,9 +30,9 @@ using System.Text; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { /* * Class to wrap all objects. diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs index a00991f978..6f27ac7683 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrim.cs @@ -32,11 +32,10 @@ using System.Xml; using log4net; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.ConvexDecompositionDotNet; -using OpenSim.Region.OptionalModules.Scripting; // for ExtendedPhysics +using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { [Serializable] diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs similarity index 98% rename from OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs index 2eb144049f..d8ed56b4a4 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimDisplaced.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrimDisplaced.cs @@ -31,11 +31,11 @@ using System.Reflection; using System.Runtime.InteropServices; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSPrimDisplaced : BSPrim { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs similarity index 98% rename from OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs index 430d645566..55b5da09c9 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSPrimLinkable.cs @@ -30,11 +30,10 @@ using System.Linq; using System.Text; using OpenSim.Framework; -using OpenSim.Region.OptionalModules.Scripting; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public class BSPrimLinkable : BSPrimDisplaced { @@ -72,7 +71,7 @@ public class BSPrimLinkable : BSPrimDisplaced base.Destroy(); } - public override void link(Manager.PhysicsActor obj) + public override void link(OpenSim.Region.PhysicsModules.SharedBase.PhysicsActor obj) { BSPrimLinkable parent = obj as BSPrimLinkable; if (parent != null) diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs new file mode 100644 index 0000000000..452ce55509 --- /dev/null +++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs @@ -0,0 +1,1333 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyrightD + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using OpenSim.Framework; +using OpenSim.Framework.Monitoring; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.PhysicsModules.SharedBase; +using Nini.Config; +using log4net; +using OpenMetaverse; +using Mono.Addins; + +namespace OpenSim.Region.PhysicsModule.BulletS +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BulletSPhysicsScene")] + public sealed class BSScene : PhysicsScene, IPhysicsParameters, INonSharedRegionModule + { + internal static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + internal static readonly string LogHeader = "[BULLETS SCENE]"; + + private bool m_Enabled = false; + private IConfigSource m_Config; + + // The name of the region we're working for. + public string RegionName { get; private set; } + + public string BulletSimVersion = "?"; + + // The handle to the underlying managed or unmanaged version of Bullet being used. + public string BulletEngineName { get; private set; } + public BSAPITemplate PE; + + // If the physics engine is running on a separate thread + public Thread m_physicsThread; + + public Dictionary PhysObjects; + public BSShapeCollection Shapes; + + // Keeping track of the objects with collisions so we can report begin and end of a collision + public HashSet ObjectsWithCollisions = new HashSet(); + public HashSet ObjectsWithNoMoreCollisions = new HashSet(); + + // All the collision processing is protected with this lock object + public Object CollisionLock = new Object(); + + // Properties are updated here + public Object UpdateLock = new Object(); + public HashSet ObjectsWithUpdates = new HashSet(); + + // Keep track of all the avatars so we can send them a collision event + // every tick so OpenSim will update its animation. + private HashSet AvatarsInScene = new HashSet(); + private Object AvatarsInSceneLock = new Object(); + + // let my minuions use my logger + public ILog Logger { get { return m_log; } } + + public IMesher mesher; + public uint WorldID { get; private set; } + public BulletWorld World { get; private set; } + + // All the constraints that have been allocated in this instance. + public BSConstraintCollection Constraints { get; private set; } + + // Simulation parameters + //internal float m_physicsStepTime; // if running independently, the interval simulated by default + + internal int m_maxSubSteps; + internal float m_fixedTimeStep; + + internal float m_simulatedTime; // the time simulated previously. Used for physics framerate calc. + + internal long m_simulationStep = 0; // The current simulation step. + public long SimulationStep { get { return m_simulationStep; } } + // A number to use for SimulationStep that is probably not any step value + // Used by the collision code (which remembers the step when a collision happens) to remember not any simulation step. + public static long NotASimulationStep = -1234; + + internal float LastTimeStep { get; private set; } // The simulation time from the last invocation of Simulate() + + internal float NominalFrameRate { get; set; } // Parameterized ideal frame rate that simulation is scaled to + + // Physical objects can register for prestep or poststep events + public delegate void PreStepAction(float timeStep); + public delegate void PostStepAction(float timeStep); + public event PreStepAction BeforeStep; + public event PostStepAction AfterStep; + + // A value of the time 'now' so all the collision and update routines do not have to get their own + // Set to 'now' just before all the prims and actors are called for collisions and updates + public int SimulationNowTime { get; private set; } + + // True if initialized and ready to do simulation steps + private bool m_initialized = false; + + // Flag which is true when processing taints. + // Not guaranteed to be correct all the time (don't depend on this) but good for debugging. + public bool InTaintTime { get; private set; } + + // Pinned memory used to pass step information between managed and unmanaged + internal int m_maxCollisionsPerFrame; + internal CollisionDesc[] m_collisionArray; + + internal int m_maxUpdatesPerFrame; + internal EntityProperties[] m_updateArray; + + /// + /// Used to control physics simulation timing if Bullet is running on its own thread. + /// + private ManualResetEvent m_updateWaitEvent; + + public const uint TERRAIN_ID = 0; // OpenSim senses terrain with a localID of zero + public const uint GROUNDPLANE_ID = 1; + public const uint CHILDTERRAIN_ID = 2; // Terrain allocated based on our mega-prim childre start here + + public float SimpleWaterLevel { get; set; } + public BSTerrainManager TerrainManager { get; private set; } + + public ConfigurationParameters Params + { + get { return UnmanagedParams[0]; } + } + public Vector3 DefaultGravity + { + get { return new Vector3(0f, 0f, Params.gravity); } + } + // Just the Z value of the gravity + public float DefaultGravityZ + { + get { return Params.gravity; } + } + + // When functions in the unmanaged code must be called, it is only + // done at a known time just before the simulation step. The taint + // system saves all these function calls and executes them in + // order before the simulation. + public delegate void TaintCallback(); + private struct TaintCallbackEntry + { + public String originator; + public String ident; + public TaintCallback callback; + public TaintCallbackEntry(string pIdent, TaintCallback pCallBack) + { + originator = BSScene.DetailLogZero; + ident = pIdent; + callback = pCallBack; + } + public TaintCallbackEntry(string pOrigin, string pIdent, TaintCallback pCallBack) + { + originator = pOrigin; + ident = pIdent; + callback = pCallBack; + } + } + private Object _taintLock = new Object(); // lock for using the next object + private List _taintOperations; + private Dictionary _postTaintOperations; + private List _postStepOperations; + + // A pointer to an instance if this structure is passed to the C++ code + // Used to pass basic configuration values to the unmanaged code. + internal ConfigurationParameters[] UnmanagedParams; + + // Sometimes you just have to log everything. + public LogWriter PhysicsLogging; + private bool m_physicsLoggingEnabled; + private string m_physicsLoggingDir; + private string m_physicsLoggingPrefix; + private int m_physicsLoggingFileMinutes; + private bool m_physicsLoggingDoFlush; + private bool m_physicsPhysicalDumpEnabled; + public int PhysicsMetricDumpFrames { get; set; } + // 'true' of the vehicle code is to log lots of details + public bool VehicleLoggingEnabled { get; private set; } + public bool VehiclePhysicalLoggingEnabled { get; private set; } + + #region INonSharedRegionModule + public string Name + { + get { return "BulletSim"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + string physics = config.GetString("physics", string.Empty); + if (physics == Name) + { + m_Enabled = true; + m_Config = source; + } + } + + } + + public void Close() + { + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + EngineType = Name; + RegionName = scene.RegionInfo.RegionName; + PhysicsSceneName = EngineType + "/" + RegionName; + + scene.RegisterModuleInterface(this); + Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); + Initialise(m_Config, extent); + + base.Initialise(scene.PhysicsRequestAsset, + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[scene.RegionInfo.RegionSizeX * scene.RegionInfo.RegionSizeY]), + (float)scene.RegionInfo.RegionSettings.WaterHeight); + + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + + mesher = scene.RequestModuleInterface(); + if (mesher == null) + m_log.WarnFormat("{0} No mesher. Things will not work well.", LogHeader); + + scene.PhysicsEnabled = true; + } + #endregion + + #region Initialization + + private void Initialise(IConfigSource config, Vector3 regionExtent) + { + _taintOperations = new List(); + _postTaintOperations = new Dictionary(); + _postStepOperations = new List(); + PhysObjects = new Dictionary(); + Shapes = new BSShapeCollection(this); + + m_simulatedTime = 0f; + LastTimeStep = 0.1f; + + // Allocate pinned memory to pass parameters. + UnmanagedParams = new ConfigurationParameters[1]; + + // Set default values for physics parameters plus any overrides from the ini file + GetInitialParameterValues(config); + + // Force some parameters to values depending on other configurations + // Only use heightmap terrain implementation if terrain larger than legacy size + if ((uint)regionExtent.X > Constants.RegionSize || (uint)regionExtent.Y > Constants.RegionSize) + { + m_log.WarnFormat("{0} Forcing terrain implementation to heightmap for large region", LogHeader); + BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; + } + + // Get the connection to the physics engine (could be native or one of many DLLs) + PE = SelectUnderlyingBulletEngine(BulletEngineName); + + // Enable very detailed logging. + // By creating an empty logger when not logging, the log message invocation code + // can be left in and every call doesn't have to check for null. + if (m_physicsLoggingEnabled) + { + PhysicsLogging = new LogWriter(m_physicsLoggingDir, m_physicsLoggingPrefix, m_physicsLoggingFileMinutes, m_physicsLoggingDoFlush); + PhysicsLogging.ErrorLogger = m_log; // for DEBUG. Let's the logger output its own error messages. + } + else + { + PhysicsLogging = new LogWriter(); + } + + // Allocate memory for returning of the updates and collisions from the physics engine + m_collisionArray = new CollisionDesc[m_maxCollisionsPerFrame]; + m_updateArray = new EntityProperties[m_maxUpdatesPerFrame]; + + // The bounding box for the simulated world. The origin is 0,0,0 unless we're + // a child in a mega-region. + // Bullet actually doesn't care about the extents of the simulated + // area. It tracks active objects no matter where they are. + Vector3 worldExtent = regionExtent; + + World = PE.Initialize(worldExtent, Params, m_maxCollisionsPerFrame, ref m_collisionArray, m_maxUpdatesPerFrame, ref m_updateArray); + + Constraints = new BSConstraintCollection(World); + + TerrainManager = new BSTerrainManager(this, worldExtent); + TerrainManager.CreateInitialGroundPlaneAndTerrain(); + + // Put some informational messages into the log file. + m_log.InfoFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation); + + InTaintTime = false; + m_initialized = true; + + // If the physics engine runs on its own thread, start same. + if (BSParam.UseSeparatePhysicsThread) + { + // The physics simulation should happen independently of the heartbeat loop + m_physicsThread + = WorkManager.StartThread( + BulletSPluginPhysicsThread, + string.Format("{0} ({1})", BulletEngineName, RegionName), + ThreadPriority.Normal, + true, + true); + } + } + + // All default parameter values are set here. There should be no values set in the + // variable definitions. + private void GetInitialParameterValues(IConfigSource config) + { + ConfigurationParameters parms = new ConfigurationParameters(); + UnmanagedParams[0] = parms; + + BSParam.SetParameterDefaultValues(this); + + if (config != null) + { + // If there are specifications in the ini file, use those values + IConfig pConfig = config.Configs["BulletSim"]; + if (pConfig != null) + { + BSParam.SetParameterConfigurationValues(this, pConfig); + + // There are two Bullet implementations to choose from + BulletEngineName = pConfig.GetString("BulletEngine", "BulletUnmanaged"); + + // Very detailed logging for physics debugging + // TODO: the boolean values can be moved to the normal parameter processing. + m_physicsLoggingEnabled = pConfig.GetBoolean("PhysicsLoggingEnabled", false); + m_physicsLoggingDir = pConfig.GetString("PhysicsLoggingDir", "."); + m_physicsLoggingPrefix = pConfig.GetString("PhysicsLoggingPrefix", "physics-%REGIONNAME%-"); + m_physicsLoggingFileMinutes = pConfig.GetInt("PhysicsLoggingFileMinutes", 5); + m_physicsLoggingDoFlush = pConfig.GetBoolean("PhysicsLoggingDoFlush", false); + m_physicsPhysicalDumpEnabled = pConfig.GetBoolean("PhysicsPhysicalDumpEnabled", false); + // Very detailed logging for vehicle debugging + VehicleLoggingEnabled = pConfig.GetBoolean("VehicleLoggingEnabled", false); + VehiclePhysicalLoggingEnabled = pConfig.GetBoolean("VehiclePhysicalLoggingEnabled", false); + + // Do any replacements in the parameters + m_physicsLoggingPrefix = m_physicsLoggingPrefix.Replace("%REGIONNAME%", RegionName); + } + else + { + // Nothing in the configuration INI file so assume unmanaged and other defaults. + BulletEngineName = "BulletUnmanaged"; + m_physicsLoggingEnabled = false; + VehicleLoggingEnabled = false; + } + + // The material characteristics. + BSMaterials.InitializeFromDefaults(Params); + if (pConfig != null) + { + // Let the user add new and interesting material property values. + BSMaterials.InitializefromParameters(pConfig); + } + } + } + + // A helper function that handles a true/false parameter and returns the proper float number encoding + float ParamBoolean(IConfig config, string parmName, float deflt) + { + float ret = deflt; + if (config.Contains(parmName)) + { + ret = ConfigurationParameters.numericFalse; + if (config.GetBoolean(parmName, false)) + { + ret = ConfigurationParameters.numericTrue; + } + } + return ret; + } + + // Select the connection to the actual Bullet implementation. + // The main engine selection is the engineName up to the first hypen. + // So "Bullet-2.80-OpenCL-Intel" specifies the 'bullet' class here and the whole name + // is passed to the engine to do its special selection, etc. + private BSAPITemplate SelectUnderlyingBulletEngine(string engineName) + { + // For the moment, do a simple switch statement. + // Someday do fancyness with looking up the interfaces in the assembly. + BSAPITemplate ret = null; + + string selectionName = engineName.ToLower(); + int hyphenIndex = engineName.IndexOf("-"); + if (hyphenIndex > 0) + selectionName = engineName.ToLower().Substring(0, hyphenIndex - 1); + + switch (selectionName) + { + case "bullet": + case "bulletunmanaged": + ret = new BSAPIUnman(engineName, this); + break; + case "bulletxna": + ret = new BSAPIXNA(engineName, this); + // Disable some features that are not implemented in BulletXNA + m_log.InfoFormat("{0} Disabling some physics features not implemented by BulletXNA", LogHeader); + m_log.InfoFormat("{0} Disabling ShouldUseBulletHACD", LogHeader); + BSParam.ShouldUseBulletHACD = false; + m_log.InfoFormat("{0} Disabling ShouldUseSingleConvexHullForPrims", LogHeader); + BSParam.ShouldUseSingleConvexHullForPrims = false; + m_log.InfoFormat("{0} Disabling ShouldUseGImpactShapeForPrims", LogHeader); + BSParam.ShouldUseGImpactShapeForPrims = false; + m_log.InfoFormat("{0} Setting terrain implimentation to Heightmap", LogHeader); + BSParam.TerrainImplementation = (float)BSTerrainPhys.TerrainImplementation.Heightmap; + break; + } + + if (ret == null) + { + m_log.ErrorFormat("{0} COULD NOT SELECT BULLET ENGINE: '[BulletSim]PhysicsEngine' must be either 'BulletUnmanaged-*' or 'BulletXNA-*'", LogHeader); + } + else + { + m_log.InfoFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion); + } + + return ret; + } + + public override void Dispose() + { + // m_log.DebugFormat("{0}: Dispose()", LogHeader); + + // make sure no stepping happens while we're deleting stuff + m_initialized = false; + + lock (PhysObjects) + { + foreach (KeyValuePair kvp in PhysObjects) + { + kvp.Value.Destroy(); + } + PhysObjects.Clear(); + } + + // Now that the prims are all cleaned up, there should be no constraints left + if (Constraints != null) + { + Constraints.Dispose(); + Constraints = null; + } + + if (Shapes != null) + { + Shapes.Dispose(); + Shapes = null; + } + + if (TerrainManager != null) + { + TerrainManager.ReleaseGroundPlaneAndTerrain(); + TerrainManager.Dispose(); + TerrainManager = null; + } + + // Anything left in the unmanaged code should be cleaned out + PE.Shutdown(World); + + // Not logging any more + PhysicsLogging.Close(); + } + #endregion // Construction and Initialization + + #region Prim and Avatar addition and removal + + public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) + { + m_log.ErrorFormat("{0}: CALL TO AddAvatar in BSScene. NOT IMPLEMENTED", LogHeader); + return null; + } + + public override PhysicsActor AddAvatar(uint localID, string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) + { + // m_log.DebugFormat("{0}: AddAvatar: {1}", LogHeader, avName); + + if (!m_initialized) return null; + + BSCharacter actor = new BSCharacter(localID, avName, this, position, velocity, size, isFlying); + lock (PhysObjects) + PhysObjects.Add(localID, actor); + + // TODO: Remove kludge someday. + // We must generate a collision for avatars whether they collide or not. + // This is required by OpenSim to update avatar animations, etc. + lock (AvatarsInSceneLock) + AvatarsInScene.Add(actor); + + return actor; + } + + public override void RemoveAvatar(PhysicsActor actor) + { + // m_log.DebugFormat("{0}: RemoveAvatar", LogHeader); + + if (!m_initialized) return; + + BSCharacter bsactor = actor as BSCharacter; + if (bsactor != null) + { + try + { + lock (PhysObjects) + PhysObjects.Remove(bsactor.LocalID); + // Remove kludge someday + lock (AvatarsInSceneLock) + AvatarsInScene.Remove(bsactor); + } + catch (Exception e) + { + m_log.WarnFormat("{0}: Attempt to remove avatar that is not in physics scene: {1}", LogHeader, e); + } + bsactor.Destroy(); + // bsactor.dispose(); + } + else + { + m_log.ErrorFormat("{0}: Requested to remove avatar that is not a BSCharacter. ID={1}, type={2}", + LogHeader, actor.LocalID, actor.GetType().Name); + } + } + + public override void RemovePrim(PhysicsActor prim) + { + if (!m_initialized) return; + + BSPhysObject bsprim = prim as BSPhysObject; + if (bsprim != null) + { + DetailLog("{0},RemovePrim,call", bsprim.LocalID); + // m_log.DebugFormat("{0}: RemovePrim. id={1}/{2}", LogHeader, bsprim.Name, bsprim.LocalID); + try + { + lock (PhysObjects) PhysObjects.Remove(bsprim.LocalID); + } + catch (Exception e) + { + m_log.ErrorFormat("{0}: Attempt to remove prim that is not in physics scene: {1}", LogHeader, e); + } + bsprim.Destroy(); + // bsprim.dispose(); + } + else + { + m_log.ErrorFormat("{0}: Attempt to remove prim that is not a BSPrim type.", LogHeader); + } + } + + public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, + Vector3 size, Quaternion rotation, bool isPhysical, uint localID) + { + // m_log.DebugFormat("{0}: AddPrimShape2: {1}", LogHeader, primName); + + if (!m_initialized) return null; + + // DetailLog("{0},BSScene.AddPrimShape,call", localID); + + BSPhysObject prim = new BSPrimLinkable(localID, primName, this, position, size, rotation, pbs, isPhysical); + lock (PhysObjects) PhysObjects.Add(localID, prim); + return prim; + } + + // This is a call from the simulator saying that some physical property has been updated. + // The BulletSim driver senses the changing of relevant properties so this taint + // information call is not needed. + public override void AddPhysicsActorTaint(PhysicsActor prim) { } + + #endregion // Prim and Avatar addition and removal + + #region Simulation + + // Call from the simulator to send physics information to the simulator objects. + // This pushes all the collision and property update events into the objects in + // the simulator and, since it is on the heartbeat thread, there is an implicit + // locking of those data structures from other heartbeat events. + // If the physics engine is running on a separate thread, the update information + // will be in the ObjectsWithCollions and ObjectsWithUpdates structures. + public override float Simulate(float timeStep) + { + if (!BSParam.UseSeparatePhysicsThread) + { + DoPhysicsStep(timeStep); + } + return SendUpdatesToSimulator(timeStep); + } + + // Call the physics engine to do one 'timeStep' and collect collisions and updates + // into ObjectsWithCollisions and ObjectsWithUpdates data structures. + private void DoPhysicsStep(float timeStep) + { + // prevent simulation until we've been initialized + if (!m_initialized) return; + + LastTimeStep = timeStep; + + int updatedEntityCount = 0; + int collidersCount = 0; + + int beforeTime = Util.EnvironmentTickCount(); + int simTime = 0; + + int numTaints = _taintOperations.Count; + InTaintTime = true; // Only used for debugging so locking is not necessary. + + // update the prim states while we know the physics engine is not busy + ProcessTaints(); + + // Some of the physical objects requre individual, pre-step calls + // (vehicles and avatar movement, in particular) + TriggerPreStepEvent(timeStep); + + // the prestep actions might have added taints + numTaints += _taintOperations.Count; + ProcessTaints(); + + InTaintTime = false; // Only used for debugging so locking is not necessary. + + // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. + // Only enable this in a limited test world with few objects. + if (m_physicsPhysicalDumpEnabled) + PE.DumpAllInfo(World); + + // step the physical world one interval + m_simulationStep++; + int numSubSteps = 0; + try + { + numSubSteps = PE.PhysicsStep(World, timeStep, m_maxSubSteps, m_fixedTimeStep, out updatedEntityCount, out collidersCount); + + } + catch (Exception e) + { + m_log.WarnFormat("{0},PhysicsStep Exception: nTaints={1}, substeps={2}, updates={3}, colliders={4}, e={5}", + LogHeader, numTaints, numSubSteps, updatedEntityCount, collidersCount, e); + DetailLog("{0},PhysicsStepException,call, nTaints={1}, substeps={2}, updates={3}, colliders={4}", + DetailLogZero, numTaints, numSubSteps, updatedEntityCount, collidersCount); + updatedEntityCount = 0; + collidersCount = 0; + } + + // Make the physics engine dump useful statistics periodically + if (PhysicsMetricDumpFrames != 0 && ((m_simulationStep % PhysicsMetricDumpFrames) == 0)) + PE.DumpPhysicsStatistics(World); + + // Get a value for 'now' so all the collision and update routines don't have to get their own. + SimulationNowTime = Util.EnvironmentTickCount(); + + // Send collision information to the colliding objects. The objects decide if the collision + // is 'real' (like linksets don't collide with themselves) and the individual objects + // know if the simulator has subscribed to collisions. + lock (CollisionLock) + { + if (collidersCount > 0) + { + lock (PhysObjects) + { + for (int ii = 0; ii < collidersCount; ii++) + { + uint cA = m_collisionArray[ii].aID; + uint cB = m_collisionArray[ii].bID; + Vector3 point = m_collisionArray[ii].point; + Vector3 normal = m_collisionArray[ii].normal; + float penetration = m_collisionArray[ii].penetration; + SendCollision(cA, cB, point, normal, penetration); + SendCollision(cB, cA, point, -normal, penetration); + } + } + } + } + + // If any of the objects had updated properties, tell the managed objects about the update + // and remember that there was a change so it will be passed to the simulator. + lock (UpdateLock) + { + if (updatedEntityCount > 0) + { + lock (PhysObjects) + { + for (int ii = 0; ii < updatedEntityCount; ii++) + { + EntityProperties entprop = m_updateArray[ii]; + BSPhysObject pobj; + if (PhysObjects.TryGetValue(entprop.ID, out pobj)) + { + if (pobj.IsInitialized) + pobj.UpdateProperties(entprop); + } + } + } + } + } + + // Some actors want to know when the simulation step is complete. + TriggerPostStepEvent(timeStep); + + simTime = Util.EnvironmentTickCountSubtract(beforeTime); + if (PhysicsLogging.Enabled) + { + DetailLog("{0},DoPhysicsStep,complete,frame={1}, nTaints={2}, simTime={3}, substeps={4}, updates={5}, colliders={6}, objWColl={7}", + DetailLogZero, m_simulationStep, numTaints, simTime, numSubSteps, + updatedEntityCount, collidersCount, ObjectsWithCollisions.Count); + } + + // The following causes the unmanaged code to output ALL the values found in ALL the objects in the world. + // Only enable this in a limited test world with few objects. + if (m_physicsPhysicalDumpEnabled) + PE.DumpAllInfo(World); + + // The physics engine returns the number of milliseconds it simulated this call. + // These are summed and normalized to one second and divided by 1000 to give the reported physics FPS. + // Multiply by a fixed nominal frame rate to give a rate similar to the simulator (usually 55). + m_simulatedTime += (float)numSubSteps * m_fixedTimeStep * 1000f * NominalFrameRate; + } + + // Called by a BSPhysObject to note that it has changed properties and this information + // should be passed up to the simulator at the proper time. + // Note: this is called by the BSPhysObject from invocation via DoPhysicsStep() above so + // this is is under UpdateLock. + public void PostUpdate(BSPhysObject updatee) + { + lock (UpdateLock) + { + ObjectsWithUpdates.Add(updatee); + } + } + + // The simulator thinks it is physics time so return all the collisions and position + // updates that were collected in actual physics simulation. + private float SendUpdatesToSimulator(float timeStep) + { + if (!m_initialized) return 5.0f; + + DetailLog("{0},SendUpdatesToSimulator,collisions={1},updates={2},simedTime={3}", + BSScene.DetailLogZero, ObjectsWithCollisions.Count, ObjectsWithUpdates.Count, m_simulatedTime); + // Push the collisions into the simulator. + lock (CollisionLock) + { + if (ObjectsWithCollisions.Count > 0) + { + foreach (BSPhysObject bsp in ObjectsWithCollisions) + if (!bsp.SendCollisions()) + { + // If the object is done colliding, see that it's removed from the colliding list + ObjectsWithNoMoreCollisions.Add(bsp); + } + } + + // This is a kludge to get avatar movement updates. + // The simulator expects collisions for avatars even if there are have been no collisions. + // The event updates avatar animations and stuff. + // If you fix avatar animation updates, remove this overhead and let normal collision processing happen. + // Note that we get a copy of the list to search because SendCollision() can take a while. + HashSet tempAvatarsInScene; + lock (AvatarsInSceneLock) + { + tempAvatarsInScene = new HashSet(AvatarsInScene); + } + foreach (BSPhysObject actor in tempAvatarsInScene) + { + if (!ObjectsWithCollisions.Contains(actor)) // don't call avatars twice + actor.SendCollisions(); + } + tempAvatarsInScene = null; + + // Objects that are done colliding are removed from the ObjectsWithCollisions list. + // Not done above because it is inside an iteration of ObjectWithCollisions. + // This complex collision processing is required to create an empty collision + // event call after all real collisions have happened on an object. This allows + // the simulator to generate the 'collision end' event. + if (ObjectsWithNoMoreCollisions.Count > 0) + { + foreach (BSPhysObject po in ObjectsWithNoMoreCollisions) + ObjectsWithCollisions.Remove(po); + ObjectsWithNoMoreCollisions.Clear(); + } + } + + // Call the simulator for each object that has physics property updates. + HashSet updatedObjects = null; + lock (UpdateLock) + { + if (ObjectsWithUpdates.Count > 0) + { + updatedObjects = ObjectsWithUpdates; + ObjectsWithUpdates = new HashSet(); + } + } + if (updatedObjects != null) + { + foreach (BSPhysObject obj in updatedObjects) + { + obj.RequestPhysicsterseUpdate(); + } + updatedObjects.Clear(); + } + + // Return the framerate simulated to give the above returned results. + // (Race condition here but this is just bookkeeping so rare mistakes do not merit a lock). + float simTime = m_simulatedTime; + m_simulatedTime = 0f; + return simTime; + } + + // Something has collided + private void SendCollision(uint localID, uint collidingWith, Vector3 collidePoint, Vector3 collideNormal, float penetration) + { + if (localID <= TerrainManager.HighestTerrainID) + { + return; // don't send collisions to the terrain + } + + BSPhysObject collider; + // NOTE that PhysObjects was locked before the call to SendCollision(). + if (!PhysObjects.TryGetValue(localID, out collider)) + { + // If the object that is colliding cannot be found, just ignore the collision. + DetailLog("{0},BSScene.SendCollision,colliderNotInObjectList,id={1},with={2}", DetailLogZero, localID, collidingWith); + return; + } + + // Note: the terrain is not in the physical object list so 'collidee' can be null when Collide() is called. + BSPhysObject collidee = null; + PhysObjects.TryGetValue(collidingWith, out collidee); + + // DetailLog("{0},BSScene.SendCollision,collide,id={1},with={2}", DetailLogZero, localID, collidingWith); + + if (collider.IsInitialized) + { + if (collider.Collide(collidingWith, collidee, collidePoint, collideNormal, penetration)) + { + // If a collision was 'good', remember to send it to the simulator + lock (CollisionLock) + { + ObjectsWithCollisions.Add(collider); + } + } + } + + return; + } + + public void BulletSPluginPhysicsThread() + { + Thread.CurrentThread.Priority = ThreadPriority.Highest; + m_updateWaitEvent = new ManualResetEvent(false); + + while (m_initialized) + { + int beginSimulationRealtimeMS = Util.EnvironmentTickCount(); + + if (BSParam.Active) + DoPhysicsStep(BSParam.PhysicsTimeStep); + + int simulationRealtimeMS = Util.EnvironmentTickCountSubtract(beginSimulationRealtimeMS); + int simulationTimeVsRealtimeDifferenceMS = ((int)(BSParam.PhysicsTimeStep*1000f)) - simulationRealtimeMS; + + if (simulationTimeVsRealtimeDifferenceMS > 0) + { + // The simulation of the time interval took less than realtime. + // Do a wait for the rest of realtime. + m_updateWaitEvent.WaitOne(simulationTimeVsRealtimeDifferenceMS); + //Thread.Sleep(simulationTimeVsRealtimeDifferenceMS); + } + else + { + // The simulation took longer than realtime. + // Do some scaling of simulation time. + // TODO. + DetailLog("{0},BulletSPluginPhysicsThread,longerThanRealtime={1}", BSScene.DetailLogZero, simulationTimeVsRealtimeDifferenceMS); + } + + Watchdog.UpdateThread(); + } + + Watchdog.RemoveThread(); + } + + #endregion // Simulation + + public override void GetResults() { } + + #region Terrain + + public override void SetTerrain(float[] heightMap) { + TerrainManager.SetTerrain(heightMap); + } + + public override void SetWaterLevel(float baseheight) + { + SimpleWaterLevel = baseheight; + } + + public override void DeleteTerrain() + { + // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); + } + + // Although no one seems to check this, I do support combining. + public override bool SupportsCombining() + { + return TerrainManager.SupportsCombining(); + } + // This call says I am a child to region zero in a mega-region. 'pScene' is that + // of region zero, 'offset' is my offset from regions zero's origin, and + // 'extents' is the largest XY that is handled in my region. + public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents) + { + TerrainManager.Combine(pScene, offset, extents); + } + + // Unhook all the combining that I know about. + public override void UnCombine(PhysicsScene pScene) + { + TerrainManager.UnCombine(pScene); + } + + #endregion // Terrain + + public override Dictionary GetTopColliders() + { + Dictionary topColliders; + + lock (PhysObjects) + { + foreach (KeyValuePair kvp in PhysObjects) + { + kvp.Value.ComputeCollisionScore(); + } + + List orderedPrims = new List(PhysObjects.Values); + orderedPrims.OrderByDescending(p => p.CollisionScore); + topColliders = orderedPrims.Take(25).ToDictionary(p => p.LocalID, p => p.CollisionScore); + } + + return topColliders; + } + + public override bool IsThreaded { get { return false; } } + + #region Extensions + public override object Extension(string pFunct, params object[] pParams) + { + DetailLog("{0} BSScene.Extension,op={1}", DetailLogZero, pFunct); + return base.Extension(pFunct, pParams); + } + #endregion // Extensions + + public static string PrimitiveBaseShapeToString(PrimitiveBaseShape pbs) + { + float pathShearX = pbs.PathShearX < 128 ? (float)pbs.PathShearX * 0.01f : (float)(pbs.PathShearX - 256) * 0.01f; + float pathShearY = pbs.PathShearY < 128 ? (float)pbs.PathShearY * 0.01f : (float)(pbs.PathShearY - 256) * 0.01f; + float pathBegin = (float)pbs.PathBegin * 2.0e-5f; + float pathEnd = 1.0f - (float)pbs.PathEnd * 2.0e-5f; + float pathScaleX = (float)(200 - pbs.PathScaleX) * 0.01f; + float pathScaleY = (float)(200 - pbs.PathScaleY) * 0.01f; + float pathTaperX = pbs.PathTaperX * 0.01f; + float pathTaperY = pbs.PathTaperY * 0.01f; + + float profileBegin = (float)pbs.ProfileBegin * 2.0e-5f; + float profileEnd = 1.0f - (float)pbs.ProfileEnd * 2.0e-5f; + float profileHollow = (float)pbs.ProfileHollow * 2.0e-5f; + if (profileHollow > 0.95f) + profileHollow = 0.95f; + + StringBuilder buff = new StringBuilder(); + buff.Append("shape="); + buff.Append(((ProfileShape)pbs.ProfileShape).ToString()); + buff.Append(","); + buff.Append("hollow="); + buff.Append(((HollowShape)pbs.HollowShape).ToString()); + buff.Append(","); + buff.Append("pathCurve="); + buff.Append(((Extrusion)pbs.PathCurve).ToString()); + buff.Append(","); + buff.Append("profCurve="); + buff.Append(((Extrusion)pbs.ProfileCurve).ToString()); + buff.Append(","); + buff.Append("profHollow="); + buff.Append(profileHollow.ToString()); + buff.Append(","); + buff.Append("pathBegEnd="); + buff.Append(pathBegin.ToString()); + buff.Append("/"); + buff.Append(pathEnd.ToString()); + buff.Append(","); + buff.Append("profileBegEnd="); + buff.Append(profileBegin.ToString()); + buff.Append("/"); + buff.Append(profileEnd.ToString()); + buff.Append(","); + buff.Append("scaleXY="); + buff.Append(pathScaleX.ToString()); + buff.Append("/"); + buff.Append(pathScaleY.ToString()); + buff.Append(","); + buff.Append("shearXY="); + buff.Append(pathShearX.ToString()); + buff.Append("/"); + buff.Append(pathShearY.ToString()); + buff.Append(","); + buff.Append("taperXY="); + buff.Append(pbs.PathTaperX.ToString()); + buff.Append("/"); + buff.Append(pbs.PathTaperY.ToString()); + buff.Append(","); + buff.Append("skew="); + buff.Append(pbs.PathSkew.ToString()); + buff.Append(","); + buff.Append("twist/Beg="); + buff.Append(pbs.PathTwist.ToString()); + buff.Append("/"); + buff.Append(pbs.PathTwistBegin.ToString()); + + return buff.ToString(); + } + + #region Taints + // The simulation execution order is: + // Simulate() + // DoOneTimeTaints + // TriggerPreStepEvent + // DoOneTimeTaints + // Step() + // ProcessAndSendToSimulatorCollisions + // ProcessAndSendToSimulatorPropertyUpdates + // TriggerPostStepEvent + + // Calls to the PhysicsActors can't directly call into the physics engine + // because it might be busy. We delay changes to a known time. + // We rely on C#'s closure to save and restore the context for the delegate. + public void TaintedObject(string pOriginator, string pIdent, TaintCallback pCallback) + { + TaintedObject(false /*inTaintTime*/, pOriginator, pIdent, pCallback); + } + public void TaintedObject(uint pOriginator, String pIdent, TaintCallback pCallback) + { + TaintedObject(false /*inTaintTime*/, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); + } + public void TaintedObject(bool inTaintTime, String pIdent, TaintCallback pCallback) + { + TaintedObject(inTaintTime, BSScene.DetailLogZero, pIdent, pCallback); + } + public void TaintedObject(bool inTaintTime, uint pOriginator, String pIdent, TaintCallback pCallback) + { + TaintedObject(inTaintTime, m_physicsLoggingEnabled ? pOriginator.ToString() : BSScene.DetailLogZero, pIdent, pCallback); + } + // Sometimes a potentially tainted operation can be used in and out of taint time. + // This routine executes the command immediately if in taint-time otherwise it is queued. + public void TaintedObject(bool inTaintTime, string pOriginator, string pIdent, TaintCallback pCallback) + { + if (!m_initialized) return; + + if (inTaintTime) + pCallback(); + else + { + lock (_taintLock) + { + _taintOperations.Add(new TaintCallbackEntry(pOriginator, pIdent, pCallback)); + } + } + } + + private void TriggerPreStepEvent(float timeStep) + { + PreStepAction actions = BeforeStep; + if (actions != null) + actions(timeStep); + + } + + private void TriggerPostStepEvent(float timeStep) + { + PostStepAction actions = AfterStep; + if (actions != null) + actions(timeStep); + + } + + // When someone tries to change a property on a BSPrim or BSCharacter, the object queues + // a callback into itself to do the actual property change. That callback is called + // here just before the physics engine is called to step the simulation. + public void ProcessTaints() + { + ProcessRegularTaints(); + ProcessPostTaintTaints(); + } + + private void ProcessRegularTaints() + { + if (m_initialized && _taintOperations.Count > 0) // save allocating new list if there is nothing to process + { + // swizzle a new list into the list location so we can process what's there + List oldList; + lock (_taintLock) + { + oldList = _taintOperations; + _taintOperations = new List(); + } + + foreach (TaintCallbackEntry tcbe in oldList) + { + try + { + DetailLog("{0},BSScene.ProcessTaints,doTaint,id={1}", tcbe.originator, tcbe.ident); // DEBUG DEBUG DEBUG + tcbe.callback(); + } + catch (Exception e) + { + m_log.ErrorFormat("{0}: ProcessTaints: {1}: Exception: {2}", LogHeader, tcbe.ident, e); + } + } + oldList.Clear(); + } + } + + // Schedule an update to happen after all the regular taints are processed. + // Note that new requests for the same operation ("ident") for the same object ("ID") + // will replace any previous operation by the same object. + public void PostTaintObject(String ident, uint ID, TaintCallback callback) + { + string IDAsString = ID.ToString(); + string uniqueIdent = ident + "-" + IDAsString; + lock (_taintLock) + { + _postTaintOperations[uniqueIdent] = new TaintCallbackEntry(IDAsString, uniqueIdent, callback); + } + + return; + } + + // Taints that happen after the normal taint processing but before the simulation step. + private void ProcessPostTaintTaints() + { + if (m_initialized && _postTaintOperations.Count > 0) + { + Dictionary oldList; + lock (_taintLock) + { + oldList = _postTaintOperations; + _postTaintOperations = new Dictionary(); + } + + foreach (KeyValuePair kvp in oldList) + { + try + { + DetailLog("{0},BSScene.ProcessPostTaintTaints,doTaint,id={1}", DetailLogZero, kvp.Key); // DEBUG DEBUG DEBUG + kvp.Value.callback(); + } + catch (Exception e) + { + m_log.ErrorFormat("{0}: ProcessPostTaintTaints: {1}: Exception: {2}", LogHeader, kvp.Key, e); + } + } + oldList.Clear(); + } + } + + // Only used for debugging. Does not change state of anything so locking is not necessary. + public bool AssertInTaintTime(string whereFrom) + { + if (!InTaintTime) + { + DetailLog("{0},BSScene.AssertInTaintTime,NOT IN TAINT TIME,Region={1},Where={2}", DetailLogZero, RegionName, whereFrom); + m_log.ErrorFormat("{0} NOT IN TAINT TIME!! Region={1}, Where={2}", LogHeader, RegionName, whereFrom); + // Util.PrintCallStack(DetailLog); + } + return InTaintTime; + } + + #endregion // Taints + + #region IPhysicsParameters + // Get the list of parameters this physics engine supports + public PhysParameterEntry[] GetParameterList() + { + BSParam.BuildParameterTable(); + return BSParam.SettableParameters; + } + + // Set parameter on a specific or all instances. + // Return 'false' if not able to set the parameter. + // Setting the value in the m_params block will change the value the physics engine + // will use the next time since it's pinned and shared memory. + // Some of the values require calling into the physics engine to get the new + // value activated ('terrainFriction' for instance). + public bool SetPhysicsParameter(string parm, string val, uint localID) + { + bool ret = false; + + BSParam.ParameterDefnBase theParam; + if (BSParam.TryGetParameter(parm, out theParam)) + { + // Set the value in the C# code + theParam.SetValue(this, val); + + // Optionally set the parameter in the unmanaged code + if (theParam.HasSetOnObject) + { + // update all the localIDs specified + // If the local ID is APPLY_TO_NONE, just change the default value + // If the localID is APPLY_TO_ALL change the default value and apply the new value to all the lIDs + // If the localID is a specific object, apply the parameter change to only that object + List objectIDs = new List(); + switch (localID) + { + case PhysParameterEntry.APPLY_TO_NONE: + // This will cause a call into the physical world if some operation is specified (SetOnObject). + objectIDs.Add(TERRAIN_ID); + TaintedUpdateParameter(parm, objectIDs, val); + break; + case PhysParameterEntry.APPLY_TO_ALL: + lock (PhysObjects) objectIDs = new List(PhysObjects.Keys); + TaintedUpdateParameter(parm, objectIDs, val); + break; + default: + // setting only one localID + objectIDs.Add(localID); + TaintedUpdateParameter(parm, objectIDs, val); + break; + } + } + + ret = true; + } + return ret; + } + + // schedule the actual updating of the paramter to when the phys engine is not busy + private void TaintedUpdateParameter(string parm, List lIDs, string val) + { + string xval = val; + List xlIDs = lIDs; + string xparm = parm; + TaintedObject(DetailLogZero, "BSScene.UpdateParameterSet", delegate() { + BSParam.ParameterDefnBase thisParam; + if (BSParam.TryGetParameter(xparm, out thisParam)) + { + if (thisParam.HasSetOnObject) + { + foreach (uint lID in xlIDs) + { + BSPhysObject theObject = null; + if (PhysObjects.TryGetValue(lID, out theObject)) + thisParam.SetOnObject(this, theObject); + } + } + } + }); + } + + // Get parameter. + // Return 'false' if not able to get the parameter. + public bool GetPhysicsParameter(string parm, out string value) + { + string val = String.Empty; + bool ret = false; + BSParam.ParameterDefnBase theParam; + if (BSParam.TryGetParameter(parm, out theParam)) + { + val = theParam.GetValue(this); + ret = true; + } + value = val; + return ret; + } + + #endregion IPhysicsParameters + + // Invoke the detailed logger and output something if it's enabled. + public void DetailLog(string msg, params Object[] args) + { + PhysicsLogging.Write(msg, args); + } + // Used to fill in the LocalID when there isn't one. It's the correct number of characters. + public const string DetailLogZero = "0000000000"; + + } +} diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs index d1de844e96..b1002733fa 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSShapeCollection.cs @@ -29,10 +29,10 @@ using System.Collections.Generic; using System.Text; using OMV = OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.ConvexDecompositionDotNet; +using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSShapeCollection : IDisposable { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs index 03a9ddc99d..79f1a8959e 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSShapes.cs @@ -30,13 +30,13 @@ using System.Collections.Generic; using System.Text; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.Meshing; -using OpenSim.Region.Physics.ConvexDecompositionDotNet; +using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.PhysicsModules.Meshing; +using OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { // Information class that holds stats for the shape. Which values mean // something depends on the type of shape. @@ -299,7 +299,7 @@ public abstract class BSShape { xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch; physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}", - LogHeader, physicsScene.Name); + LogHeader, physicsScene.PhysicsSceneName); } } else @@ -336,7 +336,7 @@ public abstract class BSShape if (pScene != null) { buff.Append("/rgn="); - buff.Append(pScene.Name); + buff.Append(pScene.PhysicsSceneName); } return buff.ToString(); } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs similarity index 98% rename from OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs index d70b2fbfaf..42fc11bcd5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainHeightmap.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainHeightmap.cs @@ -30,15 +30,14 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; -using OpenSim.Region.CoreModules; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using Nini.Config; using log4net; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSTerrainHeightmap : BSTerrainPhys { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs index 50f917a485..d11baa6cef 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainManager.cs @@ -30,15 +30,14 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; -using OpenSim.Region.CoreModules; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using Nini.Config; using log4net; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { // The physical implementation of the terrain is wrapped in this class. diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs rename to OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs index e4ca098b2d..cd59b656ea 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BSTerrainMesh.cs @@ -30,15 +30,14 @@ using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework; -using OpenSim.Region.CoreModules; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using Nini.Config; using log4net; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { public sealed class BSTerrainMesh : BSTerrainPhys { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs similarity index 99% rename from OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs rename to OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs index 59324611d6..3329395274 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/BulletSimData.cs @@ -29,7 +29,7 @@ using System.Collections.Generic; using System.Text; using OMV = OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin +namespace OpenSim.Region.PhysicsModule.BulletS { // Classes to allow some type checking for the API // These hold pointers to allocated objects in the unmanaged space. diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/PhysicsModules/BulletS/BulletSimTODO.txt similarity index 100% rename from OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt rename to OpenSim/Region/PhysicsModules/BulletS/BulletSimTODO.txt diff --git a/OpenSim/Region/PhysicsModules/BulletS/ExtendedPhysics.cs b/OpenSim/Region/PhysicsModules/BulletS/ExtendedPhysics.cs new file mode 100755 index 0000000000..2ba3c5a762 --- /dev/null +++ b/OpenSim/Region/PhysicsModules/BulletS/ExtendedPhysics.cs @@ -0,0 +1,622 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyrightD + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; + +using OpenSim.Framework; +using OpenSim.Region.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.PhysicsModules.SharedBase; + +using Mono.Addins; +using Nini.Config; +using log4net; +using OpenMetaverse; + +namespace OpenSim.Region.PhysicsModule.BulletS +{ + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class ExtendedPhysics : INonSharedRegionModule + { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static string LogHeader = "[EXTENDED PHYSICS]"; + + // ============================================================= + // Since BulletSim is a plugin, this these values aren't defined easily in one place. + // This table must correspond to an identical table in BSScene. + + // Per scene functions. See BSScene. + + // Per avatar functions. See BSCharacter. + + // Per prim functions. See BSPrim. + public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType"; + public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType"; + public const string PhysFunctChangeLinkFixed = "BulletSim.ChangeLinkFixed"; + public const string PhysFunctChangeLinkType = "BulletSim.ChangeLinkType"; + public const string PhysFunctGetLinkType = "BulletSim.GetLinkType"; + public const string PhysFunctChangeLinkParams = "BulletSim.ChangeLinkParams"; + public const string PhysFunctAxisLockLimits = "BulletSim.AxisLockLimits"; + + // ============================================================= + + private IConfig Configuration { get; set; } + private bool Enabled { get; set; } + private Scene BaseScene { get; set; } + private IScriptModuleComms Comms { get; set; } + + #region INonSharedRegionModule + + public string Name { get { return this.GetType().Name; } } + + public void Initialise(IConfigSource config) + { + BaseScene = null; + Enabled = false; + Configuration = null; + Comms = null; + + try + { + if ((Configuration = config.Configs["ExtendedPhysics"]) != null) + { + Enabled = Configuration.GetBoolean("Enabled", Enabled); + } + } + catch (Exception e) + { + m_log.ErrorFormat("{0} Initialization error: {0}", LogHeader, e); + } + + m_log.InfoFormat("{0} module {1} enabled", LogHeader, (Enabled ? "is" : "is not")); + } + + public void Close() + { + if (BaseScene != null) + { + BaseScene.EventManager.OnObjectAddedToScene -= EventManager_OnObjectAddedToScene; + BaseScene.EventManager.OnSceneObjectPartUpdated -= EventManager_OnSceneObjectPartUpdated; + BaseScene = null; + } + } + + public void AddRegion(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + if (BaseScene != null && BaseScene == scene) + { + Close(); + } + } + + public void RegionLoaded(Scene scene) + { + if (!Enabled) return; + + BaseScene = scene; + + Comms = BaseScene.RequestModuleInterface(); + if (Comms == null) + { + m_log.WarnFormat("{0} ScriptModuleComms interface not defined", LogHeader); + Enabled = false; + + return; + } + + // Register as LSL functions all the [ScriptInvocation] marked methods. + Comms.RegisterScriptInvocations(this); + Comms.RegisterConstants(this); + + // When an object is modified, we might need to update its extended physics parameters + BaseScene.EventManager.OnObjectAddedToScene += EventManager_OnObjectAddedToScene; + BaseScene.EventManager.OnSceneObjectPartUpdated += EventManager_OnSceneObjectPartUpdated; + + } + + public Type ReplaceableInterface { get { return null; } } + + #endregion // INonSharedRegionModule + + private void EventManager_OnObjectAddedToScene(SceneObjectGroup obj) + { + } + + // Event generated when some property of a prim changes. + private void EventManager_OnSceneObjectPartUpdated(SceneObjectPart sop, bool isFullUpdate) + { + } + + [ScriptConstant] + public const int PHYS_CENTER_OF_MASS = 1 << 0; + + [ScriptInvocation] + public string physGetEngineType(UUID hostID, UUID scriptID) + { + string ret = string.Empty; + + if (BaseScene.PhysicsScene != null) + { + ret = BaseScene.PhysicsScene.EngineType; + } + + return ret; + } + + // Code for specifying params. + // The choice if 14700 is arbitrary and only serves to catch parameter code misuse. + [ScriptConstant] + public const int PHYS_AXIS_LOCK_LINEAR = 14700; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_LINEAR_X = 14701; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_LINEAR_X = 14702; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_LINEAR_Y = 14703; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_LINEAR_Y = 14704; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_LINEAR_Z = 14705; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_LINEAR_Z = 14706; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_ANGULAR = 14707; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_ANGULAR_X = 14708; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_ANGULAR_X = 14709; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_ANGULAR_Y = 14710; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_ANGULAR_Y = 14711; + [ScriptConstant] + public const int PHYS_AXIS_LOCK_ANGULAR_Z = 14712; + [ScriptConstant] + public const int PHYS_AXIS_LIMIT_ANGULAR_Z = 14713; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_LINEAR = 14714; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_LINEAR_X = 14715; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_LINEAR_Y = 14716; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_LINEAR_Z = 14717; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_ANGULAR = 14718; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_ANGULAR_X = 14719; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_ANGULAR_Y = 14720; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK_ANGULAR_Z = 14721; + [ScriptConstant] + public const int PHYS_AXIS_UNLOCK = 14722; + // physAxisLockLimits() + [ScriptInvocation] + public int physAxisLock(UUID hostID, UUID scriptID, object[] parms) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + if (GetRootPhysActor(hostID, out rootPhysActor)) + { + object[] parms2 = AddToBeginningOfArray(rootPhysActor, null, parms); + ret = MakeIntError(rootPhysActor.Extension(PhysFunctAxisLockLimits, parms2)); + } + + return ret; + } + + [ScriptConstant] + public const int PHYS_LINKSET_TYPE_CONSTRAINT = 0; + [ScriptConstant] + public const int PHYS_LINKSET_TYPE_COMPOUND = 1; + [ScriptConstant] + public const int PHYS_LINKSET_TYPE_MANUAL = 2; + + [ScriptInvocation] + public int physSetLinksetType(UUID hostID, UUID scriptID, int linksetType) + { + int ret = -1; + if (!Enabled) return ret; + + // The part that is requesting the change. + SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID); + + if (requestingPart != null) + { + // The change is always made to the root of a linkset. + SceneObjectGroup containingGroup = requestingPart.ParentGroup; + SceneObjectPart rootPart = containingGroup.RootPart; + + if (rootPart != null) + { + PhysicsActor rootPhysActor = rootPart.PhysActor; + if (rootPhysActor != null) + { + if (rootPhysActor.IsPhysical) + { + // Change a physical linkset by making non-physical, waiting for one heartbeat so all + // the prim and linkset state is updated, changing the type and making the + // linkset physical again. + containingGroup.ScriptSetPhysicsStatus(false); + Thread.Sleep(150); // longer than one heartbeat tick + + // A kludge for the moment. + // Since compound linksets move the children but don't generate position updates to the + // simulator, it is possible for compound linkset children to have out-of-sync simulator + // and physical positions. The following causes the simulator to push the real child positions + // down into the physics engine to get everything synced. + containingGroup.UpdateGroupPosition(containingGroup.AbsolutePosition); + containingGroup.UpdateGroupRotationR(containingGroup.GroupRotation); + + object[] parms2 = { rootPhysActor, null, linksetType }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2)); + Thread.Sleep(150); // longer than one heartbeat tick + + containingGroup.ScriptSetPhysicsStatus(true); + } + else + { + // Non-physical linksets don't have a physical instantiation so there is no state to + // worry about being updated. + object[] parms2 = { rootPhysActor, null, linksetType }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctSetLinksetType, parms2)); + } + } + else + { + m_log.WarnFormat("{0} physSetLinksetType: root part does not have a physics actor. rootName={1}, hostID={2}", + LogHeader, rootPart.Name, hostID); + } + } + else + { + m_log.WarnFormat("{0} physSetLinksetType: root part does not exist. RequestingPartName={1}, hostID={2}", + LogHeader, requestingPart.Name, hostID); + } + } + else + { + m_log.WarnFormat("{0} physSetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); + } + return ret; + } + + [ScriptInvocation] + public int physGetLinksetType(UUID hostID, UUID scriptID) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + if (GetRootPhysActor(hostID, out rootPhysActor)) + { + object[] parms2 = { rootPhysActor, null }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinksetType, parms2)); + } + else + { + m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID); + } + return ret; + } + + [ScriptConstant] + public const int PHYS_LINK_TYPE_FIXED = 1234; + [ScriptConstant] + public const int PHYS_LINK_TYPE_HINGE = 4; + [ScriptConstant] + public const int PHYS_LINK_TYPE_SPRING = 9; + [ScriptConstant] + public const int PHYS_LINK_TYPE_6DOF = 6; + [ScriptConstant] + public const int PHYS_LINK_TYPE_SLIDER = 7; + + // physChangeLinkType(integer linkNum, integer typeCode) + [ScriptInvocation] + public int physChangeLinkType(UUID hostID, UUID scriptID, int linkNum, int typeCode) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + PhysicsActor childPhysActor; + + if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) + { + object[] parms2 = { rootPhysActor, childPhysActor, typeCode }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2)); + } + + return ret; + } + + // physGetLinkType(integer linkNum) + [ScriptInvocation] + public int physGetLinkType(UUID hostID, UUID scriptID, int linkNum) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + PhysicsActor childPhysActor; + + if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) + { + object[] parms2 = { rootPhysActor, childPhysActor }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctGetLinkType, parms2)); + } + + return ret; + } + + // physChangeLinkFixed(integer linkNum) + // Change the link between the root and the linkNum into a fixed, static physical connection. + [ScriptInvocation] + public int physChangeLinkFixed(UUID hostID, UUID scriptID, int linkNum) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + PhysicsActor childPhysActor; + + if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) + { + object[] parms2 = { rootPhysActor, childPhysActor , PHYS_LINK_TYPE_FIXED }; + ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkType, parms2)); + } + + return ret; + } + + // Code for specifying params. + // The choice if 14400 is arbitrary and only serves to catch parameter code misuse. + public const int PHYS_PARAM_MIN = 14401; + + [ScriptConstant] + public const int PHYS_PARAM_FRAMEINA_LOC = 14401; + [ScriptConstant] + public const int PHYS_PARAM_FRAMEINA_ROT = 14402; + [ScriptConstant] + public const int PHYS_PARAM_FRAMEINB_LOC = 14403; + [ScriptConstant] + public const int PHYS_PARAM_FRAMEINB_ROT = 14404; + [ScriptConstant] + public const int PHYS_PARAM_LINEAR_LIMIT_LOW = 14405; + [ScriptConstant] + public const int PHYS_PARAM_LINEAR_LIMIT_HIGH = 14406; + [ScriptConstant] + public const int PHYS_PARAM_ANGULAR_LIMIT_LOW = 14407; + [ScriptConstant] + public const int PHYS_PARAM_ANGULAR_LIMIT_HIGH = 14408; + [ScriptConstant] + public const int PHYS_PARAM_USE_FRAME_OFFSET = 14409; + [ScriptConstant] + public const int PHYS_PARAM_ENABLE_TRANSMOTOR = 14410; + [ScriptConstant] + public const int PHYS_PARAM_TRANSMOTOR_MAXVEL = 14411; + [ScriptConstant] + public const int PHYS_PARAM_TRANSMOTOR_MAXFORCE = 14412; + [ScriptConstant] + public const int PHYS_PARAM_CFM = 14413; + [ScriptConstant] + public const int PHYS_PARAM_ERP = 14414; + [ScriptConstant] + public const int PHYS_PARAM_SOLVER_ITERATIONS = 14415; + [ScriptConstant] + public const int PHYS_PARAM_SPRING_AXIS_ENABLE = 14416; + [ScriptConstant] + public const int PHYS_PARAM_SPRING_DAMPING = 14417; + [ScriptConstant] + public const int PHYS_PARAM_SPRING_STIFFNESS = 14418; + [ScriptConstant] + public const int PHYS_PARAM_LINK_TYPE = 14419; + [ScriptConstant] + public const int PHYS_PARAM_USE_LINEAR_FRAMEA = 14420; + [ScriptConstant] + public const int PHYS_PARAM_SPRING_EQUILIBRIUM_POINT = 14421; + + public const int PHYS_PARAM_MAX = 14421; + + // Used when specifying a parameter that has settings for the three linear and three angular axis + [ScriptConstant] + public const int PHYS_AXIS_ALL = -1; + [ScriptConstant] + public const int PHYS_AXIS_LINEAR_ALL = -2; + [ScriptConstant] + public const int PHYS_AXIS_ANGULAR_ALL = -3; + [ScriptConstant] + public const int PHYS_AXIS_LINEAR_X = 0; + [ScriptConstant] + public const int PHYS_AXIS_LINEAR_Y = 1; + [ScriptConstant] + public const int PHYS_AXIS_LINEAR_Z = 2; + [ScriptConstant] + public const int PHYS_AXIS_ANGULAR_X = 3; + [ScriptConstant] + public const int PHYS_AXIS_ANGULAR_Y = 4; + [ScriptConstant] + public const int PHYS_AXIS_ANGULAR_Z = 5; + + // physChangeLinkParams(integer linkNum, [ PHYS_PARAM_*, value, PHYS_PARAM_*, value, ...]) + [ScriptInvocation] + public int physChangeLinkParams(UUID hostID, UUID scriptID, int linkNum, object[] parms) + { + int ret = -1; + if (!Enabled) return ret; + + PhysicsActor rootPhysActor; + PhysicsActor childPhysActor; + + if (GetRootAndChildPhysActors(hostID, linkNum, out rootPhysActor, out childPhysActor)) + { + object[] parms2 = AddToBeginningOfArray(rootPhysActor, childPhysActor, parms); + ret = MakeIntError(rootPhysActor.Extension(PhysFunctChangeLinkParams, parms2)); + } + + return ret; + } + + private bool GetRootPhysActor(UUID hostID, out PhysicsActor rootPhysActor) + { + SceneObjectGroup containingGroup; + SceneObjectPart rootPart; + return GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor); + } + + private bool GetRootPhysActor(UUID hostID, out SceneObjectGroup containingGroup, out SceneObjectPart rootPart, out PhysicsActor rootPhysActor) + { + bool ret = false; + rootPhysActor = null; + containingGroup = null; + rootPart = null; + + SceneObjectPart requestingPart; + + requestingPart = BaseScene.GetSceneObjectPart(hostID); + if (requestingPart != null) + { + // The type is is always on the root of a linkset. + containingGroup = requestingPart.ParentGroup; + if (containingGroup != null && !containingGroup.IsDeleted) + { + rootPart = containingGroup.RootPart; + if (rootPart != null) + { + rootPhysActor = rootPart.PhysActor; + if (rootPhysActor != null) + { + ret = true; + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}", + LogHeader, rootPart.Name, hostID); + } + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not exist. RequestingPartName={1}, hostID={2}", + LogHeader, requestingPart.Name, hostID); + } + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Containing group missing or deleted. hostID={1}", LogHeader, hostID); + } + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: cannot find script object in scene. hostID={1}", LogHeader, hostID); + } + + return ret; + } + + // Find the root and child PhysActors based on the linkNum. + // Return 'true' if both are found and returned. + private bool GetRootAndChildPhysActors(UUID hostID, int linkNum, out PhysicsActor rootPhysActor, out PhysicsActor childPhysActor) + { + bool ret = false; + rootPhysActor = null; + childPhysActor = null; + + SceneObjectGroup containingGroup; + SceneObjectPart rootPart; + + if (GetRootPhysActor(hostID, out containingGroup, out rootPart, out rootPhysActor)) + { + SceneObjectPart linkPart = containingGroup.GetLinkNumPart(linkNum); + if (linkPart != null) + { + childPhysActor = linkPart.PhysActor; + if (childPhysActor != null) + { + ret = true; + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Link part has no physical actor. rootName={1}, hostID={2}, linknum={3}", + LogHeader, rootPart.Name, hostID, linkNum); + } + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Could not find linknum part. rootName={1}, hostID={2}, linknum={3}", + LogHeader, rootPart.Name, hostID, linkNum); + } + } + else + { + m_log.WarnFormat("{0} GetRootAndChildPhysActors: Root part does not have a physics actor. rootName={1}, hostID={2}", + LogHeader, rootPart.Name, hostID); + } + + return ret; + } + + // Return an array of objects with the passed object as the first object of a new array + private object[] AddToBeginningOfArray(object firstOne, object secondOne, object[] prevArray) + { + object[] newArray = new object[2 + prevArray.Length]; + newArray[0] = firstOne; + newArray[1] = secondOne; + prevArray.CopyTo(newArray, 2); + return newArray; + } + + // Extension() returns an object. Convert that object into the integer error we expect to return. + private int MakeIntError(object extensionRet) + { + int ret = -1; + if (extensionRet != null) + { + try + { + ret = (int)extensionRet; + } + catch + { + ret = -1; + } + } + return ret; + } + } +} diff --git a/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs similarity index 85% rename from OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs index 4f90eee5da..5a33bdf0f2 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Properties/AssemblyInfo.cs @@ -1,6 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using Mono.Addins; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -31,3 +32,5 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("0.8.2.*")] +[assembly: Addin("OpenSim.Region.PhysicsModule.BulletS", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs similarity index 97% rename from OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs rename to OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs index 48e74eb9d4..35eba29373 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BasicVehicles.cs @@ -34,13 +34,13 @@ using NUnit.Framework; using log4net; using OpenSim.Framework; -using OpenSim.Region.Physics.BulletSPlugin; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.BulletS; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Tests.Common; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin.Tests +namespace OpenSim.Region.PhysicsModule.BulletS.Tests { [TestFixture] public class BasicVehicles : OpenSimTestCase diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs similarity index 95% rename from OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs rename to OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs index 35cbc1d3d1..0be1f4ce6b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTests.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTests.cs @@ -35,7 +35,7 @@ using log4net; using OpenSim.Tests.Common; -namespace OpenSim.Region.Physics.BulletSPlugin.Tests +namespace OpenSim.Region.PhysicsModule.BulletS.Tests { [TestFixture] public class BulletSimTests : OpenSimTestCase diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs similarity index 81% rename from OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs rename to OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs index 775bca213c..4eeea4d618 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/Tests/BulletSimTestsUtil.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs @@ -33,12 +33,13 @@ using System.Text; using Nini.Config; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.Meshing; +using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.PhysicsModules.Meshing; +using OpenSim.Region.Framework.Interfaces; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin.Tests +namespace OpenSim.Region.PhysicsModule.BulletS.Tests { // Utility functions for building up and tearing down the sample physics environments public static class BulletSimTestsUtil @@ -78,22 +79,30 @@ public static class BulletSimTestsUtil bulletSimConfig.Set("VehicleLoggingEnabled","True"); } - PhysicsPluginManager physicsPluginManager; - physicsPluginManager = new PhysicsPluginManager(); - physicsPluginManager.LoadPluginsFromAssemblies("Physics"); - Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); - PhysicsScene pScene = physicsPluginManager.GetPhysicsScene( - "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent); + RegionInfo info = new RegionInfo(); + info.RegionName = "BSTestRegion"; + info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize; + OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info); - BSScene bsScene = pScene as BSScene; + IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer(); + INonSharedRegionModule mod = mesher as INonSharedRegionModule; + mod.Initialise(openSimINI); + mod.AddRegion(scene); + mod.RegionLoaded(scene); + + BSScene pScene = new BSScene(); + mod = (pScene as INonSharedRegionModule); + mod.Initialise(openSimINI); + mod.AddRegion(scene); + mod.RegionLoaded(scene); // Since the asset requestor is not initialized, any mesh or sculptie will be a cube. // In the future, add a fake asset fetcher to get meshes and sculpts. // bsScene.RequestAssetMethod = ???; - return bsScene; + return pScene; } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs similarity index 98% rename from OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs rename to OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs index 5a5de110b4..c0cf19ab2b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/Tests/HullCreation.cs +++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/HullCreation.cs @@ -34,13 +34,13 @@ using NUnit.Framework; using log4net; using OpenSim.Framework; -using OpenSim.Region.Physics.BulletSPlugin; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModule.BulletS; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Tests.Common; using OpenMetaverse; -namespace OpenSim.Region.Physics.BulletSPlugin.Tests +namespace OpenSim.Region.PhysicsModule.BulletS.Tests { [TestFixture] public class HullCreation : OpenSimTestCase diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/CTri.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs similarity index 99% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/CTri.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs index 4d84c44704..7ad689e7a1 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/CTri.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/CTri.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class Wpoint { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Concavity.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs similarity index 99% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/Concavity.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs index cc6383a9c6..4140d250d1 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Concavity.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Concavity.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public static class Concavity { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexBuilder.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs similarity index 99% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexBuilder.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs index dfaede1176..70c3a2bf6c 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexBuilder.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexBuilder.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class DecompDesc { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexDecomposition.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs similarity index 99% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexDecomposition.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs index 2e2bb70c7a..5046bce62e 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexDecomposition.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexDecomposition.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public delegate void ConvexDecompositionCallback(ConvexResult result); diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexResult.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs similarity index 97% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexResult.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs index 87758b5971..44e3e50940 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/ConvexResult.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/ConvexResult.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class ConvexResult { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullClasses.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs similarity index 98% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/HullClasses.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs index d81df262ae..8a0164e7b8 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullClasses.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullClasses.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class HullResult { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullTriangle.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs similarity index 97% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/HullTriangle.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs index 1119a75e91..d3f0052e36 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullTriangle.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullTriangle.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class HullTriangle : int3 { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullUtils.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs similarity index 99% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/HullUtils.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs index c9ccfe2c61..390325465d 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/HullUtils.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/HullUtils.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public static class HullUtils { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/LICENSE.txt b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/LICENSE.txt similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/LICENSE.txt rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/LICENSE.txt diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Plane.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs similarity index 97% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/Plane.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs index d099676208..da9ae0cb8a 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Plane.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Plane.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class Plane { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/PlaneTri.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs similarity index 99% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/PlaneTri.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs index 31f0182520..42f7a229d6 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/PlaneTri.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/PlaneTri.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public enum PlaneTriResult : int { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Properties/AssemblyInfo.cs diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Quaternion.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs similarity index 99% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/Quaternion.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs index 0ba8f17a9c..045f62075c 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/Quaternion.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/Quaternion.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class Quaternion : float4 { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/README.txt b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/README.txt similarity index 100% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/README.txt rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/README.txt diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/SplitPlane.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs similarity index 99% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/SplitPlane.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs index 9f06a9a23f..9f56bc5f48 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/SplitPlane.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/SplitPlane.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class Rect3d { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/VertexLookup.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs similarity index 97% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/VertexLookup.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs index 6f17c9f711..bfe11e5824 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/VertexLookup.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/VertexLookup.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class VertexPool { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float2.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs similarity index 97% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/float2.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs index ce88fc826e..e7358c1599 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float2.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float2.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class float2 { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs similarity index 99% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/float3.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs index 4389114848..fde9b32224 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float3.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class float3 : IEquatable { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float3x3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs similarity index 99% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/float3x3.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs index 76cf06347a..c420fde85f 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float3x3.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float3x3.cs @@ -29,7 +29,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class float3x3 { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs similarity index 98% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/float4.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs index fa6087679f..b2b6fd3949 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float4.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class float4 { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float4x4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs similarity index 99% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/float4x4.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs index 7d1592f00c..087eba75dd 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/float4x4.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/float4x4.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class float4x4 { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/int3.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs similarity index 98% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/int3.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs index 9c5760d7e9..90624eb0f6 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/int3.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int3.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class int3 { diff --git a/OpenSim/Region/Physics/ConvexDecompositionDotNet/int4.cs b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs similarity index 96% rename from OpenSim/Region/Physics/ConvexDecompositionDotNet/int4.cs rename to OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs index c2b32e5a4d..e9320c082e 100644 --- a/OpenSim/Region/Physics/ConvexDecompositionDotNet/int4.cs +++ b/OpenSim/Region/PhysicsModules/ConvexDecompositionDotNet/int4.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.ConvexDecompositionDotNet +namespace OpenSim.Region.PhysicsModule.ConvexDecompositionDotNet { public class int4 { diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs similarity index 99% rename from OpenSim/Region/Physics/Meshing/HelperTypes.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs index 8cd8dcf6ff..34a925d746 100644 --- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/HelperTypes.cs @@ -30,8 +30,8 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using OpenMetaverse; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.Meshing; +using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.PhysicsModules.Meshing; public class Vertex : IComparable { diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs similarity index 99% rename from OpenSim/Region/Physics/Meshing/Mesh.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs index e6b32e781f..8c97f2fa16 100644 --- a/OpenSim/Region/Physics/Meshing/Mesh.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Mesh.cs @@ -29,11 +29,11 @@ using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using PrimMesher; using OpenMetaverse; -namespace OpenSim.Region.Physics.Meshing +namespace OpenSim.Region.PhysicsModules.Meshing { public class Mesh : IMesh { diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs similarity index 94% rename from OpenSim/Region/Physics/Meshing/Meshmerizer.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs index ef6482a1ff..bae34499c8 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs @@ -28,8 +28,12 @@ using System; using System.Collections.Generic; +using System.Reflection; +using System.IO; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenMetaverse; using OpenMetaverse.StructuredData; using System.Drawing; @@ -38,29 +42,12 @@ using System.IO.Compression; using PrimMesher; using log4net; using Nini.Config; -using System.Reflection; -using System.IO; +using Mono.Addins; -namespace OpenSim.Region.Physics.Meshing +namespace OpenSim.Region.PhysicsModules.Meshing { - public class MeshmerizerPlugin : IMeshingPlugin - { - public MeshmerizerPlugin() - { - } - - public string GetName() - { - return "Meshmerizer"; - } - - public IMesher GetMesher(IConfigSource config) - { - return new Meshmerizer(config); - } - } - - public class Meshmerizer : IMesher + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "Meshmerizer")] + public class Meshmerizer : IMesher, INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static string LogHeader = "[MESH]"; @@ -72,6 +59,8 @@ namespace OpenSim.Region.Physics.Meshing #else private const string baseDir = null; //"rawFiles"; #endif + private bool m_Enabled = false; + // If 'true', lots of DEBUG logging of asset parsing details private bool debugDetail = false; @@ -87,30 +76,79 @@ namespace OpenSim.Region.Physics.Meshing // Mesh cache. Static so it can be shared across instances of this class private static Dictionary m_uniqueMeshes = new Dictionary(); - public Meshmerizer(IConfigSource config) + #region INonSharedRegionModule + public string Name { - IConfig start_config = config.Configs["Startup"]; - IConfig mesh_config = config.Configs["Mesh"]; + get { return "Meshmerizer"; } + } - decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); - cacheSculptMaps = start_config.GetBoolean("CacheSculptMaps", cacheSculptMaps); - if (mesh_config != null) - { - useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh); - debugDetail = mesh_config.GetBoolean("LogMeshDetails", debugDetail); - } + public Type ReplaceableInterface + { + get { return null; } + } - try + public void Initialise(IConfigSource source) + { + IConfig config = source.Configs["Startup"]; + if (config != null) { - if (!Directory.Exists(decodedSculptMapPath)) - Directory.CreateDirectory(decodedSculptMapPath); - } - catch (Exception e) - { - m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedSculptMapPath, e.Message); + string mesher = config.GetString("meshing", string.Empty); + if (mesher == Name) + { + m_Enabled = true; + + IConfig mesh_config = source.Configs["Mesh"]; + + decodedSculptMapPath = config.GetString("DecodedSculptMapPath", "j2kDecodeCache"); + cacheSculptMaps = config.GetBoolean("CacheSculptMaps", cacheSculptMaps); + if (mesh_config != null) + { + useMeshiesPhysicsMesh = mesh_config.GetBoolean("UseMeshiesPhysicsMesh", useMeshiesPhysicsMesh); + debugDetail = mesh_config.GetBoolean("LogMeshDetails", debugDetail); + } + + try + { + if (!Directory.Exists(decodedSculptMapPath)) + Directory.CreateDirectory(decodedSculptMapPath); + } + catch (Exception e) + { + m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedSculptMapPath, e.Message); + } + + } } } + public void Close() + { + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + scene.RegisterModuleInterface(this); + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + + scene.UnregisterModuleInterface(this); + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + } + #endregion + + /// /// creates a simple box mesh of the specified size. This mesh is of very low vertex count and may /// be useful as a backup proxy when level of detail is not needed or when more complex meshes fail diff --git a/OpenSim/Region/Physics/Meshing/PrimMesher.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs similarity index 100% rename from OpenSim/Region/Physics/Meshing/PrimMesher.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/PrimMesher.cs diff --git a/OpenSim/Region/Physics/Meshing/SculptMap.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs similarity index 100% rename from OpenSim/Region/Physics/Meshing/SculptMap.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMap.cs diff --git a/OpenSim/Region/Physics/Meshing/SculptMesh.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMesh.cs similarity index 100% rename from OpenSim/Region/Physics/Meshing/SculptMesh.cs rename to OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/SculptMesh.cs diff --git a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs similarity index 84% rename from OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs index 11b89d2e03..d6ac8b2260 100644 --- a/OpenSim/Region/RegionCombinerModule/Properties/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ using Mono.Addins; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Region.RegionCombinerModule")] +[assembly: AssemblyTitle("OpenSim.Region.PhysicsModules.Meshing")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("http://opensimulator.org")] @@ -21,7 +21,7 @@ using Mono.Addins; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("73c166d2-c9d8-4ab8-af4e-89c41b4b58a9")] +[assembly: Guid("4b7e35c2-a9dd-4b10-b778-eb417f4f6884")] // Version information for an assembly consists of the following four values: // @@ -32,5 +32,5 @@ using Mono.Addins; // [assembly: AssemblyVersion("0.8.2.*")] -[assembly: Addin("OpenSim.RegionModules.RegionCombinerModule", OpenSim.VersionInfo.VersionNumber)] +[assembly: Addin("OpenSim.Region.PhysicsModules.Meshing", OpenSim.VersionInfo.VersionNumber)] [assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs similarity index 68% rename from OpenSim/Region/Physics/Manager/ZeroMesher.cs rename to OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs index 890951ffba..09676c6d87 100644 --- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs +++ b/OpenSim/Region/PhysicsModules/Meshing/ZeroMesher.cs @@ -26,9 +26,15 @@ */ using System; +using System.Reflection; using OpenSim.Framework; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenMetaverse; using Nini.Config; +using Mono.Addins; +using log4net; /* * This is the zero mesher. @@ -41,27 +47,67 @@ using Nini.Config; * it's always availabe and thus the default in case of configuration errors */ -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModules.Meshing { - public class ZeroMesherPlugin : IMeshingPlugin + + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ZeroMesher")] + public class ZeroMesher : IMesher, INonSharedRegionModule { - public ZeroMesherPlugin() + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private bool m_Enabled = false; + + #region INonSharedRegionModule + public string Name + { + get { return "ZeroMesher"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + // This is the default Mesher + string mesher = config.GetString("meshing", Name); + if (mesher == Name) + m_Enabled = true; + } + } + + public void Close() { } - public string GetName() + public void AddRegion(Scene scene) { - return "ZeroMesher"; + if (!m_Enabled) + return; + + scene.RegisterModuleInterface(this); } - public IMesher GetMesher(IConfigSource config) + public void RemoveRegion(Scene scene) { - return new ZeroMesher(); - } - } + if (!m_Enabled) + return; - public class ZeroMesher : IMesher - { + scene.UnregisterModuleInterface(this); + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + } + #endregion + + #region IMesher public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) { return CreateMesh(primName, primShape, size, lod, false); @@ -93,5 +139,7 @@ namespace OpenSim.Region.Physics.Manager public void ReleaseMesh(IMesh mesh) { } public void ExpireReleaseMeshs() { } public void ExpireFileCache() { } + + #endregion } } diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs similarity index 93% rename from OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs index 076da7816c..7869739574 100644 --- a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs @@ -27,6 +27,7 @@ using System.Reflection; using System.Runtime.InteropServices; +using Mono.Addins; // Information about this assembly is defined by the following // attributes. @@ -56,3 +57,6 @@ using System.Runtime.InteropServices; // numbers with the '*' character (the default): [assembly : AssemblyVersion("0.8.2.*")] + +[assembly: Addin("OpenSim.Region.PhysicsModule.ODE", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs similarity index 99% rename from OpenSim/Region/Physics/OdePlugin/ODECharacter.cs rename to OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs index 05eaf2aa68..b35c2998cc 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs @@ -31,10 +31,10 @@ using System.Reflection; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using log4net; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { /// /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. @@ -511,7 +511,7 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.Name); + m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.PhysicsSceneName); } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.c_comments b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.c_comments similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/ODEDynamics.c_comments rename to OpenSim/Region/PhysicsModules/Ode/ODEDynamics.c_comments diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs similarity index 99% rename from OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs rename to OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs index 2342bfa141..8f8e2bde5d 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs @@ -46,9 +46,9 @@ using log4net; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { public class ODEDynamics { diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs similarity index 99% rename from OpenSim/Region/Physics/OdePlugin/ODEPrim.cs rename to OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs index 0a99e30991..5e48de6700 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs @@ -50,9 +50,9 @@ using log4net; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { /// /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. @@ -3381,7 +3381,7 @@ Console.WriteLine(" JointCreateFixed"); { m_log.WarnFormat( "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}", - _pbs.SculptTexture, Name, _position, _parent_scene.Name); + _pbs.SculptTexture, Name, _position, _parent_scene.PhysicsSceneName); } } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs similarity index 98% rename from OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs rename to OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs index fa2ed3e9af..80f0fcfa44 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs @@ -31,11 +31,11 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Text; using OpenMetaverse; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using Ode.NET; using log4net; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { /// /// Processes raycast requests as ODE is in a state to be able to do them. @@ -172,7 +172,9 @@ namespace OpenSim.Region.Physics.OdePlugin /// private void RayCast(ODERayCastRequest req) { - // limit ray lenght or collisions will take all avaiable stack space + // NOTE: limit ray lenght or collisions will take all avaiable stack space + // this value may still be too large, depending on machine configuration + // of maximum stack float len = req.length; if (len > 250f) len = 250f; @@ -441,4 +443,4 @@ namespace OpenSim.Region.Physics.OdePlugin public float length; public RayCallback callbackMethod; } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs similarity index 93% rename from OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs rename to OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs index b4a3c48650..2eb7ba634e 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs @@ -29,10 +29,10 @@ using System; using OpenMetaverse; using Ode.NET; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.OdePlugin; +using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.PhysicsModule.ODE; -namespace OpenSim.Region.Physics.OdePlugin +namespace OpenSim.Region.PhysicsModule.ODE { class OdePhysicsJoint : PhysicsJoint { diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs similarity index 97% rename from OpenSim/Region/Physics/OdePlugin/OdeScene.cs rename to OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 812b469ee5..26210d61ce 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -25,13 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// Ubit changes for varsize regions -// using a large Heightfield geometry for terrain -// ODE ode should handle it fine -// EXCEPT raycasts, those need to have limited range +// changes for varsize regions +// note that raycasts need to have limited range // (even in normal regions) -// or aplication stack will just blowup - +// or aplication thread stack may just blowup +// see RayCast(ODERayCastRequest req) //#define USE_DRAWSTUFF //#define SPAM @@ -46,15 +44,19 @@ using System.Runtime.InteropServices; using System.Threading; using log4net; using Nini.Config; +using Mono.Addins; using Ode.NET; using OpenMetaverse; #if USE_DRAWSTUFF using Drawstuff.NET; #endif using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; -namespace OpenSim.Region.Physics.OdePlugin + +namespace OpenSim.Region.PhysicsModule.ODE { public enum StatusIndicators : int { @@ -109,9 +111,12 @@ namespace OpenSim.Region.Physics.OdePlugin Rubber = 6 } - public class OdeScene : PhysicsScene + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")] + public class OdeScene : PhysicsScene, INonSharedRegionModule { - private readonly ILog m_log; + private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString()); + private bool m_Enabled = false; + // private Dictionary m_storedCollisions = new Dictionary(); /// @@ -298,7 +303,7 @@ namespace OpenSim.Region.Physics.OdePlugin private int framecount = 0; //private int m_returncollisions = 10; - private readonly IntPtr contactgroup; + private IntPtr contactgroup; // internal IntPtr WaterGeom; @@ -530,19 +535,103 @@ namespace OpenSim.Region.Physics.OdePlugin private ODERayCastRequestManager m_rayCastManager; + + #region INonSharedRegionModule + public string Name + { + get { return "OpenDynamicsEngine"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + string physics = config.GetString("physics", string.Empty); + if (physics == Name) + { + m_Enabled = true; + m_config = source; + + // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether + // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports + // will find it already loaded later on. + // + // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be + // controlled in Ode.NET.dll.config + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("ode.dll"); + + // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to + // http://opensimulator.org/mantis/view.php?id=2750). + d.InitODE(); + + } + } + + } + + public void Close() + { + } + + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + EngineType = Name; + PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; + + scene.RegisterModuleInterface(this); + Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); + Initialise(extent); + InitialiseFromConfig(m_config); + + // This may not be that good since terrain may not be avaiable at this point + base.Initialise(scene.PhysicsRequestAsset, + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[(int)(extent.X * extent.Y)]), + (float)scene.RegionInfo.RegionSettings.WaterHeight); + + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + + mesher = scene.RequestModuleInterface(); + if (mesher == null) + m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName); + } + #endregion + /// /// Initiailizes the scene /// Sets many properties that ODE requires to be stable /// These settings need to be tweaked 'exactly' right or weird stuff happens. /// - /// Name of the scene. Useful in debug messages. - public OdeScene(string engineType, string name) + private void Initialise(Vector3 regionExtent) { - m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name); - - Name = name; - EngineType = engineType; - + WorldExtents.X = regionExtent.X; + m_regionWidth = (uint)regionExtent.X; + WorldExtents.Y = regionExtent.Y; + m_regionHeight = (uint)regionExtent.Y; + + m_suportCombine = false; + nearCallback = near; triCallback = TriCallback; triArrayCallback = TriArrayCallback; @@ -597,7 +686,6 @@ namespace OpenSim.Region.Physics.OdePlugin { InitializeExtraStats(); - mesher = meshmerizer; m_config = config; // Defaults @@ -725,11 +813,11 @@ namespace OpenSim.Region.Physics.OdePlugin spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeterX); spaceGridMaxY = (int)(WorldExtents.Y * spacesPerMeterY); - // ubit: limit number of spaces + // note: limit number of spaces if (spaceGridMaxX > 24) { spaceGridMaxX = 24; - spacesPerMeterX = spaceGridMaxX / WorldExtents.X ; + spacesPerMeterX = spaceGridMaxX / WorldExtents.X; } if (spaceGridMaxY > 24) { @@ -1862,7 +1950,7 @@ namespace OpenSim.Region.Physics.OdePlugin } catch (AccessViolationException) { - m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", Name); + m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", PhysicsSceneName); } //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); @@ -3119,7 +3207,7 @@ namespace OpenSim.Region.Physics.OdePlugin { m_log.ErrorFormat( "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving", - actor.Name, actor.LocalID, Name); + actor.Name, actor.LocalID, PhysicsSceneName); RemoveCharacter(actor); actor.DestroyOdeStructures(); @@ -3236,7 +3324,7 @@ namespace OpenSim.Region.Physics.OdePlugin { m_log.ErrorFormat( "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity", - actor.Name, actor.LocalID, Name); + actor.Name, actor.LocalID, PhysicsSceneName); RemoveCharacter(actor); actor.DestroyOdeStructures(); @@ -3835,7 +3923,7 @@ namespace OpenSim.Region.Physics.OdePlugin private void SetTerrain(float[] heightMap, Vector3 pOffset) { int startTime = Util.EnvironmentTickCount(); - m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", Name, pOffset); + m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", PhysicsSceneName, pOffset); float[] _heightmap; @@ -3873,6 +3961,7 @@ namespace OpenSim.Region.Physics.OdePlugin uint xt = 0; xx = 0; + for (uint x = 0; x < heightmapWidthSamples; x++) { if (x > 1 && xx < maxXX) @@ -3951,7 +4040,7 @@ namespace OpenSim.Region.Physics.OdePlugin } m_log.DebugFormat( - "[ODE SCENE]: Setting terrain for {0} took {1}ms", Name, Util.EnvironmentTickCountSubtract(startTime)); + "[ODE SCENE]: Setting terrain for {0} took {1}ms", PhysicsSceneName, Util.EnvironmentTickCountSubtract(startTime)); } public override void DeleteTerrain() diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs similarity index 63% rename from OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs rename to OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index 16404c69e4..6dc22bd66d 100644 --- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -30,51 +30,74 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.OdePlugin; +using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.PhysicsModule.ODE; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; using OpenSim.Tests.Common; using log4net; using System.Reflection; -namespace OpenSim.Region.Physics.OdePlugin.Tests +namespace OpenSim.Region.PhysicsModule.ODE.Tests { [TestFixture] public class ODETestClass : OpenSimTestCase { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private OpenSim.Region.Physics.OdePlugin.OdePlugin cbt; - private PhysicsScene ps; - private IMeshingPlugin imp; + //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; + private PhysicsScene pScene; [SetUp] public void Initialize() { - IConfigSource TopConfig = new IniConfigSource(); - IConfig config = TopConfig.AddConfig("Startup"); - config.Set("DecodedSculptMapPath","j2kDecodeCache"); + IConfigSource openSimINI = new IniConfigSource(); + IConfig startupConfig = openSimINI.AddConfig("Startup"); + startupConfig.Set("physics", "OpenDynamicsEngine"); + startupConfig.Set("DecodedSculptMapPath", "j2kDecodeCache"); + + Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); + + //PhysicsScene pScene = physicsPluginManager.GetPhysicsScene( + // "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent); + RegionInfo info = new RegionInfo(); + info.RegionName = "ODETestRegion"; + info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize; + OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info); + + //IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer(); + //INonSharedRegionModule mod = mesher as INonSharedRegionModule; + //mod.Initialise(openSimINI); + //mod.AddRegion(scene); + //mod.RegionLoaded(scene); + + pScene = new OdeScene(); + Console.WriteLine("HERE " + (pScene == null ? "Null" : "Not null")); + INonSharedRegionModule mod = (pScene as INonSharedRegionModule); + Console.WriteLine("HERE " + (mod == null ? "Null" : "Not null")); + mod.Initialise(openSimINI); + mod.AddRegion(scene); + mod.RegionLoaded(scene); // Loading ODEPlugin - cbt = new OdePlugin(); - // Loading Zero Mesher - imp = new ZeroMesherPlugin(); + //cbt = new OdePlugin(); // Getting Physics Scene - ps = cbt.GetScene("test"); + //ps = cbt.GetScene("test"); // Initializing Physics Scene. - ps.Initialise(imp.GetMesher(TopConfig),null); + //ps.Initialise(imp.GetMesher(TopConfig), null, Vector3.Zero); float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize]; for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++) { _heightmap[i] = 21f; } - ps.SetTerrain(_heightmap); + pScene.SetTerrain(_heightmap); } [TearDown] public void Terminate() { - ps.DeleteTerrain(); - ps.Dispose(); + pScene.DeleteTerrain(); + pScene.Dispose(); } @@ -85,9 +108,9 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f); Vector3 size = new Vector3(0.5f, 0.5f, 0.5f); Quaternion rot = Quaternion.Identity; - PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0); + PhysicsActor prim = pScene.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0); OdePrim oprim = (OdePrim)prim; - OdeScene pscene = (OdeScene) ps; + OdeScene pscene = (OdeScene)pScene; Assert.That(oprim.m_taintadd); @@ -95,7 +118,7 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests for (int i = 0; i < 58; i++) { - ps.Simulate(0.133f); + pScene.Simulate(0.133f); Assert.That(oprim.prim_geom != (IntPtr)0); @@ -119,9 +142,9 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests // Make sure we're not somewhere above the ground Assert.That(prim.Position.Z < 21.5f); - ps.RemovePrim(prim); + pScene.RemovePrim(prim); Assert.That(oprim.m_taintremove); - ps.Simulate(0.133f); + pScene.Simulate(0.133f); Assert.That(oprim.Body == (IntPtr)0); } } diff --git a/OpenSim/Region/Physics/OdePlugin/drawstuff.cs b/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs similarity index 100% rename from OpenSim/Region/Physics/OdePlugin/drawstuff.cs rename to OpenSim/Region/PhysicsModules/Ode/drawstuff.cs diff --git a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs similarity index 93% rename from OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs index fc1ffba1cb..e3a3e356c2 100644 --- a/OpenSim/Region/Physics/POSPlugin/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/POS/AssemblyInfo.cs @@ -27,6 +27,7 @@ using System.Reflection; using System.Runtime.InteropServices; +using Mono.Addins; // Information about this assembly is defined by the following // attributes. @@ -56,3 +57,6 @@ using System.Runtime.InteropServices; // numbers with the '*' character (the default): [assembly : AssemblyVersion("0.8.2.*")] + +[assembly: Addin("OpenSim.Region.PhysicsModule.POS", OpenSim.VersionInfo.VersionNumber)] +[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] diff --git a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs b/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs similarity index 98% rename from OpenSim/Region/Physics/POSPlugin/POSCharacter.cs rename to OpenSim/Region/PhysicsModules/POS/POSCharacter.cs index 40ab984dc8..32469d9d4d 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSCharacter.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSCharacter.cs @@ -30,9 +30,9 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.POSPlugin +namespace OpenSim.Region.PhysicsModule.POS { public class POSCharacter : PhysicsActor { diff --git a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs b/OpenSim/Region/PhysicsModules/POS/POSPrim.cs similarity index 98% rename from OpenSim/Region/Physics/POSPlugin/POSPrim.cs rename to OpenSim/Region/PhysicsModules/POS/POSPrim.cs index 782ba82b00..c190fab3fc 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPrim.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSPrim.cs @@ -30,9 +30,9 @@ using System.Collections.Generic; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; -namespace OpenSim.Region.Physics.POSPlugin +namespace OpenSim.Region.PhysicsModule.POS { public class POSPrim : PhysicsActor { diff --git a/OpenSim/Region/Physics/POSPlugin/POSScene.cs b/OpenSim/Region/PhysicsModules/POS/POSScene.cs similarity index 84% rename from OpenSim/Region/Physics/POSPlugin/POSScene.cs rename to OpenSim/Region/PhysicsModules/POS/POSScene.cs index 061304a623..e6bcbf2ab3 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSScene.cs +++ b/OpenSim/Region/PhysicsModules/POS/POSScene.cs @@ -29,31 +29,81 @@ using System; using System.Collections.Generic; using Nini.Config; using OpenMetaverse; +using Mono.Addins; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; -namespace OpenSim.Region.Physics.POSPlugin +namespace OpenSim.Region.PhysicsModule.POS { - public class POSScene : PhysicsScene + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "POSPhysicsScene")] + public class POSScene : PhysicsScene, INonSharedRegionModule { private List _characters = new List(); private List _prims = new List(); private float[] _heightMap; private const float gravity = -9.8f; + private bool m_Enabled = false; //protected internal string sceneIdentifier; - public POSScene(string engineType, String _sceneIdentifier) + #region INonSharedRegionModule + public string Name { - EngineType = engineType; - Name = EngineType + "/" + _sceneIdentifier; - //sceneIdentifier = _sceneIdentifier; + get { return "POS"; } } - public override void Initialise(IMesher meshmerizer, IConfigSource config) + public Type ReplaceableInterface + { + get { return null; } + } + + public void Initialise(IConfigSource source) + { + // TODO: Move this out of Startup + IConfig config = source.Configs["Startup"]; + if (config != null) + { + string physics = config.GetString("physics", string.Empty); + if (physics == Name) + m_Enabled = true; + } + + } + + public void Close() { } + public void AddRegion(Scene scene) + { + if (!m_Enabled) + return; + + EngineType = Name; + PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; + + scene.RegisterModuleInterface(this); + base.Initialise(scene.PhysicsRequestAsset, + (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]), + (float)scene.RegionInfo.RegionSettings.WaterHeight); + + } + + public void RemoveRegion(Scene scene) + { + if (!m_Enabled) + return; + } + + public void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + } + #endregion + public override void Dispose() { } diff --git a/OpenSim/Region/Physics/Manager/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs similarity index 100% rename from OpenSim/Region/Physics/Manager/AssemblyInfo.cs rename to OpenSim/Region/PhysicsModules/SharedBase/AssemblyInfo.cs diff --git a/OpenSim/Region/Physics/Manager/CollisionLocker.cs b/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs similarity index 97% rename from OpenSim/Region/Physics/Manager/CollisionLocker.cs rename to OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs index cace4e44cf..6e658b53e2 100644 --- a/OpenSim/Region/Physics/Manager/CollisionLocker.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/CollisionLocker.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModules.SharedBase { public class CollisionLocker { diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs similarity index 98% rename from OpenSim/Region/Physics/Manager/IMesher.cs rename to OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs index e290dc918f..88169bbc7b 100644 --- a/OpenSim/Region/Physics/Manager/IMesher.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/IMesher.cs @@ -31,7 +31,7 @@ using System.Runtime.InteropServices; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModules.SharedBase { public interface IMesher { diff --git a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs similarity index 98% rename from OpenSim/Region/Physics/Manager/IPhysicsParameters.cs rename to OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs index 31a397c7d4..fb0c9e21db 100755 --- a/OpenSim/Region/Physics/Manager/IPhysicsParameters.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/IPhysicsParameters.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModules.SharedBase { public struct PhysParameterEntry { diff --git a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs similarity index 95% rename from OpenSim/Region/Physics/Manager/NullPhysicsScene.cs rename to OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs index b52f1f62f7..432708c840 100644 --- a/OpenSim/Region/Physics/Manager/NullPhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/NullPhysicsScene.cs @@ -32,7 +32,7 @@ using Nini.Config; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModules.SharedBase { class NullPhysicsScene : PhysicsScene { @@ -40,11 +40,6 @@ namespace OpenSim.Region.Physics.Manager private static int m_workIndicator; - public override void Initialise(IMesher meshmerizer, IConfigSource config) - { - // Does nothing right now - } - public override PhysicsActor AddAvatar( string avName, Vector3 position, Vector3 velocity, Vector3 size, bool isFlying) { diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs similarity index 99% rename from OpenSim/Region/Physics/Manager/PhysicsActor.cs rename to OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs index 60f64809e6..edc41e4653 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs @@ -32,7 +32,7 @@ using System.Reflection; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModules.SharedBase { public delegate void PositionUpdate(Vector3 position); public delegate void VelocityUpdate(Vector3 velocity); diff --git a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs similarity index 98% rename from OpenSim/Region/Physics/Manager/PhysicsJoint.cs rename to OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs index b685d04d19..ce2bf05b96 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsJoint.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsJoint.cs @@ -30,7 +30,7 @@ using System.Collections.Generic; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModules.SharedBase { public enum PhysicsJointType : int { diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs similarity index 96% rename from OpenSim/Region/Physics/Manager/PhysicsScene.cs rename to OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs index a9b30e1a11..1c0ad20460 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs @@ -35,7 +35,7 @@ using Nini.Config; using OpenSim.Framework; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModules.SharedBase { public delegate void physicsCrash(); @@ -104,7 +104,7 @@ namespace OpenSim.Region.Physics.Manager /// Useful in debug messages to distinguish one OdeScene instance from another. /// Usually set to include the region name that the physics engine is acting for. /// - public string Name { get; protected set; } + public string PhysicsSceneName { get; protected set; } /// /// A string identifying the family of this physics engine. Most common values returned @@ -123,6 +123,14 @@ namespace OpenSim.Region.Physics.Manager public RequestAssetDelegate RequestAssetMethod { get; set; } + protected void Initialise(RequestAssetDelegate m, float[] terrain, float waterHeight) + { + RequestAssetMethod = m; + SetTerrain(terrain); + SetWaterLevel(waterHeight); + + } + public virtual void TriggerPhysicsBasedRestart() { physicsCrash handler = OnPhysicsCrash; @@ -132,17 +140,6 @@ namespace OpenSim.Region.Physics.Manager } } - // Deprecated. Do not use this for new physics engines. - public abstract void Initialise(IMesher meshmerizer, IConfigSource config); - - // For older physics engines that do not implement non-legacy region sizes. - // If the physics engine handles the region extent feature, it overrides this function. - public virtual void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) - { - // If not overridden, call the old initialization entry. - Initialise(meshmerizer, config); - } - /// /// Add an avatar /// diff --git a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs similarity index 98% rename from OpenSim/Region/Physics/Manager/PhysicsSensor.cs rename to OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs index f480d7170a..da9c96c469 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsSensor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsSensor.cs @@ -29,7 +29,7 @@ using System; using System.Timers; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModules.SharedBase { [Flags] public enum SenseType : uint diff --git a/OpenSim/Region/Physics/Manager/PhysicsVector.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs similarity index 99% rename from OpenSim/Region/Physics/Manager/PhysicsVector.cs rename to OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs index f60a63638a..76a82fa291 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsVector.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsVector.cs @@ -27,7 +27,7 @@ using System; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModules.SharedBase { /*public class PhysicsVector { diff --git a/OpenSim/Region/Physics/Manager/VehicleConstants.cs b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs similarity index 99% rename from OpenSim/Region/Physics/Manager/VehicleConstants.cs rename to OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs index 8e24b4c81e..e850b11749 100644 --- a/OpenSim/Region/Physics/Manager/VehicleConstants.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/VehicleConstants.cs @@ -28,7 +28,7 @@ using System; using OpenMetaverse; -namespace OpenSim.Region.Physics.Manager +namespace OpenSim.Region.PhysicsModules.SharedBase { public enum Vehicle : int { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8f4e840c67..3f523a486a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -54,7 +54,7 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Region.Framework.Scenes.Animation; using OpenSim.Region.Framework.Scenes.Scripting; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; using OpenSim.Region.ScriptEngine.Shared.ScriptBase; diff --git a/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs b/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs deleted file mode 100644 index 9fac53e12c..0000000000 --- a/OpenSim/Region/UserStatistics/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("OpenSim.Region.UserStatistics")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("http://opensimulator.org")] -[assembly: AssemblyProduct("OpenSim")] -[assembly: AssemblyCopyright("OpenSimulator developers")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("42b28288-5fdd-478f-8903-8dccbbb2d5f9")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("0.8.2.*")] - diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index a139b9b43c..8f3cb800fe 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -35,7 +35,6 @@ using System.Timers; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Communications; using OpenSim.Services.Interfaces; using OpenMetaverse; diff --git a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs index 63730b3a83..d2da85f398 100644 --- a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs +++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs @@ -32,7 +32,6 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; using OpenSim.Services.Interfaces; using OpenMetaverse; diff --git a/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs b/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs index d68829996d..20dc1ccf03 100644 --- a/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs +++ b/OpenSim/Services/Connectors/Freeswitch/RemoteFreeswitchConnector.cs @@ -32,7 +32,7 @@ using System.Collections; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Services.Interfaces; using OpenSim.Server.Base; using OpenMetaverse; diff --git a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs index 74851a94db..b7702a8ed0 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs @@ -33,7 +33,7 @@ using System.Reflection; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.ServiceAuth; -using OpenSim.Framework.Communications; + using OpenSim.Services.Interfaces; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using OpenSim.Server.Base; diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index d208f1ed1d..6c6ccf9887 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs @@ -32,7 +32,7 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.ServiceAuth; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs index ffdd94aca8..b5ca1adb7a 100644 --- a/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs +++ b/OpenSim/Services/Connectors/GridUser/GridUserServicesConnector.cs @@ -32,7 +32,7 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.ServiceAuth; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index b0615b8f3d..f235446ac9 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs @@ -33,7 +33,7 @@ using System.Reflection; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Communications; + using OpenSim.Framework.Monitoring; using OpenSim.Services.Interfaces; using OpenSim.Server.Base; diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 3408f7ad24..7839a68dcc 100644 --- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs @@ -33,7 +33,7 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Services.Interfaces; using OpenMetaverse; using Nwc.XmlRpc; diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index a0ac5f98d7..84c4efe378 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs @@ -35,7 +35,7 @@ using System.Reflection; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Console; -using OpenSim.Framework.Communications; + using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 70f1aee010..939059da71 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs @@ -35,7 +35,7 @@ using System.Reflection; using System.Text; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Services.Interfaces; using OpenMetaverse; using OpenMetaverse.StructuredData; diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs index e474d41b85..1f14b32b90 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs @@ -32,7 +32,7 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.ServiceAuth; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 15a9fbe752..3de0a20f9e 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs @@ -32,7 +32,7 @@ using System.IO; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 44b26d5ac2..87c681033d 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -131,8 +131,11 @@ namespace OpenSim.Services.HypergridService else if (simulationService != string.Empty) m_SimulationService = ServerUtils.LoadPlugin(simulationService, args); - m_AllowedClients = serverConfig.GetString("AllowedClients", string.Empty); - m_DeniedClients = serverConfig.GetString("DeniedClients", string.Empty); + string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "GatekeeperService" }; + m_AllowedClients = Util.GetConfigVarFromSections( + config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); + m_DeniedClients = Util.GetConfigVarFromSections( + config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); m_ForeignAgentsAllowed = serverConfig.GetBoolean("ForeignAgentsAllowed", true); LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_ForeignsAllowedExceptions); diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 29199ae64d..c1b45b2adb 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -127,8 +127,12 @@ namespace OpenSim.Services.LLLoginService m_DestinationGuide = m_LoginServerConfig.GetString ("DestinationGuide", string.Empty); m_AvatarPicker = m_LoginServerConfig.GetString ("AvatarPicker", string.Empty); - m_AllowedClients = m_LoginServerConfig.GetString("AllowedClients", string.Empty); - m_DeniedClients = m_LoginServerConfig.GetString("DeniedClients", string.Empty); + string[] possibleAccessControlConfigSections = new string[] { "AccessControl", "LoginService" }; + m_AllowedClients = Util.GetConfigVarFromSections( + config, "AllowedClients", possibleAccessControlConfigSections, string.Empty); + m_DeniedClients = Util.GetConfigVarFromSections( + config, "DeniedClients", possibleAccessControlConfigSections, string.Empty); + m_MessageUrl = m_LoginServerConfig.GetString("MessageUrl", string.Empty); m_DSTZone = m_LoginServerConfig.GetString("DSTZone", "America/Los_Angeles;Pacific Standard Time"); diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs index e6adcf72ce..1f6233d686 100644 --- a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs @@ -37,7 +37,7 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.Servers; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index b3688222f6..5cd5b88ed9 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -32,11 +32,11 @@ using Nini.Config; using OpenMetaverse; using OpenSim.Data.Null; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -48,6 +48,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; +using OpenSim.Region.PhysicsModule.BasicPhysics; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; @@ -77,6 +78,8 @@ namespace OpenSim.Tests.Common private CoreAssetCache m_cache; + private PhysicsScene m_physicsScene; + public SceneHelpers() : this(null) {} public SceneHelpers(CoreAssetCache cache) @@ -97,6 +100,8 @@ namespace OpenSim.Tests.Common m_cache = cache; + m_physicsScene = StartPhysicsScene(); + SimDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin("OpenSim.Tests.Common.dll", null); } @@ -158,12 +163,16 @@ namespace OpenSim.Tests.Common "basicphysics", "ZeroMesher", new IniConfigSource(), "test", regionExtent); TestScene testScene = new TestScene( - regInfo, m_acm, physicsScene, scs, SimDataService, m_estateDataService, configSource, null); + regInfo, m_acm, SimDataService, m_estateDataService, configSource, null); INonSharedRegionModule godsModule = new GodsModule(); godsModule.Initialise(new IniConfigSource()); godsModule.AddRegion(testScene); + // Add scene to physics + ((INonSharedRegionModule)m_physicsScene).AddRegion(testScene); + ((INonSharedRegionModule)m_physicsScene).RegionLoaded(testScene); + // Add scene to services m_assetService.AddRegion(testScene); @@ -330,6 +339,19 @@ namespace OpenSim.Tests.Common return presenceService; } + private static PhysicsScene StartPhysicsScene() + { + IConfigSource config = new IniConfigSource(); + config.AddConfig("Startup"); + config.Configs["Startup"].Set("physics", "basicphysics"); + + PhysicsScene pScene = new BasicScene(); + INonSharedRegionModule mod = pScene as INonSharedRegionModule; + mod.Initialise(config); + + return pScene; + } + /// /// Setup modules for a scene using their default settings. /// diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs index 2fbebc4ea9..c62b58eff0 100644 --- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs @@ -27,7 +27,7 @@ using System.Collections.Generic; using OpenMetaverse; -using OpenSim.Framework.Communications; + using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs index 45acf91f38..1a93c9fef1 100644 --- a/OpenSim/Tests/Common/Mock/TestScene.cs +++ b/OpenSim/Tests/Common/Mock/TestScene.cs @@ -28,12 +28,12 @@ using System; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Framework.Servers; using OpenSim.Region.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Physics.Manager; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Services.Interfaces; namespace OpenSim.Tests.Common @@ -41,10 +41,10 @@ namespace OpenSim.Tests.Common public class TestScene : Scene { public TestScene( - RegionInfo regInfo, AgentCircuitManager authen, PhysicsScene physicsScene, - SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService, + RegionInfo regInfo, AgentCircuitManager authen, + ISimulationDataService simDataService, IEstateDataService estateDataService, IConfigSource config, string simulatorVersion) - : base(regInfo, authen, physicsScene, sceneGridService, simDataService, estateDataService, + : base(regInfo, authen, simDataService, estateDataService, config, simulatorVersion) { } diff --git a/OpenSim/Tests/Common/OpenSimTestCase.cs b/OpenSim/Tests/Common/OpenSimTestCase.cs index c1415afe43..9fea34820c 100644 --- a/OpenSim/Tests/Common/OpenSimTestCase.cs +++ b/OpenSim/Tests/Common/OpenSimTestCase.cs @@ -38,7 +38,7 @@ namespace OpenSim.Tests.Common [SetUp] public virtual void SetUp() { -// TestHelpers.InMethod(); + //TestHelpers.InMethod(); // Disable logging for each test so that one where logging is enabled doesn't cause all subsequent tests // to have logging on if it failed with an exception. TestHelpers.DisableLogging(); diff --git a/OpenSim/Tests/Performance/NPCPerformanceTests.cs b/OpenSim/Tests/Performance/NPCPerformanceTests.cs index 747c9920ca..e41f5d12cb 100644 --- a/OpenSim/Tests/Performance/NPCPerformanceTests.cs +++ b/OpenSim/Tests/Performance/NPCPerformanceTests.cs @@ -34,7 +34,7 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; + using OpenSim.Region.CoreModules.Avatar.Attachments; using OpenSim.Region.CoreModules.Avatar.AvatarFactory; using OpenSim.Region.CoreModules.Framework.InventoryAccess; diff --git a/bin/Physics/OpenSim.Region.Physics.BulletSPlugin.dll.config b/bin/OpenSim.Region.PhysicsModule.BulletS.dll.config similarity index 100% rename from bin/Physics/OpenSim.Region.Physics.BulletSPlugin.dll.config rename to bin/OpenSim.Region.PhysicsModule.BulletS.dll.config diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 8df81cf06b..cab41f718f 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -304,9 +304,9 @@ ;; - "Imprudence" has access ;; - "Imprudence 1.3" has access ;; - "Imprudence 1.3.1" has no access - ; AllowedClients = + ; AllowedClients = "" - ;# {BannedClients} {} {Bar (|) separated list of banned clients} {} + ;# {DeniedClients} {} {Bar (|) separated list of denied clients} {} ;; Bar (|) separated list of viewers which may not gain access to the regions. ;; One can use a Substring of the viewer name to disable only certain ;; versions @@ -314,7 +314,8 @@ ;; - "Imprudence" has no access ;; - "Imprudence 1.3" has no access ;; - "Imprudence 1.3.1" has access - ; BannedClients = + ;; + ; DeniedClients = "" [Map] diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 05ea867176..786c81bf0e 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -531,6 +531,14 @@ ; many simultaneous requests, default is 30 and is currently applied only to assets ;MaxRequestConcurrency = 30 +[AccessControl] + ; Viewer-based access control. |-separated list of allowed viewers. + ; AllowedClients = "" + + ; Viewer-based access control. |-separated list of denied viewers. + ; No restrictions by default. + ; DeniedClients = "" + [ClientStack.LindenUDP] ; Set this to true to process incoming packets asynchronously. Networking is diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 36025d5fba..82eaf1ffa8 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -184,6 +184,26 @@ ;; This is a default that can be overwritten in some sections. ; GatekeeperURI = "${Const|BaseURL}:${Const|PublicPort}" +[AccessControl] + ;# {AllowedClients} {} {Bar (|) separated list of allowed clients} {} + ;; Bar (|) separated list of viewers which may gain access to the regions. + ;; One can use a substring of the viewer name to enable only certain + ;; versions + ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" + ;; - "Imprudence" has access + ;; - "Imprudence 1.3" has access + ;; - "Imprudence 1.3.1" has no access + ; AllowedClients = "" + + ;# {DeniedClients} {} {Bar (|) separated list of denied clients} {} + ;; Bar (|) separated list of viewers which may not gain access to the regions. + ;; One can use a Substring of the viewer name to disable only certain + ;; versions + ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" + ;; - "Imprudence" has no access + ;; - "Imprudence 1.3" has no access + ;; - "Imprudence 1.3.1" has access + ; DeniedClients = "" [DatabaseService] ; PGSQL @@ -482,23 +502,6 @@ SRV_IMServerURI = "${Const|BaseURL}:${Const|PublicPort}" SRV_GroupsServerURI = "${Const|BaseURL}:${Const|PublicPort}" - ;; Regular expressions for controlling which client versions are accepted/denied. - ;; An empty string means nothing is checked. - ;; - ;; Example 1: allow only these 3 types of clients (any version of them) - ;; AllowedClients = "Imprudence|Hippo|Second Life" - ;; - ;; Example 2: allow all clients except these - ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" - ;; - ;; Note that these are regular expressions, so every character counts. - ;; Also note that this is very weak security and should not be trusted as a reliable means - ;; for keeping bad clients out; modified clients can fake their identifiers. - ;; - ;; - ;AllowedClients = "" - ;DeniedClients = "" - ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" ;; Viewers do not receive timezone information from the server - almost all (?) default to Pacific Standard Time ;; However, they do rely on the server to tell them whether it's Daylight Saving Time or not. @@ -595,23 +598,6 @@ ; If you run this gatekeeper server behind a proxy, set this to true ; HasProxy = false - ;; Regular expressions for controlling which client versions are accepted/denied. - ;; An empty string means nothing is checked. - ;; - ;; Example 1: allow only these 3 types of clients (any version of them) - ;; AllowedClients = "Imprudence|Hippo|Second Life" - ;; - ;; Example 2: allow all clients except these - ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" - ;; - ;; Note that these are regular expressions, so every character counts. - ;; Also note that this is very weak security and should not be trusted as a reliable means - ;; for keeping bad clients out; modified clients can fake their identifiers. - ;; - ;; - ;AllowedClients = "" - ;DeniedClients = "" - ;; Are foreign visitors allowed? ;ForeignAgentsAllowed = true ;; diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 284e9699e1..8d6496db6a 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -145,6 +145,27 @@ ;ConsolePass = secret ;ConsolePort = 0 +[AccessControl] + ;# {AllowedClients} {} {Bar (|) separated list of allowed clients} {} + ;; Bar (|) separated list of viewers which may gain access to the regions. + ;; One can use a substring of the viewer name to enable only certain + ;; versions + ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" + ;; - "Imprudence" has access + ;; - "Imprudence 1.3" has access + ;; - "Imprudence 1.3.1" has no access + ; AllowedClients = "" + + ;# {DeniedClients} {} {Bar (|) separated list of denied clients} {} + ;; Bar (|) separated list of viewers which may not gain access to the regions. + ;; One can use a Substring of the viewer name to disable only certain + ;; versions + ;; Example: Agent uses the viewer "Imprudence 1.3.2.0" + ;; - "Imprudence" has no access + ;; - "Imprudence 1.3" has no access + ;; - "Imprudence 1.3.1" has access + ; DeniedClients = "" + [DatabaseService] ; PGSQL @@ -431,23 +452,6 @@ ; If you run this login server behind a proxy, set this to true ; HasProxy = false - ;; Regular expressions for controlling which client versions are accepted/denied. - ;; An empty string means nothing is checked. - ;; - ;; Example 1: allow only these 3 types of clients (any version of them) - ;; AllowedClients = "Imprudence|Hippo|Second Life" - ;; - ;; Example 2: allow all clients except these - ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" - ;; - ;; Note that these are regular expressions, so every character counts. - ;; Also note that this is very weak security and should not be trusted as a reliable means - ;; for keeping bad clients out; modified clients can fake their identifiers. - ;; - ;; - ;AllowedClients = "" - ;DeniedClients = "" - ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" ;; Viewers do not listen to timezone sent by the server. They use Pacific Standard Time instead, ;; but rely on the server to calculate Daylight Saving Time. Sending another DST than US Pacific diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 179be94775..76d7a9953c 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -145,23 +145,6 @@ ;; Set minimum fee to publish classified ; ClassifiedFee = 0 - ;; Regular expressions for controlling which client versions are accepted/denied. - ;; An empty string means nothing is checked. - ;; - ;; Example 1: allow only these 3 types of clients (any version of them) - ;; AllowedClients = "Imprudence|Hippo|Second Life" - ;; - ;; Example 2: allow all clients except these - ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" - ;; - ;; Note that these are regular expressions, so every character counts. - ;; Also note that this is very weak security and should not be trusted as a reliable means - ;; for keeping bad clients out; modified clients can fake their identifiers. - ;; - ;; - ;AllowedClients = "" - ;DeniedClients = "" - ; Basic Login Service Dos Protection Tweaks ; ; ; ; Some Grids/Users use a transparent proxy that makes use of the X-Forwarded-For HTTP Header, If you do, set this to true diff --git a/prebuild.xml b/prebuild.xml index 2c436839f6..d82f802c5b 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -107,6 +107,7 @@ + @@ -324,58 +325,6 @@ - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - - @@ -410,135 +359,6 @@ - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - - - ../../../../bin/Physics/ - - - - - ../../../../bin/Physics/ - - - - ../../../../bin/ - - - - - - - - - - - - - - ../../../../bin/Physics/ - - - - - ../../../../bin/Physics/ - - - - ../../../../bin/ - - - - - - - - - - - - - - ../../../../bin/Physics/ - - - - - ../../../../bin/Physics/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - - - - - ../../../../bin/ - - - - - ../../../../bin/ - - - - ../../../../bin/ - - - - - - - - - - - - @@ -601,36 +421,6 @@ - - - - ../../../../bin/Physics/ - - - - - ../../../../bin/Physics/ - - - - ../../../../bin/ - - - - - - - - - - - - - - - - - @@ -698,49 +488,33 @@ - + - ../../../bin/ + ../../../../bin/ - ../../../bin/ + ../../../../bin/ - ../../../bin/ + ../../../../bin/ - - - + - - - - - - - - - - - - - + + + - - - - + - @@ -765,18 +539,16 @@ - - + - @@ -789,8 +561,6 @@ - - @@ -943,7 +713,6 @@ - @@ -1603,41 +1372,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - @@ -1667,14 +1401,13 @@ - - + @@ -1715,7 +1448,7 @@ - + @@ -1762,7 +1495,6 @@ - @@ -1770,7 +1502,7 @@ - + @@ -1782,7 +1514,6 @@ - @@ -1800,44 +1531,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1853,6 +1546,7 @@ ../../../bin/ + @@ -1861,9 +1555,9 @@ + - @@ -1874,7 +1568,7 @@ - + @@ -1884,7 +1578,6 @@ - @@ -1926,7 +1619,7 @@ - + ../../../../bin/ @@ -1951,16 +1644,131 @@ - + - ../../../../bin/Physics/ + ../../../../bin/ + + + + + ../../../../bin/ + + + + ../../../../bin/ + + + + + + + + + + + + + + + + + + + + + + + + ../../../../bin/ + + + + + ../../../../bin/ + + + + ../../../../bin/ + + + + + + + + + + + + + + + + ../../../../bin/ + + + + + ../../../../bin/ + + + + ../../../../bin/ + + + + + + + + + + + + + + + + ../../../../bin/ + + + + + ../../../../bin/ + + + + ../../../../bin/ + + + + + + + + + + + + + + + + + + + + + + + ../../../../bin/ true - ../../../../bin/Physics/ + ../../../../bin/ true @@ -1974,12 +1782,11 @@ - - - - - + + + + @@ -2014,15 +1821,13 @@ - - - + @@ -2055,7 +1860,6 @@ - @@ -2091,7 +1895,6 @@ - @@ -2125,10 +1928,8 @@ - - @@ -2144,42 +1945,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - @@ -2316,7 +2081,6 @@ - @@ -2353,7 +2117,6 @@ - @@ -2390,12 +2153,11 @@ - - + @@ -2458,7 +2220,6 @@ - @@ -2498,7 +2259,6 @@ - @@ -2534,7 +2294,6 @@ - @@ -2558,55 +2317,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2845,7 +2555,6 @@ - @@ -2854,7 +2563,8 @@ - + + @@ -3173,7 +2883,6 @@ - @@ -3181,7 +2890,7 @@ - + @@ -3193,7 +2902,6 @@ - @@ -3252,7 +2960,6 @@ - @@ -3262,7 +2969,7 @@ - + @@ -3274,7 +2981,6 @@ - @@ -3319,18 +3025,16 @@ - - - + @@ -3341,7 +3045,6 @@ - @@ -3382,7 +3085,6 @@ - @@ -3421,9 +3123,7 @@ - - @@ -3453,7 +3153,6 @@ - @@ -3495,7 +3194,7 @@ TODO: this is kind of lame, we basically build a duplicate assembly but with tests added in, just because we can't resolve cross-bin-dir-refs. --> - + ../../../../../bin/ @@ -3514,8 +3213,9 @@ - - + + + @@ -3526,7 +3226,7 @@ - + ../../../../../bin/ @@ -3549,10 +3249,10 @@ - - - - + + + + @@ -3631,7 +3331,6 @@ - @@ -3671,7 +3370,6 @@ -