make old Ode PInvoke follow ms coding rules

This commit is contained in:
UbitUmarov
2018-01-14 01:40:49 +00:00
parent 88511bfab2
commit 3d87e37d99
7 changed files with 1023 additions and 1026 deletions

View File

@@ -61,12 +61,12 @@ namespace OpenSim.Region.PhysicsModule.ODE
/// <summary>
/// ODE contact array to be filled by the collision testing
/// </summary>
d.ContactGeom[] contacts = new d.ContactGeom[5];
SafeNativeMethods.ContactGeom[] contacts = new SafeNativeMethods.ContactGeom[5];
/// <summary>
/// ODE near callback delegate
/// </summary>
private d.NearCallback nearCallback;
private SafeNativeMethods.NearCallback nearCallback;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private List<ContactResult> m_contactResults = new List<ContactResult>();
@@ -179,14 +179,14 @@ namespace OpenSim.Region.PhysicsModule.ODE
len = 100f;
// Create the ray
IntPtr ray = d.CreateRay(m_scene.space, len);
d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
IntPtr ray = SafeNativeMethods.CreateRay(m_scene.space, len);
SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
// Collide test
d.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback);
SafeNativeMethods.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback);
// Remove Ray
d.GeomDestroy(ray);
SafeNativeMethods.GeomDestroy(ray);
// Define default results
bool hitYN = false;
@@ -230,14 +230,14 @@ namespace OpenSim.Region.PhysicsModule.ODE
len = 100f;
// Create the ray
IntPtr ray = d.CreateRay(m_scene.space, len);
d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
IntPtr ray = SafeNativeMethods.CreateRay(m_scene.space, len);
SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z);
// Collide test
d.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback);
SafeNativeMethods.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback);
// Remove Ray
d.GeomDestroy(ray);
SafeNativeMethods.GeomDestroy(ray);
// Find closest contact and object.
lock (m_contactResults)
@@ -258,7 +258,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
// return;
// Raytest against AABBs of spaces first, then dig into the spaces it hits for actual geoms.
if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2))
if (SafeNativeMethods.GeomIsSpace(g1) || SafeNativeMethods.GeomIsSpace(g2))
{
if (g1 == IntPtr.Zero || g2 == IntPtr.Zero)
return;
@@ -269,7 +269,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
// contact points in the space
try
{
d.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
SafeNativeMethods.SpaceCollide2(g1, g2, IntPtr.Zero, nearCallback);
}
catch (AccessViolationException)
{
@@ -296,7 +296,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
lock (contacts)
{
count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.unmanagedSizeOf);
count = SafeNativeMethods.Collide(g1, g2, contacts.GetLength(0), contacts, SafeNativeMethods.ContactGeom.unmanagedSizeOf);
}
}
catch (SEHException)