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