diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs index 35adf11ff1..47e7c7bdc1 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEApi.cs @@ -44,7 +44,7 @@ using System; using System.Runtime.InteropServices; using System.Security; using OMV = OpenMetaverse; -namespace OdeAPI +namespace OpenSim.Region.PhysicsModule.ubOde { //#if dDOUBLE // don't see much use in double precision with time steps of 20ms and 10 iterations used on opensim @@ -54,18 +54,18 @@ namespace OdeAPI using dReal = System.Single; //#endif - public static class d + internal static class SafeNativeMethods { - public static dReal Infinity = dReal.MaxValue; - public static int NTotalBodies = 0; - public static int NTotalGeoms = 0; + internal static dReal Infinity = dReal.MaxValue; + internal static int NTotalBodies = 0; + internal static int NTotalGeoms = 0; - public const uint CONTACTS_UNIMPORTANT = 0x80000000; + internal const uint CONTACTS_UNIMPORTANT = 0x80000000; #region Flags and Enumerations [Flags] - public enum AllocateODEDataFlags : uint + internal enum AllocateODEDataFlags : uint { BasicData = 0, CollisionData = 0x00000001, @@ -73,13 +73,13 @@ namespace OdeAPI } [Flags] - public enum IniteODEFlags : uint + internal enum IniteODEFlags : uint { dInitFlagManualThreadCleanup = 0x00000001 } [Flags] - public enum ContactFlags : int + internal enum ContactFlags : int { Mu2 = 0x001, FDir1 = 0x002, @@ -97,7 +97,7 @@ namespace OdeAPI Approx1 = 0x3000 } - public enum GeomClassID : int + internal enum GeomClassID : int { SphereClass, BoxClass, @@ -121,7 +121,7 @@ namespace OdeAPI MaxUserClasses = 5 } - public enum JointType : int + internal enum JointType : int { None, Ball, @@ -137,7 +137,7 @@ namespace OdeAPI Plane2D } - public enum JointParam : int + internal enum JointParam : int { LoStop, HiStop, @@ -174,7 +174,7 @@ namespace OdeAPI SuspensionCFM3 } - public enum dSweepAndPruneAxis : int + internal enum dSweepAndPruneAxis : int { XYZ = ((0)|(1<<2)|(2<<4)), XZY = ((0)|(2<<2)|(1<<4)), @@ -189,126 +189,126 @@ namespace OdeAPI #region Callbacks [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate int AABBTestFn(IntPtr o1, IntPtr o2, ref AABB aabb); + internal delegate int AABBTestFn(IntPtr o1, IntPtr o2, ref AABB aabb); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate int ColliderFn(IntPtr o1, IntPtr o2, int flags, out ContactGeom contact, int skip); + internal delegate int ColliderFn(IntPtr o1, IntPtr o2, int flags, out ContactGeom contact, int skip); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void GetAABBFn(IntPtr geom, out AABB aabb); + internal delegate void GetAABBFn(IntPtr geom, out AABB aabb); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate ColliderFn GetColliderFnFn(int num); + internal delegate ColliderFn GetColliderFnFn(int num); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void GeomDtorFn(IntPtr o); + internal delegate void GeomDtorFn(IntPtr o); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate dReal HeightfieldGetHeight(IntPtr p_user_data, int x, int z); + internal delegate dReal HeightfieldGetHeight(IntPtr p_user_data, int x, int z); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate dReal OSTerrainGetHeight(IntPtr p_user_data, int x, int z); + internal delegate dReal OSTerrainGetHeight(IntPtr p_user_data, int x, int z); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void NearCallback(IntPtr data, IntPtr geom1, IntPtr geom2); + internal delegate void NearCallback(IntPtr data, IntPtr geom1, IntPtr geom2); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex); + internal delegate int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount); + internal delegate int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate int TriRayCallback(IntPtr trimesh, IntPtr ray, int triangleIndex, dReal u, dReal v); + internal delegate int TriRayCallback(IntPtr trimesh, IntPtr ray, int triangleIndex, dReal u, dReal v); #endregion #region Structs [StructLayout(LayoutKind.Sequential)] - public struct AABB + internal struct AABB { - public dReal MinX, MaxX; - public dReal MinY, MaxY; - public dReal MinZ, MaxZ; + internal dReal MinX, MaxX; + internal dReal MinY, MaxY; + internal dReal MinZ, MaxZ; } [StructLayout(LayoutKind.Sequential)] - public struct Contact + internal struct Contact { - public SurfaceParameters surface; - public ContactGeom geom; - public Vector3 fdir1; - public static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(Contact)); + internal SurfaceParameters surface; + internal ContactGeom geom; + internal Vector3 fdir1; + internal static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(Contact)); } [StructLayout(LayoutKind.Sequential)] - public struct ContactGeom + internal struct ContactGeom { - public Vector3 pos; - public Vector3 normal; - public dReal depth; - public IntPtr g1; - public IntPtr g2; - public int side1; - public int side2; - public static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(ContactGeom)); + internal Vector3 pos; + internal Vector3 normal; + internal dReal depth; + internal IntPtr g1; + internal IntPtr g2; + internal int side1; + internal int side2; + internal static readonly int unmanagedSizeOf = Marshal.SizeOf(typeof(ContactGeom)); } [StructLayout(LayoutKind.Sequential)] - public struct GeomClass + internal struct GeomClass { - public int bytes; - public GetColliderFnFn collider; - public GetAABBFn aabb; - public AABBTestFn aabb_test; - public GeomDtorFn dtor; + internal int bytes; + internal GetColliderFnFn collider; + internal GetAABBFn aabb; + internal AABBTestFn aabb_test; + internal GeomDtorFn dtor; } [StructLayout(LayoutKind.Sequential)] - public struct JointFeedback + internal struct JointFeedback { - public Vector3 f1; - public Vector3 t1; - public Vector3 f2; - public Vector3 t2; + internal Vector3 f1; + internal Vector3 t1; + internal Vector3 f2; + internal Vector3 t2; } [StructLayout(LayoutKind.Sequential)] - public struct Mass + internal struct Mass { - public dReal mass; - public Vector4 c; - public Matrix3 I; + internal dReal mass; + internal Vector4 c; + internal Matrix3 I; } [StructLayout(LayoutKind.Sequential)] - public struct Matrix3 + internal struct Matrix3 { - public Matrix3(dReal m00, dReal m10, dReal m20, dReal m01, dReal m11, dReal m21, dReal m02, dReal m12, dReal m22) + internal Matrix3(dReal m00, dReal m10, dReal m20, dReal m01, dReal m11, dReal m21, dReal m02, dReal m12, dReal m22) { M00 = m00; M10 = m10; M20 = m20; _m30 = 0.0f; M01 = m01; M11 = m11; M21 = m21; _m31 = 0.0f; M02 = m02; M12 = m12; M22 = m22; _m32 = 0.0f; } - public dReal M00, M10, M20; + internal dReal M00, M10, M20; private dReal _m30; - public dReal M01, M11, M21; + internal dReal M01, M11, M21; private dReal _m31; - public dReal M02, M12, M22; + internal dReal M02, M12, M22; private dReal _m32; } [StructLayout(LayoutKind.Sequential)] - public struct Matrix4 + internal struct Matrix4 { - public Matrix4(dReal m00, dReal m10, dReal m20, dReal m30, + internal Matrix4(dReal m00, dReal m10, dReal m20, dReal m30, dReal m01, dReal m11, dReal m21, dReal m31, dReal m02, dReal m12, dReal m22, dReal m32, dReal m03, dReal m13, dReal m23, dReal m33) @@ -318,312 +318,312 @@ namespace OdeAPI M02 = m02; M12 = m12; M22 = m22; M32 = m32; M03 = m03; M13 = m13; M23 = m23; M33 = m33; } - public dReal M00, M10, M20, M30; - public dReal M01, M11, M21, M31; - public dReal M02, M12, M22, M32; - public dReal M03, M13, M23, M33; + internal dReal M00, M10, M20, M30; + internal dReal M01, M11, M21, M31; + internal dReal M02, M12, M22, M32; + internal dReal M03, M13, M23, M33; } [StructLayout(LayoutKind.Sequential)] - public struct Quaternion + internal struct Quaternion { - public dReal W, X, Y, Z; + internal dReal W, X, Y, Z; } [StructLayout(LayoutKind.Sequential)] - public struct SurfaceParameters + internal struct SurfaceParameters { - public ContactFlags mode; - public dReal mu; - public dReal mu2; - public dReal bounce; - public dReal bounce_vel; - public dReal soft_erp; - public dReal soft_cfm; - public dReal motion1; - public dReal motion2; - public dReal motionN; - public dReal slip1; - public dReal slip2; + internal ContactFlags mode; + internal dReal mu; + internal dReal mu2; + internal dReal bounce; + internal dReal bounce_vel; + internal dReal soft_erp; + internal dReal soft_cfm; + internal dReal motion1; + internal dReal motion2; + internal dReal motionN; + internal dReal slip1; + internal dReal slip2; } [StructLayout(LayoutKind.Sequential)] - public struct Vector3 + internal struct Vector3 { - public Vector3(dReal x, dReal y, dReal z) + internal Vector3(dReal x, dReal y, dReal z) { X = x; Y = y; Z = z; _w = 0.0f; } - public dReal X, Y, Z; + internal dReal X, Y, Z; private dReal _w; } [StructLayout(LayoutKind.Sequential)] - public struct Vector4 + internal struct Vector4 { - public Vector4(dReal x, dReal y, dReal z, dReal w) + internal Vector4(dReal x, dReal y, dReal z, dReal w) { X = x; Y = y; Z = z; W = w; } - public dReal X, Y, Z, W; + internal dReal X, Y, Z, W; } #endregion [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAllocateODEDataForThread"), SuppressUnmanagedCodeSecurity] - public static extern int AllocateODEDataForThread(uint ODEInitFlags); + internal static extern int AllocateODEDataForThread(uint ODEInitFlags); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAreConnected"), SuppressUnmanagedCodeSecurity] - public static extern bool AreConnected(IntPtr b1, IntPtr b2); + internal static extern bool AreConnected(IntPtr b1, IntPtr b2); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dAreConnectedExcluding"), SuppressUnmanagedCodeSecurity] - public static extern bool AreConnectedExcluding(IntPtr b1, IntPtr b2, JointType joint_type); + internal static extern bool AreConnectedExcluding(IntPtr b1, IntPtr b2, JointType joint_type); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForce"), SuppressUnmanagedCodeSecurity] - public static extern void BodyAddForce(IntPtr body, dReal fx, dReal fy, dReal fz); + internal static extern void BodyAddForce(IntPtr body, dReal fx, dReal fy, dReal fz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForceAtPos"), SuppressUnmanagedCodeSecurity] - public static extern void BodyAddForceAtPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); + internal static extern void BodyAddForceAtPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddForceAtRelPos"), SuppressUnmanagedCodeSecurity] - public static extern void BodyAddForceAtRelPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); + internal static extern void BodyAddForceAtRelPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForce"), SuppressUnmanagedCodeSecurity] - public static extern void BodyAddRelForce(IntPtr body, dReal fx, dReal fy, dReal fz); + internal static extern void BodyAddRelForce(IntPtr body, dReal fx, dReal fy, dReal fz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForceAtPos"), SuppressUnmanagedCodeSecurity] - public static extern void BodyAddRelForceAtPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); + internal static extern void BodyAddRelForceAtPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelForceAtRelPos"), SuppressUnmanagedCodeSecurity] - public static extern void BodyAddRelForceAtRelPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); + internal static extern void BodyAddRelForceAtRelPos(IntPtr body, dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddRelTorque"), SuppressUnmanagedCodeSecurity] - public static extern void BodyAddRelTorque(IntPtr body, dReal fx, dReal fy, dReal fz); + internal static extern void BodyAddRelTorque(IntPtr body, dReal fx, dReal fy, dReal fz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyAddTorque"), SuppressUnmanagedCodeSecurity] - public static extern void BodyAddTorque(IntPtr body, dReal fx, dReal fy, dReal fz); + internal static extern void BodyAddTorque(IntPtr body, dReal fx, dReal fy, dReal fz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyPosition"), SuppressUnmanagedCodeSecurity] - public static extern void BodyCopyPosition(IntPtr body, out Vector3 pos); + internal static extern void BodyCopyPosition(IntPtr body, out Vector3 pos); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyPosition"), SuppressUnmanagedCodeSecurity] - public static extern void BodyCopyPosition(IntPtr body, out dReal X); + internal static extern void BodyCopyPosition(IntPtr body, out dReal X); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void BodyCopyQuaternion(IntPtr body, out Quaternion quat); + internal static extern void BodyCopyQuaternion(IntPtr body, out Quaternion quat); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void BodyCopyQuaternion(IntPtr body, out dReal X); + internal static extern void BodyCopyQuaternion(IntPtr body, out dReal X); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyRotation"), SuppressUnmanagedCodeSecurity] - public static extern void BodyCopyRotation(IntPtr body, out Matrix3 R); + internal static extern void BodyCopyRotation(IntPtr body, out Matrix3 R); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCopyRotation"), SuppressUnmanagedCodeSecurity] - public static extern void BodyCopyRotation(IntPtr body, out dReal M00); + internal static extern void BodyCopyRotation(IntPtr body, out dReal M00); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyCreate"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr BodyiCreate(IntPtr world); - public static IntPtr BodyCreate(IntPtr world) + internal static extern IntPtr BodyiCreate(IntPtr world); + internal static IntPtr BodyCreate(IntPtr world) { NTotalBodies++; return BodyiCreate(world); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyDestroy"), SuppressUnmanagedCodeSecurity] - public static extern void BodyiDestroy(IntPtr body); - public static void BodyDestroy(IntPtr body) + internal static extern void BodyiDestroy(IntPtr body); + internal static void BodyDestroy(IntPtr body) { NTotalBodies--; BodyiDestroy(body); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyDisable"), SuppressUnmanagedCodeSecurity] - public static extern void BodyDisable(IntPtr body); + internal static extern void BodyDisable(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyEnable"), SuppressUnmanagedCodeSecurity] - public static extern void BodyEnable(IntPtr body); + internal static extern void BodyEnable(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] - public static extern dReal BodyGetAutoDisableAngularThreshold(IntPtr body); + internal static extern dReal BodyGetAutoDisableAngularThreshold(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] - public static extern bool BodyGetAutoDisableFlag(IntPtr body); + internal static extern bool BodyGetAutoDisableFlag(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableDefaults"), SuppressUnmanagedCodeSecurity] - public static extern void BodyGetAutoDisableDefaults(IntPtr body); + internal static extern void BodyGetAutoDisableDefaults(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] - public static extern dReal BodyGetAutoDisableLinearThreshold(IntPtr body); + internal static extern dReal BodyGetAutoDisableLinearThreshold(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] - public static extern int BodyGetAutoDisableSteps(IntPtr body); + internal static extern int BodyGetAutoDisableSteps(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAutoDisableTime"), SuppressUnmanagedCodeSecurity] - public static extern dReal BodyGetAutoDisableTime(IntPtr body); + internal static extern dReal BodyGetAutoDisableTime(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularVel"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Vector3* BodyGetAngularVelUnsafe(IntPtr body); - public static Vector3 BodyGetAngularVel(IntPtr body) + internal extern unsafe static Vector3* BodyGetAngularVelUnsafe(IntPtr body); + internal static Vector3 BodyGetAngularVel(IntPtr body) { unsafe { return *(BodyGetAngularVelUnsafe(body)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetData"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr BodyGetData(IntPtr body); + internal static extern IntPtr BodyGetData(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFiniteRotationMode"), SuppressUnmanagedCodeSecurity] - public static extern int BodyGetFiniteRotationMode(IntPtr body); + internal static extern int BodyGetFiniteRotationMode(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFiniteRotationAxis"), SuppressUnmanagedCodeSecurity] - public static extern void BodyGetFiniteRotationAxis(IntPtr body, out Vector3 result); + internal static extern void BodyGetFiniteRotationAxis(IntPtr body, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetForce"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Vector3* BodyGetForceUnsafe(IntPtr body); - public static Vector3 BodyGetForce(IntPtr body) + internal extern unsafe static Vector3* BodyGetForceUnsafe(IntPtr body); + internal static Vector3 BodyGetForce(IntPtr body) { unsafe { return *(BodyGetForceUnsafe(body)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetGravityMode"), SuppressUnmanagedCodeSecurity] - public static extern bool BodyGetGravityMode(IntPtr body); + internal static extern bool BodyGetGravityMode(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetGyroscopicMode"), SuppressUnmanagedCodeSecurity] - public static extern int BodyGetGyroscopicMode(IntPtr body); + internal static extern int BodyGetGyroscopicMode(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetJoint"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr BodyGetJoint(IntPtr body, int index); + internal static extern IntPtr BodyGetJoint(IntPtr body, int index); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearVel"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Vector3* BodyGetLinearVelUnsafe(IntPtr body); - public static Vector3 BodyGetLinearVel(IntPtr body) + internal extern unsafe static Vector3* BodyGetLinearVelUnsafe(IntPtr body); + internal static Vector3 BodyGetLinearVel(IntPtr body) { unsafe { return *(BodyGetLinearVelUnsafe(body)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetMass"), SuppressUnmanagedCodeSecurity] - public static extern void BodyGetMass(IntPtr body, out Mass mass); + internal static extern void BodyGetMass(IntPtr body, out Mass mass); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetNumJoints"), SuppressUnmanagedCodeSecurity] - public static extern int BodyGetNumJoints(IntPtr body); + internal static extern int BodyGetNumJoints(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPointVel"), SuppressUnmanagedCodeSecurity] - public static extern void BodyGetPointVel(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); + internal static extern void BodyGetPointVel(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPosition"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Vector3* BodyGetPositionUnsafe(IntPtr body); - public static Vector3 BodyGetPosition(IntPtr body) + internal extern unsafe static Vector3* BodyGetPositionUnsafe(IntPtr body); + internal static Vector3 BodyGetPosition(IntPtr body) { unsafe { return *(BodyGetPositionUnsafe(body)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetPosRelPoint"), SuppressUnmanagedCodeSecurity] - public static extern void BodyGetPosRelPoint(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); + internal static extern void BodyGetPosRelPoint(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetQuaternion"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Quaternion* BodyGetQuaternionUnsafe(IntPtr body); - public static Quaternion BodyGetQuaternion(IntPtr body) + internal extern unsafe static Quaternion* BodyGetQuaternionUnsafe(IntPtr body); + internal static Quaternion BodyGetQuaternion(IntPtr body) { unsafe { return *(BodyGetQuaternionUnsafe(body)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRelPointPos"), SuppressUnmanagedCodeSecurity] - public static extern void BodyGetRelPointPos(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); + internal static extern void BodyGetRelPointPos(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRelPointVel"), SuppressUnmanagedCodeSecurity] - public static extern void BodyGetRelPointVel(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); + internal static extern void BodyGetRelPointVel(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetRotation"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Matrix3* BodyGetRotationUnsafe(IntPtr body); - public static Matrix3 BodyGetRotation(IntPtr body) + internal extern unsafe static Matrix3* BodyGetRotationUnsafe(IntPtr body); + internal static Matrix3 BodyGetRotation(IntPtr body) { unsafe { return *(BodyGetRotationUnsafe(body)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetTorque"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Vector3* BodyGetTorqueUnsafe(IntPtr body); - public static Vector3 BodyGetTorque(IntPtr body) + internal extern unsafe static Vector3* BodyGetTorqueUnsafe(IntPtr body); + internal static Vector3 BodyGetTorque(IntPtr body) { unsafe { return *(BodyGetTorqueUnsafe(body)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetWorld"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr BodyGetWorld(IntPtr body); + internal static extern IntPtr BodyGetWorld(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetFirstGeom"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr BodyGetFirstGeom(IntPtr body); + internal static extern IntPtr BodyGetFirstGeom(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetNextGeom"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr dBodyGetNextGeom(IntPtr Geom); + internal static extern IntPtr dBodyGetNextGeom(IntPtr Geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyIsEnabled"), SuppressUnmanagedCodeSecurity] - public static extern bool BodyIsEnabled(IntPtr body); + internal static extern bool BodyIsEnabled(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularVel"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetAngularVel(IntPtr body, dReal x, dReal y, dReal z); + internal static extern void BodySetAngularVel(IntPtr body, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetAutoDisableAngularThreshold(IntPtr body, dReal angular_threshold); + internal static extern void BodySetAutoDisableAngularThreshold(IntPtr body, dReal angular_threshold); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableDefaults"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetAutoDisableDefaults(IntPtr body); + internal static extern void BodySetAutoDisableDefaults(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetAutoDisableFlag(IntPtr body, bool do_auto_disable); + internal static extern void BodySetAutoDisableFlag(IntPtr body, bool do_auto_disable); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetAutoDisableLinearThreshold(IntPtr body, dReal linear_threshold); + internal static extern void BodySetAutoDisableLinearThreshold(IntPtr body, dReal linear_threshold); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetAutoDisableSteps(IntPtr body, int steps); + internal static extern void BodySetAutoDisableSteps(IntPtr body, int steps); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAutoDisableTime"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetAutoDisableTime(IntPtr body, dReal time); + internal static extern void BodySetAutoDisableTime(IntPtr body, dReal time); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetData"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetData(IntPtr body, IntPtr data); + internal static extern void BodySetData(IntPtr body, IntPtr data); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetFiniteRotationMode"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetFiniteRotationMode(IntPtr body, int mode); + internal static extern void BodySetFiniteRotationMode(IntPtr body, int mode); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetFiniteRotationAxis"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetFiniteRotationAxis(IntPtr body, dReal x, dReal y, dReal z); + internal static extern void BodySetFiniteRotationAxis(IntPtr body, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearDamping"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetLinearDamping(IntPtr body, dReal scale); + internal static extern void BodySetLinearDamping(IntPtr body, dReal scale); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDamping"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetAngularDamping(IntPtr body, dReal scale); + internal static extern void BodySetAngularDamping(IntPtr body, dReal scale); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearDamping"), SuppressUnmanagedCodeSecurity] - public static extern dReal BodyGetLinearDamping(IntPtr body); + internal static extern dReal BodyGetLinearDamping(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularDamping"), SuppressUnmanagedCodeSecurity] - public static extern dReal BodyGetAngularDamping(IntPtr body); + internal static extern dReal BodyGetAngularDamping(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDamping"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetDamping(IntPtr body, dReal linear_scale, dReal angular_scale); + internal static extern void BodySetDamping(IntPtr body, dReal linear_scale, dReal angular_scale); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetAngularDampingThreshold(IntPtr body, dReal threshold); + internal static extern void BodySetAngularDampingThreshold(IntPtr body, dReal threshold); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetLinearDampingThreshold(IntPtr body, dReal threshold); + internal static extern void BodySetLinearDampingThreshold(IntPtr body, dReal threshold); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] - public static extern dReal BodyGetLinearDampingThreshold(IntPtr body); + internal static extern dReal BodyGetLinearDampingThreshold(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyGetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] - public static extern dReal BodyGetAngularDampingThreshold(IntPtr body); + internal static extern dReal BodyGetAngularDampingThreshold(IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetForce"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetForce(IntPtr body, dReal x, dReal y, dReal z); + internal static extern void BodySetForce(IntPtr body, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetGravityMode"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetGravityMode(IntPtr body, bool mode); + internal static extern void BodySetGravityMode(IntPtr body, bool mode); /// /// Sets the Gyroscopic term status on the body specified. @@ -631,112 +631,112 @@ namespace OdeAPI /// Pointer to body /// NonZero enabled, Zero disabled [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetGyroscopicMode"), SuppressUnmanagedCodeSecurity] - public static extern void dBodySetGyroscopicMode(IntPtr body, int enabled); + internal static extern void dBodySetGyroscopicMode(IntPtr body, int enabled); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetLinearVel"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetLinearVel(IntPtr body, dReal x, dReal y, dReal z); + internal static extern void BodySetLinearVel(IntPtr body, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetMass"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetMass(IntPtr body, ref Mass mass); + internal static extern void BodySetMass(IntPtr body, ref Mass mass); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetPosition"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetPosition(IntPtr body, dReal x, dReal y, dReal z); + internal static extern void BodySetPosition(IntPtr body, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetQuaternion(IntPtr body, ref Quaternion q); + internal static extern void BodySetQuaternion(IntPtr body, ref Quaternion q); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetQuaternion(IntPtr body, ref dReal w); + internal static extern void BodySetQuaternion(IntPtr body, ref dReal w); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetRotation"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetRotation(IntPtr body, ref Matrix3 R); + internal static extern void BodySetRotation(IntPtr body, ref Matrix3 R); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetRotation"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetRotation(IntPtr body, ref dReal M00); + internal static extern void BodySetRotation(IntPtr body, ref dReal M00); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodySetTorque"), SuppressUnmanagedCodeSecurity] - public static extern void BodySetTorque(IntPtr body, dReal x, dReal y, dReal z); + internal static extern void BodySetTorque(IntPtr body, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyVectorFromWorld"), SuppressUnmanagedCodeSecurity] - public static extern void BodyVectorFromWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); + internal static extern void BodyVectorFromWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBodyVectorToWorld"), SuppressUnmanagedCodeSecurity] - public static extern void BodyVectorToWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); + internal static extern void BodyVectorToWorld(IntPtr body, dReal px, dReal py, dReal pz, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBoxBox"), SuppressUnmanagedCodeSecurity] - public static extern void BoxBox(ref Vector3 p1, ref Matrix3 R1, + internal static extern void BoxBox(ref Vector3 p1, ref Matrix3 R1, ref Vector3 side1, ref Vector3 p2, ref Matrix3 R2, ref Vector3 side2, ref Vector3 normal, out dReal depth, out int return_code, int maxc, out ContactGeom contact, int skip); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dBoxTouchesBox"), SuppressUnmanagedCodeSecurity] - public static extern void BoxTouchesBox(ref Vector3 _p1, ref Matrix3 R1, + internal static extern void BoxTouchesBox(ref Vector3 _p1, ref Matrix3 R1, ref Vector3 side1, ref Vector3 _p2, ref Matrix3 R2, ref Vector3 side2); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCleanupODEAllDataForThread"), SuppressUnmanagedCodeSecurity] - public static extern void CleanupODEAllDataForThread(); + internal static extern void CleanupODEAllDataForThread(); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dClosestLineSegmentPoints"), SuppressUnmanagedCodeSecurity] - public static extern void ClosestLineSegmentPoints(ref Vector3 a1, ref Vector3 a2, + internal static extern void ClosestLineSegmentPoints(ref Vector3 a1, ref Vector3 a2, ref Vector3 b1, ref Vector3 b2, ref Vector3 cp1, ref Vector3 cp2); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCloseODE"), SuppressUnmanagedCodeSecurity] - public static extern void CloseODE(); + internal static extern void CloseODE(); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCollide"), SuppressUnmanagedCodeSecurity] - public static extern int Collide(IntPtr o1, IntPtr o2, int flags, [In, Out] ContactGeom[] contact, int skip); + internal static extern int Collide(IntPtr o1, IntPtr o2, int flags, [In, Out] ContactGeom[] contact, int skip); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCollide"), SuppressUnmanagedCodeSecurity] - public static extern int CollidePtr(IntPtr o1, IntPtr o2, int flags, IntPtr contactgeomarray, int skip); + internal static extern int CollidePtr(IntPtr o1, IntPtr o2, int flags, IntPtr contactgeomarray, int skip); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dConnectingJoint"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr ConnectingJoint(IntPtr j1, IntPtr j2); + internal static extern IntPtr ConnectingJoint(IntPtr j1, IntPtr j2); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateBox"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateiBox(IntPtr space, dReal lx, dReal ly, dReal lz); - public static IntPtr CreateBox(IntPtr space, dReal lx, dReal ly, dReal lz) + internal static extern IntPtr CreateiBox(IntPtr space, dReal lx, dReal ly, dReal lz); + internal static IntPtr CreateBox(IntPtr space, dReal lx, dReal ly, dReal lz) { NTotalGeoms++; return CreateiBox(space, lx, ly, lz); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateCapsule"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateiCapsule(IntPtr space, dReal radius, dReal length); - public static IntPtr CreateCapsule(IntPtr space, dReal radius, dReal length) + internal static extern IntPtr CreateiCapsule(IntPtr space, dReal radius, dReal length); + internal static IntPtr CreateCapsule(IntPtr space, dReal radius, dReal length) { NTotalGeoms++; return CreateiCapsule(space, radius, length); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateConvex"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateiConvex(IntPtr space, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); - public static IntPtr CreateConvex(IntPtr space, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons) + internal static extern IntPtr CreateiConvex(IntPtr space, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); + internal static IntPtr CreateConvex(IntPtr space, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons) { NTotalGeoms++; return CreateiConvex(space, planes, planeCount, points, pointCount, polygons); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateCylinder"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateiCylinder(IntPtr space, dReal radius, dReal length); - public static IntPtr CreateCylinder(IntPtr space, dReal radius, dReal length) + internal static extern IntPtr CreateiCylinder(IntPtr space, dReal radius, dReal length); + internal static IntPtr CreateCylinder(IntPtr space, dReal radius, dReal length) { NTotalGeoms++; return CreateiCylinder(space, radius, length); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateHeightfield"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateiHeightfield(IntPtr space, IntPtr data, int bPlaceable); - public static IntPtr CreateHeightfield(IntPtr space, IntPtr data, int bPlaceable) + internal static extern IntPtr CreateiHeightfield(IntPtr space, IntPtr data, int bPlaceable); + internal static IntPtr CreateHeightfield(IntPtr space, IntPtr data, int bPlaceable) { NTotalGeoms++; return CreateiHeightfield(space, data, bPlaceable); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateOSTerrain"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateiOSTerrain(IntPtr space, IntPtr data, int bPlaceable); - public static IntPtr CreateOSTerrain(IntPtr space, IntPtr data, int bPlaceable) + internal static extern IntPtr CreateiOSTerrain(IntPtr space, IntPtr data, int bPlaceable); + internal static IntPtr CreateOSTerrain(IntPtr space, IntPtr data, int bPlaceable) { NTotalGeoms++; return CreateiOSTerrain(space, data, bPlaceable); @@ -747,127 +747,127 @@ namespace OdeAPI [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeom"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateiGeom(int classnum); - public static IntPtr CreateGeom(int classnum) + internal static extern IntPtr CreateiGeom(int classnum); + internal static IntPtr CreateGeom(int classnum) { NTotalGeoms++; return CreateiGeom(classnum); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeomClass"), SuppressUnmanagedCodeSecurity] - public static extern int CreateGeomClass(ref GeomClass classptr); + internal static extern int CreateGeomClass(ref GeomClass classptr); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateGeomTransform"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateGeomTransform(IntPtr space); + internal static extern IntPtr CreateGeomTransform(IntPtr space); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreatePlane"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateiPlane(IntPtr space, dReal a, dReal b, dReal c, dReal d); - public static IntPtr CreatePlane(IntPtr space, dReal a, dReal b, dReal c, dReal d) + internal static extern IntPtr CreateiPlane(IntPtr space, dReal a, dReal b, dReal c, dReal d); + internal static IntPtr CreatePlane(IntPtr space, dReal a, dReal b, dReal c, dReal d) { NTotalGeoms++; return CreateiPlane(space, a, b, c, d); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateRay"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateiRay(IntPtr space, dReal length); - public static IntPtr CreateRay(IntPtr space, dReal length) + internal static extern IntPtr CreateiRay(IntPtr space, dReal length); + internal static IntPtr CreateRay(IntPtr space, dReal length) { NTotalGeoms++; return CreateiRay(space, length); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateSphere"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateiSphere(IntPtr space, dReal radius); - public static IntPtr CreateSphere(IntPtr space, dReal radius) + internal static extern IntPtr CreateiSphere(IntPtr space, dReal radius); + internal static IntPtr CreateSphere(IntPtr space, dReal radius) { NTotalGeoms++; return CreateiSphere(space, radius); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateTriMesh"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr CreateiTriMesh(IntPtr space, IntPtr data, + internal static extern IntPtr CreateiTriMesh(IntPtr space, IntPtr data, TriCallback callback, TriArrayCallback arrayCallback, TriRayCallback rayCallback); - public static IntPtr CreateTriMesh(IntPtr space, IntPtr data, + internal static IntPtr CreateTriMesh(IntPtr space, IntPtr data, TriCallback callback, TriArrayCallback arrayCallback, TriRayCallback rayCallback) { NTotalGeoms++; return CreateiTriMesh(space, data, callback, arrayCallback, rayCallback); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dDot"), SuppressUnmanagedCodeSecurity] - public static extern dReal Dot(ref dReal X0, ref dReal X1, int n); + internal static extern dReal Dot(ref dReal X0, ref dReal X1, int n); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dDQfromW"), SuppressUnmanagedCodeSecurity] - public static extern void DQfromW(dReal[] dq, ref Vector3 w, ref Quaternion q); + internal static extern void DQfromW(dReal[] dq, ref Vector3 w, ref Quaternion q); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dFactorCholesky"), SuppressUnmanagedCodeSecurity] - public static extern int FactorCholesky(ref dReal A00, int n); + internal static extern int FactorCholesky(ref dReal A00, int n); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dFactorLDLT"), SuppressUnmanagedCodeSecurity] - public static extern void FactorLDLT(ref dReal A, out dReal d, int n, int nskip); + internal static extern void FactorLDLT(ref dReal A, out dReal d, int n, int nskip); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxGetLengths"), SuppressUnmanagedCodeSecurity] - public static extern void GeomBoxGetLengths(IntPtr geom, out Vector3 len); + internal static extern void GeomBoxGetLengths(IntPtr geom, out Vector3 len); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxGetLengths"), SuppressUnmanagedCodeSecurity] - public static extern void GeomBoxGetLengths(IntPtr geom, out dReal x); + internal static extern void GeomBoxGetLengths(IntPtr geom, out dReal x); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxPointDepth"), SuppressUnmanagedCodeSecurity] - public static extern dReal GeomBoxPointDepth(IntPtr geom, dReal x, dReal y, dReal z); + internal static extern dReal GeomBoxPointDepth(IntPtr geom, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomBoxSetLengths"), SuppressUnmanagedCodeSecurity] - public static extern void GeomBoxSetLengths(IntPtr geom, dReal x, dReal y, dReal z); + internal static extern void GeomBoxSetLengths(IntPtr geom, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsuleGetParams"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCapsuleGetParams(IntPtr geom, out dReal radius, out dReal length); + internal static extern void GeomCapsuleGetParams(IntPtr geom, out dReal radius, out dReal length); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsulePointDepth"), SuppressUnmanagedCodeSecurity] - public static extern dReal GeomCapsulePointDepth(IntPtr geom, dReal x, dReal y, dReal z); + internal static extern dReal GeomCapsulePointDepth(IntPtr geom, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCapsuleSetParams"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCapsuleSetParams(IntPtr geom, dReal radius, dReal length); + internal static extern void GeomCapsuleSetParams(IntPtr geom, dReal radius, dReal length); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomClearOffset"), SuppressUnmanagedCodeSecurity] - public static extern void GeomClearOffset(IntPtr geom); + internal static extern void GeomClearOffset(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetPosition"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomCopyOffsetPosition(IntPtr geom, ref Vector3 pos); + internal static extern IntPtr GeomCopyOffsetPosition(IntPtr geom, ref Vector3 pos); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetPosition"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomCopyOffsetPosition(IntPtr geom, ref dReal X); + internal static extern IntPtr GeomCopyOffsetPosition(IntPtr geom, ref dReal X); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCopyOffsetQuaternion(IntPtr geom, ref Quaternion Q); + internal static extern void GeomCopyOffsetQuaternion(IntPtr geom, ref Quaternion Q); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCopyOffsetQuaternion(IntPtr geom, ref dReal X); + internal static extern void GeomCopyOffsetQuaternion(IntPtr geom, ref dReal X); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetRotation"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomCopyOffsetRotation(IntPtr geom, ref Matrix3 R); + internal static extern IntPtr GeomCopyOffsetRotation(IntPtr geom, ref Matrix3 R); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyOffsetRotation"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomCopyOffsetRotation(IntPtr geom, ref dReal M00); + internal static extern IntPtr GeomCopyOffsetRotation(IntPtr geom, ref dReal M00); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyPosition"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCopyPosition(IntPtr geom, out Vector3 pos); + internal static extern void GeomCopyPosition(IntPtr geom, out Vector3 pos); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyPosition"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCopyPosition(IntPtr geom, out dReal X); + internal static extern void GeomCopyPosition(IntPtr geom, out dReal X); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyRotation"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCopyRotation(IntPtr geom, out Matrix3 R); + internal static extern void GeomCopyRotation(IntPtr geom, out Matrix3 R); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCopyRotation"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCopyRotation(IntPtr geom, out dReal M00); + internal static extern void GeomCopyRotation(IntPtr geom, out dReal M00); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCylinderGetParams"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCylinderGetParams(IntPtr geom, out dReal radius, out dReal length); + internal static extern void GeomCylinderGetParams(IntPtr geom, out dReal radius, out dReal length); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomCylinderSetParams"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCylinderSetParams(IntPtr geom, dReal radius, dReal length); + internal static extern void GeomCylinderSetParams(IntPtr geom, dReal radius, dReal length); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomDestroy"), SuppressUnmanagedCodeSecurity] - public static extern void GeomiDestroy(IntPtr geom); - public static void GeomDestroy(IntPtr geom) + internal static extern void GeomiDestroy(IntPtr geom); + internal static void GeomDestroy(IntPtr geom) { NTotalGeoms--; GeomiDestroy(geom); @@ -875,64 +875,64 @@ namespace OdeAPI [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomDisable"), SuppressUnmanagedCodeSecurity] - public static extern void GeomDisable(IntPtr geom); + internal static extern void GeomDisable(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomEnable"), SuppressUnmanagedCodeSecurity] - public static extern void GeomEnable(IntPtr geom); + internal static extern void GeomEnable(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetAABB"), SuppressUnmanagedCodeSecurity] - public static extern void GeomGetAABB(IntPtr geom, out AABB aabb); + internal static extern void GeomGetAABB(IntPtr geom, out AABB aabb); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetAABB"), SuppressUnmanagedCodeSecurity] - public static extern void GeomGetAABB(IntPtr geom, out dReal minX); + internal static extern void GeomGetAABB(IntPtr geom, out dReal minX); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetBody"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomGetBody(IntPtr geom); + internal static extern IntPtr GeomGetBody(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetCategoryBits"), SuppressUnmanagedCodeSecurity] - public static extern uint GeomGetCategoryBits(IntPtr geom); + internal static extern uint GeomGetCategoryBits(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetClassData"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomGetClassData(IntPtr geom); + internal static extern IntPtr GeomGetClassData(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetCollideBits"), SuppressUnmanagedCodeSecurity] - public static extern uint GeomGetCollideBits(IntPtr geom); + internal static extern uint GeomGetCollideBits(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetClass"), SuppressUnmanagedCodeSecurity] - public static extern GeomClassID GeomGetClass(IntPtr geom); + internal static extern GeomClassID GeomGetClass(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetData"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomGetData(IntPtr geom); + internal static extern IntPtr GeomGetData(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetPosition"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Vector3* GeomGetOffsetPositionUnsafe(IntPtr geom); - public static Vector3 GeomGetOffsetPosition(IntPtr geom) + internal extern unsafe static Vector3* GeomGetOffsetPositionUnsafe(IntPtr geom); + internal static Vector3 GeomGetOffsetPosition(IntPtr geom) { unsafe { return *(GeomGetOffsetPositionUnsafe(geom)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetOffsetRotation"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Matrix3* GeomGetOffsetRotationUnsafe(IntPtr geom); - public static Matrix3 GeomGetOffsetRotation(IntPtr geom) + internal extern unsafe static Matrix3* GeomGetOffsetRotationUnsafe(IntPtr geom); + internal static Matrix3 GeomGetOffsetRotation(IntPtr geom) { unsafe { return *(GeomGetOffsetRotationUnsafe(geom)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetPosition"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Vector3* GeomGetPositionUnsafe(IntPtr geom); - public static Vector3 GeomGetPosition(IntPtr geom) + internal extern unsafe static Vector3* GeomGetPositionUnsafe(IntPtr geom); + internal static Vector3 GeomGetPosition(IntPtr geom) { unsafe { return *(GeomGetPositionUnsafe(geom)); } } - public static OMV.Vector3 GeomGetPositionOMV(IntPtr geom) + internal static OMV.Vector3 GeomGetPositionOMV(IntPtr geom) { Vector3 vtmp = GeomGetPosition(geom); return new OMV.Vector3(vtmp.X, vtmp.Y, vtmp.Z); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCopyQuaternion(IntPtr geom, out Quaternion q); - public static OMV.Quaternion GeomGetQuaternionOMV(IntPtr geom) + internal static extern void GeomCopyQuaternion(IntPtr geom, out Quaternion q); + internal static OMV.Quaternion GeomGetQuaternionOMV(IntPtr geom) { Quaternion qtmp; GeomCopyQuaternion(geom, out qtmp); @@ -940,393 +940,393 @@ namespace OdeAPI } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void GeomCopyQuaternion(IntPtr geom, out dReal X); + internal static extern void GeomCopyQuaternion(IntPtr geom, out dReal X); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetRotation"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Matrix3* GeomGetRotationUnsafe(IntPtr geom); - public static Matrix3 GeomGetRotation(IntPtr geom) + internal extern unsafe static Matrix3* GeomGetRotationUnsafe(IntPtr geom); + internal static Matrix3 GeomGetRotation(IntPtr geom) { unsafe { return *(GeomGetRotationUnsafe(geom)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomGetSpace"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomGetSpace(IntPtr geom); + internal static extern IntPtr GeomGetSpace(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildByte"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataBuildByte(IntPtr d, byte[] pHeightData, int bCopyHeightData, + internal static extern void GeomHeightfieldDataBuildByte(IntPtr d, byte[] pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildByte"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataBuildByte(IntPtr d, IntPtr pHeightData, int bCopyHeightData, + internal static extern void GeomHeightfieldDataBuildByte(IntPtr d, IntPtr pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildCallback"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataBuildCallback(IntPtr d, IntPtr pUserData, HeightfieldGetHeight pCallback, + internal static extern void GeomHeightfieldDataBuildCallback(IntPtr d, IntPtr pUserData, HeightfieldGetHeight pCallback, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataBuildShort(IntPtr d, ushort[] pHeightData, int bCopyHeightData, + internal static extern void GeomHeightfieldDataBuildShort(IntPtr d, ushort[] pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataBuildShort(IntPtr d, short[] pHeightData, int bCopyHeightData, + internal static extern void GeomHeightfieldDataBuildShort(IntPtr d, short[] pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildShort"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataBuildShort(IntPtr d, IntPtr pHeightData, int bCopyHeightData, + internal static extern void GeomHeightfieldDataBuildShort(IntPtr d, IntPtr pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildSingle"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataBuildSingle(IntPtr d, float[] pHeightData, int bCopyHeightData, + internal static extern void GeomHeightfieldDataBuildSingle(IntPtr d, float[] pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildSingle"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataBuildSingle(IntPtr d, IntPtr pHeightData, int bCopyHeightData, + internal static extern void GeomHeightfieldDataBuildSingle(IntPtr d, IntPtr pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildDouble"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataBuildDouble(IntPtr d, double[] pHeightData, int bCopyHeightData, + internal static extern void GeomHeightfieldDataBuildDouble(IntPtr d, double[] pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataBuildDouble"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataBuildDouble(IntPtr d, IntPtr pHeightData, int bCopyHeightData, + internal static extern void GeomHeightfieldDataBuildDouble(IntPtr d, IntPtr pHeightData, int bCopyHeightData, dReal width, dReal depth, int widthSamples, int depthSamples, dReal scale, dReal offset, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataCreate"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomHeightfieldDataCreate(); + internal static extern IntPtr GeomHeightfieldDataCreate(); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataDestroy"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataDestroy(IntPtr d); + internal static extern void GeomHeightfieldDataDestroy(IntPtr d); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldDataSetBounds"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight); + internal static extern void GeomHeightfieldDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldGetHeightfieldData"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomHeightfieldGetHeightfieldData(IntPtr g); + internal static extern IntPtr GeomHeightfieldGetHeightfieldData(IntPtr g); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomHeightfieldSetHeightfieldData"), SuppressUnmanagedCodeSecurity] - public static extern void GeomHeightfieldSetHeightfieldData(IntPtr g, IntPtr d); + internal static extern void GeomHeightfieldSetHeightfieldData(IntPtr g, IntPtr d); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomUbitTerrainDataBuild"), SuppressUnmanagedCodeSecurity] - public static extern void GeomOSTerrainDataBuild(IntPtr d, float[] pHeightData, int bCopyHeightData, + internal static extern void GeomOSTerrainDataBuild(IntPtr d, float[] pHeightData, int bCopyHeightData, dReal sampleSize, int widthSamples, int depthSamples, dReal offset, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataBuild"), SuppressUnmanagedCodeSecurity] - public static extern void GeomOSTerrainDataBuild(IntPtr d, IntPtr pHeightData, int bCopyHeightData, + internal static extern void GeomOSTerrainDataBuild(IntPtr d, IntPtr pHeightData, int bCopyHeightData, dReal sampleSize, int widthSamples, int depthSamples, dReal thickness, int bWrap); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataCreate"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomOSTerrainDataCreate(); + internal static extern IntPtr GeomOSTerrainDataCreate(); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataDestroy"), SuppressUnmanagedCodeSecurity] - public static extern void GeomOSTerrainDataDestroy(IntPtr d); + internal static extern void GeomOSTerrainDataDestroy(IntPtr d); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataSetBounds"), SuppressUnmanagedCodeSecurity] - public static extern void GeomOSTerrainDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight); + internal static extern void GeomOSTerrainDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainGetHeightfieldData"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomOSTerrainGetHeightfieldData(IntPtr g); + internal static extern IntPtr GeomOSTerrainGetHeightfieldData(IntPtr g); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainSetHeightfieldData"), SuppressUnmanagedCodeSecurity] - public static extern void GeomOSTerrainSetHeightfieldData(IntPtr g, IntPtr d); + internal static extern void GeomOSTerrainSetHeightfieldData(IntPtr g, IntPtr d); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsEnabled"), SuppressUnmanagedCodeSecurity] - public static extern bool GeomIsEnabled(IntPtr geom); + internal static extern bool GeomIsEnabled(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsOffset"), SuppressUnmanagedCodeSecurity] - public static extern bool GeomIsOffset(IntPtr geom); + internal static extern bool GeomIsOffset(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsSpace"), SuppressUnmanagedCodeSecurity] - public static extern bool GeomIsSpace(IntPtr geom); + internal static extern bool GeomIsSpace(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneGetParams"), SuppressUnmanagedCodeSecurity] - public static extern void GeomPlaneGetParams(IntPtr geom, ref Vector4 result); + internal static extern void GeomPlaneGetParams(IntPtr geom, ref Vector4 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneGetParams"), SuppressUnmanagedCodeSecurity] - public static extern void GeomPlaneGetParams(IntPtr geom, ref dReal A); + internal static extern void GeomPlaneGetParams(IntPtr geom, ref dReal A); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlanePointDepth"), SuppressUnmanagedCodeSecurity] - public static extern dReal GeomPlanePointDepth(IntPtr geom, dReal x, dReal y, dReal z); + internal static extern dReal GeomPlanePointDepth(IntPtr geom, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomPlaneSetParams"), SuppressUnmanagedCodeSecurity] - public static extern void GeomPlaneSetParams(IntPtr plane, dReal a, dReal b, dReal c, dReal d); + internal static extern void GeomPlaneSetParams(IntPtr plane, dReal a, dReal b, dReal c, dReal d); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGet"), SuppressUnmanagedCodeSecurity] - public static extern void GeomRayGet(IntPtr ray, ref Vector3 start, ref Vector3 dir); + internal static extern void GeomRayGet(IntPtr ray, ref Vector3 start, ref Vector3 dir); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGet"), SuppressUnmanagedCodeSecurity] - public static extern void GeomRayGet(IntPtr ray, ref dReal startX, ref dReal dirX); + internal static extern void GeomRayGet(IntPtr ray, ref dReal startX, ref dReal dirX); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetClosestHit"), SuppressUnmanagedCodeSecurity] - public static extern int GeomRayGetClosestHit(IntPtr ray); + internal static extern int GeomRayGetClosestHit(IntPtr ray); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetLength"), SuppressUnmanagedCodeSecurity] - public static extern dReal GeomRayGetLength(IntPtr ray); + internal static extern dReal GeomRayGetLength(IntPtr ray); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRayGetParams"), SuppressUnmanagedCodeSecurity] - public static extern dReal GeomRayGetParams(IntPtr g, out int firstContact, out int backfaceCull); + internal static extern dReal GeomRayGetParams(IntPtr g, out int firstContact, out int backfaceCull); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySet"), SuppressUnmanagedCodeSecurity] - public static extern void GeomRaySet(IntPtr ray, dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz); + internal static extern void GeomRaySet(IntPtr ray, dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetClosestHit"), SuppressUnmanagedCodeSecurity] - public static extern void GeomRaySetClosestHit(IntPtr ray, int closestHit); + internal static extern void GeomRaySetClosestHit(IntPtr ray, int closestHit); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetLength"), SuppressUnmanagedCodeSecurity] - public static extern void GeomRaySetLength(IntPtr ray, dReal length); + internal static extern void GeomRaySetLength(IntPtr ray, dReal length); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomRaySetParams"), SuppressUnmanagedCodeSecurity] - public static extern void GeomRaySetParams(IntPtr ray, int firstContact, int backfaceCull); + internal static extern void GeomRaySetParams(IntPtr ray, int firstContact, int backfaceCull); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetBody"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetBody(IntPtr geom, IntPtr body); + internal static extern void GeomSetBody(IntPtr geom, IntPtr body); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetCategoryBits"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetCategoryBits(IntPtr geom, uint bits); + internal static extern void GeomSetCategoryBits(IntPtr geom, uint bits); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetCollideBits"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetCollideBits(IntPtr geom, uint bits); + internal static extern void GeomSetCollideBits(IntPtr geom, uint bits); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetConvex"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomSetConvex(IntPtr geom, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); + internal static extern IntPtr GeomSetConvex(IntPtr geom, dReal[] planes, int planeCount, dReal[] points, int pointCount, int[] polygons); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetData"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetData(IntPtr geom, IntPtr data); + internal static extern void GeomSetData(IntPtr geom, IntPtr data); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetPosition"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetOffsetPosition(IntPtr geom, dReal x, dReal y, dReal z); + internal static extern void GeomSetOffsetPosition(IntPtr geom, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetOffsetQuaternion(IntPtr geom, ref Quaternion Q); + internal static extern void GeomSetOffsetQuaternion(IntPtr geom, ref Quaternion Q); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetOffsetQuaternion(IntPtr geom, ref dReal X); + internal static extern void GeomSetOffsetQuaternion(IntPtr geom, ref dReal X); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetRotation"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetOffsetRotation(IntPtr geom, ref Matrix3 R); + internal static extern void GeomSetOffsetRotation(IntPtr geom, ref Matrix3 R); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetRotation"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetOffsetRotation(IntPtr geom, ref dReal M00); + internal static extern void GeomSetOffsetRotation(IntPtr geom, ref dReal M00); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldPosition"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetOffsetWorldPosition(IntPtr geom, dReal x, dReal y, dReal z); + internal static extern void GeomSetOffsetWorldPosition(IntPtr geom, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetOffsetWorldQuaternion(IntPtr geom, ref Quaternion Q); + internal static extern void GeomSetOffsetWorldQuaternion(IntPtr geom, ref Quaternion Q); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetOffsetWorldQuaternion(IntPtr geom, ref dReal X); + internal static extern void GeomSetOffsetWorldQuaternion(IntPtr geom, ref dReal X); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldRotation"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetOffsetWorldRotation(IntPtr geom, ref Matrix3 R); + internal static extern void GeomSetOffsetWorldRotation(IntPtr geom, ref Matrix3 R); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetOffsetWorldRotation"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetOffsetWorldRotation(IntPtr geom, ref dReal M00); + internal static extern void GeomSetOffsetWorldRotation(IntPtr geom, ref dReal M00); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetPosition"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetPosition(IntPtr geom, dReal x, dReal y, dReal z); + internal static extern void GeomSetPosition(IntPtr geom, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetQuaternion(IntPtr geom, ref Quaternion quat); + internal static extern void GeomSetQuaternion(IntPtr geom, ref Quaternion quat); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetQuaternion"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetQuaternion(IntPtr geom, ref dReal w); + internal static extern void GeomSetQuaternion(IntPtr geom, ref dReal w); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetRotation"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetRotation(IntPtr geom, ref Matrix3 R); + internal static extern void GeomSetRotation(IntPtr geom, ref Matrix3 R); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSetRotation"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSetRotation(IntPtr geom, ref dReal M00); + internal static extern void GeomSetRotation(IntPtr geom, ref dReal M00); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSphereGetRadius"), SuppressUnmanagedCodeSecurity] - public static extern dReal GeomSphereGetRadius(IntPtr geom); + internal static extern dReal GeomSphereGetRadius(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSpherePointDepth"), SuppressUnmanagedCodeSecurity] - public static extern dReal GeomSpherePointDepth(IntPtr geom, dReal x, dReal y, dReal z); + internal static extern dReal GeomSpherePointDepth(IntPtr geom, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomSphereSetRadius"), SuppressUnmanagedCodeSecurity] - public static extern void GeomSphereSetRadius(IntPtr geom, dReal radius); + internal static extern void GeomSphereSetRadius(IntPtr geom, dReal radius); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetCleanup"), SuppressUnmanagedCodeSecurity] - public static extern int GeomTransformGetCleanup(IntPtr geom); + internal static extern int GeomTransformGetCleanup(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetGeom"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomTransformGetGeom(IntPtr geom); + internal static extern IntPtr GeomTransformGetGeom(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformGetInfo"), SuppressUnmanagedCodeSecurity] - public static extern int GeomTransformGetInfo(IntPtr geom); + internal static extern int GeomTransformGetInfo(IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetCleanup"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTransformSetCleanup(IntPtr geom, int mode); + internal static extern void GeomTransformSetCleanup(IntPtr geom, int mode); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetGeom"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTransformSetGeom(IntPtr geom, IntPtr obj); + internal static extern void GeomTransformSetGeom(IntPtr geom, IntPtr obj); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTransformSetInfo"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTransformSetInfo(IntPtr geom, int info); + internal static extern void GeomTransformSetInfo(IntPtr geom, int info); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildDouble(IntPtr d, + internal static extern void GeomTriMeshDataBuildDouble(IntPtr d, double[] vertices, int vertexStride, int vertexCount, int[] indices, int indexCount, int triStride); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildDouble(IntPtr d, + internal static extern void GeomTriMeshDataBuildDouble(IntPtr d, IntPtr vertices, int vertexStride, int vertexCount, IntPtr indices, int indexCount, int triStride); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble1"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildDouble1(IntPtr d, + internal static extern void GeomTriMeshDataBuildDouble1(IntPtr d, double[] vertices, int vertexStride, int vertexCount, int[] indices, int indexCount, int triStride, double[] normals); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildDouble1"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildDouble(IntPtr d, + internal static extern void GeomTriMeshDataBuildDouble(IntPtr d, IntPtr vertices, int vertexStride, int vertexCount, IntPtr indices, int indexCount, int triStride, IntPtr normals); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildSingle(IntPtr d, + internal static extern void GeomTriMeshDataBuildSingle(IntPtr d, dReal[] vertices, int vertexStride, int vertexCount, int[] indices, int indexCount, int triStride); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildSingle(IntPtr d, + internal static extern void GeomTriMeshDataBuildSingle(IntPtr d, IntPtr vertices, int vertexStride, int vertexCount, IntPtr indices, int indexCount, int triStride); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple1"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildSingle1(IntPtr d, + internal static extern void GeomTriMeshDataBuildSingle1(IntPtr d, dReal[] vertices, int vertexStride, int vertexCount, int[] indices, int indexCount, int triStride, dReal[] normals); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSimple1"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildSingle1(IntPtr d, + internal static extern void GeomTriMeshDataBuildSingle1(IntPtr d, IntPtr vertices, int vertexStride, int vertexCount, IntPtr indices, int indexCount, int triStride, IntPtr normals); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildSimple(IntPtr d, + internal static extern void GeomTriMeshDataBuildSimple(IntPtr d, float[] vertices, int vertexStride, int vertexCount, int[] indices, int indexCount, int triStride); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildSimple(IntPtr d, + internal static extern void GeomTriMeshDataBuildSimple(IntPtr d, IntPtr vertices, int vertexStride, int vertexCount, IntPtr indices, int indexCount, int triStride); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle1"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildSimple1(IntPtr d, + internal static extern void GeomTriMeshDataBuildSimple1(IntPtr d, float[] vertices, int vertexStride, int vertexCount, int[] indices, int indexCount, int triStride, float[] normals); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataBuildSingle1"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataBuildSimple1(IntPtr d, + internal static extern void GeomTriMeshDataBuildSimple1(IntPtr d, IntPtr vertices, int vertexStride, int vertexCount, IntPtr indices, int indexCount, int triStride, IntPtr normals); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshClearTCCache"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshClearTCCache(IntPtr g); + internal static extern void GeomTriMeshClearTCCache(IntPtr g); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataCreate"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomTriMeshDataCreate(); + internal static extern IntPtr GeomTriMeshDataCreate(); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataDestroy"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataDestroy(IntPtr d); + internal static extern void GeomTriMeshDataDestroy(IntPtr d); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataGet"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomTriMeshDataGet(IntPtr d, int data_id); + internal static extern IntPtr GeomTriMeshDataGet(IntPtr d, int data_id); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataPreprocess"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataPreprocess(IntPtr d); + internal static extern void GeomTriMeshDataPreprocess(IntPtr d); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataSet"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataSet(IntPtr d, int data_id, IntPtr in_data); + internal static extern void GeomTriMeshDataSet(IntPtr d, int data_id, IntPtr in_data); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshDataUpdate"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshDataUpdate(IntPtr d); + internal static extern void GeomTriMeshDataUpdate(IntPtr d); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshEnableTC"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshEnableTC(IntPtr g, int geomClass, bool enable); + internal static extern void GeomTriMeshEnableTC(IntPtr g, int geomClass, bool enable); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetArrayCallback"), SuppressUnmanagedCodeSecurity] - public static extern TriArrayCallback GeomTriMeshGetArrayCallback(IntPtr g); + internal static extern TriArrayCallback GeomTriMeshGetArrayCallback(IntPtr g); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetCallback"), SuppressUnmanagedCodeSecurity] - public static extern TriCallback GeomTriMeshGetCallback(IntPtr g); + internal static extern TriCallback GeomTriMeshGetCallback(IntPtr g); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetData"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomTriMeshGetData(IntPtr g); + internal static extern IntPtr GeomTriMeshGetData(IntPtr g); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetLastTransform"), SuppressUnmanagedCodeSecurity] - public extern unsafe static Matrix4* GeomTriMeshGetLastTransformUnsafe(IntPtr geom); - public static Matrix4 GeomTriMeshGetLastTransform(IntPtr geom) + internal extern unsafe static Matrix4* GeomTriMeshGetLastTransformUnsafe(IntPtr geom); + internal static Matrix4 GeomTriMeshGetLastTransform(IntPtr geom) { unsafe { return *(GeomTriMeshGetLastTransformUnsafe(geom)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetPoint"), SuppressUnmanagedCodeSecurity] - public extern static void GeomTriMeshGetPoint(IntPtr g, int index, dReal u, dReal v, ref Vector3 outVec); + internal extern static void GeomTriMeshGetPoint(IntPtr g, int index, dReal u, dReal v, ref Vector3 outVec); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetRayCallback"), SuppressUnmanagedCodeSecurity] - public static extern TriRayCallback GeomTriMeshGetRayCallback(IntPtr g); + internal static extern TriRayCallback GeomTriMeshGetRayCallback(IntPtr g); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriangle"), SuppressUnmanagedCodeSecurity] - public extern static void GeomTriMeshGetTriangle(IntPtr g, int index, ref Vector3 v0, ref Vector3 v1, ref Vector3 v2); + internal extern static void GeomTriMeshGetTriangle(IntPtr g, int index, ref Vector3 v0, ref Vector3 v1, ref Vector3 v2); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriangleCount"), SuppressUnmanagedCodeSecurity] - public extern static int GeomTriMeshGetTriangleCount(IntPtr g); + internal extern static int GeomTriMeshGetTriangleCount(IntPtr g); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshGetTriMeshDataID"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr GeomTriMeshGetTriMeshDataID(IntPtr g); + internal static extern IntPtr GeomTriMeshGetTriMeshDataID(IntPtr g); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshIsTCEnabled"), SuppressUnmanagedCodeSecurity] - public static extern bool GeomTriMeshIsTCEnabled(IntPtr g, int geomClass); + internal static extern bool GeomTriMeshIsTCEnabled(IntPtr g, int geomClass); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetArrayCallback"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshSetArrayCallback(IntPtr g, TriArrayCallback arrayCallback); + internal static extern void GeomTriMeshSetArrayCallback(IntPtr g, TriArrayCallback arrayCallback); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetCallback"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshSetCallback(IntPtr g, TriCallback callback); + internal static extern void GeomTriMeshSetCallback(IntPtr g, TriCallback callback); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetData"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshSetData(IntPtr g, IntPtr data); + internal static extern void GeomTriMeshSetData(IntPtr g, IntPtr data); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetLastTransform"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshSetLastTransform(IntPtr g, ref Matrix4 last_trans); + internal static extern void GeomTriMeshSetLastTransform(IntPtr g, ref Matrix4 last_trans); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetLastTransform"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshSetLastTransform(IntPtr g, ref dReal M00); + internal static extern void GeomTriMeshSetLastTransform(IntPtr g, ref dReal M00); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomTriMeshSetRayCallback"), SuppressUnmanagedCodeSecurity] - public static extern void GeomTriMeshSetRayCallback(IntPtr g, TriRayCallback callback); + internal static extern void GeomTriMeshSetRayCallback(IntPtr g, TriRayCallback callback); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGetConfiguration"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr iGetConfiguration(); + internal static extern IntPtr iGetConfiguration(); - public static string GetConfiguration() + internal static string GetConfiguration() { IntPtr ptr = iGetConfiguration(); string s = Marshal.PtrToStringAnsi(ptr); @@ -1334,691 +1334,688 @@ namespace OdeAPI } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceCreate"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr HashSpaceCreate(IntPtr space); + internal static extern IntPtr HashSpaceCreate(IntPtr space); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceGetLevels"), SuppressUnmanagedCodeSecurity] - public static extern void HashSpaceGetLevels(IntPtr space, out int minlevel, out int maxlevel); + internal static extern void HashSpaceGetLevels(IntPtr space, out int minlevel, out int maxlevel); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dHashSpaceSetLevels"), SuppressUnmanagedCodeSecurity] - public static extern void HashSpaceSetLevels(IntPtr space, int minlevel, int maxlevel); + internal static extern void HashSpaceSetLevels(IntPtr space, int minlevel, int maxlevel); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInfiniteAABB"), SuppressUnmanagedCodeSecurity] - public static extern void InfiniteAABB(IntPtr geom, out AABB aabb); + internal static extern void InfiniteAABB(IntPtr geom, out AABB aabb); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInitODE"), SuppressUnmanagedCodeSecurity] - public static extern void InitODE(); + internal static extern void InitODE(); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInitODE2"), SuppressUnmanagedCodeSecurity] - public static extern int InitODE2(uint ODEInitFlags); + internal static extern int InitODE2(uint ODEInitFlags); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dIsPositiveDefinite"), SuppressUnmanagedCodeSecurity] - public static extern int IsPositiveDefinite(ref dReal A, int n); + internal static extern int IsPositiveDefinite(ref dReal A, int n); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dInvertPDMatrix"), SuppressUnmanagedCodeSecurity] - public static extern int InvertPDMatrix(ref dReal A, out dReal Ainv, int n); + internal static extern int InvertPDMatrix(ref dReal A, out dReal Ainv, int n); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddAMotorTorques"), SuppressUnmanagedCodeSecurity] - public static extern void JointAddAMotorTorques(IntPtr joint, dReal torque1, dReal torque2, dReal torque3); + internal static extern void JointAddAMotorTorques(IntPtr joint, dReal torque1, dReal torque2, dReal torque3); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddHingeTorque"), SuppressUnmanagedCodeSecurity] - public static extern void JointAddHingeTorque(IntPtr joint, dReal torque); + internal static extern void JointAddHingeTorque(IntPtr joint, dReal torque); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddHinge2Torque"), SuppressUnmanagedCodeSecurity] - public static extern void JointAddHinge2Torques(IntPtr joint, dReal torque1, dReal torque2); + internal static extern void JointAddHinge2Torques(IntPtr joint, dReal torque1, dReal torque2); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddPRTorque"), SuppressUnmanagedCodeSecurity] - public static extern void JointAddPRTorque(IntPtr joint, dReal torque); + internal static extern void JointAddPRTorque(IntPtr joint, dReal torque); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddUniversalTorque"), SuppressUnmanagedCodeSecurity] - public static extern void JointAddUniversalTorques(IntPtr joint, dReal torque1, dReal torque2); + internal static extern void JointAddUniversalTorques(IntPtr joint, dReal torque1, dReal torque2); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAddSliderForce"), SuppressUnmanagedCodeSecurity] - public static extern void JointAddSliderForce(IntPtr joint, dReal force); + internal static extern void JointAddSliderForce(IntPtr joint, dReal force); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointAttach"), SuppressUnmanagedCodeSecurity] - public static extern void JointAttach(IntPtr joint, IntPtr body1, IntPtr body2); + internal static extern void JointAttach(IntPtr joint, IntPtr body1, IntPtr body2); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateAMotor"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreateAMotor(IntPtr world, IntPtr group); + internal static extern IntPtr JointCreateAMotor(IntPtr world, IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateBall"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreateBall(IntPtr world, IntPtr group); + internal static extern IntPtr JointCreateBall(IntPtr world, IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateContact"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreateContact(IntPtr world, IntPtr group, ref Contact contact); + internal static extern IntPtr JointCreateContact(IntPtr world, IntPtr group, ref Contact contact); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateContact"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreateContactPtr(IntPtr world, IntPtr group, IntPtr contact); + internal static extern IntPtr JointCreateContactPtr(IntPtr world, IntPtr group, IntPtr contact); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateFixed"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreateFixed(IntPtr world, IntPtr group); + internal static extern IntPtr JointCreateFixed(IntPtr world, IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateHinge"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreateHinge(IntPtr world, IntPtr group); + internal static extern IntPtr JointCreateHinge(IntPtr world, IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateHinge2"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreateHinge2(IntPtr world, IntPtr group); + internal static extern IntPtr JointCreateHinge2(IntPtr world, IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateLMotor"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreateLMotor(IntPtr world, IntPtr group); + internal static extern IntPtr JointCreateLMotor(IntPtr world, IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateNull"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreateNull(IntPtr world, IntPtr group); + internal static extern IntPtr JointCreateNull(IntPtr world, IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreatePR"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreatePR(IntPtr world, IntPtr group); + internal static extern IntPtr JointCreatePR(IntPtr world, IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreatePlane2D"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreatePlane2D(IntPtr world, IntPtr group); + internal static extern IntPtr JointCreatePlane2D(IntPtr world, IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateSlider"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreateSlider(IntPtr world, IntPtr group); + internal static extern IntPtr JointCreateSlider(IntPtr world, IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointCreateUniversal"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointCreateUniversal(IntPtr world, IntPtr group); + internal static extern IntPtr JointCreateUniversal(IntPtr world, IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointDestroy"), SuppressUnmanagedCodeSecurity] - public static extern void JointDestroy(IntPtr j); + internal static extern void JointDestroy(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAngle"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetAMotorAngle(IntPtr j, int anum); + internal static extern dReal JointGetAMotorAngle(IntPtr j, int anum); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAngleRate"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetAMotorAngleRate(IntPtr j, int anum); + internal static extern dReal JointGetAMotorAngleRate(IntPtr j, int anum); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAxis"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetAMotorAxis(IntPtr j, int anum, out Vector3 result); + internal static extern void JointGetAMotorAxis(IntPtr j, int anum, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorAxisRel"), SuppressUnmanagedCodeSecurity] - public static extern int JointGetAMotorAxisRel(IntPtr j, int anum); + internal static extern int JointGetAMotorAxisRel(IntPtr j, int anum); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorMode"), SuppressUnmanagedCodeSecurity] - public static extern int JointGetAMotorMode(IntPtr j); + internal static extern int JointGetAMotorMode(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorNumAxes"), SuppressUnmanagedCodeSecurity] - public static extern int JointGetAMotorNumAxes(IntPtr j); + internal static extern int JointGetAMotorNumAxes(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetAMotorParam"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetAMotorParam(IntPtr j, int parameter); + internal static extern dReal JointGetAMotorParam(IntPtr j, int parameter); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBallAnchor"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetBallAnchor(IntPtr j, out Vector3 result); + internal static extern void JointGetBallAnchor(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBallAnchor2"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetBallAnchor2(IntPtr j, out Vector3 result); + internal static extern void JointGetBallAnchor2(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetBody"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointGetBody(IntPtr j); + internal static extern IntPtr JointGetBody(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetData"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointGetData(IntPtr j); + internal static extern IntPtr JointGetData(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetFeedback"), SuppressUnmanagedCodeSecurity] - public extern unsafe static JointFeedback* JointGetFeedbackUnsafe(IntPtr j); - public static JointFeedback JointGetFeedback(IntPtr j) + internal extern unsafe static JointFeedback* JointGetFeedbackUnsafe(IntPtr j); + internal static JointFeedback JointGetFeedback(IntPtr j) { unsafe { return *(JointGetFeedbackUnsafe(j)); } } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAnchor"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetHingeAnchor(IntPtr j, out Vector3 result); + internal static extern void JointGetHingeAnchor(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAngle"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetHingeAngle(IntPtr j); + internal static extern dReal JointGetHingeAngle(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAngleRate"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetHingeAngleRate(IntPtr j); + internal static extern dReal JointGetHingeAngleRate(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAxis"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetHingeAxis(IntPtr j, out Vector3 result); + internal static extern void JointGetHingeAxis(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeParam"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetHingeParam(IntPtr j, int parameter); + internal static extern dReal JointGetHingeParam(IntPtr j, int parameter); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle1"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetHinge2Angle1(IntPtr j); + internal static extern dReal JointGetHinge2Angle1(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle1Rate"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetHinge2Angle1Rate(IntPtr j); + internal static extern dReal JointGetHinge2Angle1Rate(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Angle2Rate"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetHinge2Angle2Rate(IntPtr j); + internal static extern dReal JointGetHinge2Angle2Rate(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHingeAnchor2"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetHingeAnchor2(IntPtr j, out Vector3 result); + internal static extern void JointGetHingeAnchor2(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Anchor"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetHinge2Anchor(IntPtr j, out Vector3 result); + internal static extern void JointGetHinge2Anchor(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Anchor2"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetHinge2Anchor2(IntPtr j, out Vector3 result); + internal static extern void JointGetHinge2Anchor2(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Axis1"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetHinge2Axis1(IntPtr j, out Vector3 result); + internal static extern void JointGetHinge2Axis1(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Axis2"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetHinge2Axis2(IntPtr j, out Vector3 result); + internal static extern void JointGetHinge2Axis2(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetHinge2Param"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetHinge2Param(IntPtr j, int parameter); + internal static extern dReal JointGetHinge2Param(IntPtr j, int parameter); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorAxis"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetLMotorAxis(IntPtr j, int anum, out Vector3 result); + internal static extern void JointGetLMotorAxis(IntPtr j, int anum, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorNumAxes"), SuppressUnmanagedCodeSecurity] - public static extern int JointGetLMotorNumAxes(IntPtr j); + internal static extern int JointGetLMotorNumAxes(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetLMotorParam"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetLMotorParam(IntPtr j, int parameter); + internal static extern dReal JointGetLMotorParam(IntPtr j, int parameter); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAnchor"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetPRAnchor(IntPtr j, out Vector3 result); + internal static extern void JointGetPRAnchor(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAxis1"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetPRAxis1(IntPtr j, out Vector3 result); + internal static extern void JointGetPRAxis1(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRAxis2"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetPRAxis2(IntPtr j, out Vector3 result); + internal static extern void JointGetPRAxis2(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRParam"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetPRParam(IntPtr j, int parameter); + internal static extern dReal JointGetPRParam(IntPtr j, int parameter); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRPosition"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetPRPosition(IntPtr j); + internal static extern dReal JointGetPRPosition(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetPRPositionRate"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetPRPositionRate(IntPtr j); + internal static extern dReal JointGetPRPositionRate(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderAxis"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetSliderAxis(IntPtr j, out Vector3 result); + internal static extern void JointGetSliderAxis(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderParam"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetSliderParam(IntPtr j, int parameter); + internal static extern dReal JointGetSliderParam(IntPtr j, int parameter); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderPosition"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetSliderPosition(IntPtr j); + internal static extern dReal JointGetSliderPosition(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetSliderPositionRate"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetSliderPositionRate(IntPtr j); + internal static extern dReal JointGetSliderPositionRate(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetType"), SuppressUnmanagedCodeSecurity] - public static extern JointType JointGetType(IntPtr j); + internal static extern JointType JointGetType(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAnchor"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetUniversalAnchor(IntPtr j, out Vector3 result); + internal static extern void JointGetUniversalAnchor(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAnchor2"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetUniversalAnchor2(IntPtr j, out Vector3 result); + internal static extern void JointGetUniversalAnchor2(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle1"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetUniversalAngle1(IntPtr j); + internal static extern dReal JointGetUniversalAngle1(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle1Rate"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetUniversalAngle1Rate(IntPtr j); + internal static extern dReal JointGetUniversalAngle1Rate(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle2"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetUniversalAngle2(IntPtr j); + internal static extern dReal JointGetUniversalAngle2(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngle2Rate"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetUniversalAngle2Rate(IntPtr j); + internal static extern dReal JointGetUniversalAngle2Rate(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAngles"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetUniversalAngles(IntPtr j, out dReal angle1, out dReal angle2); + internal static extern void JointGetUniversalAngles(IntPtr j, out dReal angle1, out dReal angle2); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAxis1"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetUniversalAxis1(IntPtr j, out Vector3 result); + internal static extern void JointGetUniversalAxis1(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalAxis2"), SuppressUnmanagedCodeSecurity] - public static extern void JointGetUniversalAxis2(IntPtr j, out Vector3 result); + internal static extern void JointGetUniversalAxis2(IntPtr j, out Vector3 result); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGetUniversalParam"), SuppressUnmanagedCodeSecurity] - public static extern dReal JointGetUniversalParam(IntPtr j, int parameter); + internal static extern dReal JointGetUniversalParam(IntPtr j, int parameter); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupCreate"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr JointGroupCreate(int max_size); + internal static extern IntPtr JointGroupCreate(int max_size); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupDestroy"), SuppressUnmanagedCodeSecurity] - public static extern void JointGroupDestroy(IntPtr group); + internal static extern void JointGroupDestroy(IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointGroupEmpty"), SuppressUnmanagedCodeSecurity] - public static extern void JointGroupEmpty(IntPtr group); + internal static extern void JointGroupEmpty(IntPtr group); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorAngle"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetAMotorAngle(IntPtr j, int anum, dReal angle); + internal static extern void JointSetAMotorAngle(IntPtr j, int anum, dReal angle); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorAxis"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetAMotorAxis(IntPtr j, int anum, int rel, dReal x, dReal y, dReal z); + internal static extern void JointSetAMotorAxis(IntPtr j, int anum, int rel, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorMode"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetAMotorMode(IntPtr j, int mode); + internal static extern void JointSetAMotorMode(IntPtr j, int mode); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorNumAxes"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetAMotorNumAxes(IntPtr group, int num); + internal static extern void JointSetAMotorNumAxes(IntPtr group, int num); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetAMotorParam"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetAMotorParam(IntPtr group, int parameter, dReal value); + internal static extern void JointSetAMotorParam(IntPtr group, int parameter, dReal value); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetBallAnchor"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetBallAnchor(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetBallAnchor(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetBallAnchor2"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetBallAnchor2(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetBallAnchor2(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetData"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetData(IntPtr j, IntPtr data); + internal static extern void JointSetData(IntPtr j, IntPtr data); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetFeedback"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetFeedback(IntPtr j, out JointFeedback feedback); + internal static extern void JointSetFeedback(IntPtr j, out JointFeedback feedback); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetFixed"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetFixed(IntPtr j); + internal static extern void JointSetFixed(IntPtr j); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAnchor"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetHingeAnchor(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetHingeAnchor(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAnchorDelta"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetHingeAnchorDelta(IntPtr j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az); + internal static extern void JointSetHingeAnchorDelta(IntPtr j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeAxis"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetHingeAxis(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetHingeAxis(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHingeParam"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetHingeParam(IntPtr j, int parameter, dReal value); + internal static extern void JointSetHingeParam(IntPtr j, int parameter, dReal value); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Anchor"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetHinge2Anchor(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetHinge2Anchor(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Axis1"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetHinge2Axis1(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetHinge2Axis1(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Axis2"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetHinge2Axis2(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetHinge2Axis2(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetHinge2Param"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetHinge2Param(IntPtr j, int parameter, dReal value); + internal static extern void JointSetHinge2Param(IntPtr j, int parameter, dReal value); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorAxis"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetLMotorAxis(IntPtr j, int anum, int rel, dReal x, dReal y, dReal z); + internal static extern void JointSetLMotorAxis(IntPtr j, int anum, int rel, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorNumAxes"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetLMotorNumAxes(IntPtr j, int num); + internal static extern void JointSetLMotorNumAxes(IntPtr j, int num); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetLMotorParam"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetLMotorParam(IntPtr j, int parameter, dReal value); + internal static extern void JointSetLMotorParam(IntPtr j, int parameter, dReal value); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DAngleParam"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetPlane2DAngleParam(IntPtr j, int parameter, dReal value); + internal static extern void JointSetPlane2DAngleParam(IntPtr j, int parameter, dReal value); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DXParam"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetPlane2DXParam(IntPtr j, int parameter, dReal value); + internal static extern void JointSetPlane2DXParam(IntPtr j, int parameter, dReal value); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPlane2DYParam"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetPlane2DYParam(IntPtr j, int parameter, dReal value); + internal static extern void JointSetPlane2DYParam(IntPtr j, int parameter, dReal value); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAnchor"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetPRAnchor(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetPRAnchor(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAxis1"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetPRAxis1(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetPRAxis1(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRAxis2"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetPRAxis2(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetPRAxis2(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetPRParam"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetPRParam(IntPtr j, int parameter, dReal value); + internal static extern void JointSetPRParam(IntPtr j, int parameter, dReal value); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderAxis"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetSliderAxis(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetSliderAxis(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderAxisDelta"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetSliderAxisDelta(IntPtr j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az); + internal static extern void JointSetSliderAxisDelta(IntPtr j, dReal x, dReal y, dReal z, dReal ax, dReal ay, dReal az); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetSliderParam"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetSliderParam(IntPtr j, int parameter, dReal value); + internal static extern void JointSetSliderParam(IntPtr j, int parameter, dReal value); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAnchor"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetUniversalAnchor(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetUniversalAnchor(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAxis1"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetUniversalAxis1(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetUniversalAxis1(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalAxis2"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetUniversalAxis2(IntPtr j, dReal x, dReal y, dReal z); + internal static extern void JointSetUniversalAxis2(IntPtr j, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dJointSetUniversalParam"), SuppressUnmanagedCodeSecurity] - public static extern void JointSetUniversalParam(IntPtr j, int parameter, dReal value); + internal static extern void JointSetUniversalParam(IntPtr j, int parameter, dReal value); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dLDLTAddTL"), SuppressUnmanagedCodeSecurity] - public static extern void LDLTAddTL(ref dReal L, ref dReal d, ref dReal a, int n, int nskip); + internal static extern void LDLTAddTL(ref dReal L, ref dReal d, ref dReal a, int n, int nskip); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassAdd"), SuppressUnmanagedCodeSecurity] - public static extern void MassAdd(ref Mass a, ref Mass b); + internal static extern void MassAdd(ref Mass a, ref Mass b); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassAdjust"), SuppressUnmanagedCodeSecurity] - public static extern void MassAdjust(ref Mass m, dReal newmass); + internal static extern void MassAdjust(ref Mass m, dReal newmass); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassCheck"), SuppressUnmanagedCodeSecurity] - public static extern bool MassCheck(ref Mass m); + internal static extern bool MassCheck(ref Mass m); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassRotate"), SuppressUnmanagedCodeSecurity] - public static extern void MassRotate(ref Mass mass, ref Matrix3 R); + internal static extern void MassRotate(ref Mass mass, ref Matrix3 R); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassRotate"), SuppressUnmanagedCodeSecurity] - public static extern void MassRotate(ref Mass mass, ref dReal M00); + internal static extern void MassRotate(ref Mass mass, ref dReal M00); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetBox"), SuppressUnmanagedCodeSecurity] - public static extern void MassSetBox(out Mass mass, dReal density, dReal lx, dReal ly, dReal lz); + internal static extern void MassSetBox(out Mass mass, dReal density, dReal lx, dReal ly, dReal lz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetBoxTotal"), SuppressUnmanagedCodeSecurity] - public static extern void MassSetBoxTotal(out Mass mass, dReal total_mass, dReal lx, dReal ly, dReal lz); + internal static extern void MassSetBoxTotal(out Mass mass, dReal total_mass, dReal lx, dReal ly, dReal lz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCapsule"), SuppressUnmanagedCodeSecurity] - public static extern void MassSetCapsule(out Mass mass, dReal density, int direction, dReal radius, dReal length); + internal static extern void MassSetCapsule(out Mass mass, dReal density, int direction, dReal radius, dReal length); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCapsuleTotal"), SuppressUnmanagedCodeSecurity] - public static extern void MassSetCapsuleTotal(out Mass mass, dReal total_mass, int direction, dReal radius, dReal length); + internal static extern void MassSetCapsuleTotal(out Mass mass, dReal total_mass, int direction, dReal radius, dReal length); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCylinder"), SuppressUnmanagedCodeSecurity] - public static extern void MassSetCylinder(out Mass mass, dReal density, int direction, dReal radius, dReal length); + internal static extern void MassSetCylinder(out Mass mass, dReal density, int direction, dReal radius, dReal length); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetCylinderTotal"), SuppressUnmanagedCodeSecurity] - public static extern void MassSetCylinderTotal(out Mass mass, dReal total_mass, int direction, dReal radius, dReal length); + internal static extern void MassSetCylinderTotal(out Mass mass, dReal total_mass, int direction, dReal radius, dReal length); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetParameters"), SuppressUnmanagedCodeSecurity] - public static extern void MassSetParameters(out Mass mass, dReal themass, + internal static extern void MassSetParameters(out Mass mass, dReal themass, dReal cgx, dReal cgy, dReal cgz, dReal i11, dReal i22, dReal i33, dReal i12, dReal i13, dReal i23); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetSphere"), SuppressUnmanagedCodeSecurity] - public static extern void MassSetSphere(out Mass mass, dReal density, dReal radius); + internal static extern void MassSetSphere(out Mass mass, dReal density, dReal radius); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetSphereTotal"), SuppressUnmanagedCodeSecurity] - public static extern void dMassSetSphereTotal(out Mass mass, dReal total_mass, dReal radius); + internal static extern void dMassSetSphereTotal(out Mass mass, dReal total_mass, dReal radius); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetTrimesh"), SuppressUnmanagedCodeSecurity] - public static extern void MassSetTrimesh(out Mass mass, dReal density, IntPtr g); + internal static extern void MassSetTrimesh(out Mass mass, dReal density, IntPtr g); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassSetZero"), SuppressUnmanagedCodeSecurity] - public static extern void MassSetZero(out Mass mass); + internal static extern void MassSetZero(out Mass mass); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMassTranslate"), SuppressUnmanagedCodeSecurity] - public static extern void MassTranslate(ref Mass mass, dReal x, dReal y, dReal z); + internal static extern void MassTranslate(ref Mass mass, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply0"), SuppressUnmanagedCodeSecurity] - public static extern void Multiply0(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); + internal static extern void Multiply0(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply0"), SuppressUnmanagedCodeSecurity] private static extern void MultiplyiM3V3(out Vector3 vout, ref Matrix3 matrix, ref Vector3 vect,int p, int q, int r); - public static void MultiplyM3V3(out Vector3 outvector, ref Matrix3 matrix, ref Vector3 invector) + internal static void MultiplyM3V3(out Vector3 outvector, ref Matrix3 matrix, ref Vector3 invector) { MultiplyiM3V3(out outvector, ref matrix, ref invector, 3, 3, 1); } [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply1"), SuppressUnmanagedCodeSecurity] - public static extern void Multiply1(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); + internal static extern void Multiply1(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dMultiply2"), SuppressUnmanagedCodeSecurity] - public static extern void Multiply2(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); + internal static extern void Multiply2(out dReal A00, ref dReal B00, ref dReal C00, int p, int q, int r); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQFromAxisAndAngle"), SuppressUnmanagedCodeSecurity] - public static extern void QFromAxisAndAngle(out Quaternion q, dReal ax, dReal ay, dReal az, dReal angle); + internal static extern void QFromAxisAndAngle(out Quaternion q, dReal ax, dReal ay, dReal az, dReal angle); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQfromR"), SuppressUnmanagedCodeSecurity] - public static extern void QfromR(out Quaternion q, ref Matrix3 R); + internal static extern void QfromR(out Quaternion q, ref Matrix3 R); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply0"), SuppressUnmanagedCodeSecurity] - public static extern void QMultiply0(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); + internal static extern void QMultiply0(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply1"), SuppressUnmanagedCodeSecurity] - public static extern void QMultiply1(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); + internal static extern void QMultiply1(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply2"), SuppressUnmanagedCodeSecurity] - public static extern void QMultiply2(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); + internal static extern void QMultiply2(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQMultiply3"), SuppressUnmanagedCodeSecurity] - public static extern void QMultiply3(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); + internal static extern void QMultiply3(out Quaternion qa, ref Quaternion qb, ref Quaternion qc); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQSetIdentity"), SuppressUnmanagedCodeSecurity] - public static extern void QSetIdentity(out Quaternion q); + internal static extern void QSetIdentity(out Quaternion q); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQuadTreeSpaceCreate"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr QuadTreeSpaceCreate(IntPtr space, ref Vector3 center, ref Vector3 extents, int depth); + internal static extern IntPtr QuadTreeSpaceCreate(IntPtr space, ref Vector3 center, ref Vector3 extents, int depth); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dQuadTreeSpaceCreate"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr QuadTreeSpaceCreate(IntPtr space, ref dReal centerX, ref dReal extentsX, int depth); + internal static extern IntPtr QuadTreeSpaceCreate(IntPtr space, ref dReal centerX, ref dReal extentsX, int depth); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRandReal"), SuppressUnmanagedCodeSecurity] - public static extern dReal RandReal(); + internal static extern dReal RandReal(); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFrom2Axes"), SuppressUnmanagedCodeSecurity] - public static extern void RFrom2Axes(out Matrix3 R, dReal ax, dReal ay, dReal az, dReal bx, dReal by, dReal bz); + internal static extern void RFrom2Axes(out Matrix3 R, dReal ax, dReal ay, dReal az, dReal bx, dReal by, dReal bz); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromAxisAndAngle"), SuppressUnmanagedCodeSecurity] - public static extern void RFromAxisAndAngle(out Matrix3 R, dReal x, dReal y, dReal z, dReal angle); + internal static extern void RFromAxisAndAngle(out Matrix3 R, dReal x, dReal y, dReal z, dReal angle); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromEulerAngles"), SuppressUnmanagedCodeSecurity] - public static extern void RFromEulerAngles(out Matrix3 R, dReal phi, dReal theta, dReal psi); + internal static extern void RFromEulerAngles(out Matrix3 R, dReal phi, dReal theta, dReal psi); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRfromQ"), SuppressUnmanagedCodeSecurity] - public static extern void RfromQ(out Matrix3 R, ref Quaternion q); + internal static extern void RfromQ(out Matrix3 R, ref Quaternion q); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRFromZAxis"), SuppressUnmanagedCodeSecurity] - public static extern void RFromZAxis(out Matrix3 R, dReal ax, dReal ay, dReal az); + internal static extern void RFromZAxis(out Matrix3 R, dReal ax, dReal ay, dReal az); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dRSetIdentity"), SuppressUnmanagedCodeSecurity] - public static extern void RSetIdentity(out Matrix3 R); + internal static extern void RSetIdentity(out Matrix3 R); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSetValue"), SuppressUnmanagedCodeSecurity] - public static extern void SetValue(out dReal a, int n); + internal static extern void SetValue(out dReal a, int n); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSetZero"), SuppressUnmanagedCodeSecurity] - public static extern void SetZero(out dReal a, int n); + internal static extern void SetZero(out dReal a, int n); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSimpleSpaceCreate"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr SimpleSpaceCreate(IntPtr space); + internal static extern IntPtr SimpleSpaceCreate(IntPtr space); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveCholesky"), SuppressUnmanagedCodeSecurity] - public static extern void SolveCholesky(ref dReal L, out dReal b, int n); + internal static extern void SolveCholesky(ref dReal L, out dReal b, int n); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveL1"), SuppressUnmanagedCodeSecurity] - public static extern void SolveL1(ref dReal L, out dReal b, int n, int nskip); + internal static extern void SolveL1(ref dReal L, out dReal b, int n, int nskip); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveL1T"), SuppressUnmanagedCodeSecurity] - public static extern void SolveL1T(ref dReal L, out dReal b, int n, int nskip); + internal static extern void SolveL1T(ref dReal L, out dReal b, int n, int nskip); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSolveLDLT"), SuppressUnmanagedCodeSecurity] - public static extern void SolveLDLT(ref dReal L, ref dReal d, out dReal b, int n, int nskip); + internal static extern void SolveLDLT(ref dReal L, ref dReal d, out dReal b, int n, int nskip); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceAdd"), SuppressUnmanagedCodeSecurity] - public static extern void SpaceAdd(IntPtr space, IntPtr geom); + internal static extern void SpaceAdd(IntPtr space, IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceLockQuery"), SuppressUnmanagedCodeSecurity] - public static extern bool SpaceLockQuery(IntPtr space); + internal static extern bool SpaceLockQuery(IntPtr space); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceClean"), SuppressUnmanagedCodeSecurity] - public static extern void SpaceClean(IntPtr space); + internal static extern void SpaceClean(IntPtr space); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceCollide"), SuppressUnmanagedCodeSecurity] - public static extern void SpaceCollide(IntPtr space, IntPtr data, NearCallback callback); + internal static extern void SpaceCollide(IntPtr space, IntPtr data, NearCallback callback); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceCollide2"), SuppressUnmanagedCodeSecurity] - public static extern void SpaceCollide2(IntPtr space1, IntPtr space2, IntPtr data, NearCallback callback); + internal static extern void SpaceCollide2(IntPtr space1, IntPtr space2, IntPtr data, NearCallback callback); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceDestroy"), SuppressUnmanagedCodeSecurity] - public static extern void SpaceDestroy(IntPtr space); + internal static extern void SpaceDestroy(IntPtr space); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetCleanup"), SuppressUnmanagedCodeSecurity] - public static extern bool SpaceGetCleanup(IntPtr space); + internal static extern bool SpaceGetCleanup(IntPtr space); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetNumGeoms"), SuppressUnmanagedCodeSecurity] - public static extern int SpaceGetNumGeoms(IntPtr space); + internal static extern int SpaceGetNumGeoms(IntPtr space); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetGeom"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr SpaceGetGeom(IntPtr space, int i); + internal static extern IntPtr SpaceGetGeom(IntPtr space, int i); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceGetSublevel"), SuppressUnmanagedCodeSecurity] - public static extern int SpaceGetSublevel(IntPtr space); + internal static extern int SpaceGetSublevel(IntPtr space); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceQuery"), SuppressUnmanagedCodeSecurity] - public static extern bool SpaceQuery(IntPtr space, IntPtr geom); + internal static extern bool SpaceQuery(IntPtr space, IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceRemove"), SuppressUnmanagedCodeSecurity] - public static extern void SpaceRemove(IntPtr space, IntPtr geom); + internal static extern void SpaceRemove(IntPtr space, IntPtr geom); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceSetCleanup"), SuppressUnmanagedCodeSecurity] - public static extern void SpaceSetCleanup(IntPtr space, bool mode); + internal static extern void SpaceSetCleanup(IntPtr space, bool mode); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSpaceSetSublevel"), SuppressUnmanagedCodeSecurity] - public static extern void SpaceSetSublevel(IntPtr space, int sublevel); + internal static extern void SpaceSetSublevel(IntPtr space, int sublevel); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dSweepAndPruneSpaceCreate"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr SweepAndPruneSpaceCreate(IntPtr space, int AxisOrder); + internal static extern IntPtr SweepAndPruneSpaceCreate(IntPtr space, int AxisOrder); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dVectorScale"), SuppressUnmanagedCodeSecurity] - public static extern void VectorScale(out dReal a, ref dReal d, int n); + internal static extern void VectorScale(out dReal a, ref dReal d, int n); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldCreate"), SuppressUnmanagedCodeSecurity] - public static extern IntPtr WorldCreate(); + internal static extern IntPtr WorldCreate(); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldDestroy"), SuppressUnmanagedCodeSecurity] - public static extern void WorldDestroy(IntPtr world); + internal static extern void WorldDestroy(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableAverageSamplesCount"), SuppressUnmanagedCodeSecurity] - public static extern int WorldGetAutoDisableAverageSamplesCount(IntPtr world); + internal static extern int WorldGetAutoDisableAverageSamplesCount(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetAutoDisableAngularThreshold(IntPtr world); + internal static extern dReal WorldGetAutoDisableAngularThreshold(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] - public static extern bool WorldGetAutoDisableFlag(IntPtr world); + internal static extern bool WorldGetAutoDisableFlag(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetAutoDisableLinearThreshold(IntPtr world); + internal static extern dReal WorldGetAutoDisableLinearThreshold(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] - public static extern int WorldGetAutoDisableSteps(IntPtr world); + internal static extern int WorldGetAutoDisableSteps(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoDisableTime"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetAutoDisableTime(IntPtr world); + internal static extern dReal WorldGetAutoDisableTime(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAutoEnableDepthSF1"), SuppressUnmanagedCodeSecurity] - public static extern int WorldGetAutoEnableDepthSF1(IntPtr world); + internal static extern int WorldGetAutoEnableDepthSF1(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetCFM"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetCFM(IntPtr world); + internal static extern dReal WorldGetCFM(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetERP"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetERP(IntPtr world); + internal static extern dReal WorldGetERP(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetGravity"), SuppressUnmanagedCodeSecurity] - public static extern void WorldGetGravity(IntPtr world, out Vector3 gravity); + internal static extern void WorldGetGravity(IntPtr world, out Vector3 gravity); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetGravity"), SuppressUnmanagedCodeSecurity] - public static extern void WorldGetGravity(IntPtr world, out dReal X); + internal static extern void WorldGetGravity(IntPtr world, out dReal X); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetContactMaxCorrectingVel"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetContactMaxCorrectingVel(IntPtr world); + internal static extern dReal WorldGetContactMaxCorrectingVel(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetContactSurfaceLayer"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetContactSurfaceLayer(IntPtr world); + internal static extern dReal WorldGetContactSurfaceLayer(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAngularDamping"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetAngularDamping(IntPtr world); + internal static extern dReal WorldGetAngularDamping(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetAngularDampingThreshold(IntPtr world); + internal static extern dReal WorldGetAngularDampingThreshold(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetLinearDamping"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetLinearDamping(IntPtr world); + internal static extern dReal WorldGetLinearDamping(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetLinearDampingThreshold(IntPtr world); + internal static extern dReal WorldGetLinearDampingThreshold(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetQuickStepNumIterations"), SuppressUnmanagedCodeSecurity] - public static extern int WorldGetQuickStepNumIterations(IntPtr world); + internal static extern int WorldGetQuickStepNumIterations(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetQuickStepW"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetQuickStepW(IntPtr world); + internal static extern dReal WorldGetQuickStepW(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldGetMaxAngularSpeed"), SuppressUnmanagedCodeSecurity] - public static extern dReal WorldGetMaxAngularSpeed(IntPtr world); + internal static extern dReal WorldGetMaxAngularSpeed(IntPtr world); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldImpulseToForce"), SuppressUnmanagedCodeSecurity] - public static extern void WorldImpulseToForce(IntPtr world, dReal stepsize, dReal ix, dReal iy, dReal iz, out Vector3 force); + internal static extern void WorldImpulseToForce(IntPtr world, dReal stepsize, dReal ix, dReal iy, dReal iz, out Vector3 force); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldImpulseToForce"), SuppressUnmanagedCodeSecurity] - public static extern void WorldImpulseToForce(IntPtr world, dReal stepsize, dReal ix, dReal iy, dReal iz, out dReal forceX); + internal static extern void WorldImpulseToForce(IntPtr world, dReal stepsize, dReal ix, dReal iy, dReal iz, out dReal forceX); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldQuickStep"), SuppressUnmanagedCodeSecurity] - public static extern void WorldQuickStep(IntPtr world, dReal stepsize); + internal static extern void WorldQuickStep(IntPtr world, dReal stepsize); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAngularDamping"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetAngularDamping(IntPtr world, dReal scale); + internal static extern void WorldSetAngularDamping(IntPtr world, dReal scale); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAngularDampingThreshold"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetAngularDampingThreshold(IntPtr world, dReal threshold); + internal static extern void WorldSetAngularDampingThreshold(IntPtr world, dReal threshold); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableAngularThreshold"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetAutoDisableAngularThreshold(IntPtr world, dReal angular_threshold); + internal static extern void WorldSetAutoDisableAngularThreshold(IntPtr world, dReal angular_threshold); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableAverageSamplesCount"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetAutoDisableAverageSamplesCount(IntPtr world, int average_samples_count); + internal static extern void WorldSetAutoDisableAverageSamplesCount(IntPtr world, int average_samples_count); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableFlag"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetAutoDisableFlag(IntPtr world, bool do_auto_disable); + internal static extern void WorldSetAutoDisableFlag(IntPtr world, bool do_auto_disable); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableLinearThreshold"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetAutoDisableLinearThreshold(IntPtr world, dReal linear_threshold); + internal static extern void WorldSetAutoDisableLinearThreshold(IntPtr world, dReal linear_threshold); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableSteps"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetAutoDisableSteps(IntPtr world, int steps); + internal static extern void WorldSetAutoDisableSteps(IntPtr world, int steps); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoDisableTime"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetAutoDisableTime(IntPtr world, dReal time); + internal static extern void WorldSetAutoDisableTime(IntPtr world, dReal time); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetAutoEnableDepthSF1"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetAutoEnableDepthSF1(IntPtr world, int autoEnableDepth); + internal static extern void WorldSetAutoEnableDepthSF1(IntPtr world, int autoEnableDepth); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetCFM"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetCFM(IntPtr world, dReal cfm); + internal static extern void WorldSetCFM(IntPtr world, dReal cfm); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetContactMaxCorrectingVel"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetContactMaxCorrectingVel(IntPtr world, dReal vel); + internal static extern void WorldSetContactMaxCorrectingVel(IntPtr world, dReal vel); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetContactSurfaceLayer"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetContactSurfaceLayer(IntPtr world, dReal depth); + internal static extern void WorldSetContactSurfaceLayer(IntPtr world, dReal depth); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetDamping"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetDamping(IntPtr world, dReal linear_scale, dReal angular_scale); + internal static extern void WorldSetDamping(IntPtr world, dReal linear_scale, dReal angular_scale); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetERP"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetERP(IntPtr world, dReal erp); + internal static extern void WorldSetERP(IntPtr world, dReal erp); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetGravity"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetGravity(IntPtr world, dReal x, dReal y, dReal z); + internal static extern void WorldSetGravity(IntPtr world, dReal x, dReal y, dReal z); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetLinearDamping"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetLinearDamping(IntPtr world, dReal scale); + internal static extern void WorldSetLinearDamping(IntPtr world, dReal scale); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetLinearDampingThreshold"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetLinearDampingThreshold(IntPtr world, dReal threshold); + internal static extern void WorldSetLinearDampingThreshold(IntPtr world, dReal threshold); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetQuickStepNumIterations"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetQuickStepNumIterations(IntPtr world, int num); + internal static extern void WorldSetQuickStepNumIterations(IntPtr world, int num); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetQuickStepW"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetQuickStepW(IntPtr world, dReal over_relaxation); + internal static extern void WorldSetQuickStepW(IntPtr world, dReal over_relaxation); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldSetMaxAngularSpeed"), SuppressUnmanagedCodeSecurity] - public static extern void WorldSetMaxAngularSpeed(IntPtr world, dReal max_speed); + internal static extern void WorldSetMaxAngularSpeed(IntPtr world, dReal max_speed); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldStep"), SuppressUnmanagedCodeSecurity] - public static extern void WorldStep(IntPtr world, dReal stepsize); + internal static extern void WorldStep(IntPtr world, dReal stepsize); [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldStepFast1"), SuppressUnmanagedCodeSecurity] - public static extern void WorldStepFast1(IntPtr world, dReal stepsize, int maxiterations); - - [DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dWorldExportDIF"), SuppressUnmanagedCodeSecurity] - public static extern void WorldExportDIF(IntPtr world, string filename, bool append, string prefix); + internal static extern void WorldStepFast1(IntPtr world, dReal stepsize, int maxiterations); } } diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index f111e879f5..60cc5497da 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs @@ -32,7 +32,6 @@ using System; using System.Collections.Generic; using System.Reflection; using OpenMetaverse; -using OdeAPI; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; using log4net; @@ -43,7 +42,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. /// - public enum dParam : int + public enum dParam:int { LowStop = 0, HiStop = 1, @@ -68,7 +67,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde StopCFM3 = 8 + 512 } - public class OdeCharacter : PhysicsActor + public class OdeCharacter:PhysicsActor { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -122,7 +121,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private bool m_freemove = false; -// private string m_name = String.Empty; + // private string m_name = String.Empty; // other filter control int m_colliderfilter = 0; int m_colliderGroundfilter = 0; @@ -144,7 +143,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public IntPtr Amotor = IntPtr.Zero; - public d.Mass ShellMass; + internal SafeNativeMethods.Mass ShellMass; public int m_eventsubscription = 0; private int m_cureventsubscription = 0; @@ -165,7 +164,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private float m_targetHoverHeight; - public OdeCharacter(uint localID, String avName, ODEScene parent_scene, Vector3 pos, Vector3 pSize, float pfeetOffset, float density, float walk_divisor, float rundivisor) + public OdeCharacter(uint localID,String avName,ODEScene parent_scene,Vector3 pos,Vector3 pSize,float pfeetOffset,float density,float walk_divisor,float rundivisor) { m_uuid = UUID.Random(); m_localID = localID; @@ -174,21 +173,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde timeStep = parent_scene.ODE_STEPSIZE; invtimeStep = 1 / timeStep; - if (pos.IsFinite()) + if(pos.IsFinite()) { - if (pos.Z > 99999f) + if(pos.Z > 99999f) { - pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; + pos.Z = parent_scene.GetTerrainHeightAtXY(127,127) + 5; } - if (pos.Z < -100f) // shouldn't this be 0 ? + if(pos.Z < -100f) // shouldn't this be 0 ? { - pos.Z = parent_scene.GetTerrainHeightAtXY(127, 127) + 5; + pos.Z = parent_scene.GetTerrainHeightAtXY(127,127) + 5; } _position = pos; } else { - _position = new Vector3(((float)m_parent_scene.WorldExtents.X * 0.5f), ((float)m_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128f, 128f) + 10f); + _position = new Vector3(((float)m_parent_scene.WorldExtents.X * 0.5f),((float)m_parent_scene.WorldExtents.Y * 0.5f),parent_scene.GetTerrainHeightAtXY(128f,128f) + 10f); m_log.Warn("[PHYSICS]: Got NaN Position on Character Create"); } @@ -216,7 +215,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde walkDivisor = walk_divisor; runDivisor = rundivisor; - m_mass = m_density * m_size.X * m_size.Y * m_size.Z; ; // sure we have a default + m_mass = m_density * m_size.X * m_size.Y * m_size.Z; + ; // sure we have a default PID_D = basePID_D * m_mass * invtimeStep; PID_P = basePID_P * m_mass * invtimeStep; @@ -225,13 +225,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde Name = avName; - AddChange(changes.Add, null); + AddChange(changes.Add,null); } public override int PhysicsActorType { - get { return (int)ActorTypes.Agent; } - set { return; } + get + { + return (int)ActorTypes.Agent; + } + set + { + return; + } } public override void getContactData(ref ContactData cdata) @@ -241,68 +247,116 @@ namespace OpenSim.Region.PhysicsModule.ubOde cdata.softcolide = false; } - public override bool Building { get; set; } + public override bool Building + { + get; set; + } /// /// If this is set, the avatar will move faster /// public override bool SetAlwaysRun { - get { return m_alwaysRun; } - set { m_alwaysRun = value; } + get + { + return m_alwaysRun; + } + set + { + m_alwaysRun = value; + } } public override uint LocalID { - get { return m_localID; } - set { m_localID = value; } + get + { + return m_localID; + } + set + { + m_localID = value; + } } public override PhysicsActor ParentActor { - get { return (PhysicsActor)this; } + get + { + return (PhysicsActor)this; + } } public override bool Grabbed { - set { return; } + set + { + return; + } } public override bool Selected { - set { return; } + set + { + return; + } } public override float Buoyancy { - get { return m_buoyancy; } - set { m_buoyancy = value; } + get + { + return m_buoyancy; + } + set + { + m_buoyancy = value; + } } public override bool FloatOnWater { - set { return; } + set + { + return; + } } public override bool IsPhysical { - get { return m_isPhysical; } - set { return; } + get + { + return m_isPhysical; + } + set + { + return; + } } public override bool ThrottleUpdates { - get { return false; } - set { return; } + get + { + return false; + } + set + { + return; + } } public override bool Flying { - get { return m_flying; } + get + { + return m_flying; + } set { m_flying = value; -// m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying); + // m_log.DebugFormat("[PHYSICS]: Set OdeCharacter Flying to {0}", flying); } } @@ -312,23 +366,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// public override bool IsColliding { - get { return (m_iscolliding || m_iscollidingGround); } + get + { + return (m_iscolliding || m_iscollidingGround); + } set { - if (value) + if(value) { m_colliderfilter += 3; - if (m_colliderfilter > 3) + if(m_colliderfilter > 3) m_colliderfilter = 3; } else { m_colliderfilter--; - if (m_colliderfilter < 0) + if(m_colliderfilter < 0) m_colliderfilter = 0; } - if (m_colliderfilter == 0) + if(m_colliderfilter == 0) m_iscolliding = false; else { @@ -344,28 +401,31 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// public override bool CollidingGround { - get { return m_iscollidingGround; } + get + { + return m_iscollidingGround; + } set { -/* we now control this - if (value) - { - m_colliderGroundfilter += 2; - if (m_colliderGroundfilter > 2) - m_colliderGroundfilter = 2; - } - else - { - m_colliderGroundfilter--; - if (m_colliderGroundfilter < 0) - m_colliderGroundfilter = 0; - } + /* we now control this + if (value) + { + m_colliderGroundfilter += 2; + if (m_colliderGroundfilter > 2) + m_colliderGroundfilter = 2; + } + else + { + m_colliderGroundfilter--; + if (m_colliderGroundfilter < 0) + m_colliderGroundfilter = 0; + } - if (m_colliderGroundfilter == 0) - m_iscollidingGround = false; - else - m_iscollidingGround = true; - */ + if (m_colliderGroundfilter == 0) + m_iscollidingGround = false; + else + m_iscollidingGround = true; + */ } } @@ -375,31 +435,34 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// public override bool CollidingObj { - get { return m_iscollidingObj; } + get + { + return m_iscollidingObj; + } set { // Ubit filter this also - if (value) + if(value) { m_colliderObjectfilter += 2; - if (m_colliderObjectfilter > 2) + if(m_colliderObjectfilter > 2) m_colliderObjectfilter = 2; } else { m_colliderObjectfilter--; - if (m_colliderObjectfilter < 0) + if(m_colliderObjectfilter < 0) m_colliderObjectfilter = 0; } - if (m_colliderObjectfilter == 0) + if(m_colliderObjectfilter == 0) m_iscollidingObj = false; else m_iscollidingObj = true; -// m_iscollidingObj = value; + // m_iscollidingObj = value; - if (m_iscollidingObj) + if(m_iscollidingObj) m_pidControllerActive = false; else m_pidControllerActive = true; @@ -418,7 +481,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override bool Stopped { - get { return _zeroFlag; } + get + { + return _zeroFlag; + } } /// @@ -428,20 +494,23 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// public override Vector3 Position { - get { return _position; } + get + { + return _position; + } set { - if (value.IsFinite()) + if(value.IsFinite()) { - if (value.Z > 9999999f) + if(value.Z > 9999999f) { - value.Z = m_parent_scene.GetTerrainHeightAtXY(127, 127) + 5; + value.Z = m_parent_scene.GetTerrainHeightAtXY(127,127) + 5; } - if (value.Z < -100f) + if(value.Z < -100f) { - value.Z = m_parent_scene.GetTerrainHeightAtXY(127, 127) + 5; + value.Z = m_parent_scene.GetTerrainHeightAtXY(127,127) + 5; } - AddChange(changes.Position, value); + AddChange(changes.Position,value); } else { @@ -452,8 +521,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override Vector3 RotationalVelocity { - get { return m_rotationalVelocity; } - set { m_rotationalVelocity = value; } + get + { + return m_rotationalVelocity; + } + set + { + m_rotationalVelocity = value; + } } /// @@ -468,7 +543,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - if (value.IsFinite()) + if(value.IsFinite()) { if(value.X <0.01f) value.X = 0.01f; @@ -477,7 +552,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(value.Z <0.01f) value.Z = 0.01f; - AddChange(changes.Size, value); + AddChange(changes.Size,value); } else { @@ -486,21 +561,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - public override void setAvatarSize(Vector3 size, float feetOffset) + public override void setAvatarSize(Vector3 size,float feetOffset) { - if (size.IsFinite()) + if(size.IsFinite()) { - if (size.X < 0.01f) + if(size.X < 0.01f) size.X = 0.01f; - if (size.Y < 0.01f) + if(size.Y < 0.01f) size.Y = 0.01f; - if (size.Z < 0.01f) + if(size.Z < 0.01f) size.Z = 0.01f; strAvatarSize st = new strAvatarSize(); st.size = size; st.offset = feetOffset; - AddChange(changes.AvatarSize, st); + AddChange(changes.AvatarSize,st); } else { @@ -545,32 +620,44 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override Vector3 Force { - get { return _target_velocity; } - set { return; } + get + { + return _target_velocity; + } + set + { + return; + } } public override int VehicleType { - get { return 0; } - set { return; } + get + { + return 0; + } + set + { + return; + } } - public override void VehicleFloatParam(int param, float value) + public override void VehicleFloatParam(int param,float value) { } - public override void VehicleVectorParam(int param, Vector3 value) + public override void VehicleVectorParam(int param,Vector3 value) { } - public override void VehicleRotationParam(int param, Quaternion rotation) + public override void VehicleRotationParam(int param,Quaternion rotation) { } - public override void VehicleFlags(int param, bool remove) + public override void VehicleFlags(int param,bool remove) { } @@ -600,7 +687,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override PrimitiveBaseShape Shape { - set { return; } + set + { + return; + } } public override Vector3 rootVelocity @@ -619,9 +709,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - if (value.IsFinite()) + if(value.IsFinite()) { - AddChange(changes.Velocity, value); + AddChange(changes.Velocity,value); } else { @@ -638,9 +728,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde } set { - if (value.IsFinite()) + if(value.IsFinite()) { - AddChange(changes.TargetVelocity, value); + AddChange(changes.TargetVelocity,value); } else { @@ -651,38 +741,62 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override Vector3 Torque { - get { return Vector3.Zero; } - set { return; } + get + { + return Vector3.Zero; + } + set + { + return; + } } public override float CollisionScore { - get { return 0f; } - set { } + get + { + return 0f; + } + set + { + } } public override bool Kinematic { - get { return false; } - set { } + get + { + return false; + } + set + { + } } public override Quaternion Orientation { - get { return m_orientation; } + get + { + return m_orientation; + } set { -// fakeori = value; -// givefakeori++; + // fakeori = value; + // givefakeori++; value.Normalize(); - AddChange(changes.Orientation, value); + AddChange(changes.Orientation,value); } } public override Vector3 Acceleration { - get { return _acceleration; } - set { } + get + { + return _acceleration; + } + set + { + } } public void SetAcceleration(Vector3 accel) @@ -696,17 +810,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// The PID controller takes this target velocity and tries to make it a reality /// /// - public override void AddForce(Vector3 force, bool pushforce) + public override void AddForce(Vector3 force,bool pushforce) { - if (force.IsFinite()) + if(force.IsFinite()) { - if (pushforce) + if(pushforce) { - AddChange(changes.Force, force * m_density / (m_parent_scene.ODE_STEPSIZE * 28f)); + AddChange(changes.Force,force * m_density / (m_parent_scene.ODE_STEPSIZE * 28f)); } else { - AddChange(changes.TargetVelocity, force); + AddChange(changes.TargetVelocity,force); } } else @@ -716,19 +830,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde //m_lastUpdateSent = false; } - public override void AddAngularForce(Vector3 force, bool pushforce) + public override void AddAngularForce(Vector3 force,bool pushforce) { } public override void SetMomentum(Vector3 momentum) { - if (momentum.IsFinite()) - AddChange(changes.Momentum, momentum); + if(momentum.IsFinite()) + AddChange(changes.Momentum,momentum); } - private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ) + private void AvatarGeomAndBodyCreation(float npositionX,float npositionY,float npositionZ) { // sizes one day should came from visual parameters float sx = m_size.X; @@ -739,7 +853,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde boneOff = bot + 0.3f; float feetsz = sz * 0.45f; - if (feetsz > 0.6f) + if(feetsz > 0.6f) feetsz = 0.6f; feetOff = bot + feetsz; @@ -751,28 +865,28 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_parent_scene.waitForSpaceUnlock(m_parent_scene.CharsSpace); - collider = d.SimpleSpaceCreate(m_parent_scene.CharsSpace); - d.SpaceSetSublevel(collider, 3); - d.SpaceSetCleanup(collider, false); - d.GeomSetCategoryBits(collider, (uint)m_collisionCategories); - d.GeomSetCollideBits(collider, (uint)m_collisionFlags); + collider = SafeNativeMethods.SimpleSpaceCreate(m_parent_scene.CharsSpace); + SafeNativeMethods.SpaceSetSublevel(collider,3); + SafeNativeMethods.SpaceSetCleanup(collider,false); + SafeNativeMethods.GeomSetCategoryBits(collider,(uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(collider,(uint)m_collisionFlags); float r = m_size.X; - if (m_size.Y > r) + if(m_size.Y > r) r = m_size.Y; float l = m_size.Z - r; r *= 0.5f; - capsule = d.CreateCapsule(collider, r, l); + capsule = SafeNativeMethods.CreateCapsule(collider,r,l); m_mass = m_density * m_size.X * m_size.Y * m_size.Z; // update mass - d.MassSetBoxTotal(out ShellMass, m_mass, m_size.X, m_size.Y, m_size.Z); + SafeNativeMethods.MassSetBoxTotal(out ShellMass,m_mass,m_size.X,m_size.Y,m_size.Z); PID_D = basePID_D * m_mass / m_parent_scene.ODE_STEPSIZE; PID_P = basePID_P * m_mass / m_parent_scene.ODE_STEPSIZE; - Body = d.BodyCreate(m_parent_scene.world); + Body = SafeNativeMethods.BodyCreate(m_parent_scene.world); _zeroFlag = false; m_pidControllerActive = true; @@ -780,53 +894,53 @@ namespace OpenSim.Region.PhysicsModule.ubOde _velocity = Vector3.Zero; - d.BodySetAutoDisableFlag(Body, false); - d.BodySetPosition(Body, npositionX, npositionY, npositionZ); + SafeNativeMethods.BodySetAutoDisableFlag(Body,false); + SafeNativeMethods.BodySetPosition(Body,npositionX,npositionY,npositionZ); _position.X = npositionX; _position.Y = npositionY; _position.Z = npositionZ; - d.BodySetMass(Body, ref ShellMass); - d.GeomSetBody(capsule, Body); + SafeNativeMethods.BodySetMass(Body,ref ShellMass); + SafeNativeMethods.GeomSetBody(capsule,Body); // The purpose of the AMotor here is to keep the avatar's physical // surrogate from rotating while moving - Amotor = d.JointCreateAMotor(m_parent_scene.world, IntPtr.Zero); - d.JointAttach(Amotor, Body, IntPtr.Zero); + Amotor = SafeNativeMethods.JointCreateAMotor(m_parent_scene.world,IntPtr.Zero); + SafeNativeMethods.JointAttach(Amotor,Body,IntPtr.Zero); - d.JointSetAMotorMode(Amotor, 0); - d.JointSetAMotorNumAxes(Amotor, 3); - d.JointSetAMotorAxis(Amotor, 0, 0, 1, 0, 0); - d.JointSetAMotorAxis(Amotor, 1, 0, 0, 1, 0); - d.JointSetAMotorAxis(Amotor, 2, 0, 0, 0, 1); + SafeNativeMethods.JointSetAMotorMode(Amotor,0); + SafeNativeMethods.JointSetAMotorNumAxes(Amotor,3); + SafeNativeMethods.JointSetAMotorAxis(Amotor,0,0,1,0,0); + SafeNativeMethods.JointSetAMotorAxis(Amotor,1,0,0,1,0); + SafeNativeMethods.JointSetAMotorAxis(Amotor,2,0,0,0,1); - d.JointSetAMotorAngle(Amotor, 0, 0); - d.JointSetAMotorAngle(Amotor, 1, 0); - d.JointSetAMotorAngle(Amotor, 2, 0); + SafeNativeMethods.JointSetAMotorAngle(Amotor,0,0); + SafeNativeMethods.JointSetAMotorAngle(Amotor,1,0); + SafeNativeMethods.JointSetAMotorAngle(Amotor,2,0); - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM, 0f); // make it HARD - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM2, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM3, 0f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopERP, 0.8f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopERP2, 0.8f); - d.JointSetAMotorParam(Amotor, (int)dParam.StopERP3, 0.8f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopCFM,0f); // make it HARD + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopCFM2,0f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopCFM3,0f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopERP,0.8f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopERP2,0.8f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.StopERP3,0.8f); // These lowstops and high stops are effectively (no wiggle room) - d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -1e-5f); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 1e-5f); - d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -1e-5f); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 1e-5f); - d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -1e-5f); - d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.LowStop,-1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.HiStop,1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.LoStop2,-1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.HiStop2,1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.LoStop3,-1e-5f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.HiStop3,1e-5f); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.Vel, 0); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.Vel2, 0); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.Vel3, 0); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)SafeNativeMethods.JointParam.Vel,0); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)SafeNativeMethods.JointParam.Vel2,0); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)SafeNativeMethods.JointParam.Vel3,0); - d.JointSetAMotorParam(Amotor, (int)dParam.FMax, 5e8f); - d.JointSetAMotorParam(Amotor, (int)dParam.FMax2, 5e8f); - d.JointSetAMotorParam(Amotor, (int)dParam.FMax3, 5e8f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.FMax,5e8f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.FMax2,5e8f); + SafeNativeMethods.JointSetAMotorParam(Amotor,(int)dParam.FMax3,5e8f); } /// @@ -835,38 +949,38 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void AvatarGeomAndBodyDestroy() { // Kill the Amotor - if (Amotor != IntPtr.Zero) + if(Amotor != IntPtr.Zero) { - d.JointDestroy(Amotor); + SafeNativeMethods.JointDestroy(Amotor); Amotor = IntPtr.Zero; } - if (Body != IntPtr.Zero) + if(Body != IntPtr.Zero) { //kill the body - d.BodyDestroy(Body); + SafeNativeMethods.BodyDestroy(Body); Body = IntPtr.Zero; } //kill the Geoms - if (capsule != IntPtr.Zero) + if(capsule != IntPtr.Zero) { m_parent_scene.actor_name_map.Remove(capsule); m_parent_scene.waitForSpaceUnlock(collider); - d.GeomDestroy(capsule); + SafeNativeMethods.GeomDestroy(capsule); capsule = IntPtr.Zero; } - if (collider != IntPtr.Zero) + if(collider != IntPtr.Zero) { - d.SpaceDestroy(collider); + SafeNativeMethods.SpaceDestroy(collider); collider = IntPtr.Zero; } } //in place 2D rotation around Z assuming rot is normalised and is a rotation around Z - public void RotateXYonZ(ref float x, ref float y, ref Quaternion rot) + public void RotateXYonZ(ref float x,ref float y,ref Quaternion rot) { float sin = 2.0f * rot.Z * rot.W; float cos = rot.W * rot.W - rot.Z * rot.Z; @@ -875,22 +989,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde x = tx * cos - y * sin; y = tx * sin + y * cos; } - public void RotateXYonZ(ref float x, ref float y, ref float sin, ref float cos) + public void RotateXYonZ(ref float x,ref float y,ref float sin,ref float cos) { float tx = x; x = tx * cos - y * sin; y = tx * sin + y * cos; } - public void invRotateXYonZ(ref float x, ref float y, ref float sin, ref float cos) + public void invRotateXYonZ(ref float x,ref float y,ref float sin,ref float cos) { float tx = x; x = tx * cos + y * sin; y = -tx * sin + y * cos; } - public void invRotateXYonZ(ref float x, ref float y, ref Quaternion rot) + public void invRotateXYonZ(ref float x,ref float y,ref Quaternion rot) { - float sin = - 2.0f * rot.Z * rot.W; + float sin = -2.0f * rot.Z * rot.W; float cos = rot.W * rot.W - rot.Z * rot.Z; float tx = x; @@ -898,13 +1012,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde y = tx * sin + y * cos; } - public bool Collide(IntPtr me, IntPtr other, bool reverse, ref d.ContactGeom contact, - ref d.ContactGeom altContact , ref bool useAltcontact, ref bool feetcollision) - { + internal bool Collide(IntPtr me,IntPtr other,bool reverse,ref SafeNativeMethods.ContactGeom contact, + ref SafeNativeMethods.ContactGeom altContact,ref bool useAltcontact,ref bool feetcollision) + { feetcollision = false; useAltcontact = false; - if (me == capsule) + if(me == capsule) { Vector3 offset; @@ -914,25 +1028,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde offset.X = contact.pos.X - _position.X; offset.Y = contact.pos.Y - _position.Y; - d.GeomClassID gtype = d.GeomGetClass(other); - if (gtype == d.GeomClassID.CapsuleClass) + SafeNativeMethods.GeomClassID gtype = SafeNativeMethods.GeomGetClass(other); + if(gtype == SafeNativeMethods.GeomClassID.CapsuleClass) { Vector3 roff = offset * Quaternion.Inverse(m_orientation2D); float r = roff.X *roff.X / AvaAvaSizeXsq; r += (roff.Y * roff.Y) / AvaAvaSizeYsq; - if (r > 1.0f) + if(r > 1.0f) return false; float dp = 1.0f -(float)Math.Sqrt((double)r); - if (dp > 0.05f) + if(dp > 0.05f) dp = 0.05f; contact.depth = dp; - if (offset.Z < 0) + if(offset.Z < 0) { feetcollision = true; - if (h < boneOff) + if(h < boneOff) { m_collideNormal.X = contact.normal.X; m_collideNormal.Y = contact.normal.Y; @@ -943,18 +1057,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde return true; } - if (gtype == d.GeomClassID.SphereClass && d.GeomGetBody(other) != IntPtr.Zero) + if(gtype == SafeNativeMethods.GeomClassID.SphereClass && SafeNativeMethods.GeomGetBody(other) != IntPtr.Zero) { - if(d.GeomSphereGetRadius(other) < 0.5) + if(SafeNativeMethods.GeomSphereGetRadius(other) < 0.5) return true; } - if (offset.Z > 0 || contact.normal.Z > 0.35f) + if(offset.Z > 0 || contact.normal.Z > 0.35f) { - if (offset.Z <= 0) + if(offset.Z <= 0) { feetcollision = true; - if (h < boneOff) + if(h < boneOff) { m_collideNormal.X = contact.normal.X; m_collideNormal.Y = contact.normal.Y; @@ -969,7 +1083,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde return true; feetcollision = true; - if (h < boneOff) + if(h < boneOff) { m_collideNormal.X = contact.normal.X; m_collideNormal.Y = contact.normal.Y; @@ -989,18 +1103,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde t = Math.Abs(t); if(t > 1e-6) { - tdp /= t; - tdp *= contact.normal.X; + tdp /= t; + tdp *= contact.normal.X; } else tdp *= 10; - if (tdp > 0.25f) + if(tdp > 0.25f) tdp = 0.25f; altContact.depth = tdp; - if (reverse) + if(reverse) { altContact.normal.X = offset.X; altContact.normal.Y = offset.Y; @@ -1024,28 +1138,28 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// public void Move(List defects) { - if (Body == IntPtr.Zero) + if(Body == IntPtr.Zero) return; - d.Vector3 dtmp = d.BodyGetPosition(Body); - Vector3 localpos = new Vector3(dtmp.X, dtmp.Y, dtmp.Z); + SafeNativeMethods.Vector3 dtmp = SafeNativeMethods.BodyGetPosition(Body); + Vector3 localpos = new Vector3(dtmp.X,dtmp.Y,dtmp.Z); // the Amotor still lets avatar rotation to drift during colisions // so force it back to identity - d.Quaternion qtmp; + SafeNativeMethods.Quaternion qtmp; qtmp.W = m_orientation2D.W; qtmp.X = m_orientation2D.X; qtmp.Y = m_orientation2D.Y; qtmp.Z = m_orientation2D.Z; - d.BodySetQuaternion(Body, ref qtmp); + SafeNativeMethods.BodySetQuaternion(Body,ref qtmp); - if (m_pidControllerActive == false) + if(m_pidControllerActive == false) { _zeroPosition = localpos; } - if (!localpos.IsFinite()) + if(!localpos.IsFinite()) { m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); defects.Add(this); @@ -1058,44 +1172,44 @@ namespace OpenSim.Region.PhysicsModule.ubOde // check outbounds forcing to be in world bool fixbody = false; - if (localpos.X < 0.0f) + if(localpos.X < 0.0f) { fixbody = true; localpos.X = 0.1f; } - else if (localpos.X > m_parent_scene.WorldExtents.X - 0.1f) + else if(localpos.X > m_parent_scene.WorldExtents.X - 0.1f) { fixbody = true; localpos.X = m_parent_scene.WorldExtents.X - 0.1f; } - if (localpos.Y < 0.0f) + if(localpos.Y < 0.0f) { fixbody = true; localpos.Y = 0.1f; } - else if (localpos.Y > m_parent_scene.WorldExtents.Y - 0.1) + else if(localpos.Y > m_parent_scene.WorldExtents.Y - 0.1) { fixbody = true; localpos.Y = m_parent_scene.WorldExtents.Y - 0.1f; } - if (fixbody) + if(fixbody) { m_freemove = false; - d.BodySetPosition(Body, localpos.X, localpos.Y, localpos.Z); + SafeNativeMethods.BodySetPosition(Body,localpos.X,localpos.Y,localpos.Z); } float breakfactor; Vector3 vec = Vector3.Zero; - dtmp = d.BodyGetLinearVel(Body); - Vector3 vel = new Vector3(dtmp.X, dtmp.Y, dtmp.Z); + dtmp = SafeNativeMethods.BodyGetLinearVel(Body); + Vector3 vel = new Vector3(dtmp.X,dtmp.Y,dtmp.Z); float velLengthSquared = vel.LengthSquared(); Vector3 ctz = _target_velocity; float movementdivisor = 1f; //Ubit change divisions into multiplications below - if (!m_alwaysRun) + if(!m_alwaysRun) movementdivisor = 1 / walkDivisor; else movementdivisor = 1 / runDivisor; @@ -1106,25 +1220,25 @@ namespace OpenSim.Region.PhysicsModule.ubOde //****************************************** // colide with land - d.AABB aabb; -// d.GeomGetAABB(feetbox, out aabb); - d.GeomGetAABB(capsule, out aabb); + SafeNativeMethods.AABB aabb; + // d.GeomGetAABB(feetbox, out aabb); + SafeNativeMethods.GeomGetAABB(capsule,out aabb); float chrminZ = aabb.MinZ; // move up a bit Vector3 posch = localpos; float ftmp; - if (m_flying) + if(m_flying) { ftmp = timeStep; posch.X += vel.X * ftmp; posch.Y += vel.Y * ftmp; } - float terrainheight = m_parent_scene.GetTerrainHeightAtXY(posch.X, posch.Y); - if (chrminZ < terrainheight) + float terrainheight = m_parent_scene.GetTerrainHeightAtXY(posch.X,posch.Y); + if(chrminZ < terrainheight) { - if (ctz.Z < 0) + if(ctz.Z < 0) ctz.Z = 0; if(!m_haveLastFallVel) @@ -1133,12 +1247,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_haveLastFallVel = true; } - Vector3 n = m_parent_scene.GetTerrainNormalAtXY(posch.X, posch.Y); + Vector3 n = m_parent_scene.GetTerrainNormalAtXY(posch.X,posch.Y); float depth = terrainheight - chrminZ; vec.Z = depth * PID_P * 50; - if (!m_flying) + if(!m_flying) { vec.Z += -vel.Z * PID_D; if(n.Z < 0.4f) @@ -1154,19 +1268,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde n.X = 0f; n.Y = 0f; n.Z = 1.0f; - } + } } } - if (depth < 0.2f) + if(depth < 0.2f) { m_colliderGroundfilter++; - if (m_colliderGroundfilter > 2) + if(m_colliderGroundfilter > 2) { m_iscolliding = true; m_colliderfilter = 2; - if (m_colliderGroundfilter > 10) + if(m_colliderGroundfilter > 10) { m_colliderGroundfilter = 10; m_freemove = false; @@ -1186,19 +1300,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde contact.SurfaceNormal.X = -n.X; contact.SurfaceNormal.Y = -n.Y; contact.SurfaceNormal.Z = -n.Z; - contact.RelativeSpeed = Vector3.Dot(m_lastFallVel, n); + contact.RelativeSpeed = Vector3.Dot(m_lastFallVel,n); contact.CharacterFeet = true; - AddCollisionEvent(0, contact); + AddCollisionEvent(0,contact); m_lastFallVel = vel; -// vec.Z *= 0.5f; + // vec.Z *= 0.5f; } } else { m_colliderGroundfilter -= 5; - if (m_colliderGroundfilter <= 0) + if(m_colliderGroundfilter <= 0) { m_colliderGroundfilter = 0; m_iscollidingGround = false; @@ -1209,7 +1323,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { m_haveLastFallVel = false; m_colliderGroundfilter -= 5; - if (m_colliderGroundfilter <= 0) + if(m_colliderGroundfilter <= 0) { m_colliderGroundfilter = 0; m_iscollidingGround = false; @@ -1218,11 +1332,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde bool hoverPIDActive = false; - if (m_useHoverPID && m_PIDHoverTau != 0 && m_PIDHoverHeight != 0) + if(m_useHoverPID && m_PIDHoverTau != 0 && m_PIDHoverHeight != 0) { hoverPIDActive = true; - switch (m_PIDHoverType) + switch(m_PIDHoverType) { case PIDHoverType.Ground: m_targetHoverHeight = terrainheight + m_PIDHoverHeight; @@ -1230,20 +1344,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde case PIDHoverType.GroundAndWater: float waterHeight = m_parent_scene.GetWaterLevel(); - if (terrainheight > waterHeight) + if(terrainheight > waterHeight) m_targetHoverHeight = terrainheight + m_PIDHoverHeight; else m_targetHoverHeight = waterHeight + m_PIDHoverHeight; break; } // end switch (m_PIDHoverType) - // don't go underground - if (m_targetHoverHeight > terrainheight + 0.5f * (aabb.MaxZ - aabb.MinZ)) + // don't go underground + if(m_targetHoverHeight > terrainheight + 0.5f * (aabb.MaxZ - aabb.MinZ)) { float fz = (m_targetHoverHeight - localpos.Z); // if error is zero, use position control; otherwise, velocity control - if (Math.Abs(fz) < 0.01f) + if(Math.Abs(fz) < 0.01f) { ctz.Z = 0; } @@ -1253,9 +1367,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde fz /= m_PIDHoverTau; float tmp = Math.Abs(fz); - if (tmp > 50) + if(tmp > 50) fz = 50 * Math.Sign(fz); - else if (tmp < 0.1) + else if(tmp < 0.1) fz = 0.1f * Math.Sign(fz); ctz.Z = fz; @@ -1264,43 +1378,43 @@ namespace OpenSim.Region.PhysicsModule.ubOde } //****************************************** - if (!m_iscolliding) + if(!m_iscolliding) m_collideNormal.Z = 0; bool tviszero = (ctz.X == 0.0f && ctz.Y == 0.0f && ctz.Z == 0.0f); - if (!tviszero) + if(!tviszero) { m_freemove = false; // movement relative to surface if moving on it // dont disturbe vertical movement, ie jumps - if (m_iscolliding && !m_flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f) + if(m_iscolliding && !m_flying && ctz.Z == 0 && m_collideNormal.Z > 0.2f && m_collideNormal.Z < 0.94f) { float p = ctz.X * m_collideNormal.X + ctz.Y * m_collideNormal.Y; ctz.X *= (float)Math.Sqrt(1 - m_collideNormal.X * m_collideNormal.X); ctz.Y *= (float)Math.Sqrt(1 - m_collideNormal.Y * m_collideNormal.Y); ctz.Z -= p; - if (ctz.Z < 0) + if(ctz.Z < 0) ctz.Z *= 2; } } - if (!m_freemove) + if(!m_freemove) { // if velocity is zero, use position control; otherwise, velocity control - if (tviszero && m_iscolliding && !m_flying) + if(tviszero && m_iscolliding && !m_flying) { // keep track of where we stopped. No more slippin' & slidin' - if (!_zeroFlag) + if(!_zeroFlag) { _zeroFlag = true; _zeroPosition = localpos; } - if (m_pidControllerActive) + if(m_pidControllerActive) { // We only want to deactivate the PID Controller if we think we want to have our surrogate // react to the physics scene by moving it's position. @@ -1313,12 +1427,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P; else vec.Z += (-vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P) * 0.2f; -/* - if (flying) - { - vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P; - } -*/ + /* + if (flying) + { + vec.Z += -vel.Z * PID_D + (_zeroPosition.Z - localpos.Z) * PID_P; + } + */ } //PidStatus = true; } @@ -1327,12 +1441,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_pidControllerActive = true; _zeroFlag = false; - if (m_iscolliding) + if(m_iscolliding) { - if (!m_flying) + if(!m_flying) { // we are on a surface - if (ctz.Z > 0f) + if(ctz.Z > 0f) { // moving up or JUMPING vec.Z += (ctz.Z - vel.Z) * PID_D * 2f; @@ -1342,9 +1456,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde else { // we are moving down on a surface - if (ctz.Z == 0) + if(ctz.Z == 0) { - if (vel.Z > 0) + if(vel.Z > 0) vec.Z -= vel.Z * PID_D * 2f; vec.X += (ctz.X - vel.X) * (PID_D); vec.Y += (ctz.Y - vel.Y) * (PID_D); @@ -1352,15 +1466,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde // intencionally going down else { - if (ctz.Z < vel.Z) + if(ctz.Z < vel.Z) vec.Z += (ctz.Z - vel.Z) * PID_D; else { } - if (Math.Abs(ctz.X) > Math.Abs(vel.X)) + if(Math.Abs(ctz.X) > Math.Abs(vel.X)) vec.X += (ctz.X - vel.X) * (PID_D); - if (Math.Abs(ctz.Y) > Math.Abs(vel.Y)) + if(Math.Abs(ctz.Y) > Math.Abs(vel.Y)) vec.Y += (ctz.Y - vel.Y) * (PID_D); } } @@ -1377,7 +1491,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else // ie not colliding { - if (m_flying || hoverPIDActive) //(!m_iscolliding && flying) + if(m_flying || hoverPIDActive) //(!m_iscolliding && flying) { // we're in mid air suspended vec.X += (ctz.X - vel.X) * (PID_D); @@ -1394,13 +1508,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde vec.X += (ctz.X - vel.X) * PID_D * 0.833f; vec.Y += (ctz.Y - vel.Y) * PID_D * 0.833f; // hack for breaking on fall - if (ctz.Z == -9999f) + if(ctz.Z == -9999f) vec.Z += -vel.Z * PID_D - m_parent_scene.gravityz * m_mass; } } } - if (velLengthSquared > 2500.0f) // 50m/s apply breaks + if(velLengthSquared > 2500.0f) // 50m/s apply breaks { breakfactor = 0.16f * m_mass; vec.X -= breakfactor * vel.X; @@ -1413,13 +1527,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde breakfactor = m_mass; vec.X -= breakfactor * vel.X; vec.Y -= breakfactor * vel.Y; - if (m_flying) + if(m_flying) vec.Z -= 0.5f * breakfactor * vel.Z; else vec.Z -= .16f* m_mass * vel.Z; } - if (m_flying || hoverPIDActive) + if(m_flying || hoverPIDActive) { vec.Z -= m_parent_scene.gravityz * m_mass; @@ -1428,18 +1542,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde //Added for auto fly height. Kitto Flora float target_altitude = terrainheight + MinimumGroundFlightOffset; - if (localpos.Z < target_altitude) + if(localpos.Z < target_altitude) { - vec.Z += (target_altitude - localpos.Z) * PID_P * 5.0f; + vec.Z += (target_altitude - localpos.Z) * PID_P * 5.0f; } // end add Kitto Flora } } - if (vec.IsFinite()) + if(vec.IsFinite()) { - if (vec.X != 0 || vec.Y !=0 || vec.Z !=0) - d.BodyAddForce(Body, vec.X, vec.Y, vec.Z); + if(vec.X != 0 || vec.Y !=0 || vec.Z !=0) + SafeNativeMethods.BodyAddForce(Body,vec.X,vec.Y,vec.Z); } else { @@ -1456,7 +1570,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // _position = localpos; _position = localpos; - if (_zeroFlag) + if(_zeroFlag) { _velocity = Vector3.Zero; _acceleration = Vector3.Zero; @@ -1464,12 +1578,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { - Vector3 a =_velocity; // previus velocity - SetSmooth(ref _velocity, ref vel, 2); + Vector3 a = _velocity; // previus velocity + SetSmooth(ref _velocity,ref vel,2); a = (_velocity - a) * invtimeStep; - SetSmooth(ref _acceleration, ref a, 2); + SetSmooth(ref _acceleration,ref a,2); - dtmp = d.BodyGetAngularVel(Body); + dtmp = SafeNativeMethods.BodyGetAngularVel(Body); m_rotationalVelocity.X = 0f; m_rotationalVelocity.Y = 0f; m_rotationalVelocity.Z = dtmp.Z; @@ -1477,30 +1591,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - public void round(ref Vector3 v, int digits) + public void round(ref Vector3 v,int digits) { - v.X = (float)Math.Round(v.X, digits); - v.Y = (float)Math.Round(v.Y, digits); - v.Z = (float)Math.Round(v.Z, digits); - } + v.X = (float)Math.Round(v.X,digits); + v.Y = (float)Math.Round(v.Y,digits); + v.Z = (float)Math.Round(v.Z,digits); + } - public void SetSmooth(ref Vector3 dst, ref Vector3 value) + public void SetSmooth(ref Vector3 dst,ref Vector3 value) { dst.X = 0.1f * dst.X + 0.9f * value.X; dst.Y = 0.1f * dst.Y + 0.9f * value.Y; dst.Z = 0.1f * dst.Z + 0.9f * value.Z; } - public void SetSmooth(ref Vector3 dst, ref Vector3 value, int rounddigits) + public void SetSmooth(ref Vector3 dst,ref Vector3 value,int rounddigits) { dst.X = 0.4f * dst.X + 0.6f * value.X; - dst.X = (float)Math.Round(dst.X, rounddigits); + dst.X = (float)Math.Round(dst.X,rounddigits); dst.Y = 0.4f * dst.Y + 0.6f * value.Y; - dst.Y = (float)Math.Round(dst.Y, rounddigits); + dst.Y = (float)Math.Round(dst.Y,rounddigits); dst.Z = 0.4f * dst.Z + 0.6f * value.Z; - dst.Z = (float)Math.Round(dst.Z, rounddigits); + dst.Z = (float)Math.Round(dst.Z,rounddigits); } @@ -1515,8 +1629,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde { return; -// if (Body == IntPtr.Zero) -// return; + // if (Body == IntPtr.Zero) + // return; } @@ -1525,16 +1639,38 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// public void Destroy() { - AddChange(changes.Remove, null); + AddChange(changes.Remove,null); } public override void CrossingFailure() { } - public override Vector3 PIDTarget { set { return; } } - public override bool PIDActive {get {return m_pidControllerActive;} set { return; } } - public override float PIDTau { set { return; } } + public override Vector3 PIDTarget + { + set + { + return; + } + } + public override bool PIDActive + { + get + { + return m_pidControllerActive; + } + set + { + return; + } + } + public override float PIDTau + { + set + { + return; + } + } public override float PIDHoverHeight { @@ -1547,11 +1683,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde { get { - return m_useHoverPID; + return m_useHoverPID; } set { - AddChange(changes.PIDHoverActive, value); + AddChange(changes.PIDHoverActive,value); } } @@ -1567,26 +1703,50 @@ namespace OpenSim.Region.PhysicsModule.ubOde { set { - float tmp =0; - if (value > 0) + float tmp = 0; + if(value > 0) { float mint = (0.05f > timeStep ? 0.05f : timeStep); - if (value < mint) + if(value < mint) tmp = mint; else tmp = value; } - AddChange(changes.PIDHoverTau, tmp); + AddChange(changes.PIDHoverTau,tmp); } } - public override Quaternion APIDTarget { set { return; } } + public override Quaternion APIDTarget + { + set + { + return; + } + } - public override bool APIDActive { set { return; } } + public override bool APIDActive + { + set + { + return; + } + } - public override float APIDStrength { set { return; } } + public override float APIDStrength + { + set + { + return; + } + } - public override float APIDDamping { set { return; } } + public override float APIDDamping + { + set + { + return; + } + } public override void SubscribeEvents(int ms) { @@ -1604,34 +1764,34 @@ namespace OpenSim.Region.PhysicsModule.ubOde CollisionEventsThisFrame.Clear(); } - public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) + public override void AddCollisionEvent(uint CollidedWith,ContactPoint contact) { lock(CollisionEventsThisFrame) - CollisionEventsThisFrame.AddCollider(CollidedWith, contact); + CollisionEventsThisFrame.AddCollider(CollidedWith,contact); m_parent_scene.AddCollisionEventReporting(this); } public void SendCollisions(int timestep) { - if (m_cureventsubscription < 50000) + if(m_cureventsubscription < 50000) m_cureventsubscription += timestep; - if (m_cureventsubscription < m_eventsubscription) + if(m_cureventsubscription < m_eventsubscription) return; lock(CollisionEventsThisFrame) { int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; - if (!SentEmptyCollisionsEvent || ncolisions > 0) + if(!SentEmptyCollisionsEvent || ncolisions > 0) { base.SendCollisionUpdate(CollisionEventsThisFrame); m_cureventsubscription = 0; - if (ncolisions == 0) + if(ncolisions == 0) { SentEmptyCollisionsEvent = true; - // _parent_scene.RemoveCollisionEventReporting(this); + // _parent_scene.RemoveCollisionEventReporting(this); } else { @@ -1644,20 +1804,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde public override bool SubscribedEvents() { - if (m_eventsubscription > 0) + if(m_eventsubscription > 0) return true; return false; } private void changePhysicsStatus(bool NewStatus) { - if (NewStatus != m_isPhysical) + if(NewStatus != m_isPhysical) { - if (NewStatus) + if(NewStatus) { AvatarGeomAndBodyDestroy(); - AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z); + AvatarGeomAndBodyCreation(_position.X,_position.Y,_position.Z); m_parent_scene.actor_name_map[collider] = (PhysicsActor)this; m_parent_scene.actor_name_map[capsule] = (PhysicsActor)this; @@ -1697,20 +1857,20 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changeSize(Vector3 pSize) { - if (pSize.IsFinite()) + if(pSize.IsFinite()) { // for now only look to Z changes since viewers also don't change X and Y - if (pSize.Z != m_size.Z) + if(pSize.Z != m_size.Z) { AvatarGeomAndBodyDestroy(); float oldsz = m_size.Z; m_size = pSize; - AvatarGeomAndBodyCreation(_position.X, _position.Y, + AvatarGeomAndBodyCreation(_position.X,_position.Y, _position.Z + (m_size.Z - oldsz) * 0.5f); -// Velocity = Vector3.Zero; + // Velocity = Vector3.Zero; m_targetVelocity = Vector3.Zero; m_parent_scene.actor_name_map[collider] = (PhysicsActor)this; @@ -1725,18 +1885,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - private void changePosition( Vector3 newPos) - { - if (Body != IntPtr.Zero) - d.BodySetPosition(Body, newPos.X, newPos.Y, newPos.Z); - _position = newPos; - m_freemove = false; - m_pidControllerActive = true; - } + private void changePosition(Vector3 newPos) + { + if(Body != IntPtr.Zero) + SafeNativeMethods.BodySetPosition(Body,newPos.X,newPos.Y,newPos.Z); + _position = newPos; + m_freemove = false; + m_pidControllerActive = true; + } private void changeOrientation(Quaternion newOri) { - if (m_orientation != newOri) + if(m_orientation != newOri) { m_orientation = newOri; // keep a copy for core use // but only use rotations around Z @@ -1745,7 +1905,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_orientation2D.Z = newOri.Z; float t = m_orientation2D.W * m_orientation2D.W + m_orientation2D.Z * m_orientation2D.Z; - if (t > 0) + if(t > 0) { t = 1.0f / (float)Math.Sqrt(t); m_orientation2D.W *= t; @@ -1759,12 +1919,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_orientation2D.Y = 0f; m_orientation2D.X = 0f; - d.Quaternion myrot = new d.Quaternion(); + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); myrot.X = m_orientation2D.X; myrot.Y = m_orientation2D.Y; myrot.Z = m_orientation2D.Z; myrot.W = m_orientation2D.W; - d.BodySetQuaternion(Body, ref myrot); + SafeNativeMethods.BodySetQuaternion(Body,ref myrot); } } @@ -1773,8 +1933,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde _velocity = newVel; setFreeMove(); - if (Body != IntPtr.Zero) - d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); + if(Body != IntPtr.Zero) + SafeNativeMethods.BodySetLinearVel(Body,newVel.X,newVel.Y,newVel.Z); } private void changeTargetVelocity(Vector3 newVel) @@ -1841,10 +2001,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde { setFreeMove(); - if (Body != IntPtr.Zero) + if(Body != IntPtr.Zero) { - if (newForce.X != 0f || newForce.Y != 0f || newForce.Z != 0) - d.BodyAddForce(Body, newForce.X, newForce.Y, newForce.Z); + if(newForce.X != 0f || newForce.Y != 0f || newForce.Z != 0) + SafeNativeMethods.BodyAddForce(Body,newForce.X,newForce.Y,newForce.Z); } } @@ -1854,15 +2014,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde _velocity = newmomentum; setFreeMove(); - if (Body != IntPtr.Zero) - d.BodySetLinearVel(Body, newmomentum.X, newmomentum.Y, newmomentum.Z); + if(Body != IntPtr.Zero) + SafeNativeMethods.BodySetLinearVel(Body,newmomentum.X,newmomentum.Y,newmomentum.Z); } private void changePIDHoverHeight(float val) { - m_PIDHoverHeight = val; - if (val == 0) - m_useHoverPID = false; + m_PIDHoverHeight = val; + if(val == 0) + m_useHoverPID = false; } private void changePIDHoverType(PIDHoverType type) @@ -1884,15 +2044,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde { } - public bool DoAChange(changes what, object arg) + public bool DoAChange(changes what,object arg) { - if (collider == IntPtr.Zero && what != changes.Add && what != changes.Remove) + if(collider == IntPtr.Zero && what != changes.Add && what != changes.Remove) { return false; } // nasty switch - switch (what) + switch(what) { case changes.Add: changeAdd(); @@ -1980,35 +2140,35 @@ namespace OpenSim.Region.PhysicsModule.ubOde changePIDHoverActive((bool)arg); break; -/* not in use for now - case changes.Shape: - changeShape((PrimitiveBaseShape)arg); - break; + /* not in use for now + case changes.Shape: + changeShape((PrimitiveBaseShape)arg); + break; - case changes.CollidesWater: - changeFloatOnWater((bool)arg); - break; + case changes.CollidesWater: + changeFloatOnWater((bool)arg); + break; - case changes.VolumeDtc: - changeVolumedetetion((bool)arg); - break; + case changes.VolumeDtc: + changeVolumedetetion((bool)arg); + break; - case changes.Physical: - changePhysicsStatus((bool)arg); - break; + case changes.Physical: + changePhysicsStatus((bool)arg); + break; - case changes.Selected: - changeSelectedStatus((bool)arg); - break; + case changes.Selected: + changeSelectedStatus((bool)arg); + break; - case changes.disabled: - changeDisable((bool)arg); - break; + case changes.disabled: + changeDisable((bool)arg); + break; - case changes.building: - changeBuilding((bool)arg); - break; -*/ + case changes.building: + changeBuilding((bool)arg); + break; + */ case changes.Null: donullchange(); break; @@ -2020,9 +2180,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde return false; } - public void AddChange(changes what, object arg) + public void AddChange(changes what,object arg) { - m_parent_scene.AddChange((PhysicsActor)this, what, arg); + m_parent_scene.AddChange((PhysicsActor)this,what,arg); } private struct strAvatarSize diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs index ce10065af9..23b119213e 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEDynamics.cs @@ -41,13 +41,7 @@ // Extensive change Ubit 2012 using System; -using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; -using log4net; using OpenMetaverse; -using OdeAPI; -using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; namespace OpenSim.Region.PhysicsModule.ubOde @@ -342,9 +336,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_amEfect = 1.0f ; // turn it on m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale; - if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) + if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body) && !rootPrim.m_isSelected && !rootPrim.m_disabled) - d.BodyEnable(rootPrim.Body); + SafeNativeMethods.BodyEnable(rootPrim.Body); break; case Vehicle.LINEAR_FRICTION_TIMESCALE: @@ -361,9 +355,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_lmEfect = 1.0f; // turn it on m_ffactor = 0.0f; - if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) + if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body) && !rootPrim.m_isSelected && !rootPrim.m_disabled) - d.BodyEnable(rootPrim.Body); + SafeNativeMethods.BodyEnable(rootPrim.Body); break; case Vehicle.LINEAR_MOTOR_OFFSET: m_linearMotorOffset = new Vector3(pValue, pValue, pValue); @@ -399,9 +393,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_amEfect = 1.0f; // turn it on m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale; - if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) + if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body) && !rootPrim.m_isSelected && !rootPrim.m_disabled) - d.BodyEnable(rootPrim.Body); + SafeNativeMethods.BodyEnable(rootPrim.Body); break; case Vehicle.LINEAR_FRICTION_TIMESCALE: if (pValue.X < m_timestep) pValue.X = m_timestep; @@ -419,9 +413,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale; m_ffactor = 0.0f; - if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) + if (rootPrim.Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(rootPrim.Body) && !rootPrim.m_isSelected && !rootPrim.m_disabled) - d.BodyEnable(rootPrim.Body); + SafeNativeMethods.BodyEnable(rootPrim.Body); break; case Vehicle.LINEAR_MOTOR_OFFSET: m_linearMotorOffset = new Vector3(pValue.X, pValue.Y, pValue.Z); @@ -772,30 +766,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde { IntPtr Body = rootPrim.Body; - d.Mass dmass; - d.BodyGetMass(Body, out dmass); + SafeNativeMethods.Mass dmass; + SafeNativeMethods.BodyGetMass(Body, out dmass); - d.Quaternion rot = d.BodyGetQuaternion(Body); + SafeNativeMethods.Quaternion rot = SafeNativeMethods.BodyGetQuaternion(Body); Quaternion objrotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object Quaternion rotq = objrotq; // rotq = rotation of object rotq *= m_referenceFrame; // rotq is now rotation in vehicle reference frame Quaternion irotq = Quaternion.Inverse(rotq); - d.Vector3 dvtmp; + SafeNativeMethods.Vector3 dvtmp; Vector3 tmpV; Vector3 curVel; // velocity in world Vector3 curAngVel; // angular velocity in world Vector3 force = Vector3.Zero; // actually linear aceleration until mult by mass in world frame Vector3 torque = Vector3.Zero;// actually angular aceleration until mult by Inertia in vehicle frame - d.Vector3 dtorque = new d.Vector3(); + SafeNativeMethods.Vector3 dtorque = new SafeNativeMethods.Vector3(); - dvtmp = d.BodyGetLinearVel(Body); + dvtmp = SafeNativeMethods.BodyGetLinearVel(Body); curVel.X = dvtmp.X; curVel.Y = dvtmp.Y; curVel.Z = dvtmp.Z; Vector3 curLocalVel = curVel * irotq; // current velocity in local - dvtmp = d.BodyGetAngularVel(Body); + dvtmp = SafeNativeMethods.BodyGetAngularVel(Body); curAngVel.X = dvtmp.X; curAngVel.Y = dvtmp.Y; curAngVel.Z = dvtmp.Z; @@ -839,7 +833,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { // have offset, do it now tmpV *= dmass.mass; - d.BodyAddForceAtRelPos(Body, tmpV.X, tmpV.Y, tmpV.Z, m_linearMotorOffset.X, m_linearMotorOffset.Y, m_linearMotorOffset.Z); + SafeNativeMethods.BodyAddForceAtRelPos(Body, tmpV.X, tmpV.Y, tmpV.Z, m_linearMotorOffset.X, m_linearMotorOffset.Y, m_linearMotorOffset.Z); } else { @@ -862,7 +856,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_VhoverTimescale < 300 && rootPrim.prim_geom != IntPtr.Zero) { // d.Vector3 pos = d.BodyGetPosition(Body); - d.Vector3 pos = d.GeomGetPosition(rootPrim.prim_geom); + SafeNativeMethods.Vector3 pos = SafeNativeMethods.GeomGetPosition(rootPrim.prim_geom); pos.Z -= 0.21f; // minor offset that seems to be always there in sl float t = _pParentScene.GetTerrainHeightAtXY(pos.X, pos.Y); @@ -1181,7 +1175,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (force.X != 0 || force.Y != 0 || force.Z != 0) { - d.BodyAddForce(Body, force.X, force.Y, force.Z); + SafeNativeMethods.BodyAddForce(Body, force.X, force.Y, force.Z); } if (torque.X != 0 || torque.Y != 0 || torque.Z != 0) @@ -1191,15 +1185,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde dtorque.Y = torque.Y; dtorque.Z = torque.Z; - d.MultiplyM3V3(out dvtmp, ref dmass.I, ref dtorque); - d.BodyAddRelTorque(Body, dvtmp.X, dvtmp.Y, dvtmp.Z); // add torque in object frame + SafeNativeMethods.MultiplyM3V3(out dvtmp, ref dmass.I, ref dtorque); + SafeNativeMethods.BodyAddRelTorque(Body, dvtmp.X, dvtmp.Y, dvtmp.Z); // add torque in object frame } torque = rootPrim.m_torque; torque += rootPrim.m_angularForceacc; rootPrim.m_angularForceacc = Vector3.Zero; if (torque.X != 0 || torque.Y != 0 || torque.Z != 0) - d.BodyAddTorque(Body,torque.X, torque.Y, torque.Z); + SafeNativeMethods.BodyAddTorque(Body,torque.X, torque.Y, torque.Z); } } } diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs index 5465035c58..f4e2b1feb5 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs @@ -4,14 +4,8 @@ using System; using System.Threading; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Text; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; -using OdeAPI; using log4net; using Nini.Config; using OpenMetaverse; diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs index 4cb17369b6..90560fde2e 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs @@ -4,7 +4,6 @@ using System.Reflection; using log4net; using Nini.Config; using Mono.Addins; -using OdeAPI; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Interfaces; @@ -53,9 +52,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (Util.IsWindows()) Util.LoadArchSpecificWindowsDll("ode.dll"); - d.InitODE(); + SafeNativeMethods.InitODE(); - string ode_config = d.GetConfiguration(); + string ode_config = SafeNativeMethods.GetConfiguration(); if (ode_config != null && ode_config != "") { m_log.InfoFormat("[ubODE] ode library configuration: {0}", ode_config); diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs index e080b186af..4e1852295c 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEPrim.cs @@ -44,11 +44,8 @@ using System; using System.Collections.Generic; using System.Reflection; -using System.Runtime.InteropServices; -using System.Threading; using log4net; using OpenMetaverse; -using OdeAPI; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; @@ -182,7 +179,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private float m_physCost; private float m_streamCost; - public d.Mass primdMass; // prim inertia information on it's own referencial + internal SafeNativeMethods.Mass primdMass; // prim inertia information on it's own referencial private PhysicsInertiaData m_InertiaOverride; float primMass; // prim own mass float primVolume; // prim own volume; @@ -489,7 +486,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // double buffering if(m_fakeInertiaOverride != null) { - d.Mass objdmass = new d.Mass(); + SafeNativeMethods.Mass objdmass = new SafeNativeMethods.Mass(); objdmass.I.M00 = m_fakeInertiaOverride.Inertia.X; objdmass.I.M11 = m_fakeInertiaOverride.Inertia.Y; objdmass.I.M22 = m_fakeInertiaOverride.Inertia.Z; @@ -498,15 +495,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(Math.Abs(m_fakeInertiaOverride.InertiaRotation.W) < 0.999) { - d.Matrix3 inertiarotmat = new d.Matrix3(); - d.Quaternion inertiarot = new d.Quaternion(); + SafeNativeMethods.Matrix3 inertiarotmat = new SafeNativeMethods.Matrix3(); + SafeNativeMethods.Quaternion inertiarot = new SafeNativeMethods.Quaternion(); inertiarot.X = m_fakeInertiaOverride.InertiaRotation.X; inertiarot.Y = m_fakeInertiaOverride.InertiaRotation.Y; inertiarot.Z = m_fakeInertiaOverride.InertiaRotation.Z; inertiarot.W = m_fakeInertiaOverride.InertiaRotation.W; - d.RfromQ(out inertiarotmat, ref inertiarot); - d.MassRotate(ref objdmass, ref inertiarotmat); + SafeNativeMethods.RfromQ(out inertiarotmat, ref inertiarot); + SafeNativeMethods.MassRotate(ref objdmass, ref inertiarotmat); } inertia.TotalMass = m_fakeInertiaOverride.TotalMass; @@ -530,13 +527,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde return inertia; } - d.Vector3 dtmp; - d.Mass m = new d.Mass(); + SafeNativeMethods.Vector3 dtmp; + SafeNativeMethods.Mass m = new SafeNativeMethods.Mass(); lock(_parent_scene.OdeLock) { - d.AllocateODEDataForThread(0); - dtmp = d.GeomGetOffsetPosition(prim_geom); - d.BodyGetMass(Body, out m); + SafeNativeMethods.AllocateODEDataForThread(0); + dtmp = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + SafeNativeMethods.BodyGetMass(Body, out m); } Vector3 cm = new Vector3(-dtmp.X, -dtmp.Y, -dtmp.Z); @@ -572,18 +569,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde { lock (_parent_scene.OdeLock) { - d.AllocateODEDataForThread(0); + SafeNativeMethods.AllocateODEDataForThread(0); - d.Vector3 dtmp; + SafeNativeMethods.Vector3 dtmp; if (!childPrim && Body != IntPtr.Zero) { - dtmp = d.BodyGetPosition(Body); + dtmp = SafeNativeMethods.BodyGetPosition(Body); return new Vector3(dtmp.X, dtmp.Y, dtmp.Z); } else if (prim_geom != IntPtr.Zero) { - d.Quaternion dq; - d.GeomCopyQuaternion(prim_geom, out dq); + SafeNativeMethods.Quaternion dq; + SafeNativeMethods.GeomCopyQuaternion(prim_geom, out dq); Quaternion q; q.X = dq.X; q.Y = dq.Y; @@ -591,7 +588,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde q.W = dq.W; Vector3 Ptot = m_OBBOffset * q; - dtmp = d.GeomGetPosition(prim_geom); + dtmp = SafeNativeMethods.GeomGetPosition(prim_geom); Ptot.X += dtmp.X; Ptot.Y += dtmp.Y; Ptot.Z += dtmp.Z; @@ -997,16 +994,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde _velocity.Y = 0; _velocity.Z = 0; - d.AllocateODEDataForThread(0); + SafeNativeMethods.AllocateODEDataForThread(0); m_lastVelocity = _velocity; if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) m_vehicle.Stop(); if(Body != IntPtr.Zero) - d.BodySetLinearVel(Body, 0, 0, 0); // stop it + SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it if (prim_geom != IntPtr.Zero) - d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); + SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); m_outbounds = false; changeDisable(false); @@ -1027,24 +1024,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_lastposition = _position; m_lastorientation = _orientation; - d.AllocateODEDataForThread(0); + SafeNativeMethods.AllocateODEDataForThread(0); if(Body != IntPtr.Zero) { - d.Vector3 dtmp = d.BodyGetAngularVel(Body); + SafeNativeMethods.Vector3 dtmp = SafeNativeMethods.BodyGetAngularVel(Body); m_rotationalVelocity.X = dtmp.X; m_rotationalVelocity.Y = dtmp.Y; m_rotationalVelocity.Z = dtmp.Z; - dtmp = d.BodyGetLinearVel(Body); + dtmp = SafeNativeMethods.BodyGetLinearVel(Body); _velocity.X = dtmp.X; _velocity.Y = dtmp.Y; _velocity.Z = dtmp.Z; - d.BodySetLinearVel(Body, 0, 0, 0); // stop it - d.BodySetAngularVel(Body, 0, 0, 0); + SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it + SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0); } if(prim_geom != IntPtr.Zero) - d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); + SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); disableBodySoft(); // stop collisions UnSubscribeEvents(); } @@ -1241,7 +1238,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde SentEmptyCollisionsEvent = true; // _parent_scene.RemoveCollisionEventReporting(this); } - else if(Body == IntPtr.Zero || (d.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 )) + else if(Body == IntPtr.Zero || (SafeNativeMethods.BodyIsEnabled(Body) && m_bodydisablecontrol >= 0 )) { SentEmptyCollisionsEvent = false; CollisionEvents.Clear(); @@ -1450,16 +1447,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (prm.m_NoColide) { - d.GeomSetCategoryBits(prm.prim_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, 0); if (m_isphysical) - d.GeomSetCollideBits(prm.prim_geom, (int)CollisionCategories.Land); + SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (int)CollisionCategories.Land); else - d.GeomSetCollideBits(prm.prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, 0); } else { - d.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories); - d.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags); } } } @@ -1467,22 +1464,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_NoColide) { - d.GeomSetCategoryBits(prim_geom, 0); - d.GeomSetCollideBits(prim_geom, (uint)CollisionCategories.Land); + SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)CollisionCategories.Land); if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) { - d.GeomSetCategoryBits(collide_geom, 0); - d.GeomSetCollideBits(collide_geom, (uint)CollisionCategories.Land); + SafeNativeMethods.GeomSetCategoryBits(collide_geom, 0); + SafeNativeMethods.GeomSetCollideBits(collide_geom, (uint)CollisionCategories.Land); } } else { - d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) { - d.GeomSetCategoryBits(collide_geom, (uint)m_collisionCategories); - d.GeomSetCollideBits(collide_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(collide_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(collide_geom, (uint)m_collisionFlags); } } } @@ -1495,7 +1492,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (Amotor != IntPtr.Zero) { - d.JointDestroy(Amotor); + SafeNativeMethods.JointDestroy(Amotor); Amotor = IntPtr.Zero; } @@ -1522,19 +1519,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(axisnum == 0) return; // stop it - d.BodySetTorque(Body, 0, 0, 0); - d.BodySetAngularVel(Body, 0, 0, 0); + SafeNativeMethods.BodySetTorque(Body, 0, 0, 0); + SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0); - Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); - d.JointAttach(Amotor, Body, IntPtr.Zero); + Amotor = SafeNativeMethods.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); + SafeNativeMethods.JointAttach(Amotor, Body, IntPtr.Zero); - d.JointSetAMotorMode(Amotor, 0); + SafeNativeMethods.JointSetAMotorMode(Amotor, 0); - d.JointSetAMotorNumAxes(Amotor, axisnum); + SafeNativeMethods.JointSetAMotorNumAxes(Amotor, axisnum); // get current orientation to lock - d.Quaternion dcur = d.BodyGetQuaternion(Body); + SafeNativeMethods.Quaternion dcur = SafeNativeMethods.BodyGetQuaternion(Body); Quaternion curr; // crap convertion between identical things curr.X = dcur.X; curr.Y = dcur.Y; @@ -1547,17 +1544,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (axisX) { ax = (new Vector3(1, 0, 0)) * curr; // rotate world X to current local X - d.JointSetAMotorAxis(Amotor, 0, 0, ax.X, ax.Y, ax.Z); - d.JointSetAMotorAngle(Amotor, 0, 0); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.LoStop, 0f); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.HiStop, 0f); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.Vel, 0); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.FudgeFactor, 0.0001f); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.Bounce, 0f); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.CFM, 0f); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.FMax, 5e8f); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.StopCFM, 0f); - d.JointSetAMotorParam(Amotor, (int)d.JointParam.StopERP, 0.8f); + SafeNativeMethods.JointSetAMotorAxis(Amotor, 0, 0, ax.X, ax.Y, ax.Z); + SafeNativeMethods.JointSetAMotorAngle(Amotor, 0, 0); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.LoStop, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.HiStop, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Vel, 0); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.FudgeFactor, 0.0001f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.Bounce, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.CFM, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.FMax, 5e8f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.StopCFM, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, (int)SafeNativeMethods.JointParam.StopERP, 0.8f); i++; j = 256; // move to next axis set } @@ -1565,17 +1562,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (axisY) { ax = (new Vector3(0, 1, 0)) * curr; - d.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z); - d.JointSetAMotorAngle(Amotor, i, 0); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.LoStop, 0f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.HiStop, 0f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Vel, 0); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FudgeFactor, 0.0001f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Bounce, 0f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.CFM, 0f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FMax, 5e8f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopCFM, 0f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopERP, 0.8f); + SafeNativeMethods.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z); + SafeNativeMethods.JointSetAMotorAngle(Amotor, i, 0); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.LoStop, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.HiStop, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Vel, 0); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FudgeFactor, 0.0001f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Bounce, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.CFM, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FMax, 5e8f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopCFM, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopERP, 0.8f); i++; j += 256; } @@ -1583,17 +1580,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (axisZ) { ax = (new Vector3(0, 0, 1)) * curr; - d.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z); - d.JointSetAMotorAngle(Amotor, i, 0); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.LoStop, 0f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.HiStop, 0f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Vel, 0); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FudgeFactor, 0.0001f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.Bounce, 0f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.CFM, 0f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.FMax, 5e8f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopCFM, 0f); - d.JointSetAMotorParam(Amotor, j + (int)d.JointParam.StopERP, 0.8f); + SafeNativeMethods.JointSetAMotorAxis(Amotor, i, 0, ax.X, ax.Y, ax.Z); + SafeNativeMethods.JointSetAMotorAngle(Amotor, i, 0); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.LoStop, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.HiStop, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Vel, 0); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FudgeFactor, 0.0001f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.Bounce, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.CFM, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.FMax, 5e8f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopCFM, 0f); + SafeNativeMethods.JointSetAMotorParam(Amotor, j + (int)SafeNativeMethods.JointParam.StopERP, 0.8f); } } @@ -1607,21 +1604,21 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_NoColide) { - d.GeomSetCategoryBits(prim_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0); if (m_isphysical) { - d.GeomSetCollideBits(prim_geom, (uint)CollisionCategories.Land); + SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)CollisionCategories.Land); } else { - d.GeomSetCollideBits(prim_geom, 0); - d.GeomDisable(prim_geom); + SafeNativeMethods.GeomSetCollideBits(prim_geom, 0); + SafeNativeMethods.GeomDisable(prim_geom); } } else { - d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); } UpdatePrimBodyData(); @@ -1689,12 +1686,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde try { - _triMeshData = d.GeomTriMeshDataCreate(); + _triMeshData = SafeNativeMethods.GeomTriMeshDataCreate(); - d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); - d.GeomTriMeshDataPreprocess(_triMeshData); + SafeNativeMethods.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); + SafeNativeMethods.GeomTriMeshDataPreprocess(_triMeshData); - geo = d.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null); + geo = SafeNativeMethods.CreateTriMesh(m_targetSpace, _triMeshData, null, null, null); } catch (Exception e) @@ -1704,7 +1701,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { try { - d.GeomTriMeshDataDestroy(_triMeshData); + SafeNativeMethods.GeomTriMeshDataDestroy(_triMeshData); } catch { @@ -1760,7 +1757,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { // it's a sphere try { - geo = d.CreateSphere(m_targetSpace, _size.X * 0.5f); + geo = SafeNativeMethods.CreateSphere(m_targetSpace, _size.X * 0.5f); } catch (Exception e) { @@ -1772,7 +1769,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde {// do it as a box try { - geo = d.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); + geo = SafeNativeMethods.CreateBox(m_targetSpace, _size.X, _size.Y, _size.Z); } catch (Exception e) { @@ -1794,10 +1791,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde try { - d.GeomDestroy(prim_geom); + SafeNativeMethods.GeomDestroy(prim_geom); if (_triMeshData != IntPtr.Zero) { - d.GeomTriMeshDataDestroy(_triMeshData); + SafeNativeMethods.GeomTriMeshDataDestroy(_triMeshData); _triMeshData = IntPtr.Zero; } } @@ -1848,8 +1845,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde ApplyCollisionCatFlags(); _zeroFlag = true; - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } } resetCollisionAccounting(); @@ -1868,7 +1865,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_collisionCategories = 0; m_collisionFlags = 0; ApplyCollisionCatFlags(); - d.BodyDisable(Body); + SafeNativeMethods.BodyDisable(Body); } } } @@ -1896,41 +1893,41 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_log.Warn("[PHYSICS]: MakeBody called having a body"); } - if (d.GeomGetBody(prim_geom) != IntPtr.Zero) + if (SafeNativeMethods.GeomGetBody(prim_geom) != IntPtr.Zero) { - d.GeomSetBody(prim_geom, IntPtr.Zero); + SafeNativeMethods.GeomSetBody(prim_geom, IntPtr.Zero); m_log.Warn("[PHYSICS]: MakeBody root geom already had a body"); } bool noInertiaOverride = (m_InertiaOverride == null); - Body = d.BodyCreate(_parent_scene.world); + Body = SafeNativeMethods.BodyCreate(_parent_scene.world); - d.Matrix3 mymat = new d.Matrix3(); - d.Quaternion myrot = new d.Quaternion(); - d.Mass objdmass = new d.Mass { }; + SafeNativeMethods.Matrix3 mymat = new SafeNativeMethods.Matrix3(); + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); + SafeNativeMethods.Mass objdmass = new SafeNativeMethods.Mass { }; myrot.X = _orientation.X; myrot.Y = _orientation.Y; myrot.Z = _orientation.Z; myrot.W = _orientation.W; - d.RfromQ(out mymat, ref myrot); + SafeNativeMethods.RfromQ(out mymat, ref myrot); // set the body rotation - d.BodySetRotation(Body, ref mymat); + SafeNativeMethods.BodySetRotation(Body, ref mymat); if(noInertiaOverride) { objdmass = primdMass; - d.MassRotate(ref objdmass, ref mymat); + SafeNativeMethods.MassRotate(ref objdmass, ref mymat); } // recompute full object inertia if needed if (childrenPrim.Count > 0) { - d.Matrix3 mat = new d.Matrix3(); - d.Quaternion quat = new d.Quaternion(); - d.Mass tmpdmass = new d.Mass { }; + SafeNativeMethods.Matrix3 mat = new SafeNativeMethods.Matrix3(); + SafeNativeMethods.Quaternion quat = new SafeNativeMethods.Quaternion(); + SafeNativeMethods.Mass tmpdmass = new SafeNativeMethods.Mass { }; Vector3 rcm; rcm.X = _position.X; @@ -1951,70 +1948,70 @@ namespace OpenSim.Region.PhysicsModule.ubOde quat.Y = prm._orientation.Y; quat.Z = prm._orientation.Z; quat.W = prm._orientation.W; - d.RfromQ(out mat, ref quat); + SafeNativeMethods.RfromQ(out mat, ref quat); // fix prim colision cats - if (d.GeomGetBody(prm.prim_geom) != IntPtr.Zero) + if (SafeNativeMethods.GeomGetBody(prm.prim_geom) != IntPtr.Zero) { - d.GeomSetBody(prm.prim_geom, IntPtr.Zero); + SafeNativeMethods.GeomSetBody(prm.prim_geom, IntPtr.Zero); m_log.Warn("[PHYSICS]: MakeBody child geom already had a body"); } - d.GeomClearOffset(prm.prim_geom); - d.GeomSetBody(prm.prim_geom, Body); + SafeNativeMethods.GeomClearOffset(prm.prim_geom); + SafeNativeMethods.GeomSetBody(prm.prim_geom, Body); prm.Body = Body; - d.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); // set relative rotation + SafeNativeMethods.GeomSetOffsetWorldRotation(prm.prim_geom, ref mat); // set relative rotation if(noInertiaOverride) { tmpdmass = prm.primdMass; - d.MassRotate(ref tmpdmass, ref mat); + SafeNativeMethods.MassRotate(ref tmpdmass, ref mat); Vector3 ppos = prm._position; ppos.X -= rcm.X; ppos.Y -= rcm.Y; ppos.Z -= rcm.Z; // refer inertia to root prim center of mass position - d.MassTranslate(ref tmpdmass, + SafeNativeMethods.MassTranslate(ref tmpdmass, ppos.X, ppos.Y, ppos.Z); - d.MassAdd(ref objdmass, ref tmpdmass); // add to total object inertia + SafeNativeMethods.MassAdd(ref objdmass, ref tmpdmass); // add to total object inertia } } } } - d.GeomClearOffset(prim_geom); // make sure we don't have a hidden offset + SafeNativeMethods.GeomClearOffset(prim_geom); // make sure we don't have a hidden offset // associate root geom with body - d.GeomSetBody(prim_geom, Body); + SafeNativeMethods.GeomSetBody(prim_geom, Body); if(noInertiaOverride) - d.BodySetPosition(Body, _position.X + objdmass.c.X, _position.Y + objdmass.c.Y, _position.Z + objdmass.c.Z); + SafeNativeMethods.BodySetPosition(Body, _position.X + objdmass.c.X, _position.Y + objdmass.c.Y, _position.Z + objdmass.c.Z); else { Vector3 ncm = m_InertiaOverride.CenterOfMass * _orientation; - d.BodySetPosition(Body, + SafeNativeMethods.BodySetPosition(Body, _position.X + ncm.X, _position.Y + ncm.Y, _position.Z + ncm.Z); } - d.GeomSetOffsetWorldPosition(prim_geom, _position.X, _position.Y, _position.Z); + SafeNativeMethods.GeomSetOffsetWorldPosition(prim_geom, _position.X, _position.Y, _position.Z); if(noInertiaOverride) { - d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body + SafeNativeMethods.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body myrot.X = -myrot.X; myrot.Y = -myrot.Y; myrot.Z = -myrot.Z; - d.RfromQ(out mymat, ref myrot); - d.MassRotate(ref objdmass, ref mymat); + SafeNativeMethods.RfromQ(out mymat, ref myrot); + SafeNativeMethods.MassRotate(ref objdmass, ref mymat); - d.BodySetMass(Body, ref objdmass); + SafeNativeMethods.BodySetMass(Body, ref objdmass); m_mass = objdmass.mass; } else @@ -2031,35 +2028,35 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(Math.Abs(m_InertiaOverride.InertiaRotation.W) < 0.999) { - d.Matrix3 inertiarotmat = new d.Matrix3(); - d.Quaternion inertiarot = new d.Quaternion(); + SafeNativeMethods.Matrix3 inertiarotmat = new SafeNativeMethods.Matrix3(); + SafeNativeMethods.Quaternion inertiarot = new SafeNativeMethods.Quaternion(); inertiarot.X = m_InertiaOverride.InertiaRotation.X; inertiarot.Y = m_InertiaOverride.InertiaRotation.Y; inertiarot.Z = m_InertiaOverride.InertiaRotation.Z; inertiarot.W = m_InertiaOverride.InertiaRotation.W; - d.RfromQ(out inertiarotmat, ref inertiarot); - d.MassRotate(ref objdmass, ref inertiarotmat); + SafeNativeMethods.RfromQ(out inertiarotmat, ref inertiarot); + SafeNativeMethods.MassRotate(ref objdmass, ref inertiarotmat); } - d.BodySetMass(Body, ref objdmass); + SafeNativeMethods.BodySetMass(Body, ref objdmass); m_mass = objdmass.mass; } // disconnect from world gravity so we can apply buoyancy - d.BodySetGravityMode(Body, false); + SafeNativeMethods.BodySetGravityMode(Body, false); - d.BodySetAutoDisableFlag(Body, true); - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodySetAutoDisableAngularThreshold(Body, 0.05f); - d.BodySetAutoDisableLinearThreshold(Body, 0.05f); - d.BodySetDamping(Body, .004f, .001f); + SafeNativeMethods.BodySetAutoDisableFlag(Body, true); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodySetAutoDisableAngularThreshold(Body, 0.05f); + SafeNativeMethods.BodySetAutoDisableLinearThreshold(Body, 0.05f); + SafeNativeMethods.BodySetDamping(Body, .004f, .001f); if (m_targetSpace != IntPtr.Zero) { _parent_scene.waitForSpaceUnlock(m_targetSpace); - if (d.SpaceQuery(m_targetSpace, prim_geom)) - d.SpaceRemove(m_targetSpace, prim_geom); + if (SafeNativeMethods.SpaceQuery(m_targetSpace, prim_geom)) + SafeNativeMethods.SpaceRemove(m_targetSpace, prim_geom); } if (childrenPrim.Count == 0) @@ -2069,20 +2066,23 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { - m_targetSpace = d.SimpleSpaceCreate(_parent_scene.ActiveSpace); - d.SpaceSetSublevel(m_targetSpace, 3); - d.SpaceSetCleanup(m_targetSpace, false); + m_targetSpace = SafeNativeMethods.SimpleSpaceCreate(_parent_scene.ActiveSpace); + SafeNativeMethods.SpaceSetSublevel(m_targetSpace, 3); + SafeNativeMethods.SpaceSetCleanup(m_targetSpace, false); - d.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space | + SafeNativeMethods.GeomSetCategoryBits(m_targetSpace, (uint)(CollisionCategories.Space | CollisionCategories.Geom | CollisionCategories.Phantom | CollisionCategories.VolumeDtc )); - d.GeomSetCollideBits(m_targetSpace, 0); + SafeNativeMethods.GeomSetCollideBits(m_targetSpace, 0); collide_geom = m_targetSpace; } - d.SpaceAdd(m_targetSpace, prim_geom); + if (SafeNativeMethods.SpaceQuery(m_targetSpace, prim_geom)) + m_log.Debug("[PRIM]: parent already in target space"); + else + SafeNativeMethods.SpaceAdd(m_targetSpace, prim_geom); if (m_delaySelect) { @@ -2101,22 +2101,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde { foreach (OdePrim prm in childrenPrim) { - if (prm.prim_geom == IntPtr.Zero) + IntPtr prmgeom = prm.prim_geom; + if (prmgeom == IntPtr.Zero) continue; Vector3 ppos = prm._position; - d.GeomSetOffsetWorldPosition(prm.prim_geom, ppos.X, ppos.Y, ppos.Z); // set relative position + SafeNativeMethods.GeomSetOffsetWorldPosition(prm.prim_geom, ppos.X, ppos.Y, ppos.Z); // set relative position - if (prm.m_targetSpace != m_targetSpace) + IntPtr prmspace = prm.m_targetSpace; + if (prmspace != m_targetSpace) { - if (prm.m_targetSpace != IntPtr.Zero) + if (prmspace != IntPtr.Zero) { - _parent_scene.waitForSpaceUnlock(prm.m_targetSpace); - if (d.SpaceQuery(prm.m_targetSpace, prm.prim_geom)) - d.SpaceRemove(prm.m_targetSpace, prm.prim_geom); + _parent_scene.waitForSpaceUnlock(prmspace); + if (SafeNativeMethods.SpaceQuery(prmspace, prmgeom)) + SafeNativeMethods.SpaceRemove(prmspace, prmgeom); } prm.m_targetSpace = m_targetSpace; - d.SpaceAdd(m_targetSpace, prm.prim_geom); + if (SafeNativeMethods.SpaceQuery(m_targetSpace, prmgeom)) + m_log.Debug("[PRIM]: child already in target space"); + else + SafeNativeMethods.SpaceAdd(m_targetSpace, prmgeom); } prm.m_collisionscore = 0; @@ -2136,13 +2141,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_isSelected || m_disabled) { - d.BodyDisable(Body); + SafeNativeMethods.BodyDisable(Body); _zeroFlag = true; } else { - d.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); - d.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); + SafeNativeMethods.BodySetAngularVel(Body, m_rotationalVelocity.X, m_rotationalVelocity.Y, m_rotationalVelocity.Z); + SafeNativeMethods.BodySetLinearVel(Body, _velocity.X, _velocity.Y, _velocity.Z); _zeroFlag = false; m_bodydisablecontrol = 0; @@ -2175,16 +2180,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (m_NoColide) { - d.GeomSetCategoryBits(prim_geom, 0); - d.GeomSetCollideBits(prim_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(prim_geom, 0); } else { - d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); } UpdateDataFromGeom(); - d.GeomSetBody(prim_geom, IntPtr.Zero); + SafeNativeMethods.GeomSetBody(prim_geom, IntPtr.Zero); SetInStaticSpace(this); } @@ -2211,13 +2216,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (prm.m_NoColide) { - d.GeomSetCategoryBits(prm.prim_geom, 0); - d.GeomSetCollideBits(prm.prim_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, 0); } else { - d.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories); - d.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, (uint)prm.m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (uint)prm.m_collisionFlags); } prm.UpdateDataFromGeom(); SetInStaticSpace(prm); @@ -2229,11 +2234,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde } if (Amotor != IntPtr.Zero) { - d.JointDestroy(Amotor); + SafeNativeMethods.JointDestroy(Amotor); Amotor = IntPtr.Zero; } _parent_scene.remActiveGroup(this); - d.BodyDestroy(Body); + SafeNativeMethods.BodyDestroy(Body); } Body = IntPtr.Zero; } @@ -2243,30 +2248,30 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void FixInertia(Vector3 NewPos,Quaternion newrot) { - d.Matrix3 mat = new d.Matrix3(); - d.Quaternion quat = new d.Quaternion(); + SafeNativeMethods.Matrix3 mat = new SafeNativeMethods.Matrix3(); + SafeNativeMethods.Quaternion quat = new SafeNativeMethods.Quaternion(); - d.Mass tmpdmass = new d.Mass { }; - d.Mass objdmass = new d.Mass { }; + SafeNativeMethods.Mass tmpdmass = new SafeNativeMethods.Mass { }; + SafeNativeMethods.Mass objdmass = new SafeNativeMethods.Mass { }; - d.BodyGetMass(Body, out tmpdmass); + SafeNativeMethods.BodyGetMass(Body, out tmpdmass); objdmass = tmpdmass; - d.Vector3 dobjpos; - d.Vector3 thispos; + SafeNativeMethods.Vector3 dobjpos; + SafeNativeMethods.Vector3 thispos; // get current object position and rotation - dobjpos = d.BodyGetPosition(Body); + dobjpos = SafeNativeMethods.BodyGetPosition(Body); // get prim own inertia in its local frame tmpdmass = primdMass; // transform to object frame - mat = d.GeomGetOffsetRotation(prim_geom); - d.MassRotate(ref tmpdmass, ref mat); + mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom); + SafeNativeMethods.MassRotate(ref tmpdmass, ref mat); - thispos = d.GeomGetOffsetPosition(prim_geom); - d.MassTranslate(ref tmpdmass, + thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + SafeNativeMethods.MassTranslate(ref tmpdmass, thispos.X, thispos.Y, thispos.Z); @@ -2279,66 +2284,66 @@ namespace OpenSim.Region.PhysicsModule.ubOde // update to new position and orientation _position = NewPos; - d.GeomSetOffsetWorldPosition(prim_geom, NewPos.X, NewPos.Y, NewPos.Z); + SafeNativeMethods.GeomSetOffsetWorldPosition(prim_geom, NewPos.X, NewPos.Y, NewPos.Z); _orientation = newrot; quat.X = newrot.X; quat.Y = newrot.Y; quat.Z = newrot.Z; quat.W = newrot.W; - d.GeomSetOffsetWorldQuaternion(prim_geom, ref quat); + SafeNativeMethods.GeomSetOffsetWorldQuaternion(prim_geom, ref quat); - mat = d.GeomGetOffsetRotation(prim_geom); - d.MassRotate(ref tmpdmass, ref mat); + mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom); + SafeNativeMethods.MassRotate(ref tmpdmass, ref mat); - thispos = d.GeomGetOffsetPosition(prim_geom); - d.MassTranslate(ref tmpdmass, + thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + SafeNativeMethods.MassTranslate(ref tmpdmass, thispos.X, thispos.Y, thispos.Z); - d.MassAdd(ref objdmass, ref tmpdmass); + SafeNativeMethods.MassAdd(ref objdmass, ref tmpdmass); // fix all positions - IntPtr g = d.BodyGetFirstGeom(Body); + IntPtr g = SafeNativeMethods.BodyGetFirstGeom(Body); while (g != IntPtr.Zero) { - thispos = d.GeomGetOffsetPosition(g); + thispos = SafeNativeMethods.GeomGetOffsetPosition(g); thispos.X -= objdmass.c.X; thispos.Y -= objdmass.c.Y; thispos.Z -= objdmass.c.Z; - d.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z); - g = d.dBodyGetNextGeom(g); + SafeNativeMethods.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z); + g = SafeNativeMethods.dBodyGetNextGeom(g); } - d.BodyVectorToWorld(Body,objdmass.c.X, objdmass.c.Y, objdmass.c.Z,out thispos); + SafeNativeMethods.BodyVectorToWorld(Body,objdmass.c.X, objdmass.c.Y, objdmass.c.Z,out thispos); - d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z); - d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body - d.BodySetMass(Body, ref objdmass); + SafeNativeMethods.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z); + SafeNativeMethods.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body + SafeNativeMethods.BodySetMass(Body, ref objdmass); m_mass = objdmass.mass; } private void FixInertia(Vector3 NewPos) { - d.Matrix3 primmat = new d.Matrix3(); - d.Mass tmpdmass = new d.Mass { }; - d.Mass objdmass = new d.Mass { }; - d.Mass primmass = new d.Mass { }; + SafeNativeMethods.Matrix3 primmat = new SafeNativeMethods.Matrix3(); + SafeNativeMethods.Mass tmpdmass = new SafeNativeMethods.Mass { }; + SafeNativeMethods.Mass objdmass = new SafeNativeMethods.Mass { }; + SafeNativeMethods.Mass primmass = new SafeNativeMethods.Mass { }; - d.Vector3 dobjpos; - d.Vector3 thispos; + SafeNativeMethods.Vector3 dobjpos; + SafeNativeMethods.Vector3 thispos; - d.BodyGetMass(Body, out objdmass); + SafeNativeMethods.BodyGetMass(Body, out objdmass); // get prim own inertia in its local frame primmass = primdMass; // transform to object frame - primmat = d.GeomGetOffsetRotation(prim_geom); - d.MassRotate(ref primmass, ref primmat); + primmat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom); + SafeNativeMethods.MassRotate(ref primmass, ref primmat); tmpdmass = primmass; - thispos = d.GeomGetOffsetPosition(prim_geom); - d.MassTranslate(ref tmpdmass, + thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + SafeNativeMethods.MassTranslate(ref tmpdmass, thispos.X, thispos.Y, thispos.Z); @@ -2348,58 +2353,58 @@ namespace OpenSim.Region.PhysicsModule.ubOde // update to new position _position = NewPos; - d.GeomSetOffsetWorldPosition(prim_geom, NewPos.X, NewPos.Y, NewPos.Z); + SafeNativeMethods.GeomSetOffsetWorldPosition(prim_geom, NewPos.X, NewPos.Y, NewPos.Z); - thispos = d.GeomGetOffsetPosition(prim_geom); - d.MassTranslate(ref primmass, + thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + SafeNativeMethods.MassTranslate(ref primmass, thispos.X, thispos.Y, thispos.Z); - d.MassAdd(ref objdmass, ref primmass); + SafeNativeMethods.MassAdd(ref objdmass, ref primmass); // fix all positions - IntPtr g = d.BodyGetFirstGeom(Body); + IntPtr g = SafeNativeMethods.BodyGetFirstGeom(Body); while (g != IntPtr.Zero) { - thispos = d.GeomGetOffsetPosition(g); + thispos = SafeNativeMethods.GeomGetOffsetPosition(g); thispos.X -= objdmass.c.X; thispos.Y -= objdmass.c.Y; thispos.Z -= objdmass.c.Z; - d.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z); - g = d.dBodyGetNextGeom(g); + SafeNativeMethods.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z); + g = SafeNativeMethods.dBodyGetNextGeom(g); } - d.BodyVectorToWorld(Body, objdmass.c.X, objdmass.c.Y, objdmass.c.Z, out thispos); + SafeNativeMethods.BodyVectorToWorld(Body, objdmass.c.X, objdmass.c.Y, objdmass.c.Z, out thispos); // get current object position and rotation - dobjpos = d.BodyGetPosition(Body); + dobjpos = SafeNativeMethods.BodyGetPosition(Body); - d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z); - d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body - d.BodySetMass(Body, ref objdmass); + SafeNativeMethods.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z); + SafeNativeMethods.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body + SafeNativeMethods.BodySetMass(Body, ref objdmass); m_mass = objdmass.mass; } private void FixInertia(Quaternion newrot) { - d.Matrix3 mat = new d.Matrix3(); - d.Quaternion quat = new d.Quaternion(); + SafeNativeMethods.Matrix3 mat = new SafeNativeMethods.Matrix3(); + SafeNativeMethods.Quaternion quat = new SafeNativeMethods.Quaternion(); - d.Mass tmpdmass = new d.Mass { }; - d.Mass objdmass = new d.Mass { }; - d.Vector3 dobjpos; - d.Vector3 thispos; + SafeNativeMethods.Mass tmpdmass = new SafeNativeMethods.Mass { }; + SafeNativeMethods.Mass objdmass = new SafeNativeMethods.Mass { }; + SafeNativeMethods.Vector3 dobjpos; + SafeNativeMethods.Vector3 thispos; - d.BodyGetMass(Body, out objdmass); + SafeNativeMethods.BodyGetMass(Body, out objdmass); // get prim own inertia in its local frame tmpdmass = primdMass; - mat = d.GeomGetOffsetRotation(prim_geom); - d.MassRotate(ref tmpdmass, ref mat); + mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom); + SafeNativeMethods.MassRotate(ref tmpdmass, ref mat); // transform to object frame - thispos = d.GeomGetOffsetPosition(prim_geom); - d.MassTranslate(ref tmpdmass, + thispos = SafeNativeMethods.GeomGetOffsetPosition(prim_geom); + SafeNativeMethods.MassTranslate(ref tmpdmass, thispos.X, thispos.Y, thispos.Z); @@ -2413,37 +2418,37 @@ namespace OpenSim.Region.PhysicsModule.ubOde quat.Y = newrot.Y; quat.Z = newrot.Z; quat.W = newrot.W; - d.GeomSetOffsetWorldQuaternion(prim_geom, ref quat); + SafeNativeMethods.GeomSetOffsetWorldQuaternion(prim_geom, ref quat); tmpdmass = primdMass; - mat = d.GeomGetOffsetRotation(prim_geom); - d.MassRotate(ref tmpdmass, ref mat); - d.MassTranslate(ref tmpdmass, + mat = SafeNativeMethods.GeomGetOffsetRotation(prim_geom); + SafeNativeMethods.MassRotate(ref tmpdmass, ref mat); + SafeNativeMethods.MassTranslate(ref tmpdmass, thispos.X, thispos.Y, thispos.Z); - d.MassAdd(ref objdmass, ref tmpdmass); + SafeNativeMethods.MassAdd(ref objdmass, ref tmpdmass); // fix all positions - IntPtr g = d.BodyGetFirstGeom(Body); + IntPtr g = SafeNativeMethods.BodyGetFirstGeom(Body); while (g != IntPtr.Zero) { - thispos = d.GeomGetOffsetPosition(g); + thispos = SafeNativeMethods.GeomGetOffsetPosition(g); thispos.X -= objdmass.c.X; thispos.Y -= objdmass.c.Y; thispos.Z -= objdmass.c.Z; - d.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z); - g = d.dBodyGetNextGeom(g); + SafeNativeMethods.GeomSetOffsetPosition(g, thispos.X, thispos.Y, thispos.Z); + g = SafeNativeMethods.dBodyGetNextGeom(g); } - d.BodyVectorToWorld(Body, objdmass.c.X, objdmass.c.Y, objdmass.c.Z, out thispos); + SafeNativeMethods.BodyVectorToWorld(Body, objdmass.c.X, objdmass.c.Y, objdmass.c.Z, out thispos); // get current object position and rotation - dobjpos = d.BodyGetPosition(Body); + dobjpos = SafeNativeMethods.BodyGetPosition(Body); - d.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z); - d.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body - d.BodySetMass(Body, ref objdmass); + SafeNativeMethods.BodySetPosition(Body, dobjpos.X + thispos.X, dobjpos.Y + thispos.Y, dobjpos.Z + thispos.Z); + SafeNativeMethods.MassTranslate(ref objdmass, -objdmass.c.X, -objdmass.c.Y, -objdmass.c.Z); // ode wants inertia at center of body + SafeNativeMethods.BodySetMass(Body, ref objdmass); m_mass = objdmass.mass; } @@ -2461,9 +2466,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_mass = primMass; // just in case - d.MassSetBoxTotal(out primdMass, primMass, 2.0f * m_OBB.X, 2.0f * m_OBB.Y, 2.0f * m_OBB.Z); + SafeNativeMethods.MassSetBoxTotal(out primdMass, primMass, 2.0f * m_OBB.X, 2.0f * m_OBB.Y, 2.0f * m_OBB.Z); - d.MassTranslate(ref primdMass, + SafeNativeMethods.MassTranslate(ref primdMass, m_OBBOffset.X, m_OBBOffset.Y, m_OBBOffset.Z); @@ -2518,7 +2523,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (prm.Body != IntPtr.Zero) { if (prm.prim_geom != IntPtr.Zero) - d.GeomSetBody(prm.prim_geom, IntPtr.Zero); + SafeNativeMethods.GeomSetBody(prm.prim_geom, IntPtr.Zero); if (prm.Body != prim.Body) prm.DestroyBody(); // don't loose bodies around prm.Body = IntPtr.Zero; @@ -2535,7 +2540,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (prim.Body != IntPtr.Zero) { if (prim.prim_geom != IntPtr.Zero) - d.GeomSetBody(prim.prim_geom, IntPtr.Zero); + SafeNativeMethods.GeomSetBody(prim.prim_geom, IntPtr.Zero); prim.DestroyBody(); // don't loose bodies around prim.Body = IntPtr.Zero; } @@ -2560,8 +2565,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (prim_geom != IntPtr.Zero) { - d.Quaternion qtmp; - d.GeomCopyQuaternion(prim_geom, out qtmp); + SafeNativeMethods.Quaternion qtmp; + SafeNativeMethods.GeomCopyQuaternion(prim_geom, out qtmp); _orientation.X = qtmp.X; _orientation.Y = qtmp.Y; _orientation.Z = qtmp.Z; @@ -2575,7 +2580,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde */ _orientation.Normalize(); - d.Vector3 lpos = d.GeomGetPosition(prim_geom); + SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(prim_geom); _position.X = lpos.X; _position.Y = lpos.Y; _position.Z = lpos.Z; @@ -2704,7 +2709,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (Amotor != IntPtr.Zero) { - d.JointDestroy(Amotor); + SafeNativeMethods.JointDestroy(Amotor); Amotor = IntPtr.Zero; } } @@ -2761,10 +2766,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (Body != IntPtr.Zero) { - d.BodySetForce(Body, 0f, 0f, 0f); - d.BodySetTorque(Body, 0f, 0f, 0f); - d.BodySetLinearVel(Body, 0f, 0f, 0f); - d.BodySetAngularVel(Body, 0f, 0f, 0f); + SafeNativeMethods.BodySetForce(Body, 0f, 0f, 0f); + SafeNativeMethods.BodySetTorque(Body, 0f, 0f, 0f); + SafeNativeMethods.BodySetLinearVel(Body, 0f, 0f, 0f); + SafeNativeMethods.BodySetAngularVel(Body, 0f, 0f, 0f); } } @@ -2826,7 +2831,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (newval) { if (!childPrim && Body != IntPtr.Zero) - d.BodyDisable(Body); + SafeNativeMethods.BodyDisable(Body); if (m_delaySelect || m_isphysical) { @@ -2845,13 +2850,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (prm.m_NoColide) { - d.GeomSetCategoryBits(prm.prim_geom, 0); - d.GeomSetCollideBits(prm.prim_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, 0); } else { - d.GeomSetCategoryBits(prm.prim_geom, (uint)m_collisionCategories); - d.GeomSetCollideBits(prm.prim_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(prm.prim_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(prm.prim_geom, (uint)m_collisionFlags); } } prm.m_delaySelect = false; @@ -2865,23 +2870,23 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (m_NoColide) { - d.GeomSetCategoryBits(prim_geom, 0); - d.GeomSetCollideBits(prim_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(prim_geom, 0); + SafeNativeMethods.GeomSetCollideBits(prim_geom, 0); if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) { - d.GeomSetCategoryBits(collide_geom, 0); - d.GeomSetCollideBits(collide_geom, 0); + SafeNativeMethods.GeomSetCategoryBits(collide_geom, 0); + SafeNativeMethods.GeomSetCollideBits(collide_geom, 0); } } else { - d.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); - d.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(prim_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(prim_geom, (uint)m_collisionFlags); if (collide_geom != prim_geom && collide_geom != IntPtr.Zero) { - d.GeomSetCategoryBits(collide_geom, (uint)m_collisionCategories); - d.GeomSetCollideBits(collide_geom, (uint)m_collisionFlags); + SafeNativeMethods.GeomSetCategoryBits(collide_geom, (uint)m_collisionCategories); + SafeNativeMethods.GeomSetCollideBits(collide_geom, (uint)m_collisionFlags); } } } @@ -2900,8 +2905,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (Body != IntPtr.Zero && !m_disabled) { _zeroFlag = true; - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } } // else if (_parent != null) @@ -2931,11 +2936,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde else if (m_forcePosOrRotation && _position != newPos && Body != IntPtr.Zero) { FixInertia(newPos); - if (!d.BodyIsEnabled(Body)) + if (!SafeNativeMethods.BodyIsEnabled(Body)) { _zeroFlag = true; - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } } } @@ -2943,14 +2948,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (_position != newPos) { - d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); + SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); _position = newPos; } - if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) + if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) { _zeroFlag = true; - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } } } @@ -2960,7 +2965,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (newPos != _position) { - d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); + SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); _position = newPos; m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, m_targetSpace); @@ -2998,12 +3003,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (newOri != _orientation) { - d.Quaternion myrot = new d.Quaternion(); + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); myrot.X = newOri.X; myrot.Y = newOri.Y; myrot.Z = newOri.Z; myrot.W = newOri.W; - d.GeomSetQuaternion(prim_geom, ref myrot); + SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); _orientation = newOri; if (Body != IntPtr.Zero) @@ -3012,11 +3017,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde createAMotor(m_angularlocks); } } - if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) + if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) { _zeroFlag = true; - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } } } @@ -3026,12 +3031,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (newOri != _orientation) { - d.Quaternion myrot = new d.Quaternion(); + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); myrot.X = newOri.X; myrot.Y = newOri.Y; myrot.Z = newOri.Z; myrot.W = newOri.W; - d.GeomSetQuaternion(prim_geom, ref myrot); + SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); _orientation = newOri; } } @@ -3056,26 +3061,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (newOri != _orientation) { - d.Quaternion myrot = new d.Quaternion(); + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); myrot.X = newOri.X; myrot.Y = newOri.Y; myrot.Z = newOri.Z; myrot.W = newOri.W; - d.GeomSetQuaternion(prim_geom, ref myrot); + SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); _orientation = newOri; if (Body != IntPtr.Zero && m_angularlocks != 0) createAMotor(m_angularlocks); } if (_position != newPos) { - d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); + SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); _position = newPos; } - if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) + if (Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) { _zeroFlag = true; - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } } } @@ -3088,18 +3093,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (newOri != _orientation) { - d.Quaternion myrot = new d.Quaternion(); + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); myrot.X = newOri.X; myrot.Y = newOri.Y; myrot.Z = newOri.Z; myrot.W = newOri.W; - d.GeomSetQuaternion(prim_geom, ref myrot); + SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); _orientation = newOri; } if (newPos != _position) { - d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); + SafeNativeMethods.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); _position = newPos; m_targetSpace = _parent_scene.MoveGeomToStaticSpace(prim_geom, m_targetSpace); @@ -3183,13 +3188,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (prim_geom != IntPtr.Zero) { - d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); - d.Quaternion myrot = new d.Quaternion(); + SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); myrot.X = _orientation.X; myrot.Y = _orientation.Y; myrot.Z = _orientation.Z; myrot.W = _orientation.W; - d.GeomSetQuaternion(prim_geom, ref myrot); + SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); } if (!m_isphysical) @@ -3259,13 +3264,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (prim_geom != IntPtr.Zero) { - d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); - d.Quaternion myrot = new d.Quaternion(); + SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); + SafeNativeMethods.Quaternion myrot = new SafeNativeMethods.Quaternion(); myrot.X = _orientation.X; myrot.Y = _orientation.Y; myrot.Z = _orientation.Z; myrot.W = _orientation.W; - d.GeomSetQuaternion(prim_geom, ref myrot); + SafeNativeMethods.GeomSetQuaternion(prim_geom, ref myrot); } if (m_isphysical) @@ -3316,10 +3321,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (m_disabled) enableBodySoft(); - else if (!d.BodyIsEnabled(Body)) + else if (!SafeNativeMethods.BodyIsEnabled(Body)) { - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } } m_torque = newtorque; @@ -3329,10 +3334,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void changeForce(Vector3 force) { m_force = force; - if (!m_isSelected && !m_outbounds && Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) + if (!m_isSelected && !m_outbounds && Body != IntPtr.Zero && !SafeNativeMethods.BodyIsEnabled(Body)) { - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } } @@ -3348,10 +3353,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (m_disabled) enableBodySoft(); - else if (!d.BodyIsEnabled(Body)) + else if (!SafeNativeMethods.BodyIsEnabled(Body)) { - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } } } @@ -3371,10 +3376,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (m_disabled) enableBodySoft(); - else if (!d.BodyIsEnabled(Body)) + else if (!SafeNativeMethods.BodyIsEnabled(Body)) { - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } } } @@ -3397,12 +3402,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (m_disabled) enableBodySoft(); - else if (!d.BodyIsEnabled(Body)) + else if (!SafeNativeMethods.BodyIsEnabled(Body)) { - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } - d.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); + SafeNativeMethods.BodySetLinearVel(Body, newVel.X, newVel.Y, newVel.Z); } //resetCollisionAccounting(); } @@ -3424,12 +3429,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (m_disabled) enableBodySoft(); - else if (!d.BodyIsEnabled(Body)) + else if (!SafeNativeMethods.BodyIsEnabled(Body)) { - d.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, m_body_autodisable_frames); + SafeNativeMethods.BodyEnable(Body); } - d.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z); + SafeNativeMethods.BodySetAngularVel(Body, newAngVel.X, newAngVel.Y, newAngVel.Z); } //resetCollisionAccounting(); } @@ -3580,7 +3585,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (!childPrim && m_isphysical && Body != IntPtr.Zero && !m_disabled && !m_isSelected && !m_building && !m_outbounds) { - if (!d.BodyIsEnabled(Body)) + if (!SafeNativeMethods.BodyIsEnabled(Body)) { // let vehicles sleep if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) @@ -3590,18 +3595,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde return; // clear residuals - d.BodySetAngularVel(Body,0f,0f,0f); - d.BodySetLinearVel(Body,0f,0f,0f); + SafeNativeMethods.BodySetAngularVel(Body,0f,0f,0f); + SafeNativeMethods.BodySetLinearVel(Body,0f,0f,0f); _zeroFlag = true; - d.BodySetAutoDisableSteps(Body, 1); - d.BodyEnable(Body); + SafeNativeMethods.BodySetAutoDisableSteps(Body, 1); + SafeNativeMethods.BodyEnable(Body); m_bodydisablecontrol = -3; } if(m_bodydisablecontrol < 0) m_bodydisablecontrol++; - d.Vector3 lpos = d.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator + SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(prim_geom); // root position that is seem by rest of simulator if (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) { @@ -3628,8 +3633,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (_target_velocity.ApproxEquals(Vector3.Zero, 0.02f)) { - d.BodySetPosition(Body, m_PIDTarget.X, m_PIDTarget.Y, m_PIDTarget.Z); - d.BodySetLinearVel(Body, 0, 0, 0); + SafeNativeMethods.BodySetPosition(Body, m_PIDTarget.X, m_PIDTarget.Y, m_PIDTarget.Z); + SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); return; } else @@ -3652,7 +3657,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde _target_velocity *= tmp; } - d.Vector3 vel = d.BodyGetLinearVel(Body); + SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body); fx = (_target_velocity.X - vel.X) * m_invTimeStep; fy = (_target_velocity.Y - vel.Y) * m_invTimeStep; fz = (_target_velocity.Z - vel.Z) * m_invTimeStep; @@ -3688,15 +3693,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_targetHoverHeight > m_groundHeight || m_isVolumeDetect) { - d.Vector3 vel = d.BodyGetLinearVel(Body); + SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body); fz = (m_targetHoverHeight - lpos.Z); // if error is zero, use position control; otherwise, velocity control if (Math.Abs(fz) < 0.01f) { - d.BodySetPosition(Body, lpos.X, lpos.Y, m_targetHoverHeight); - d.BodySetLinearVel(Body, vel.X, vel.Y, 0); + SafeNativeMethods.BodySetPosition(Body, lpos.X, lpos.Y, m_targetHoverHeight); + SafeNativeMethods.BodySetLinearVel(Body, vel.X, vel.Y, 0); } else { @@ -3739,7 +3744,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde //m_log.Info("[OBJPID]: X:" + fx.ToString() + " Y:" + fy.ToString() + " Z:" + fz.ToString()); if (fx != 0 || fy != 0 || fz != 0) { - d.BodyAddForce(Body, fx, fy, fz); + SafeNativeMethods.BodyAddForce(Body, fx, fy, fz); //Console.WriteLine("AddForce " + fx + "," + fy + "," + fz); } @@ -3750,7 +3755,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_angularForceacc = Vector3.Zero; if (trq.X != 0 || trq.Y != 0 || trq.Z != 0) { - d.BodyAddTorque(Body, trq.X, trq.Y, trq.Z); + SafeNativeMethods.BodyAddTorque(Body, trq.X, trq.Y, trq.Z); } } else @@ -3769,12 +3774,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(m_bodydisablecontrol < 0) return; - bool bodyenabled = d.BodyIsEnabled(Body); + bool bodyenabled = SafeNativeMethods.BodyIsEnabled(Body); if (bodyenabled || !_zeroFlag) { bool lastZeroFlag = _zeroFlag; - d.Vector3 lpos = d.GeomGetPosition(prim_geom); + SafeNativeMethods.Vector3 lpos = SafeNativeMethods.GeomGetPosition(prim_geom); // check outside region if (lpos.Z < -100 || lpos.Z > 100000f) @@ -3793,9 +3798,9 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_rotationalVelocity.Y = 0; m_rotationalVelocity.Z = 0; - d.BodySetLinearVel(Body, 0, 0, 0); // stop it - d.BodySetAngularVel(Body, 0, 0, 0); // stop it - d.BodySetPosition(Body, lpos.X, lpos.Y, lpos.Z); // put it somewhere + SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it + SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0); // stop it + SafeNativeMethods.BodySetPosition(Body, lpos.X, lpos.Y, lpos.Z); // put it somewhere m_lastposition = _position; m_lastorientation = _orientation; @@ -3835,19 +3840,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_lastposition = _position; m_lastorientation = _orientation; - d.Vector3 dtmp = d.BodyGetAngularVel(Body); + SafeNativeMethods.Vector3 dtmp = SafeNativeMethods.BodyGetAngularVel(Body); m_rotationalVelocity.X = dtmp.X; m_rotationalVelocity.Y = dtmp.Y; m_rotationalVelocity.Z = dtmp.Z; - dtmp = d.BodyGetLinearVel(Body); + dtmp = SafeNativeMethods.BodyGetLinearVel(Body); _velocity.X = dtmp.X; _velocity.Y = dtmp.Y; _velocity.Z = dtmp.Z; - d.BodySetLinearVel(Body, 0, 0, 0); // stop it - d.BodySetAngularVel(Body, 0, 0, 0); - d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); + SafeNativeMethods.BodySetLinearVel(Body, 0, 0, 0); // stop it + SafeNativeMethods.BodySetAngularVel(Body, 0, 0, 0); + SafeNativeMethods.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); disableBodySoft(); // stop collisions UnSubscribeEvents(); @@ -3855,8 +3860,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde return; } - d.Quaternion ori; - d.GeomCopyQuaternion(prim_geom, out ori); + SafeNativeMethods.Quaternion ori; + SafeNativeMethods.GeomCopyQuaternion(prim_geom, out ori); // decide if moving // use positions since this are integrated quantities @@ -3917,7 +3922,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde } else { - d.Vector3 vel = d.BodyGetLinearVel(Body); + SafeNativeMethods.Vector3 vel = SafeNativeMethods.BodyGetLinearVel(Body); m_acceleration = _velocity; @@ -3944,7 +3949,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_acceleration = Vector3.Zero; } - vel = d.BodyGetAngularVel(Body); + vel = SafeNativeMethods.BodyGetAngularVel(Body); if ((Math.Abs(vel.X) < 0.0001) && (Math.Abs(vel.Y) < 0.0001) && (Math.Abs(vel.Z) < 0.0001) @@ -3990,7 +3995,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde return true; } - internal static void DMassSubPartFromObj(ref d.Mass part, ref d.Mass theobj) + internal static void DMassSubPartFromObj(ref SafeNativeMethods.Mass part, ref SafeNativeMethods.Mass theobj) { // assumes object center of mass is zero float smass = part.mass; diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs index f671722e4c..2e3a197621 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODERayCastRequestManager.cs @@ -29,10 +29,8 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Runtime.InteropServices; -using System.Text; using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; -using OdeAPI; using log4net; using OpenMetaverse; @@ -67,7 +65,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// /// ODE near callback delegate /// - private d.NearCallback nearCallback; + private SafeNativeMethods.NearCallback nearCallback; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private List m_contactResults = new List(); private RayFilterFlags CurrentRayFilter; @@ -77,14 +75,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde { m_scene = pScene; nearCallback = near; - ray = d.CreateRay(IntPtr.Zero, 1.0f); - d.GeomSetCategoryBits(ray, 0); - Box = d.CreateBox(IntPtr.Zero, 1.0f, 1.0f, 1.0f); - d.GeomSetCategoryBits(Box, 0); - Sphere = d.CreateSphere(IntPtr.Zero,1.0f); - d.GeomSetCategoryBits(Sphere, 0); - Plane = d.CreatePlane(IntPtr.Zero, 0f,0f,1f,1f); - d.GeomSetCategoryBits(Sphere, 0); + ray = SafeNativeMethods.CreateRay(IntPtr.Zero, 1.0f); + SafeNativeMethods.GeomSetCategoryBits(ray, 0); + Box = SafeNativeMethods.CreateBox(IntPtr.Zero, 1.0f, 1.0f, 1.0f); + SafeNativeMethods.GeomSetCategoryBits(Box, 0); + Sphere = SafeNativeMethods.CreateSphere(IntPtr.Zero,1.0f); + SafeNativeMethods.GeomSetCategoryBits(Sphere, 0); + Plane = SafeNativeMethods.CreatePlane(IntPtr.Zero, 0f,0f,1f,1f); + SafeNativeMethods.GeomSetCategoryBits(Sphere, 0); } public void QueueRequest(ODERayRequest req) @@ -152,29 +150,29 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if (CollisionContactGeomsPerTest > 80) CollisionContactGeomsPerTest = 80; - d.GeomBoxSetLengths(Box, req.Normal.X, req.Normal.Y, req.Normal.Z); - d.GeomSetPosition(Box, req.Origin.X, req.Origin.Y, req.Origin.Z); - d.Quaternion qtmp; + SafeNativeMethods.GeomBoxSetLengths(Box, req.Normal.X, req.Normal.Y, req.Normal.Z); + SafeNativeMethods.GeomSetPosition(Box, req.Origin.X, req.Origin.Y, req.Origin.Z); + SafeNativeMethods.Quaternion qtmp; qtmp.X = req.orientation.X; qtmp.Y = req.orientation.Y; qtmp.Z = req.orientation.Z; qtmp.W = req.orientation.W; - d.GeomSetQuaternion(Box, ref qtmp); + SafeNativeMethods.GeomSetQuaternion(Box, ref qtmp); } else if (req.callbackMethod is ProbeSphereCallback) { if (CollisionContactGeomsPerTest > 80) CollisionContactGeomsPerTest = 80; - d.GeomSphereSetRadius(Sphere, req.length); - d.GeomSetPosition(Sphere, req.Origin.X, req.Origin.Y, req.Origin.Z); + SafeNativeMethods.GeomSphereSetRadius(Sphere, req.length); + SafeNativeMethods.GeomSetPosition(Sphere, req.Origin.X, req.Origin.Y, req.Origin.Z); } else if (req.callbackMethod is ProbePlaneCallback) { if (CollisionContactGeomsPerTest > 80) CollisionContactGeomsPerTest = 80; - d.GeomPlaneSetParams(Plane, req.Normal.X, req.Normal.Y, req.Normal.Z, req.length); + SafeNativeMethods.GeomPlaneSetParams(Plane, req.Normal.X, req.Normal.Y, req.Normal.Z, req.length); } else @@ -182,24 +180,24 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (CollisionContactGeomsPerTest > 25) CollisionContactGeomsPerTest = 25; - d.GeomRaySetLength(ray, req.length); - d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); - d.GeomRaySetParams(ray, 0, backfacecull); + SafeNativeMethods.GeomRaySetLength(ray, req.length); + SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); + SafeNativeMethods.GeomRaySetParams(ray, 0, backfacecull); if (req.callbackMethod is RaycastCallback) { // if we only want one get only one per Collision pair saving memory CurrentRayFilter |= RayFilterFlags.ClosestHit; - d.GeomRaySetClosestHit(ray, 1); + SafeNativeMethods.GeomRaySetClosestHit(ray, 1); } else - d.GeomRaySetClosestHit(ray, closestHit); + SafeNativeMethods.GeomRaySetClosestHit(ray, closestHit); } if ((CurrentRayFilter & RayFilterFlags.ContactsUnImportant) != 0) unchecked { - CollisionContactGeomsPerTest |= (int)d.CONTACTS_UNIMPORTANT; + CollisionContactGeomsPerTest |= (int)SafeNativeMethods.CONTACTS_UNIMPORTANT; } if (geom == IntPtr.Zero) @@ -224,27 +222,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (req.callbackMethod is ProbeBoxCallback) { catflags |= CollisionCategories.Space; - d.GeomSetCollideBits(Box, (uint)catflags); - d.GeomSetCategoryBits(Box, (uint)catflags); + SafeNativeMethods.GeomSetCollideBits(Box, (uint)catflags); + SafeNativeMethods.GeomSetCategoryBits(Box, (uint)catflags); doProbe(req, Box); } else if (req.callbackMethod is ProbeSphereCallback) { catflags |= CollisionCategories.Space; - d.GeomSetCollideBits(Sphere, (uint)catflags); - d.GeomSetCategoryBits(Sphere, (uint)catflags); + SafeNativeMethods.GeomSetCollideBits(Sphere, (uint)catflags); + SafeNativeMethods.GeomSetCategoryBits(Sphere, (uint)catflags); doProbe(req, Sphere); } else if (req.callbackMethod is ProbePlaneCallback) { catflags |= CollisionCategories.Space; - d.GeomSetCollideBits(Plane, (uint)catflags); - d.GeomSetCategoryBits(Plane, (uint)catflags); + SafeNativeMethods.GeomSetCollideBits(Plane, (uint)catflags); + SafeNativeMethods.GeomSetCategoryBits(Plane, (uint)catflags); doPlane(req,IntPtr.Zero); } else { - d.GeomSetCollideBits(ray, (uint)catflags); + SafeNativeMethods.GeomSetCollideBits(ray, (uint)catflags); doSpaceRay(req); } } @@ -255,12 +253,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (req.callbackMethod is ProbePlaneCallback) { - d.GeomSetCollideBits(Plane, (uint)CollisionCategories.All); + SafeNativeMethods.GeomSetCollideBits(Plane, (uint)CollisionCategories.All); doPlane(req,geom); } else { - d.GeomSetCollideBits(ray, (uint)CollisionCategories.All); + SafeNativeMethods.GeomSetCollideBits(ray, (uint)CollisionCategories.All); doGeomRay(req,geom); } } @@ -307,11 +305,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde // Collide tests if ((CurrentRayFilter & FilterActiveSpace) != 0) { - d.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); - d.SpaceCollide2(ray, m_scene.CharsSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(ray, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(ray, m_scene.CharsSpace, IntPtr.Zero, nearCallback); } if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) - d.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(ray, m_scene.StaticSpace, IntPtr.Zero, nearCallback); if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) { // current ode land to ray collisions is very bad @@ -324,11 +322,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde { float tmp2 = req.length * req.length - tmp + 2500; tmp2 = (float)Math.Sqrt(tmp2); - d.GeomRaySetLength(ray, tmp2); + SafeNativeMethods.GeomRaySetLength(ray, tmp2); } } - d.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(ray, m_scene.GroundSpace, IntPtr.Zero, nearCallback); } if (req.callbackMethod is RaycastCallback) @@ -377,13 +375,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde // Collide tests if ((CurrentRayFilter & FilterActiveSpace) != 0) { - d.SpaceCollide2(probe, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); - d.SpaceCollide2(probe, m_scene.CharsSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(probe, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(probe, m_scene.CharsSpace, IntPtr.Zero, nearCallback); } if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) - d.SpaceCollide2(probe, m_scene.StaticSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(probe, m_scene.StaticSpace, IntPtr.Zero, nearCallback); if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) - d.SpaceCollide2(probe, m_scene.GroundSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(probe, m_scene.GroundSpace, IntPtr.Zero, nearCallback); List cresult = new List(m_contactResults.Count); lock (m_PendingRequests) @@ -404,17 +402,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde { if ((CurrentRayFilter & FilterActiveSpace) != 0) { - d.SpaceCollide2(Plane, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); - d.SpaceCollide2(Plane, m_scene.CharsSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(Plane, m_scene.ActiveSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(Plane, m_scene.CharsSpace, IntPtr.Zero, nearCallback); } if ((CurrentRayFilter & FilterStaticSpace) != 0 && (m_contactResults.Count < CurrentMaxCount)) - d.SpaceCollide2(Plane, m_scene.StaticSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(Plane, m_scene.StaticSpace, IntPtr.Zero, nearCallback); if ((CurrentRayFilter & RayFilterFlags.land) != 0 && (m_contactResults.Count < CurrentMaxCount)) - d.SpaceCollide2(Plane, m_scene.GroundSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(Plane, m_scene.GroundSpace, IntPtr.Zero, nearCallback); } else { - d.SpaceCollide2(Plane, geom, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(Plane, geom, IntPtr.Zero, nearCallback); } List cresult = new List(m_contactResults.Count); @@ -434,7 +432,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private void doGeomRay(ODERayRequest req, IntPtr geom) { // Collide test - d.SpaceCollide2(ray, geom, IntPtr.Zero, nearCallback); // still do this to have full AABB pre test + SafeNativeMethods.SpaceCollide2(ray, geom, IntPtr.Zero, nearCallback); // still do this to have full AABB pre test if (req.callbackMethod is RaycastCallback) { @@ -478,14 +476,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde } } - private bool GetCurContactGeom(int index, ref d.ContactGeom newcontactgeom) + private bool GetCurContactGeom(int index, ref SafeNativeMethods.ContactGeom newcontactgeom) { IntPtr ContactgeomsArray = m_scene.ContactgeomsArray; if (ContactgeomsArray == IntPtr.Zero || index >= CollisionContactGeomsPerTest) return false; - IntPtr contactptr = new IntPtr(ContactgeomsArray.ToInt64() + (Int64)(index * d.ContactGeom.unmanagedSizeOf)); - newcontactgeom = (d.ContactGeom)Marshal.PtrToStructure(contactptr, typeof(d.ContactGeom)); + IntPtr contactptr = new IntPtr(ContactgeomsArray.ToInt64() + (Int64)(index * SafeNativeMethods.ContactGeom.unmanagedSizeOf)); + newcontactgeom = (SafeNativeMethods.ContactGeom)Marshal.PtrToStructure(contactptr, typeof(SafeNativeMethods.ContactGeom)); return true; } @@ -498,11 +496,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (m_contactResults.Count >= CurrentMaxCount) return; - if (d.GeomIsSpace(g2)) + if (SafeNativeMethods.GeomIsSpace(g2)) { try { - d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); } catch (Exception e) { @@ -514,7 +512,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde int count = 0; try { - count = d.CollidePtr(g1, g2, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); + count = SafeNativeMethods.CollidePtr(g1, g2, CollisionContactGeomsPerTest, m_scene.ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf); } catch (Exception e) { @@ -586,7 +584,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde break; } - d.ContactGeom curcontact = new d.ContactGeom(); + SafeNativeMethods.ContactGeom curcontact = new SafeNativeMethods.ContactGeom(); // closestHit for now only works for meshs, so must do it for others if ((CurrentRayFilter & RayFilterFlags.ClosestHit) == 0) @@ -654,22 +652,22 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_scene = null; if (ray != IntPtr.Zero) { - d.GeomDestroy(ray); + SafeNativeMethods.GeomDestroy(ray); ray = IntPtr.Zero; } if (Box != IntPtr.Zero) { - d.GeomDestroy(Box); + SafeNativeMethods.GeomDestroy(Box); Box = IntPtr.Zero; } if (Sphere != IntPtr.Zero) { - d.GeomDestroy(Sphere); + SafeNativeMethods.GeomDestroy(Sphere); Sphere = IntPtr.Zero; } if (Plane != IntPtr.Zero) { - d.GeomDestroy(Plane); + SafeNativeMethods.GeomDestroy(Plane); Plane = IntPtr.Zero; } } diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index 5f63a7bf5a..0003085fc7 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -34,15 +34,10 @@ using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Threading; -using System.IO; -using System.Diagnostics; using log4net; using Nini.Config; -using Mono.Addins; -using OdeAPI; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; -using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.PhysicsModules.SharedBase; using OpenMetaverse; @@ -180,7 +175,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // const d.ContactFlags comumContactFlags = d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM |d.ContactFlags.Approx1 | d.ContactFlags.Bounce; // const d.ContactFlags comumContactFlags = d.ContactFlags.Bounce | d.ContactFlags.Approx1 | d.ContactFlags.Slip1 | d.ContactFlags.Slip2; - const d.ContactFlags comumContactFlags = d.ContactFlags.Bounce | d.ContactFlags.Approx1; + const SafeNativeMethods.ContactFlags comumContactFlags = SafeNativeMethods.ContactFlags.Bounce | SafeNativeMethods.ContactFlags.Approx1; const float comumContactERP = 0.75f; const float comumContactCFM = 0.0001f; const float comumContactSLIP = 0f; @@ -228,7 +223,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde public int bodyFramesAutoDisable = 5; - private d.NearCallback nearCallback; + private SafeNativeMethods.NearCallback nearCallback; private Dictionary _prims = new Dictionary(); private HashSet _characters = new HashSet(); @@ -251,7 +246,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde private int contactsPerCollision = 80; internal IntPtr ContactgeomsArray = IntPtr.Zero; private IntPtr GlobalContactsArray = IntPtr.Zero; - private d.Contact SharedTmpcontact = new d.Contact(); + private SafeNativeMethods.Contact SharedTmpcontact = new SafeNativeMethods.Contact(); const int maxContactsbeforedeath = 6000; private volatile int m_global_contactcount = 0; @@ -356,7 +351,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde /// private void Initialization() { - d.AllocateODEDataForThread(~0U); + SafeNativeMethods.AllocateODEDataForThread(~0U); SimulationLock = new Object(); @@ -374,15 +369,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde // Create the world and the first space try { - world = d.WorldCreate(); - TopSpace = d.SimpleSpaceCreate(IntPtr.Zero); - ActiveSpace = d.SimpleSpaceCreate(TopSpace); - CharsSpace = d.SimpleSpaceCreate(TopSpace); - GroundSpace = d.SimpleSpaceCreate(TopSpace); + world = SafeNativeMethods.WorldCreate(); + TopSpace = SafeNativeMethods.SimpleSpaceCreate(IntPtr.Zero); + ActiveSpace = SafeNativeMethods.SimpleSpaceCreate(TopSpace); + CharsSpace = SafeNativeMethods.SimpleSpaceCreate(TopSpace); + GroundSpace = SafeNativeMethods.SimpleSpaceCreate(TopSpace); float sx = WorldExtents.X + 16; float sy = WorldExtents.Y + 16; - d.Vector3 ex =new d.Vector3(sx, sy, 0); - d.Vector3 px =new d.Vector3(sx * 0.5f, sx * 0.5f, 0); + SafeNativeMethods.Vector3 ex =new SafeNativeMethods.Vector3(sx, sy, 0); + SafeNativeMethods.Vector3 px =new SafeNativeMethods.Vector3(sx * 0.5f, sx * 0.5f, 0); if(sx < sy) sx = sy; sx = (float)Math.Log(sx) * 1.442695f + 0.5f; @@ -391,7 +386,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde dp = 8; else if(dp < 4) dp = 4; - StaticSpace = d.QuadTreeSpaceCreate(TopSpace, ref px, ref ex, dp); + StaticSpace = SafeNativeMethods.QuadTreeSpaceCreate(TopSpace, ref px, ref ex, dp); } catch { @@ -400,47 +395,47 @@ namespace OpenSim.Region.PhysicsModule.ubOde } // demote to second level - d.SpaceSetSublevel(ActiveSpace, 1); - d.SpaceSetSublevel(CharsSpace, 1); - d.SpaceSetSublevel(StaticSpace, 1); - d.SpaceSetSublevel(GroundSpace, 1); + SafeNativeMethods.SpaceSetSublevel(ActiveSpace, 1); + SafeNativeMethods.SpaceSetSublevel(CharsSpace, 1); + SafeNativeMethods.SpaceSetSublevel(StaticSpace, 1); + SafeNativeMethods.SpaceSetSublevel(GroundSpace, 1); - d.GeomSetCategoryBits(ActiveSpace, (uint)(CollisionCategories.Space | + SafeNativeMethods.GeomSetCategoryBits(ActiveSpace, (uint)(CollisionCategories.Space | CollisionCategories.Geom | CollisionCategories.Character | CollisionCategories.Phantom | CollisionCategories.VolumeDtc )); - d.GeomSetCollideBits(ActiveSpace, (uint)(CollisionCategories.Space | + SafeNativeMethods.GeomSetCollideBits(ActiveSpace, (uint)(CollisionCategories.Space | CollisionCategories.Geom | CollisionCategories.Character | CollisionCategories.Phantom | CollisionCategories.VolumeDtc )); - d.GeomSetCategoryBits(CharsSpace, (uint)(CollisionCategories.Space | + SafeNativeMethods.GeomSetCategoryBits(CharsSpace, (uint)(CollisionCategories.Space | CollisionCategories.Geom | CollisionCategories.Character | CollisionCategories.Phantom | CollisionCategories.VolumeDtc )); - d.GeomSetCollideBits(CharsSpace, 0); + SafeNativeMethods.GeomSetCollideBits(CharsSpace, 0); - d.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space | + SafeNativeMethods.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space | CollisionCategories.Geom | // CollisionCategories.Land | // CollisionCategories.Water | CollisionCategories.Phantom | CollisionCategories.VolumeDtc )); - d.GeomSetCollideBits(StaticSpace, 0); + SafeNativeMethods.GeomSetCollideBits(StaticSpace, 0); - d.GeomSetCategoryBits(GroundSpace, (uint)(CollisionCategories.Land)); - d.GeomSetCollideBits(GroundSpace, 0); + SafeNativeMethods.GeomSetCategoryBits(GroundSpace, (uint)(CollisionCategories.Land)); + SafeNativeMethods.GeomSetCollideBits(GroundSpace, 0); - contactgroup = d.JointGroupCreate(maxContactsbeforedeath + 1); + contactgroup = SafeNativeMethods.JointGroupCreate(maxContactsbeforedeath + 1); //contactgroup - d.WorldSetAutoDisableFlag(world, false); + SafeNativeMethods.WorldSetAutoDisableFlag(world, false); } @@ -490,27 +485,27 @@ namespace OpenSim.Region.PhysicsModule.ubOde maximumAngularVelocity = 0.49f * heartbeat *(float)Math.PI; maxAngVelocitySQ = maximumAngularVelocity * maximumAngularVelocity; - d.WorldSetCFM(world, comumContactCFM); - d.WorldSetERP(world, comumContactERP); + SafeNativeMethods.WorldSetCFM(world, comumContactCFM); + SafeNativeMethods.WorldSetERP(world, comumContactERP); - d.WorldSetGravity(world, gravityx, gravityy, gravityz); + SafeNativeMethods.WorldSetGravity(world, gravityx, gravityy, gravityz); - d.WorldSetLinearDamping(world, 0.001f); - d.WorldSetAngularDamping(world, 0.002f); - d.WorldSetAngularDampingThreshold(world, 0f); - d.WorldSetLinearDampingThreshold(world, 0f); - d.WorldSetMaxAngularSpeed(world, maximumAngularVelocity); + SafeNativeMethods.WorldSetLinearDamping(world, 0.001f); + SafeNativeMethods.WorldSetAngularDamping(world, 0.002f); + SafeNativeMethods.WorldSetAngularDampingThreshold(world, 0f); + SafeNativeMethods.WorldSetLinearDampingThreshold(world, 0f); + SafeNativeMethods.WorldSetMaxAngularSpeed(world, maximumAngularVelocity); - d.WorldSetQuickStepNumIterations(world, m_physicsiterations); + SafeNativeMethods.WorldSetQuickStepNumIterations(world, m_physicsiterations); - d.WorldSetContactSurfaceLayer(world, contactsurfacelayer); - d.WorldSetContactMaxCorrectingVel(world, 60.0f); + SafeNativeMethods.WorldSetContactSurfaceLayer(world, contactsurfacelayer); + SafeNativeMethods.WorldSetContactMaxCorrectingVel(world, 60.0f); HalfOdeStep = ODE_STEPSIZE * 0.5f; odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f); - ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * d.ContactGeom.unmanagedSizeOf); - GlobalContactsArray = Marshal.AllocHGlobal((maxContactsbeforedeath + 100) * d.Contact.unmanagedSizeOf); + ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * SafeNativeMethods.ContactGeom.unmanagedSizeOf); + GlobalContactsArray = Marshal.AllocHGlobal((maxContactsbeforedeath + 100) * SafeNativeMethods.Contact.unmanagedSizeOf); SharedTmpcontact.geom.g1 = IntPtr.Zero; SharedTmpcontact.geom.g2 = IntPtr.Zero; @@ -565,7 +560,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde #region Collision Detection // sets a global contact for a joint for contactgeom , and base contact description) - private IntPtr CreateContacJoint(ref d.ContactGeom contactGeom,bool smooth) + private IntPtr CreateContacJoint(ref SafeNativeMethods.ContactGeom contactGeom,bool smooth) { if (m_global_contactcount >= maxContactsbeforedeath) return IntPtr.Zero; @@ -578,18 +573,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde SharedTmpcontact.geom.pos = contactGeom.pos; SharedTmpcontact.geom.normal = contactGeom.normal; - IntPtr contact = new IntPtr(GlobalContactsArray.ToInt64() + (Int64)(m_global_contactcount * d.Contact.unmanagedSizeOf)); + IntPtr contact = new IntPtr(GlobalContactsArray.ToInt64() + (Int64)(m_global_contactcount * SafeNativeMethods.Contact.unmanagedSizeOf)); Marshal.StructureToPtr(SharedTmpcontact, contact, true); - return d.JointCreateContactPtr(world, contactgroup, contact); + return SafeNativeMethods.JointCreateContactPtr(world, contactgroup, contact); } - private bool GetCurContactGeom(int index, ref d.ContactGeom newcontactgeom) + private bool GetCurContactGeom(int index, ref SafeNativeMethods.ContactGeom newcontactgeom) { if (ContactgeomsArray == IntPtr.Zero || index >= contactsPerCollision) return false; - IntPtr contactptr = new IntPtr(ContactgeomsArray.ToInt64() + (Int64)(index * d.ContactGeom.unmanagedSizeOf)); - newcontactgeom = (d.ContactGeom)Marshal.PtrToStructure(contactptr, typeof(d.ContactGeom)); + IntPtr contactptr = new IntPtr(ContactgeomsArray.ToInt64() + (Int64)(index * SafeNativeMethods.ContactGeom.unmanagedSizeOf)); + newcontactgeom = (SafeNativeMethods.ContactGeom)Marshal.PtrToStructure(contactptr, typeof(SafeNativeMethods.ContactGeom)); return true; } @@ -614,14 +609,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) return; - if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) + if (SafeNativeMethods.GeomIsSpace(g1) || SafeNativeMethods.GeomIsSpace(g2)) { // We'll be calling near recursivly if one // of them is a space to find all of the // contact points in the space try { - d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback); } catch (AccessViolationException) { @@ -636,8 +631,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde // get geom bodies to check if we already a joint contact // guess this shouldn't happen now - IntPtr b1 = d.GeomGetBody(g1); - IntPtr b2 = d.GeomGetBody(g2); + IntPtr b1 = SafeNativeMethods.GeomGetBody(g1); + IntPtr b2 = SafeNativeMethods.GeomGetBody(g2); // d.GeomClassID id = d.GeomGetClass(g1); @@ -679,18 +674,18 @@ namespace OpenSim.Region.PhysicsModule.ubOde // */ - if (d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc || - d.GeomGetCategoryBits(g2) == (uint)CollisionCategories.VolumeDtc) + if (SafeNativeMethods.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc || + SafeNativeMethods.GeomGetCategoryBits(g2) == (uint)CollisionCategories.VolumeDtc) { int cflags; unchecked { - cflags = (int)(1 | d.CONTACTS_UNIMPORTANT); + cflags = (int)(1 | SafeNativeMethods.CONTACTS_UNIMPORTANT); } - count = d.CollidePtr(g1, g2, cflags, ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); + count = SafeNativeMethods.CollidePtr(g1, g2, cflags, ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf); } else - count = d.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); + count = SafeNativeMethods.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, SafeNativeMethods.ContactGeom.unmanagedSizeOf); } catch (SEHException) { @@ -726,7 +721,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // get first contact - d.ContactGeom curContact = new d.ContactGeom(); + SafeNativeMethods.ContactGeom curContact = new SafeNativeMethods.ContactGeom(); if (!GetCurContactGeom(0, ref curContact)) return; @@ -802,8 +797,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde // if (relVlenSQ > 0.01f) // mu *= frictionMovementMult; - if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass && - d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass) + if(SafeNativeMethods.GeomGetClass(g2) == SafeNativeMethods.GeomClassID.TriMeshClass && + SafeNativeMethods.GeomGetClass(g1) == SafeNativeMethods.GeomClassID.TriMeshClass) smoothMesh = true; break; @@ -817,7 +812,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // mu *= frictionMovementMult; p1.CollidingGround = true; - if(d.GeomGetClass(g1) == d.GeomClassID.TriMeshClass) + if(SafeNativeMethods.GeomGetClass(g1) == SafeNativeMethods.GeomClassID.TriMeshClass) smoothMesh = true; break; @@ -843,7 +838,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // if (Math.Abs(v2.X) > 0.1f || Math.Abs(v2.Y) > 0.1f) // mu *= frictionMovementMult; - if(d.GeomGetClass(g2) == d.GeomClassID.TriMeshClass) + if(SafeNativeMethods.GeomGetClass(g2) == SafeNativeMethods.GeomClassID.TriMeshClass) smoothMesh = true; } else @@ -873,7 +868,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde SharedTmpcontact.surface.mu = mu; SharedTmpcontact.surface.bounce = bounce; - d.ContactGeom altContact = new d.ContactGeom(); + SafeNativeMethods.ContactGeom altContact = new SafeNativeMethods.ContactGeom(); bool useAltcontact; bool noskip; @@ -925,7 +920,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (Joint == IntPtr.Zero) break; - d.JointAttach(Joint, b1, b2); + SafeNativeMethods.JointAttach(Joint, b1, b2); ncontacts++; @@ -1073,12 +1068,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde continue; // do colisions with static space - d.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(chr.collider, StaticSpace, IntPtr.Zero, nearCallback); // no coll with gnd } // chars with chars - d.SpaceCollide(CharsSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide(CharsSpace, IntPtr.Zero, nearCallback); } catch (AccessViolationException) @@ -1094,7 +1089,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde { aprim.CollisionScore = 0; aprim.IsColliding = false; - if(!aprim.m_outbounds && d.BodyIsEnabled(aprim.Body)) + if(!aprim.m_outbounds && SafeNativeMethods.BodyIsEnabled(aprim.Body)) aprim.clearSleeperCollisions(); } } @@ -1105,11 +1100,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde { foreach (OdePrim aprim in _activegroups) { - if(!aprim.m_outbounds && d.BodyIsEnabled(aprim.Body) && + if(!aprim.m_outbounds && SafeNativeMethods.BodyIsEnabled(aprim.Body) && aprim.collide_geom != IntPtr.Zero) { - d.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); - d.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(StaticSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(GroundSpace, aprim.collide_geom, IntPtr.Zero, nearCallback); } } } @@ -1122,7 +1117,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // colide active amoung them try { - d.SpaceCollide(ActiveSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide(ActiveSpace, IntPtr.Zero, nearCallback); } catch (Exception e) { @@ -1132,7 +1127,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // and with chars try { - d.SpaceCollide2(CharsSpace,ActiveSpace, IntPtr.Zero, nearCallback); + SafeNativeMethods.SpaceCollide2(CharsSpace,ActiveSpace, IntPtr.Zero, nearCallback); } catch (Exception e) { @@ -1232,7 +1227,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde lock (OdeLock) { - d.AllocateODEDataForThread(0); + SafeNativeMethods.AllocateODEDataForThread(0); ((OdeCharacter) actor).Destroy(); } } @@ -1403,16 +1398,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde return StaticSpace; // else remove it from its current space - if (currentspace != IntPtr.Zero && d.SpaceQuery(currentspace, geom)) + if (currentspace != IntPtr.Zero && SafeNativeMethods.SpaceQuery(currentspace, geom)) { - if (d.GeomIsSpace(currentspace)) + if (SafeNativeMethods.GeomIsSpace(currentspace)) { waitForSpaceUnlock(currentspace); - d.SpaceRemove(currentspace, geom); + SafeNativeMethods.SpaceRemove(currentspace, geom); - if (d.SpaceGetSublevel(currentspace) > 2 && d.SpaceGetNumGeoms(currentspace) == 0) + if (SafeNativeMethods.SpaceGetSublevel(currentspace) > 2 && SafeNativeMethods.SpaceGetNumGeoms(currentspace) == 0) { - d.SpaceDestroy(currentspace); + SafeNativeMethods.SpaceDestroy(currentspace); } } else @@ -1421,19 +1416,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde " Geom:" + geom); } } - else // odd currentspace is null or doesn't contain the geom? lets try the geom ideia of current space + else { - currentspace = d.GeomGetSpace(geom); + currentspace = SafeNativeMethods.GeomGetSpace(geom); if (currentspace != IntPtr.Zero) { - if (d.GeomIsSpace(currentspace)) + if (SafeNativeMethods.GeomIsSpace(currentspace)) { waitForSpaceUnlock(currentspace); - d.SpaceRemove(currentspace, geom); + SafeNativeMethods.SpaceRemove(currentspace, geom); - if (d.SpaceGetSublevel(currentspace) > 2 && d.SpaceGetNumGeoms(currentspace) == 0) + if (SafeNativeMethods.SpaceGetSublevel(currentspace) > 2 && SafeNativeMethods.SpaceGetNumGeoms(currentspace) == 0) { - d.SpaceDestroy(currentspace); + SafeNativeMethods.SpaceDestroy(currentspace); } } } @@ -1441,12 +1436,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde // put the geom in the newspace waitForSpaceUnlock(StaticSpace); - d.SpaceAdd(StaticSpace, geom); + if(SafeNativeMethods.SpaceQuery(StaticSpace, geom)) + m_log.Info("[Physics]: 'MoveGeomToStaticSpace' geom already in static space:" + geom); + else + SafeNativeMethods.SpaceAdd(StaticSpace, geom); return StaticSpace; } - - #endregion @@ -1485,7 +1481,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde return; } - d.AllocateODEDataForThread(~0U); + SafeNativeMethods.AllocateODEDataForThread(~0U); ODEchangeitem item; @@ -1585,7 +1581,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde double moveTime = 0; double rayTime = 0; */ - d.AllocateODEDataForThread(~0U); + SafeNativeMethods.AllocateODEDataForThread(~0U); if (ChangesQueue.Count > 0) { @@ -1689,7 +1685,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde pobj.SendCollisions((int)(odetimestepMS)); if(pobj.Body != IntPtr.Zero && !pobj.m_isSelected && !pobj.m_disabled && !pobj.m_building && - !d.BodyIsEnabled(pobj.Body)) + !SafeNativeMethods.BodyIsEnabled(pobj.Body)) sleepers.Add(pobj); } break; @@ -1704,8 +1700,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde // do a ode simulation step // tmpTime = Util.GetTimeStampMS(); - d.WorldQuickStep(world, ODE_STEPSIZE); - d.JointGroupEmpty(contactgroup); + SafeNativeMethods.WorldQuickStep(world, ODE_STEPSIZE); + SafeNativeMethods.JointGroupEmpty(contactgroup); // qstepTIme += Util.GetTimeStampMS() - tmpTime; // update managed ideia of physical data and do updates to core @@ -1828,26 +1824,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde } */ -/* - // Finished with all sim stepping. If requested, dump world state to file for debugging. - // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed? - // TODO: This overwrites all dump files in-place. Should this be a growing logfile, or separate snapshots? - if (physics_logging && (physics_logging_interval > 0) && (framecount % physics_logging_interval == 0)) - { - string fname = "state-" + world.ToString() + ".DIF"; // give each physics world a separate filename - string prefix = "world" + world.ToString(); // prefix for variable names in exported .DIF file - - if (physics_logging_append_existing_logfile) - { - string header = "-------------- START OF PHYSICS FRAME " + framecount.ToString() + " --------------"; - TextWriter fwriter = File.AppendText(fname); - fwriter.WriteLine(header); - fwriter.Close(); - } - - d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); - } -*/ fps = (float)nodeframes * ODE_STEPSIZE / reqTimeStep; if(step_time < HalfOdeStep) @@ -2208,35 +2184,35 @@ namespace OpenSim.Region.PhysicsModule.ubOde lock (OdeLock) { - d.AllocateODEDataForThread(~0U); + SafeNativeMethods.AllocateODEDataForThread(~0U); if (TerrainGeom != IntPtr.Zero) { actor_name_map.Remove(TerrainGeom); - d.GeomDestroy(TerrainGeom); + SafeNativeMethods.GeomDestroy(TerrainGeom); } if (TerrainHeightFieldHeightsHandler.IsAllocated) TerrainHeightFieldHeightsHandler.Free(); - IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); + IntPtr HeightmapData = SafeNativeMethods.GeomHeightfieldDataCreate(); TerrainHeightFieldHeightsHandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned); - d.GeomHeightfieldDataBuildSingle(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0, + SafeNativeMethods.GeomHeightfieldDataBuildSingle(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0, heightmapHeight, heightmapWidth , (int)heightmapHeightSamples, (int)heightmapWidthSamples, scale, offset, thickness, wrap); - d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); + SafeNativeMethods.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); - TerrainGeom = d.CreateHeightfield(GroundSpace, HeightmapData, 1); + TerrainGeom = SafeNativeMethods.CreateHeightfield(GroundSpace, HeightmapData, 1); if (TerrainGeom != IntPtr.Zero) { - d.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land)); - d.GeomSetCollideBits(TerrainGeom, 0); + SafeNativeMethods.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land)); + SafeNativeMethods.GeomSetCollideBits(TerrainGeom, 0); PhysicsActor pa = new NullPhysicsActor(); pa.Name = "Terrain"; @@ -2245,14 +2221,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde // geom_name_map[GroundGeom] = "Terrain"; - d.Quaternion q = new d.Quaternion(); + SafeNativeMethods.Quaternion q = new SafeNativeMethods.Quaternion(); q.X = 0.5f; q.Y = 0.5f; q.Z = 0.5f; q.W = 0.5f; - d.GeomSetQuaternion(TerrainGeom, ref q); - d.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f); + SafeNativeMethods.GeomSetQuaternion(TerrainGeom, ref q); + SafeNativeMethods.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f); TerrainHeightFieldHeight = _heightmap; } else @@ -2320,7 +2296,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (TerrainGeom != IntPtr.Zero) { actor_name_map.Remove(TerrainGeom); - d.GeomDestroy(TerrainGeom); + SafeNativeMethods.GeomDestroy(TerrainGeom); } if (TerrainHeightFieldHeightsHandler.IsAllocated) @@ -2328,7 +2304,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde TerrainHeightFieldHeight = null; - IntPtr HeightmapData = d.GeomOSTerrainDataCreate(); + IntPtr HeightmapData = SafeNativeMethods.GeomOSTerrainDataCreate(); const int wrap = 0; float thickness = hfmin; @@ -2337,16 +2313,16 @@ namespace OpenSim.Region.PhysicsModule.ubOde TerrainHeightFieldHeightsHandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned); - d.GeomOSTerrainDataBuild(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0, 1.0f, + SafeNativeMethods.GeomOSTerrainDataBuild(HeightmapData, TerrainHeightFieldHeightsHandler.AddrOfPinnedObject(), 0, 1.0f, (int)heightmapWidthSamples, (int)heightmapHeightSamples, thickness, wrap); // d.GeomOSTerrainDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); - TerrainGeom = d.CreateOSTerrain(GroundSpace, HeightmapData, 1); + TerrainGeom = SafeNativeMethods.CreateOSTerrain(GroundSpace, HeightmapData, 1); if (TerrainGeom != IntPtr.Zero) { - d.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land)); - d.GeomSetCollideBits(TerrainGeom, 0); + SafeNativeMethods.GeomSetCategoryBits(TerrainGeom, (uint)(CollisionCategories.Land)); + SafeNativeMethods.GeomSetCollideBits(TerrainGeom, 0); PhysicsActor pa = new NullPhysicsActor(); pa.Name = "Terrain"; @@ -2355,7 +2331,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde // geom_name_map[GroundGeom] = "Terrain"; - d.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f); + SafeNativeMethods.GeomSetPosition(TerrainGeom, m_regionWidth * 0.5f, m_regionHeight * 0.5f, 0.0f); TerrainHeightFieldHeight = _heightmap; } else @@ -2385,7 +2361,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if (world == IntPtr.Zero) return; - d.AllocateODEDataForThread(~0U); + SafeNativeMethods.AllocateODEDataForThread(~0U); if (m_meshWorker != null) m_meshWorker.Stop(); @@ -2419,7 +2395,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde ch.DoAChange(changes.Remove, null); if (TerrainGeom != IntPtr.Zero) - d.GeomDestroy(TerrainGeom); + SafeNativeMethods.GeomDestroy(TerrainGeom); TerrainGeom = IntPtr.Zero; if (TerrainHeightFieldHeightsHandler.IsAllocated) @@ -2438,7 +2414,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde GlobalContactsArray = IntPtr.Zero; } - d.WorldDestroy(world); + SafeNativeMethods.WorldDestroy(world); world = IntPtr.Zero; //d.CloseODE(); } diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs b/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs index 214205ddc5..f882e6ccf2 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODESitAvatar.cs @@ -27,13 +27,7 @@ // Ubit Umarov 2012 using System; using System.Collections.Generic; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Text; -using OpenSim.Framework; using OpenSim.Region.PhysicsModules.SharedBase; -using OdeAPI; -using log4net; using OpenMetaverse; namespace OpenSim.Region.PhysicsModule.ubOde @@ -78,8 +72,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde IntPtr geom = ((OdePrim)actor).prim_geom; - Vector3 geopos = d.GeomGetPositionOMV(geom); - Quaternion geomOri = d.GeomGetQuaternionOMV(geom); + Vector3 geopos = SafeNativeMethods.GeomGetPositionOMV(geom); + Quaternion geomOri = SafeNativeMethods.GeomGetQuaternionOMV(geom); // Vector3 geopos = actor.Position; // Quaternion geomOri = actor.Orientation; @@ -123,11 +117,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde offset = rayResults[0].Pos - geopos; - d.GeomClassID geoclass = d.GeomGetClass(geom); + SafeNativeMethods.GeomClassID geoclass = SafeNativeMethods.GeomGetClass(geom); - if (geoclass == d.GeomClassID.SphereClass) + if (geoclass == SafeNativeMethods.GeomClassID.SphereClass) { - float r = d.GeomSphereGetRadius(geom); + float r = SafeNativeMethods.GeomSphereGetRadius(geom); offset.Normalize(); offset *= r;