aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules
diff options
context:
space:
mode:
authorDiva Canto2015-08-31 15:04:10 -0700
committerDiva Canto2015-08-31 15:04:10 -0700
commit50e7e38f450599b5755c9ab887b8d9bd9c3d8981 (patch)
tree28e578fbcb02a15a4a74814f6b56629a995690a9 /OpenSim/Region/PhysicsModules
parentFirst commit where physics work as region module. (diff)
downloadopensim-SC-50e7e38f450599b5755c9ab887b8d9bd9c3d8981.zip
opensim-SC-50e7e38f450599b5755c9ab887b8d9bd9c3d8981.tar.gz
opensim-SC-50e7e38f450599b5755c9ab887b8d9bd9c3d8981.tar.bz2
opensim-SC-50e7e38f450599b5755c9ab887b8d9bd9c3d8981.tar.xz
Physics refactoring: all unit tests pass.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs4
-rw-r--r--OpenSim/Region/PhysicsModules/BulletS/BSScene.cs4
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs2
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/OdeScene.cs6
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs50
-rw-r--r--OpenSim/Region/PhysicsModules/POS/POSScene.cs4
6 files changed, 51 insertions, 19 deletions
diff --git a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs
index f7760c5..10684d1 100644
--- a/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs
+++ b/OpenSim/Region/PhysicsModules/BasicPhysics/BasicPhysicsScene.cs
@@ -93,7 +93,9 @@ namespace OpenSim.Region.PhysicsModule.BasicPhysics
93 93
94 scene.RegisterModuleInterface<PhysicsScene>(this); 94 scene.RegisterModuleInterface<PhysicsScene>(this);
95 m_regionExtent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); 95 m_regionExtent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ);
96 base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); 96 base.Initialise(scene.PhysicsRequestAsset,
97 (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]),
98 (float)scene.RegionInfo.RegionSettings.WaterHeight);
97 99
98 } 100 }
99 101
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
index b412561..d116c3b 100644
--- a/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSScene.cs
@@ -250,7 +250,9 @@ namespace OpenSim.Region.PhysicsModule.BulletS
250 Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); 250 Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ);
251 Initialise(m_Config, extent); 251 Initialise(m_Config, extent);
252 252
253 base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); 253 base.Initialise(scene.PhysicsRequestAsset,
254 (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]),
255 (float)scene.RegionInfo.RegionSettings.WaterHeight);
254 256
255 } 257 }
256 258
diff --git a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs
index d86c841..4eeea4d 100755
--- a/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/Tests/BulletSimTestsUtil.cs
@@ -81,8 +81,6 @@ public static class BulletSimTestsUtil
81 81
82 Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); 82 Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
83 83
84 //PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(
85 // "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent);
86 RegionInfo info = new RegionInfo(); 84 RegionInfo info = new RegionInfo();
87 info.RegionName = "BSTestRegion"; 85 info.RegionName = "BSTestRegion";
88 info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize; 86 info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize;
diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
index f090953..f49b0f7 100644
--- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
@@ -106,7 +106,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
106 } 106 }
107 107
108 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")] 108 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")]
109 public class OdeScene : PhysicsScene 109 public class OdeScene : PhysicsScene, INonSharedRegionModule
110 { 110 {
111 private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString()); 111 private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString());
112 private bool m_Enabled = false; 112 private bool m_Enabled = false;
@@ -585,7 +585,9 @@ namespace OpenSim.Region.PhysicsModule.ODE
585 Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); 585 Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ);
586 Initialise(); 586 Initialise();
587 InitialiseFromConfig(m_config); 587 InitialiseFromConfig(m_config);
588 base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); 588 base.Initialise(scene.PhysicsRequestAsset,
589 (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]),
590 (float)scene.RegionInfo.RegionSettings.WaterHeight);
589 591
590 } 592 }
591 593
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;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.PhysicsModules.SharedBase; 33using OpenSim.Region.PhysicsModules.SharedBase;
34using OpenSim.Region.PhysicsModule.ODE; 34using OpenSim.Region.PhysicsModule.ODE;
35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
36using log4net; 38using log4net;
37using System.Reflection; 39using System.Reflection;
@@ -44,15 +46,39 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 47
46 //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; 48 //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt;
47 private PhysicsScene ps; 49 private PhysicsScene pScene;
48 private IMeshingPlugin imp; 50 private IMeshingPlugin imp;
49 51
50 [SetUp] 52 [SetUp]
51 public void Initialize() 53 public void Initialize()
52 { 54 {
53 IConfigSource TopConfig = new IniConfigSource(); 55 IConfigSource openSimINI = new IniConfigSource();
54 IConfig config = TopConfig.AddConfig("Startup"); 56 IConfig startupConfig = openSimINI.AddConfig("Startup");
55 config.Set("DecodedSculptMapPath","j2kDecodeCache"); 57 startupConfig.Set("physics", "OpenDynamicsEngine");
58 startupConfig.Set("DecodedSculptMapPath", "j2kDecodeCache");
59
60 Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
61
62 //PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(
63 // "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent);
64 RegionInfo info = new RegionInfo();
65 info.RegionName = "ODETestRegion";
66 info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize;
67 OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info);
68
69 //IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer();
70 //INonSharedRegionModule mod = mesher as INonSharedRegionModule;
71 //mod.Initialise(openSimINI);
72 //mod.AddRegion(scene);
73 //mod.RegionLoaded(scene);
74
75 pScene = new OdeScene();
76 Console.WriteLine("HERE " + (pScene == null ? "Null" : "Not null"));
77 INonSharedRegionModule mod = (pScene as INonSharedRegionModule);
78 Console.WriteLine("HERE " + (mod == null ? "Null" : "Not null"));
79 mod.Initialise(openSimINI);
80 mod.AddRegion(scene);
81 mod.RegionLoaded(scene);
56 82
57 // Loading ODEPlugin 83 // Loading ODEPlugin
58 //cbt = new OdePlugin(); 84 //cbt = new OdePlugin();
@@ -65,14 +91,14 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests
65 { 91 {
66 _heightmap[i] = 21f; 92 _heightmap[i] = 21f;
67 } 93 }
68 ps.SetTerrain(_heightmap); 94 pScene.SetTerrain(_heightmap);
69 } 95 }
70 96
71 [TearDown] 97 [TearDown]
72 public void Terminate() 98 public void Terminate()
73 { 99 {
74 ps.DeleteTerrain(); 100 pScene.DeleteTerrain();
75 ps.Dispose(); 101 pScene.Dispose();
76 102
77 } 103 }
78 104
@@ -83,9 +109,9 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests
83 Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f); 109 Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f);
84 Vector3 size = new Vector3(0.5f, 0.5f, 0.5f); 110 Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
85 Quaternion rot = Quaternion.Identity; 111 Quaternion rot = Quaternion.Identity;
86 PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0); 112 PhysicsActor prim = pScene.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0);
87 OdePrim oprim = (OdePrim)prim; 113 OdePrim oprim = (OdePrim)prim;
88 OdeScene pscene = (OdeScene) ps; 114 OdeScene pscene = (OdeScene)pScene;
89 115
90 Assert.That(oprim.m_taintadd); 116 Assert.That(oprim.m_taintadd);
91 117
@@ -93,7 +119,7 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests
93 119
94 for (int i = 0; i < 58; i++) 120 for (int i = 0; i < 58; i++)
95 { 121 {
96 ps.Simulate(0.133f); 122 pScene.Simulate(0.133f);
97 123
98 Assert.That(oprim.prim_geom != (IntPtr)0); 124 Assert.That(oprim.prim_geom != (IntPtr)0);
99 125
@@ -117,9 +143,9 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests
117 // Make sure we're not somewhere above the ground 143 // Make sure we're not somewhere above the ground
118 Assert.That(prim.Position.Z < 21.5f); 144 Assert.That(prim.Position.Z < 21.5f);
119 145
120 ps.RemovePrim(prim); 146 pScene.RemovePrim(prim);
121 Assert.That(oprim.m_taintremove); 147 Assert.That(oprim.m_taintremove);
122 ps.Simulate(0.133f); 148 pScene.Simulate(0.133f);
123 Assert.That(oprim.Body == (IntPtr)0); 149 Assert.That(oprim.Body == (IntPtr)0);
124 } 150 }
125 } 151 }
diff --git a/OpenSim/Region/PhysicsModules/POS/POSScene.cs b/OpenSim/Region/PhysicsModules/POS/POSScene.cs
index beaa177..f47d245 100644
--- a/OpenSim/Region/PhysicsModules/POS/POSScene.cs
+++ b/OpenSim/Region/PhysicsModules/POS/POSScene.cs
@@ -85,7 +85,9 @@ namespace OpenSim.Region.PhysicsModule.POS
85 PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; 85 PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName;
86 86
87 scene.RegisterModuleInterface<PhysicsScene>(this); 87 scene.RegisterModuleInterface<PhysicsScene>(this);
88 base.Initialise(scene.PhysicsRequestAsset, scene.Heightmap.GetFloatsSerialised(), (float)scene.RegionInfo.RegionSettings.WaterHeight); 88 base.Initialise(scene.PhysicsRequestAsset,
89 (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[Constants.RegionSize * Constants.RegionSize]),
90 (float)scene.RegionInfo.RegionSettings.WaterHeight);
89 91
90 } 92 }
91 93