diff --git a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs index c1afe13b8c..4c9df9c068 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.Reflection; using OpenMetaverse; -using Ode.NET; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; using log4net; @@ -1105,8 +1104,8 @@ namespace OpenSim.Region.PhysicsModule.ODE // lock (OdeScene.UniversalColliderSyncObject) Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); - d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); - d.GeomSetCollideBits(Shell, (int)m_collisionFlags); + d.GeomSetCategoryBits(Shell, (uint)m_collisionCategories); + d.GeomSetCollideBits(Shell, (uint)m_collisionFlags); d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); Body = d.BodyCreate(_parent_scene.world); diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs index 8f8e2bde5d..739a7b3570 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEDynamics.cs @@ -44,10 +44,10 @@ using System.Reflection; using System.Runtime.InteropServices; using log4net; using OpenMetaverse; -using Ode.NET; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; + namespace OpenSim.Region.PhysicsModule.ODE { public class ODEDynamics diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEModule.cs b/OpenSim/Region/PhysicsModules/Ode/ODEModule.cs index 101e8b019b..ed50de3635 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEModule.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEModule.cs @@ -6,7 +6,6 @@ using Mono.Addins; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; -using Ode.NET; namespace OpenSim.Region.PhysicsModule.ODE { diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs index 908b2663d8..82b0999b60 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs @@ -48,7 +48,6 @@ using System.Runtime.InteropServices; using System.Threading; using log4net; using OpenMetaverse; -using Ode.NET; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; @@ -359,12 +358,12 @@ namespace OpenSim.Region.PhysicsModule.ODE if (m_assetFailed) { d.GeomSetCategoryBits(prim_geom, 0); - d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); + d.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits); } else { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); + d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); + d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); } _parent_scene.geom_name_map[prim_geom] = Name; @@ -432,7 +431,7 @@ namespace OpenSim.Region.PhysicsModule.ODE if (m_assetFailed) { d.GeomSetCategoryBits(prim_geom, 0); - d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); + d.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits); } else { @@ -440,8 +439,8 @@ namespace OpenSim.Region.PhysicsModule.ODE m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); } - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); + d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); + d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); d.BodySetAutoDisableFlag(Body, true); d.BodySetAutoDisableSteps(Body, body_autodisable_frames); @@ -825,8 +824,8 @@ namespace OpenSim.Region.PhysicsModule.ODE } else { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); + d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); + d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); } d.BodyDestroy(Body); @@ -859,8 +858,8 @@ namespace OpenSim.Region.PhysicsModule.ODE else { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); + d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); + d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); } Body = IntPtr.Zero; @@ -1151,12 +1150,12 @@ Console.WriteLine("ZProcessTaints for " + Name); if (prm.m_assetFailed) { d.GeomSetCategoryBits(prm.prim_geom, 0); - d.GeomSetCollideBits(prm.prim_geom, prm.BadMeshAssetCollideBits); + d.GeomSetCollideBits(prm.prim_geom, (uint)prm.BadMeshAssetCollideBits); } else { - d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories); - d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags); + d.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories); + d.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags); } d.Quaternion quat = new d.Quaternion(); @@ -1200,14 +1199,14 @@ Console.WriteLine("ZProcessTaints for " + Name); if (m_assetFailed) { d.GeomSetCategoryBits(prim_geom, 0); - d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); + d.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits); } else { //Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name); - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); + d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); //Console.WriteLine(" Post GeomSetCategoryBits 2"); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); + d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); } d.Quaternion quat2 = new d.Quaternion(); @@ -1377,8 +1376,8 @@ Console.WriteLine("ZProcessTaints for " + Name); } else { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); + d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); + d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); } if (IsPhysical) @@ -1403,12 +1402,12 @@ Console.WriteLine("ZProcessTaints for " + Name); if (m_assetFailed) { d.GeomSetCategoryBits(prim_geom, 0); - d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); + d.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits); } else { - d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); + d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); + d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); } if (IsPhysical) @@ -2135,10 +2134,10 @@ Console.WriteLine(" JointCreateFixed"); } if (m_assetFailed) - d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); + d.GeomSetCollideBits(prim_geom, (uint)BadMeshAssetCollideBits); else - d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); + d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); } /// /// Change prim in response to a shape taint. @@ -2813,6 +2812,7 @@ Console.WriteLine(" JointCreateFixed"); d.BodySetLinearVel(Body, 0, 0, 0); disableBodySoft(); + _position = l_position; // tell framework to fix it if (_parent == null) base.RequestPhysicsterseUpdate(); diff --git a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs index 61993872ae..e39b8c78cf 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs @@ -32,7 +32,6 @@ using System.Runtime.InteropServices; using System.Text; using OpenMetaverse; using OpenSim.Region.PhysicsModules.SharedBase; -using Ode.NET; using log4net; namespace OpenSim.Region.PhysicsModule.ODE @@ -358,7 +357,7 @@ namespace OpenSim.Region.PhysicsModule.ODE lock (contacts) { - count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); + count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.unmanagedSizeOf); } } catch (SEHException) diff --git a/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs index 2eb7ba634e..e2578be6c6 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdePhysicsJoint.cs @@ -27,10 +27,8 @@ using System; using OpenMetaverse; -using Ode.NET; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; -using OpenSim.Region.PhysicsModule.ODE; namespace OpenSim.Region.PhysicsModule.ODE { diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 4e95b7a372..6f14121667 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs @@ -31,9 +31,6 @@ // or application thread stack may just blowup // see RayCast(ODERayCastRequest req) -//#define USE_DRAWSTUFF -//#define SPAM - using System; using System.Collections.Generic; using System.Diagnostics; @@ -46,17 +43,12 @@ using System.Threading; using log4net; using Nini.Config; using Mono.Addins; -using Ode.NET; using OpenMetaverse; -#if USE_DRAWSTUFF -using Drawstuff.NET; -#endif using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; - namespace OpenSim.Region.PhysicsModule.ODE { public enum StatusIndicators : int @@ -585,32 +577,12 @@ namespace OpenSim.Region.PhysicsModule.ODE d.WorldSetAutoDisableFlag(world, false); - #if USE_DRAWSTUFF - Thread viewthread = new Thread(new ParameterizedThreadStart(startvisualization)); - viewthread.Start(); - #endif - - // _watermap = new float[258 * 258]; +// _watermap = new float[258 * 258]; // Zero out the prim spaces array (we split our space into smaller spaces so // we can hit test less. } -#if USE_DRAWSTUFF - public void startvisualization(object o) - { - ds.Functions fn; - fn.version = ds.VERSION; - fn.start = new ds.CallbackFunction(start); - fn.step = new ds.CallbackFunction(step); - fn.command = new ds.CallbackFunction(command); - fn.stop = null; - fn.path_to_textures = "./textures"; - string[] args = new string[0]; - ds.SimulationLoop(args.Length, args, 352, 288, ref fn); - } -#endif - // Initialize from configs private void InitialiseFromConfig(IConfigSource config) { @@ -957,7 +929,7 @@ namespace OpenSim.Region.PhysicsModule.ODE /// /// private int CollideGeoms( - IntPtr geom1, IntPtr geom2, int maxContacts, Ode.NET.d.ContactGeom[] contactsArray, int contactGeomSize) + IntPtr geom1, IntPtr geom2, int maxContacts, d.ContactGeom[] contactsArray, int contactGeomSize) { int count; @@ -1090,7 +1062,7 @@ namespace OpenSim.Region.PhysicsModule.ODE if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) return; - count = CollideGeoms(g1, g2, contacts.Length, contacts, d.ContactGeom.SizeOf); + count = CollideGeoms(g1, g2, contacts.Length, contacts, d.ContactGeom.unmanagedSizeOf); // All code after this is only relevant if we have any collisions if (count <= 0) @@ -2972,7 +2944,8 @@ namespace OpenSim.Region.PhysicsModule.ODE /// The number of frames simulated over that period. public override float Simulate(float timeStep) { - if (!_worldInitialized) return 11f; + if (!_worldInitialized) + return 1.0f; int startFrameTick = CollectStats ? Util.EnvironmentTickCount() : 0; int tempTick = 0, tempTick2 = 0; @@ -3804,133 +3777,6 @@ namespace OpenSim.Region.PhysicsModule.ODE return new List(ourResults); } -#if USE_DRAWSTUFF - // Keyboard callback - public void command(int cmd) - { - IntPtr geom; - d.Mass mass; - d.Vector3 sides = new d.Vector3(d.RandReal() * 0.5f + 0.1f, d.RandReal() * 0.5f + 0.1f, d.RandReal() * 0.5f + 0.1f); - - - - Char ch = Char.ToLower((Char)cmd); - switch ((Char)ch) - { - case 'w': - try - { - Vector3 rotate = (new Vector3(1, 0, 0) * Quaternion.CreateFromEulers(hpr.Z * Utils.DEG_TO_RAD, hpr.Y * Utils.DEG_TO_RAD, hpr.X * Utils.DEG_TO_RAD)); - - xyz.X += rotate.X; xyz.Y += rotate.Y; xyz.Z += rotate.Z; - ds.SetViewpoint(ref xyz, ref hpr); - } - catch (ArgumentException) - { hpr.X = 0; } - break; - - case 'a': - hpr.X++; - ds.SetViewpoint(ref xyz, ref hpr); - break; - - case 's': - try - { - Vector3 rotate2 = (new Vector3(-1, 0, 0) * Quaternion.CreateFromEulers(hpr.Z * Utils.DEG_TO_RAD, hpr.Y * Utils.DEG_TO_RAD, hpr.X * Utils.DEG_TO_RAD)); - - xyz.X += rotate2.X; xyz.Y += rotate2.Y; xyz.Z += rotate2.Z; - ds.SetViewpoint(ref xyz, ref hpr); - } - catch (ArgumentException) - { hpr.X = 0; } - break; - case 'd': - hpr.X--; - ds.SetViewpoint(ref xyz, ref hpr); - break; - case 'r': - xyz.Z++; - ds.SetViewpoint(ref xyz, ref hpr); - break; - case 'f': - xyz.Z--; - ds.SetViewpoint(ref xyz, ref hpr); - break; - case 'e': - xyz.Y++; - ds.SetViewpoint(ref xyz, ref hpr); - break; - case 'q': - xyz.Y--; - ds.SetViewpoint(ref xyz, ref hpr); - break; - } - } - - public void step(int pause) - { - - ds.SetColor(1.0f, 1.0f, 0.0f); - ds.SetTexture(ds.Texture.Wood); - lock (_prims) - { - foreach (OdePrim prm in _prims) - { - //IntPtr body = d.GeomGetBody(prm.prim_geom); - if (prm.prim_geom != IntPtr.Zero) - { - d.Vector3 pos; - d.GeomCopyPosition(prm.prim_geom, out pos); - //d.BodyCopyPosition(body, out pos); - - d.Matrix3 R; - d.GeomCopyRotation(prm.prim_geom, out R); - //d.BodyCopyRotation(body, out R); - - - d.Vector3 sides = new d.Vector3(); - sides.X = prm.Size.X; - sides.Y = prm.Size.Y; - sides.Z = prm.Size.Z; - - ds.DrawBox(ref pos, ref R, ref sides); - } - } - } - ds.SetColor(1.0f, 0.0f, 0.0f); - - foreach (OdeCharacter chr in _characters) - { - if (chr.Shell != IntPtr.Zero) - { - IntPtr body = d.GeomGetBody(chr.Shell); - - d.Vector3 pos; - d.GeomCopyPosition(chr.Shell, out pos); - //d.BodyCopyPosition(body, out pos); - - d.Matrix3 R; - d.GeomCopyRotation(chr.Shell, out R); - //d.BodyCopyRotation(body, out R); - - ds.DrawCapsule(ref pos, ref R, chr.Size.Z, 0.35f); - d.Vector3 sides = new d.Vector3(); - sides.X = 0.5f; - sides.Y = 0.5f; - sides.Z = 0.5f; - - ds.DrawBox(ref pos, ref R, ref sides); - } - } - } - - public void start(int unused) - { - ds.SetViewpoint(ref xyz, ref hpr); - } -#endif - public override Dictionary GetStats() { if (!CollectStats) diff --git a/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs b/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs deleted file mode 100644 index 87ca4464dc..0000000000 --- a/OpenSim/Region/PhysicsModules/Ode/drawstuff.cs +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright ODE - * Ode.NET - .NET bindings for ODE - * Jason Perkins (starkos@industriousone.com) - * Licensed under the New BSD - * Part of the OpenDynamicsEngine -Open Dynamics Engine -Copyright (c) 2001-2007, Russell L. Smith. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -Redistributions of source code must retain the above copyright notice, -this list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, -this list of conditions and the following disclaimer in the documentation -and/or other materials provided with the distribution. - -Neither the names of ODE's copyright owner nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - */ - -using System; -using System.Runtime.InteropServices; -using Ode.NET; - -namespace Drawstuff.NET -{ -#if dDOUBLE - using dReal = System.Double; -#else - using dReal = System.Single; -#endif - - public static class ds - { - public const int VERSION = 2; - - public enum Texture - { - None, - Wood - } - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void CallbackFunction(int arg); - - [StructLayout(LayoutKind.Sequential)] - public struct Functions - { - public int version; - public CallbackFunction start; - public CallbackFunction step; - public CallbackFunction command; - public CallbackFunction stop; - public string path_to_textures; - } - - [DllImport("drawstuff", EntryPoint = "dsDrawBox")] - public static extern void DrawBox(ref d.Vector3 pos, ref d.Matrix3 R, ref d.Vector3 sides); - - [DllImport("drawstuff", EntryPoint = "dsDrawCapsule")] - public static extern void DrawCapsule(ref d.Vector3 pos, ref d.Matrix3 R, dReal length, dReal radius); - - [DllImport("drawstuff", EntryPoint = "dsDrawConvex")] - public static extern void DrawConvex(ref d.Vector3 pos, ref d.Matrix3 R, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); - - [DllImport("drawstuff", EntryPoint = "dsSetColor")] - public static extern void SetColor(float red, float green, float blue); - - [DllImport("drawstuff", EntryPoint = "dsSetTexture")] - public static extern void SetTexture(Texture texture); - - [DllImport("drawstuff", EntryPoint = "dsSetViewpoint")] - public static extern void SetViewpoint(ref d.Vector3 xyz, ref d.Vector3 hpr); - - [DllImport("drawstuff", EntryPoint = "dsSimulationLoop")] - public static extern void SimulationLoop(int argc, string[] argv, int window_width, int window_height, ref Functions fn); - } -} diff --git a/bin/Ode.NET.dll b/bin/Ode.NET.dll deleted file mode 100755 index fcf17b1b9d..0000000000 Binary files a/bin/Ode.NET.dll and /dev/null differ diff --git a/bin/Ode.NET.dll.config b/bin/Ode.NET.dll.config deleted file mode 100644 index c72c28119e..0000000000 --- a/bin/Ode.NET.dll.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -