aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODETestClass.cs99
-rw-r--r--prebuild.xml2
2 files changed, 101 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs
new file mode 100644
index 0000000..05ec61d
--- /dev/null
+++ b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs
@@ -0,0 +1,99 @@
1using System;
2using System.Collections.Generic;
3using System.Runtime.InteropServices;
4using Axiom.Math;
5using Ode.NET;
6using OpenSim.Framework;
7using OpenSim.Framework.Console;
8using OpenSim.Region.Physics.Manager;
9using NUnit.Framework;
10using NUnit.Framework.SyntaxHelpers;
11
12namespace OpenSim.Region.Physics.OdePlugin
13{
14 [TestFixture]
15 public class ODETestClass
16 {
17 private OdePlugin cbt;
18 private PhysicsScene ps;
19 private IMeshingPlugin imp;
20
21
22 [SetUp]
23 public void Initialize()
24 {
25 // Loading ODEPlugin
26 cbt = new OdePlugin();
27 // Loading Zero Mesher
28 imp = new ZeroMesherPlugin();
29 // Getting Physics Scene
30 ps = cbt.GetScene();
31 // Initializing Physics Scene.
32 ps.Initialise(imp.GetMesher());
33 float[] _heightmap = new float[256 * 256];
34 for (int i = 0; i<(256*256);i++)
35 {
36 _heightmap[i] = 21f;
37 }
38 ps.SetTerrain(_heightmap);
39
40 }
41 [TearDown]
42 public void Terminate()
43 {
44 ps.DeleteTerrain();
45 ps.Dispose();
46
47 }
48 [Test]
49 public void CreateAndDropPhysicalCube()
50 {
51 PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox();
52 PhysicsVector position = new PhysicsVector(128, 128, 128);
53 PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f);
54 Quaternion rot = new Quaternion(1, 0, 0, 0);
55 PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true);
56 OdePrim oprim = (OdePrim)prim;
57 OdeScene pscene = (OdeScene) ps;
58
59 Assert.That(oprim.m_taintadd);
60
61 prim.LocalID = 5;
62
63
64
65 for (int i = 0; i < 38; i++)
66 {
67 ps.Simulate(0.133f);
68
69 Assert.That(oprim.prim_geom != (IntPtr)0);
70
71 Assert.That(oprim.m_targetSpace != (IntPtr)0);
72
73 //Assert.That(oprim.m_targetSpace == pscene.space);
74 Console.WriteLine("TargetSpace: " + oprim.m_targetSpace + " - SceneMainSpace: " + pscene.space);
75
76 Assert.That(!oprim.m_taintadd);
77 Console.WriteLine("Prim Position (" + oprim.m_localID + "): " + prim.Position.ToString());
78
79 // Make sure we're above the ground
80 Assert.That(prim.Position.Z > 20f);
81 Console.WriteLine("PrimCollisionScore (" + oprim.m_localID + "): " + oprim.m_collisionscore);
82
83 // Make sure we've got a Body
84 Assert.That(oprim.Body != (IntPtr)0);
85 //Console.WriteLine(
86 }
87
88 // Make sure we're not somewhere above the ground
89 Assert.That(prim.Position.Z < 21.5f);
90
91 ps.RemovePrim(prim);
92 Assert.That(oprim.m_taintremove);
93 ps.Simulate(0.133f);
94 Assert.That(oprim.Body == (IntPtr)0);
95 }
96
97
98 }
99}
diff --git a/prebuild.xml b/prebuild.xml
index faa8e76..532dd13 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -381,6 +381,7 @@
381 <Reference name="Axiom.MathLib.dll" localCopy="false"/> 381 <Reference name="Axiom.MathLib.dll" localCopy="false"/>
382 <Reference name="OpenSim.Framework" localCopy="false"/> 382 <Reference name="OpenSim.Framework" localCopy="false"/>
383 <Reference name="OpenSim.Framework.Console" localCopy="false"/> 383 <Reference name="OpenSim.Framework.Console" localCopy="false"/>
384 <Reference name="nunit.framework.dll" />
384 <Reference name="Nini.dll" /> 385 <Reference name="Nini.dll" />
385 <Reference name="log4net"/> 386 <Reference name="log4net"/>
386 387
@@ -479,6 +480,7 @@
479 <Reference name="OpenSim.Framework.Console"/> 480 <Reference name="OpenSim.Framework.Console"/>
480 <Reference name="OpenSim.Region.Physics.Manager" localCopy="false"/> 481 <Reference name="OpenSim.Region.Physics.Manager" localCopy="false"/>
481 <Reference name="Ode.NET.dll" localCopy="false" /> 482 <Reference name="Ode.NET.dll" localCopy="false" />
483 <Reference name="nunit.framework.dll" />
482 <Reference name="log4net"/> 484 <Reference name="log4net"/>
483 485
484 <Files> 486 <Files>