From 1d6b33bc2da3b312cff1d1802a73aacdf72b0385 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Aug 2015 20:06:53 -0700 Subject: Major renaming of Physics dlls / folders. No functional changes, just renames. --- .../PhysicsModules/Ode/Tests/ODETestClass.cs | 128 +++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs (limited to 'OpenSim/Region/PhysicsModules/Ode/Tests') diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs new file mode 100644 index 0000000..16404c6 --- /dev/null +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -0,0 +1,128 @@ +/* + * 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 Nini.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Physics.Manager; +using OpenSim.Region.Physics.OdePlugin; +using OpenSim.Tests.Common; +using log4net; +using System.Reflection; + +namespace OpenSim.Region.Physics.OdePlugin.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; + + [SetUp] + public void Initialize() + { + IConfigSource TopConfig = new IniConfigSource(); + IConfig config = TopConfig.AddConfig("Startup"); + config.Set("DecodedSculptMapPath","j2kDecodeCache"); + + // Loading ODEPlugin + cbt = new OdePlugin(); + // Loading Zero Mesher + imp = new ZeroMesherPlugin(); + // Getting Physics Scene + ps = cbt.GetScene("test"); + // Initializing Physics Scene. + ps.Initialise(imp.GetMesher(TopConfig),null); + 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); + } + + [TearDown] + public void Terminate() + { + ps.DeleteTerrain(); + ps.Dispose(); + + } + + [Test] + public void CreateAndDropPhysicalCube() + { + PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox(); + 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); + OdePrim oprim = (OdePrim)prim; + OdeScene pscene = (OdeScene) ps; + + Assert.That(oprim.m_taintadd); + + prim.LocalID = 5; + + for (int i = 0; i < 58; i++) + { + ps.Simulate(0.133f); + + Assert.That(oprim.prim_geom != (IntPtr)0); + + Assert.That(oprim.m_targetSpace != (IntPtr)0); + + //Assert.That(oprim.m_targetSpace == pscene.space); + m_log.Info("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space); + + Assert.That(!oprim.m_taintadd); + m_log.Info("Prim Position (" + oprim.LocalID + "): " + prim.Position); + + // Make sure we're above the ground + //Assert.That(prim.Position.Z > 20f); + //m_log.Info("PrimCollisionScore (" + oprim.m_localID + "): " + oprim.m_collisionscore); + + // Make sure we've got a Body + Assert.That(oprim.Body != (IntPtr)0); + //m_log.Info( + } + + // Make sure we're not somewhere above the ground + Assert.That(prim.Position.Z < 21.5f); + + ps.RemovePrim(prim); + Assert.That(oprim.m_taintremove); + ps.Simulate(0.133f); + Assert.That(oprim.Body == (IntPtr)0); + } + } +} -- cgit v1.1 From 2c0cad6dd3014e9ad363090f5f7872c43daffcbd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Aug 2015 20:29:31 -0700 Subject: Renamed the namespaces too --- OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/PhysicsModules/Ode/Tests') diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index 16404c6..09147b0 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -30,20 +30,20 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.OdePlugin; +using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModule.ODE; 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 OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; private PhysicsScene ps; private IMeshingPlugin imp; -- cgit v1.1 From ce2c67876e0ebf4f84420696f660dc77d96dea6b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Aug 2015 21:05:36 -0700 Subject: More namespace and dll name changes. Still no functional changes. --- OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/PhysicsModules/Ode/Tests') diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index 09147b0..1816656 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -30,7 +30,7 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Region.PhysicsModule.SharedBase; +using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.PhysicsModule.ODE; using OpenSim.Tests.Common; using log4net; -- cgit v1.1 From 3741edd1c791e87a38805a62530755cbf0c55cab Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 09:21:05 -0700 Subject: Refactored Meshing modules: - Moved ZeroMesher from OpenSim.Region.PhysicsModules.SharedBase to OpenSim.Region.PhysicsModules.Meshing - Created subfolder for all Meshmerizer files, also in the same Meshing dll - Made them both region modules, with ZeroMesher being the default one This compiles but doesn't run yet. --- OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim/Region/PhysicsModules/Ode/Tests') diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index 1816656..bbf64d5 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -56,8 +56,6 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests // Loading ODEPlugin cbt = new OdePlugin(); - // Loading Zero Mesher - imp = new ZeroMesherPlugin(); // Getting Physics Scene ps = cbt.GetScene("test"); // Initializing Physics Scene. -- cgit v1.1 From 134d4300f0b6e9b0df0326cfe0b5df9f41f42865 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 13:02:51 -0700 Subject: All physics plugins are now region modules. Compiles but doesn't run. --- OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/PhysicsModules/Ode/Tests') diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index bbf64d5..eca670c 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -43,7 +43,7 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; + //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; private PhysicsScene ps; private IMeshingPlugin imp; @@ -55,11 +55,11 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests config.Set("DecodedSculptMapPath","j2kDecodeCache"); // Loading ODEPlugin - cbt = new OdePlugin(); + //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++) { -- cgit v1.1 From 50e7e38f450599b5755c9ab887b8d9bd9c3d8981 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 15:04:10 -0700 Subject: Physics refactoring: all unit tests pass. --- .../PhysicsModules/Ode/Tests/ODETestClass.cs | 50 ++++++++++++++++------ 1 file changed, 38 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/PhysicsModules/Ode/Tests') diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index eca670c..36b65cf 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -32,6 +32,8 @@ using OpenMetaverse; using OpenSim.Framework; 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; @@ -44,15 +46,39 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; - private PhysicsScene ps; + private PhysicsScene pScene; private IMeshingPlugin imp; [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(); @@ -65,14 +91,14 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests { _heightmap[i] = 21f; } - ps.SetTerrain(_heightmap); + pScene.SetTerrain(_heightmap); } [TearDown] public void Terminate() { - ps.DeleteTerrain(); - ps.Dispose(); + pScene.DeleteTerrain(); + pScene.Dispose(); } @@ -83,9 +109,9 @@ namespace OpenSim.Region.PhysicsModule.ODE.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); @@ -93,7 +119,7 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests for (int i = 0; i < 58; i++) { - ps.Simulate(0.133f); + pScene.Simulate(0.133f); Assert.That(oprim.prim_geom != (IntPtr)0); @@ -117,9 +143,9 @@ namespace OpenSim.Region.PhysicsModule.ODE.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); } } -- cgit v1.1 From 9435405ca1c173963dd6e97116a27b798a211801 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 31 Aug 2015 16:23:43 -0700 Subject: Deleted physics plugin classes. More unit tests fixed. --- OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/PhysicsModules/Ode/Tests') diff --git a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs index 36b65cf..6dc22bd 100644 --- a/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs +++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs @@ -47,7 +47,6 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; private PhysicsScene pScene; - private IMeshingPlugin imp; [SetUp] public void Initialize() -- cgit v1.1