aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs (renamed from OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs)67
1 files changed, 45 insertions, 22 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs
index 16404c6..6dc22bd 100644
--- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs
@@ -30,51 +30,74 @@ using Nini.Config;
30using NUnit.Framework; 30using NUnit.Framework;
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager; 33using OpenSim.Region.PhysicsModules.SharedBase;
34using OpenSim.Region.Physics.OdePlugin; 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;
38 40
39namespace OpenSim.Region.Physics.OdePlugin.Tests 41namespace OpenSim.Region.PhysicsModule.ODE.Tests
40{ 42{
41 [TestFixture] 43 [TestFixture]
42 public class ODETestClass : OpenSimTestCase 44 public class ODETestClass : OpenSimTestCase
43 { 45 {
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.Physics.OdePlugin.OdePlugin cbt; 48 //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt;
47 private PhysicsScene ps; 49 private PhysicsScene pScene;
48 private IMeshingPlugin imp;
49 50
50 [SetUp] 51 [SetUp]
51 public void Initialize() 52 public void Initialize()
52 { 53 {
53 IConfigSource TopConfig = new IniConfigSource(); 54 IConfigSource openSimINI = new IniConfigSource();
54 IConfig config = TopConfig.AddConfig("Startup"); 55 IConfig startupConfig = openSimINI.AddConfig("Startup");
55 config.Set("DecodedSculptMapPath","j2kDecodeCache"); 56 startupConfig.Set("physics", "OpenDynamicsEngine");
57 startupConfig.Set("DecodedSculptMapPath", "j2kDecodeCache");
58
59 Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);
60
61 //PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(
62 // "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent);
63 RegionInfo info = new RegionInfo();
64 info.RegionName = "ODETestRegion";
65 info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize;
66 OpenSim.Region.Framework.Scenes.Scene scene = new OpenSim.Region.Framework.Scenes.Scene(info);
67
68 //IMesher mesher = new OpenSim.Region.PhysicsModules.Meshing.Meshmerizer();
69 //INonSharedRegionModule mod = mesher as INonSharedRegionModule;
70 //mod.Initialise(openSimINI);
71 //mod.AddRegion(scene);
72 //mod.RegionLoaded(scene);
73
74 pScene = new OdeScene();
75 Console.WriteLine("HERE " + (pScene == null ? "Null" : "Not null"));
76 INonSharedRegionModule mod = (pScene as INonSharedRegionModule);
77 Console.WriteLine("HERE " + (mod == null ? "Null" : "Not null"));
78 mod.Initialise(openSimINI);
79 mod.AddRegion(scene);
80 mod.RegionLoaded(scene);
56 81
57 // Loading ODEPlugin 82 // Loading ODEPlugin
58 cbt = new OdePlugin(); 83 //cbt = new OdePlugin();
59 // Loading Zero Mesher
60 imp = new ZeroMesherPlugin();
61 // Getting Physics Scene 84 // Getting Physics Scene
62 ps = cbt.GetScene("test"); 85 //ps = cbt.GetScene("test");
63 // Initializing Physics Scene. 86 // Initializing Physics Scene.
64 ps.Initialise(imp.GetMesher(TopConfig),null); 87 //ps.Initialise(imp.GetMesher(TopConfig), null, Vector3.Zero);
65 float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize]; 88 float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize];
66 for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++) 89 for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++)
67 { 90 {
68 _heightmap[i] = 21f; 91 _heightmap[i] = 21f;
69 } 92 }
70 ps.SetTerrain(_heightmap); 93 pScene.SetTerrain(_heightmap);
71 } 94 }
72 95
73 [TearDown] 96 [TearDown]
74 public void Terminate() 97 public void Terminate()
75 { 98 {
76 ps.DeleteTerrain(); 99 pScene.DeleteTerrain();
77 ps.Dispose(); 100 pScene.Dispose();
78 101
79 } 102 }
80 103
@@ -85,9 +108,9 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests
85 Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f); 108 Vector3 position = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 128f);
86 Vector3 size = new Vector3(0.5f, 0.5f, 0.5f); 109 Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
87 Quaternion rot = Quaternion.Identity; 110 Quaternion rot = Quaternion.Identity;
88 PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0); 111 PhysicsActor prim = pScene.AddPrimShape("CoolShape", newcube, position, size, rot, true, 0);
89 OdePrim oprim = (OdePrim)prim; 112 OdePrim oprim = (OdePrim)prim;
90 OdeScene pscene = (OdeScene) ps; 113 OdeScene pscene = (OdeScene)pScene;
91 114
92 Assert.That(oprim.m_taintadd); 115 Assert.That(oprim.m_taintadd);
93 116
@@ -95,7 +118,7 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests
95 118
96 for (int i = 0; i < 58; i++) 119 for (int i = 0; i < 58; i++)
97 { 120 {
98 ps.Simulate(0.133f); 121 pScene.Simulate(0.133f);
99 122
100 Assert.That(oprim.prim_geom != (IntPtr)0); 123 Assert.That(oprim.prim_geom != (IntPtr)0);
101 124
@@ -119,9 +142,9 @@ namespace OpenSim.Region.Physics.OdePlugin.Tests
119 // Make sure we're not somewhere above the ground 142 // Make sure we're not somewhere above the ground
120 Assert.That(prim.Position.Z < 21.5f); 143 Assert.That(prim.Position.Z < 21.5f);
121 144
122 ps.RemovePrim(prim); 145 pScene.RemovePrim(prim);
123 Assert.That(oprim.m_taintremove); 146 Assert.That(oprim.m_taintremove);
124 ps.Simulate(0.133f); 147 pScene.Simulate(0.133f);
125 Assert.That(oprim.Body == (IntPtr)0); 148 Assert.That(oprim.Body == (IntPtr)0);
126 } 149 }
127 } 150 }