diff options
author | Robert Adams | 2015-09-08 04:54:16 -0700 |
---|---|---|
committer | Robert Adams | 2015-09-08 04:54:16 -0700 |
commit | e5367d822be9b05e74c859afe2d2956a3e95aa33 (patch) | |
tree | e904050a30715df587aa527d7f313755177726a7 /OpenSim/Region/PhysicsModules/Ode | |
parent | add lost admin_reset_land method (diff) | |
parent | Deleted access control spec from [LoginService] section of standalone config.... (diff) | |
download | opensim-SC-e5367d822be9b05e74c859afe2d2956a3e95aa33.zip opensim-SC-e5367d822be9b05e74c859afe2d2956a3e95aa33.tar.gz opensim-SC-e5367d822be9b05e74c859afe2d2956a3e95aa33.tar.bz2 opensim-SC-e5367d822be9b05e74c859afe2d2956a3e95aa33.tar.xz |
Merge of ubitworkvarnew with opensim/master as of 20150905.
This integrates the OpenSim refactoring to make physics, etc into modules.
AVN physics hasn't been moved to new location.
Does not compile yet.
Merge branch 'osmaster' into mbworknew1
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs (renamed from OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs) | 4 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs (renamed from OpenSim/Region/Physics/OdePlugin/ODECharacter.cs) | 6 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODEDynamics.c_comments (renamed from OpenSim/Region/Physics/OdePlugin/ODEDynamics.c_comments) | 0 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs (renamed from OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs) | 4 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs (renamed from OpenSim/Region/Physics/OdePlugin/ODEPrim.cs) | 6 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs (renamed from OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs) | 10 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs (renamed from OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs) | 6 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/OdeScene.cs (renamed from OpenSim/Region/Physics/OdePlugin/OdeScene.cs) | 141 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/Tests/ODETestClass.cs (renamed from OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs) | 67 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/drawstuff.cs (renamed from OpenSim/Region/Physics/OdePlugin/drawstuff.cs) | 0 |
10 files changed, 181 insertions, 63 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs index 076da78..7869739 100644 --- a/OpenSim/Region/Physics/OdePlugin/AssemblyInfo.cs +++ b/OpenSim/Region/PhysicsModules/Ode/AssemblyInfo.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System.Reflection; | 28 | using System.Reflection; |
29 | using System.Runtime.InteropServices; | 29 | using System.Runtime.InteropServices; |
30 | using 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/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs index 05eaf2a..b35c299 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs | |||
@@ -31,10 +31,10 @@ using System.Reflection; | |||
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using Ode.NET; | 32 | using Ode.NET; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Region.Physics.Manager; | 34 | using OpenSim.Region.PhysicsModules.SharedBase; |
35 | using log4net; | 35 | using log4net; |
36 | 36 | ||
37 | namespace OpenSim.Region.Physics.OdePlugin | 37 | namespace OpenSim.Region.PhysicsModule.ODE |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. | 40 | /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. |
@@ -511,7 +511,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
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/Physics/OdePlugin/ODEDynamics.c_comments b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.c_comments index 1060aa6..1060aa6 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.c_comments +++ b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.c_comments | |||
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs index 2342bfa..8f8e2bd 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs | |||
@@ -46,9 +46,9 @@ using log4net; | |||
46 | using OpenMetaverse; | 46 | using OpenMetaverse; |
47 | using Ode.NET; | 47 | using Ode.NET; |
48 | using OpenSim.Framework; | 48 | using OpenSim.Framework; |
49 | using OpenSim.Region.Physics.Manager; | 49 | using OpenSim.Region.PhysicsModules.SharedBase; |
50 | 50 | ||
51 | namespace OpenSim.Region.Physics.OdePlugin | 51 | namespace OpenSim.Region.PhysicsModule.ODE |
52 | { | 52 | { |
53 | public class ODEDynamics | 53 | public class ODEDynamics |
54 | { | 54 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs index 0a99e30..5e48de6 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | |||
@@ -50,9 +50,9 @@ using log4net; | |||
50 | using OpenMetaverse; | 50 | using OpenMetaverse; |
51 | using Ode.NET; | 51 | using Ode.NET; |
52 | using OpenSim.Framework; | 52 | using OpenSim.Framework; |
53 | using OpenSim.Region.Physics.Manager; | 53 | using OpenSim.Region.PhysicsModules.SharedBase; |
54 | 54 | ||
55 | namespace OpenSim.Region.Physics.OdePlugin | 55 | namespace OpenSim.Region.PhysicsModule.ODE |
56 | { | 56 | { |
57 | /// <summary> | 57 | /// <summary> |
58 | /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. | 58 | /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. |
@@ -3381,7 +3381,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
3381 | { | 3381 | { |
3382 | m_log.WarnFormat( | 3382 | m_log.WarnFormat( |
3383 | "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}", | 3383 | "[ODE PRIM]: Could not get mesh/sculpt asset {0} for {1} at {2} in {3}", |
3384 | _pbs.SculptTexture, Name, _position, _parent_scene.Name); | 3384 | _pbs.SculptTexture, Name, _position, _parent_scene.PhysicsSceneName); |
3385 | } | 3385 | } |
3386 | } | 3386 | } |
3387 | } | 3387 | } |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs index fa2ed3e..80f0fcf 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs | |||
@@ -31,11 +31,11 @@ using System.Reflection; | |||
31 | using System.Runtime.InteropServices; | 31 | using System.Runtime.InteropServices; |
32 | using System.Text; | 32 | using System.Text; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Region.Physics.Manager; | 34 | using OpenSim.Region.PhysicsModules.SharedBase; |
35 | using Ode.NET; | 35 | using Ode.NET; |
36 | using log4net; | 36 | using log4net; |
37 | 37 | ||
38 | namespace OpenSim.Region.Physics.OdePlugin | 38 | namespace OpenSim.Region.PhysicsModule.ODE |
39 | { | 39 | { |
40 | /// <summary> | 40 | /// <summary> |
41 | /// Processes raycast requests as ODE is in a state to be able to do them. | 41 | /// Processes raycast requests as ODE is in a state to be able to do them. |
@@ -172,7 +172,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
172 | /// <param name="req"></param> | 172 | /// <param name="req"></param> |
173 | private void RayCast(ODERayCastRequest req) | 173 | private void RayCast(ODERayCastRequest req) |
174 | { | 174 | { |
175 | // limit ray lenght or collisions will take all avaiable stack space | 175 | // NOTE: limit ray lenght or collisions will take all avaiable stack space |
176 | // this value may still be too large, depending on machine configuration | ||
177 | // of maximum stack | ||
176 | float len = req.length; | 178 | float len = req.length; |
177 | if (len > 250f) | 179 | if (len > 250f) |
178 | len = 250f; | 180 | len = 250f; |
@@ -441,4 +443,4 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
441 | public float length; | 443 | public float length; |
442 | public RayCallback callbackMethod; | 444 | public RayCallback callbackMethod; |
443 | } | 445 | } |
444 | } \ No newline at end of file | 446 | } |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs index b4a3c48..2eb7ba6 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePhysicsJoint.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs | |||
@@ -29,10 +29,10 @@ using System; | |||
29 | using OpenMetaverse; | 29 | using OpenMetaverse; |
30 | using Ode.NET; | 30 | using Ode.NET; |
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.PhysicsModules.SharedBase; |
33 | using OpenSim.Region.Physics.OdePlugin; | 33 | using OpenSim.Region.PhysicsModule.ODE; |
34 | 34 | ||
35 | namespace OpenSim.Region.Physics.OdePlugin | 35 | namespace OpenSim.Region.PhysicsModule.ODE |
36 | { | 36 | { |
37 | class OdePhysicsJoint : PhysicsJoint | 37 | class OdePhysicsJoint : PhysicsJoint |
38 | { | 38 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 812b469..26210d6 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | |||
@@ -25,13 +25,11 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | // Ubit changes for varsize regions | 28 | // changes for varsize regions |
29 | // using a large Heightfield geometry for terrain | 29 | // note that raycasts need to have limited range |
30 | // ODE ode should handle it fine | ||
31 | // EXCEPT raycasts, those need to have limited range | ||
32 | // (even in normal regions) | 30 | // (even in normal regions) |
33 | // or aplication stack will just blowup | 31 | // or aplication thread stack may just blowup |
34 | 32 | // see RayCast(ODERayCastRequest req) | |
35 | 33 | ||
36 | //#define USE_DRAWSTUFF | 34 | //#define USE_DRAWSTUFF |
37 | //#define SPAM | 35 | //#define SPAM |
@@ -46,15 +44,19 @@ using System.Runtime.InteropServices; | |||
46 | using System.Threading; | 44 | using System.Threading; |
47 | using log4net; | 45 | using log4net; |
48 | using Nini.Config; | 46 | using Nini.Config; |
47 | using Mono.Addins; | ||
49 | using Ode.NET; | 48 | using Ode.NET; |
50 | using OpenMetaverse; | 49 | using OpenMetaverse; |
51 | #if USE_DRAWSTUFF | 50 | #if USE_DRAWSTUFF |
52 | using Drawstuff.NET; | 51 | using Drawstuff.NET; |
53 | #endif | 52 | #endif |
54 | using OpenSim.Framework; | 53 | using OpenSim.Framework; |
55 | using OpenSim.Region.Physics.Manager; | 54 | using OpenSim.Region.PhysicsModules.SharedBase; |
55 | using OpenSim.Region.Framework.Scenes; | ||
56 | using OpenSim.Region.Framework.Interfaces; | ||
57 | |||
56 | 58 | ||
57 | namespace OpenSim.Region.Physics.OdePlugin | 59 | namespace OpenSim.Region.PhysicsModule.ODE |
58 | { | 60 | { |
59 | public enum StatusIndicators : int | 61 | public enum StatusIndicators : int |
60 | { | 62 | { |
@@ -109,9 +111,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
109 | Rubber = 6 | 111 | Rubber = 6 |
110 | } | 112 | } |
111 | 113 | ||
112 | public class OdeScene : PhysicsScene | 114 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ODEPhysicsScene")] |
115 | public class OdeScene : PhysicsScene, INonSharedRegionModule | ||
113 | { | 116 | { |
114 | private readonly ILog m_log; | 117 | private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString()); |
118 | private bool m_Enabled = false; | ||
119 | |||
115 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); | 120 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); |
116 | 121 | ||
117 | /// <summary> | 122 | /// <summary> |
@@ -298,7 +303,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
298 | private int framecount = 0; | 303 | private int framecount = 0; |
299 | //private int m_returncollisions = 10; | 304 | //private int m_returncollisions = 10; |
300 | 305 | ||
301 | private readonly IntPtr contactgroup; | 306 | private IntPtr contactgroup; |
302 | 307 | ||
303 | // internal IntPtr WaterGeom; | 308 | // internal IntPtr WaterGeom; |
304 | 309 | ||
@@ -530,19 +535,103 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
530 | 535 | ||
531 | private ODERayCastRequestManager m_rayCastManager; | 536 | private ODERayCastRequestManager m_rayCastManager; |
532 | 537 | ||
538 | |||
539 | #region INonSharedRegionModule | ||
540 | public string Name | ||
541 | { | ||
542 | get { return "OpenDynamicsEngine"; } | ||
543 | } | ||
544 | |||
545 | public Type ReplaceableInterface | ||
546 | { | ||
547 | get { return null; } | ||
548 | } | ||
549 | |||
550 | public void Initialise(IConfigSource source) | ||
551 | { | ||
552 | // TODO: Move this out of Startup | ||
553 | IConfig config = source.Configs["Startup"]; | ||
554 | if (config != null) | ||
555 | { | ||
556 | string physics = config.GetString("physics", string.Empty); | ||
557 | if (physics == Name) | ||
558 | { | ||
559 | m_Enabled = true; | ||
560 | m_config = source; | ||
561 | |||
562 | // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether | ||
563 | // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports | ||
564 | // will find it already loaded later on. | ||
565 | // | ||
566 | // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be | ||
567 | // controlled in Ode.NET.dll.config | ||
568 | if (Util.IsWindows()) | ||
569 | Util.LoadArchSpecificWindowsDll("ode.dll"); | ||
570 | |||
571 | // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to | ||
572 | // http://opensimulator.org/mantis/view.php?id=2750). | ||
573 | d.InitODE(); | ||
574 | |||
575 | } | ||
576 | } | ||
577 | |||
578 | } | ||
579 | |||
580 | public void Close() | ||
581 | { | ||
582 | } | ||
583 | |||
584 | public void AddRegion(Scene scene) | ||
585 | { | ||
586 | if (!m_Enabled) | ||
587 | return; | ||
588 | |||
589 | EngineType = Name; | ||
590 | PhysicsSceneName = EngineType + "/" + scene.RegionInfo.RegionName; | ||
591 | |||
592 | scene.RegisterModuleInterface<PhysicsScene>(this); | ||
593 | Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); | ||
594 | Initialise(extent); | ||
595 | InitialiseFromConfig(m_config); | ||
596 | |||
597 | // This may not be that good since terrain may not be avaiable at this point | ||
598 | base.Initialise(scene.PhysicsRequestAsset, | ||
599 | (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[(int)(extent.X * extent.Y)]), | ||
600 | (float)scene.RegionInfo.RegionSettings.WaterHeight); | ||
601 | |||
602 | } | ||
603 | |||
604 | public void RemoveRegion(Scene scene) | ||
605 | { | ||
606 | if (!m_Enabled) | ||
607 | return; | ||
608 | } | ||
609 | |||
610 | public void RegionLoaded(Scene scene) | ||
611 | { | ||
612 | if (!m_Enabled) | ||
613 | return; | ||
614 | |||
615 | mesher = scene.RequestModuleInterface<IMesher>(); | ||
616 | if (mesher == null) | ||
617 | m_log.WarnFormat("[ODE SCENE]: No mesher in {0}. Things will not work well.", PhysicsSceneName); | ||
618 | } | ||
619 | #endregion | ||
620 | |||
533 | /// <summary> | 621 | /// <summary> |
534 | /// Initiailizes the scene | 622 | /// Initiailizes the scene |
535 | /// Sets many properties that ODE requires to be stable | 623 | /// Sets many properties that ODE requires to be stable |
536 | /// These settings need to be tweaked 'exactly' right or weird stuff happens. | 624 | /// These settings need to be tweaked 'exactly' right or weird stuff happens. |
537 | /// </summary> | 625 | /// </summary> |
538 | /// <param value="name">Name of the scene. Useful in debug messages.</param> | 626 | private void Initialise(Vector3 regionExtent) |
539 | public OdeScene(string engineType, string name) | ||
540 | { | 627 | { |
541 | m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + name); | 628 | WorldExtents.X = regionExtent.X; |
542 | 629 | m_regionWidth = (uint)regionExtent.X; | |
543 | Name = name; | 630 | WorldExtents.Y = regionExtent.Y; |
544 | EngineType = engineType; | 631 | m_regionHeight = (uint)regionExtent.Y; |
545 | 632 | ||
633 | m_suportCombine = false; | ||
634 | |||
546 | nearCallback = near; | 635 | nearCallback = near; |
547 | triCallback = TriCallback; | 636 | triCallback = TriCallback; |
548 | triArrayCallback = TriArrayCallback; | 637 | triArrayCallback = TriArrayCallback; |
@@ -597,7 +686,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
597 | { | 686 | { |
598 | InitializeExtraStats(); | 687 | InitializeExtraStats(); |
599 | 688 | ||
600 | mesher = meshmerizer; | ||
601 | m_config = config; | 689 | m_config = config; |
602 | // Defaults | 690 | // Defaults |
603 | 691 | ||
@@ -725,11 +813,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
725 | spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeterX); | 813 | spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeterX); |
726 | spaceGridMaxY = (int)(WorldExtents.Y * spacesPerMeterY); | 814 | spaceGridMaxY = (int)(WorldExtents.Y * spacesPerMeterY); |
727 | 815 | ||
728 | // ubit: limit number of spaces | 816 | // note: limit number of spaces |
729 | if (spaceGridMaxX > 24) | 817 | if (spaceGridMaxX > 24) |
730 | { | 818 | { |
731 | spaceGridMaxX = 24; | 819 | spaceGridMaxX = 24; |
732 | spacesPerMeterX = spaceGridMaxX / WorldExtents.X ; | 820 | spacesPerMeterX = spaceGridMaxX / WorldExtents.X; |
733 | } | 821 | } |
734 | if (spaceGridMaxY > 24) | 822 | if (spaceGridMaxY > 24) |
735 | { | 823 | { |
@@ -1862,7 +1950,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1862 | } | 1950 | } |
1863 | catch (AccessViolationException) | 1951 | catch (AccessViolationException) |
1864 | { | 1952 | { |
1865 | m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", Name); | 1953 | m_log.ErrorFormat("[ODE SCENE]: Unable to space collide {0}", PhysicsSceneName); |
1866 | } | 1954 | } |
1867 | 1955 | ||
1868 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); | 1956 | //float terrainheight = GetTerrainHeightAtXY(chr.Position.X, chr.Position.Y); |
@@ -3119,7 +3207,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3119 | { | 3207 | { |
3120 | m_log.ErrorFormat( | 3208 | m_log.ErrorFormat( |
3121 | "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving", | 3209 | "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when moving", |
3122 | actor.Name, actor.LocalID, Name); | 3210 | actor.Name, actor.LocalID, PhysicsSceneName); |
3123 | 3211 | ||
3124 | RemoveCharacter(actor); | 3212 | RemoveCharacter(actor); |
3125 | actor.DestroyOdeStructures(); | 3213 | actor.DestroyOdeStructures(); |
@@ -3236,7 +3324,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3236 | { | 3324 | { |
3237 | m_log.ErrorFormat( | 3325 | m_log.ErrorFormat( |
3238 | "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity", | 3326 | "[ODE SCENE]: Removing physics character {0} {1} from physics scene {2} due to defect found when updating position and velocity", |
3239 | actor.Name, actor.LocalID, Name); | 3327 | actor.Name, actor.LocalID, PhysicsSceneName); |
3240 | 3328 | ||
3241 | RemoveCharacter(actor); | 3329 | RemoveCharacter(actor); |
3242 | actor.DestroyOdeStructures(); | 3330 | actor.DestroyOdeStructures(); |
@@ -3835,7 +3923,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3835 | private void SetTerrain(float[] heightMap, Vector3 pOffset) | 3923 | private void SetTerrain(float[] heightMap, Vector3 pOffset) |
3836 | { | 3924 | { |
3837 | int startTime = Util.EnvironmentTickCount(); | 3925 | int startTime = Util.EnvironmentTickCount(); |
3838 | m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", Name, pOffset); | 3926 | m_log.DebugFormat("[ODE SCENE]: Setting terrain for {0} with offset {1}", PhysicsSceneName, pOffset); |
3839 | 3927 | ||
3840 | 3928 | ||
3841 | float[] _heightmap; | 3929 | float[] _heightmap; |
@@ -3873,6 +3961,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3873 | uint xt = 0; | 3961 | uint xt = 0; |
3874 | xx = 0; | 3962 | xx = 0; |
3875 | 3963 | ||
3964 | |||
3876 | for (uint x = 0; x < heightmapWidthSamples; x++) | 3965 | for (uint x = 0; x < heightmapWidthSamples; x++) |
3877 | { | 3966 | { |
3878 | if (x > 1 && xx < maxXX) | 3967 | if (x > 1 && xx < maxXX) |
@@ -3951,7 +4040,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3951 | } | 4040 | } |
3952 | 4041 | ||
3953 | m_log.DebugFormat( | 4042 | m_log.DebugFormat( |
3954 | "[ODE SCENE]: Setting terrain for {0} took {1}ms", Name, Util.EnvironmentTickCountSubtract(startTime)); | 4043 | "[ODE SCENE]: Setting terrain for {0} took {1}ms", PhysicsSceneName, Util.EnvironmentTickCountSubtract(startTime)); |
3955 | } | 4044 | } |
3956 | 4045 | ||
3957 | public override void DeleteTerrain() | 4046 | public override void DeleteTerrain() |
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; | |||
30 | using NUnit.Framework; | 30 | using NUnit.Framework; |
31 | using OpenMetaverse; | 31 | using OpenMetaverse; |
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Region.Physics.Manager; | 33 | using OpenSim.Region.PhysicsModules.SharedBase; |
34 | using OpenSim.Region.Physics.OdePlugin; | 34 | using OpenSim.Region.PhysicsModule.ODE; |
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
35 | using OpenSim.Tests.Common; | 37 | using OpenSim.Tests.Common; |
36 | using log4net; | 38 | using log4net; |
37 | using System.Reflection; | 39 | using System.Reflection; |
38 | 40 | ||
39 | namespace OpenSim.Region.Physics.OdePlugin.Tests | 41 | namespace 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 | } |
diff --git a/OpenSim/Region/Physics/OdePlugin/drawstuff.cs b/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs index 87ca446..87ca446 100644 --- a/OpenSim/Region/Physics/OdePlugin/drawstuff.cs +++ b/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs | |||