aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/Ode
diff options
context:
space:
mode:
authorDiva Canto2015-08-31 13:02:51 -0700
committerDiva Canto2015-08-31 13:02:51 -0700
commit134d4300f0b6e9b0df0326cfe0b5df9f41f42865 (patch)
tree86420f55292ec2f566c10b30cdb52a54e6c0f14c /OpenSim/Region/PhysicsModules/Ode
parentFixed a namespace dependency. Also started preparing prebuild.xml for making ... (diff)
downloadopensim-SC_OLD-134d4300f0b6e9b0df0326cfe0b5df9f41f42865.zip
opensim-SC_OLD-134d4300f0b6e9b0df0326cfe0b5df9f41f42865.tar.gz
opensim-SC_OLD-134d4300f0b6e9b0df0326cfe0b5df9f41f42865.tar.bz2
opensim-SC_OLD-134d4300f0b6e9b0df0326cfe0b5df9f41f42865.tar.xz
All physics plugins are now region modules. Compiles but doesn't run.
Diffstat (limited to 'OpenSim/Region/PhysicsModules/Ode')
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs4
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs2
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs2
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs70
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/OdeScene.cs111
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs8
6 files changed, 139 insertions, 58 deletions
diff --git a/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs
index 076da78..7869739 100644
--- a/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs
@@ -27,6 +27,7 @@
27 27
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30using Mono.Addins;
30 31
31// Information about this assembly is defined by the following 32// Information about this assembly is defined by the following
32// attributes. 33// attributes.
@@ -56,3 +57,6 @@ using System.Runtime.InteropServices;
56// numbers with the '*' character (the default): 57// numbers with the '*' character (the default):
57 58
58[assembly : AssemblyVersion("0.8.2.*")] 59[assembly : AssemblyVersion("0.8.2.*")]
60
61[assembly: Addin("OpenSim.Region.PhysicsModule.ODE", OpenSim.VersionInfo.VersionNumber)]
62[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
index 44f4039..b35c299 100644
--- a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
@@ -511,7 +511,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
511 } 511 }
512 else 512 else
513 { 513 {
514 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.Name); 514 m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.PhysicsSceneName);
515 } 515 }
516 } 516 }
517 517
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs
index 91a4302..445fef8 100644
--- a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs
@@ -3380,7 +3380,7 @@ Console.WriteLine(" JointCreateFixed");
3380 { 3380 {
3381 m_log.WarnFormat( 3381 m_log.WarnFormat(
3382 "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}", 3382 "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}",
3383 _pbs.SculptTexture, Name, _position, _parent_scene.Name); 3383 _pbs.SculptTexture, Name, _position, _parent_scene.PhysicsSceneName);
3384 } 3384 }
3385 } 3385 }
3386 } 3386 }
diff --git a/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs b/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs
index 1d9d0e5..bb2fad9 100644
--- a/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/OdePlugin.cs
@@ -44,47 +44,47 @@ namespace OpenSim.Region.PhysicsModule.ODE
44 /// <summary> 44 /// <summary>
45 /// ODE plugin 45 /// ODE plugin
46 /// </summary> 46 /// </summary>
47 public class OdePlugin : IPhysicsPlugin 47// public class OdePlugin : IPhysicsPlugin
48 { 48// {
49// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 49//// private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
50 50
51 private OdeScene m_scene; 51// private OdeScene m_scene;
52 52
53 public bool Init() 53// public bool Init()
54 { 54// {
55 return true; 55// return true;
56 } 56// }
57 57
58 public PhysicsScene GetScene(String sceneIdentifier) 58// public PhysicsScene GetScene(String sceneIdentifier)
59 { 59// {
60 if (m_scene == null) 60// if (m_scene == null)
61 { 61// {
62 // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether 62// // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether
63 // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports 63// // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
64 // will find it already loaded later on. 64// // will find it already loaded later on.
65 // 65// //
66 // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be 66// // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
67 // controlled in Ode.NET.dll.config 67// // controlled in Ode.NET.dll.config
68 if (Util.IsWindows()) 68// if (Util.IsWindows())
69 Util.LoadArchSpecificWindowsDll("ode.dll"); 69// Util.LoadArchSpecificWindowsDll("ode.dll");
70 70
71 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to 71// // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
72 // http://opensimulator.org/mantis/view.php?id=2750). 72// // http://opensimulator.org/mantis/view.php?id=2750).
73 d.InitODE(); 73// d.InitODE();
74 74
75 m_scene = new OdeScene(GetName(), sceneIdentifier); 75// m_scene = new OdeScene(GetName(), sceneIdentifier);
76 } 76// }
77 77
78 return m_scene; 78// return m_scene;
79 } 79// }
80 80
81 public string GetName() 81// public string GetName()
82 { 82// {
83 return ("OpenDynamicsEngine"); 83// return ("OpenDynamicsEngine");
84 } 84// }
85 85
86 public void Dispose() 86// public void Dispose()
87 { 87// {
88 } 88// }
89 } 89// }
90} \ No newline at end of file 90} \ No newline at end of file
diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
index d7163e2..3616200 100644
--- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
@@ -38,6 +38,7 @@ using System.Runtime.InteropServices;
38using System.Threading; 38using System.Threading;
39using log4net; 39using log4net;
40using Nini.Config; 40using Nini.Config;
41using Mono.Addins;
41using Ode.NET; 42using Ode.NET;
42using OpenMetaverse; 43using OpenMetaverse;
43#if USE_DRAWSTUFF 44#if USE_DRAWSTUFF
@@ -45,6 +46,9 @@ using Drawstuff.NET;
45#endif 46#endif
46using OpenSim.Framework; 47using OpenSim.Framework;
47using OpenSim.Region.PhysicsModules.SharedBase; 48using OpenSim.Region.PhysicsModules.SharedBase;
49using OpenSim.Region.Framework.Scenes;
50using OpenSim.Region.Framework.Interfaces;
51
48 52
49namespace OpenSim.Region.PhysicsModule.ODE 53namespace OpenSim.Region.PhysicsModule.ODE
50{ 54{
@@ -101,9 +105,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
101 Rubber = 6 105 Rubber = 6
102 } 106 }
103 107
108 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")]
104 public class OdeScene : PhysicsScene 109 public class OdeScene : PhysicsScene
105 { 110 {
106 private readonly ILog m_log; 111 private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString());
112 private bool m_Enabled = false;
113
107 // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); 114 // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>();
108 115
109 /// <summary> 116 /// <summary>
@@ -288,7 +295,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
288 private int framecount = 0; 295 private int framecount = 0;
289 //private int m_returncollisions = 10; 296 //private int m_returncollisions = 10;
290 297
291 private readonly IntPtr contactgroup; 298 private IntPtr contactgroup;
292 299
293 internal IntPtr WaterGeom; 300 internal IntPtr WaterGeom;
294 301
@@ -520,19 +527,90 @@ namespace OpenSim.Region.PhysicsModule.ODE
520 527
521 private ODERayCastRequestManager m_rayCastManager; 528 private ODERayCastRequestManager m_rayCastManager;
522 529
530
531 #region INonSharedRegionModule
532 public string Name
533 {
534 get { return "OpenDynamicsEngine"; }
535 }
536
537 public Type ReplaceableInterface
538 {
539 get { return null; }
540 }
541
542 public void Initialise(IConfigSource source)
543 {
544 // TODO: Move this out of Startup
545 IConfig config = source.Configs["Startup"];
546 if (config != null)
547 {
548 string physics = config.GetString("physics", string.Empty);
549 if (physics == Name)
550 {
551 m_Enabled = true;
552 m_config = source;
553
554 // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether
555 // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports
556 // will find it already loaded later on.
557 //
558 // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be
559 // controlled in Ode.NET.dll.config
560 if (Util.IsWindows())
561 Util.LoadArchSpecificWindowsDll("ode.dll");
562
563 // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to
564 // http://opensimulator.org/mantis/view.php?id=2750).
565 d.InitODE();
566
567 }
568 }
569
570 }
571
572 public void Close()
573 {
574 }
575
576 public void AddRegion(Scene scene)
577 {
578 if (!m_Enabled)
579 return;
580
581 EngineType = Name;
582 PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName;
583
584 scene.RegisterModuleInterface<PhysicsScene>(this);
585 Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ);
586 Initialise();
587 InitialiseFromConfig(m_config);
588 }
589
590 public void RemoveRegion(Scene scene)
591 {
592 if (!m_Enabled)
593 return;
594 }
595
596 public void RegionLoaded(Scene scene)
597 {
598 if (!m_Enabled)
599 return;
600
601 mesher = scene.RequestModuleInterface<IMesher>();
602 if (mesher == null)
603 m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName);
604 }
605 #endregion
606
523 /// <summary> 607 /// <summary>
524 /// Initiailizes the scene 608 /// Initiailizes the scene
525 /// Sets many properties that ODE requires to be stable 609 /// Sets many properties that ODE requires to be stable
526 /// These settings need to be tweaked 'exactly' right or weird stuff happens. 610 /// These settings need to be tweaked 'exactly' right or weird stuff happens.
527 /// </summary> 611 /// </summary>
528 /// <param value="name">Name of the scene. Useful in debug messages.</param> 612 private void Initialise()
529 public OdeScene(string engineType, string name)
530 { 613 {
531 m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name);
532
533 Name = name;
534 EngineType = engineType;
535
536 nearCallback = near; 614 nearCallback = near;
537 triCallback = TriCallback; 615 triCallback = TriCallback;
538 triArrayCallback = TriArrayCallback; 616 triArrayCallback = TriArrayCallback;
@@ -572,12 +650,11 @@ namespace OpenSim.Region.PhysicsModule.ODE
572 } 650 }
573#endif 651#endif
574 652
575 // Initialize the mesh plugin 653 // Initialize from configs
576 public override void Initialise(IMesher meshmerizer, IConfigSource config) 654 private void InitialiseFromConfig(IConfigSource config)
577 { 655 {
578 InitializeExtraStats(); 656 InitializeExtraStats();
579 657
580 mesher = meshmerizer;
581 m_config = config; 658 m_config = config;
582 // Defaults 659 // Defaults
583 660
@@ -1818,7 +1895,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
1818 } 1895 }
1819 catch (AccessViolationException) 1896 catch (AccessViolationException)
1820 { 1897 {
1821 m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", Name); 1898 m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", PhysicsSceneName);
1822 } 1899 }
1823 1900
1824 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); 1901 //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y);
@@ -3082,7 +3159,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
3082 { 3159 {
3083 m_log.ErrorFormat( 3160 m_log.ErrorFormat(
3084 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving", 3161 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving",
3085 actor.Name, actor.LocalID, Name); 3162 actor.Name, actor.LocalID, PhysicsSceneName);
3086 3163
3087 RemoveCharacter(actor); 3164 RemoveCharacter(actor);
3088 actor.DestroyOdeStructures(); 3165 actor.DestroyOdeStructures();
@@ -3198,7 +3275,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
3198 { 3275 {
3199 m_log.ErrorFormat( 3276 m_log.ErrorFormat(
3200 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity", 3277 "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity",
3201 actor.Name, actor.LocalID, Name); 3278 actor.Name, actor.LocalID, PhysicsSceneName);
3202 3279
3203 RemoveCharacter(actor); 3280 RemoveCharacter(actor);
3204 actor.DestroyOdeStructures(); 3281 actor.DestroyOdeStructures();
@@ -3795,7 +3872,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
3795 private void SetTerrain(float[] heightMap, Vector3 pOffset) 3872 private void SetTerrain(float[] heightMap, Vector3 pOffset)
3796 { 3873 {
3797 int startTime = Util.EnvironmentTickCount(); 3874 int startTime = Util.EnvironmentTickCount();
3798 m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", Name, pOffset); 3875 m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", PhysicsSceneName, pOffset);
3799 3876
3800 // this._heightmap[i] = (double)heightMap[i]; 3877 // this._heightmap[i] = (double)heightMap[i];
3801 // dbm (danx0r) -- creating a buffer zone of one extra sample all around 3878 // dbm (danx0r) -- creating a buffer zone of one extra sample all around
@@ -3920,7 +3997,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
3920 } 3997 }
3921 3998
3922 m_log.DebugFormat( 3999 m_log.DebugFormat(
3923 "[ODE SCENE]: Setting terrain for {0} took {1}ms", Name, Util.EnvironmentTickCountSubtract(startTime)); 4000 "[ODE SCENE]: Setting terrain for {0} took {1}ms", PhysicsSceneName, Util.EnvironmentTickCountSubtract(startTime));
3924 } 4001 }
3925 4002
3926 public override void DeleteTerrain() 4003 public override void DeleteTerrain()
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
43 { 43 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt; 46 //private OpenSim.Region.PhysicsModule.ODE.OdePlugin cbt;
47 private PhysicsScene ps; 47 private PhysicsScene ps;
48 private IMeshingPlugin imp; 48 private IMeshingPlugin imp;
49 49
@@ -55,11 +55,11 @@ namespace OpenSim.Region.PhysicsModule.ODE.Tests
55 config.Set("DecodedSculptMapPath","j2kDecodeCache"); 55 config.Set("DecodedSculptMapPath","j2kDecodeCache");
56 56
57 // Loading ODEPlugin 57 // Loading ODEPlugin
58 cbt = new OdePlugin(); 58 //cbt = new OdePlugin();
59 // Getting Physics Scene 59 // Getting Physics Scene
60 ps = cbt.GetScene("test"); 60 //ps = cbt.GetScene("test");
61 // Initializing Physics Scene. 61 // Initializing Physics Scene.
62 ps.Initialise(imp.GetMesher(TopConfig),null); 62 //ps.Initialise(imp.GetMesher(TopConfig), null, Vector3.Zero);
63 float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize]; 63 float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize];
64 for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++) 64 for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++)
65 { 65 {