rename terrain for opensim and respective configuration flag that a future costumized ODE library may have

avinationmerge
UbitUmarov 2015-10-22 16:20:19 +01:00
parent afba4dc1ce
commit 7aaa84515f
3 changed files with 37 additions and 34 deletions

View File

@ -207,7 +207,7 @@ namespace OdeAPI
public delegate dReal HeightfieldGetHeight(IntPtr p_user_data, int x, int z);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate dReal ubTerrainGetHeight(IntPtr p_user_data, int x, int z);
public delegate dReal OSTerrainGetHeight(IntPtr p_user_data, int x, int z);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void NearCallback(IntPtr data, IntPtr geom1, IntPtr geom2);
@ -734,12 +734,12 @@ namespace OdeAPI
return CreateiHeightfield(space, data, bPlaceable);
}
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dCreateubTerrain"), SuppressUnmanagedCodeSecurity]
public static extern IntPtr CreateiubTerrain(IntPtr space, IntPtr data, int bPlaceable);
public static IntPtr CreateubTerrain(IntPtr space, IntPtr data, int 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)
{
NTotalGeoms++;
return CreateiubTerrain(space, data, bPlaceable);
return CreateiOSTerrain(space, data, bPlaceable);
}
@ -1021,29 +1021,29 @@ namespace OdeAPI
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomUbitTerrainDataBuild"), SuppressUnmanagedCodeSecurity]
public static extern void GeomubTerrainDataBuild(IntPtr d, float[] pHeightData, int bCopyHeightData,
public 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 = "dGeomubTerrainDataBuild"), SuppressUnmanagedCodeSecurity]
public static extern void GeomubTerrainDataBuild(IntPtr d, IntPtr pHeightData, int bCopyHeightData,
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataBuild"), SuppressUnmanagedCodeSecurity]
public 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 = "dGeomubTerrainDataCreate"), SuppressUnmanagedCodeSecurity]
public static extern IntPtr GeomubTerrainDataCreate();
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataCreate"), SuppressUnmanagedCodeSecurity]
public static extern IntPtr GeomOSTerrainDataCreate();
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomubTerrainDataDestroy"), SuppressUnmanagedCodeSecurity]
public static extern void GeomubTerrainDataDestroy(IntPtr d);
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataDestroy"), SuppressUnmanagedCodeSecurity]
public static extern void GeomOSTerrainDataDestroy(IntPtr d);
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomubTerrainDataSetBounds"), SuppressUnmanagedCodeSecurity]
public static extern void GeomubTerrainDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight);
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainDataSetBounds"), SuppressUnmanagedCodeSecurity]
public static extern void GeomOSTerrainDataSetBounds(IntPtr d, dReal minHeight, dReal maxHeight);
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomubTerrainGetHeightfieldData"), SuppressUnmanagedCodeSecurity]
public static extern IntPtr GeomubTerrainGetHeightfieldData(IntPtr g);
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainGetHeightfieldData"), SuppressUnmanagedCodeSecurity]
public static extern IntPtr GeomOSTerrainGetHeightfieldData(IntPtr g);
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomubTerrainSetHeightfieldData"), SuppressUnmanagedCodeSecurity]
public static extern void GeomubTerrainSetHeightfieldData(IntPtr g, IntPtr d);
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomOSTerrainSetHeightfieldData"), SuppressUnmanagedCodeSecurity]
public static extern void GeomOSTerrainSetHeightfieldData(IntPtr g, IntPtr d);
[DllImport("ode", CallingConvention = CallingConvention.Cdecl, EntryPoint = "dGeomIsEnabled"), SuppressUnmanagedCodeSecurity]

View File

@ -18,7 +18,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private bool m_Enabled = false;
private IConfigSource m_config;
private ODEScene m_scene;
private bool ubOdeLib;
private bool OSOdeLib;
#region INonSharedRegionModule
@ -67,13 +67,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
m_log.InfoFormat("[ubODE] ode library configuration: {0}", ode_config);
// ubODE still not avaiable
if (ode_config.Contains("ubODE"))
if (ode_config.Contains("ODE_OPENSIM"))
{
ubOdeLib = true;
OSOdeLib = true;
}
}
m_scene = new ODEScene(scene, m_config, Name, ubOdeLib);
m_scene = new ODEScene(scene, m_config, Name, OSOdeLib);
}
public void RemoveRegion(Scene scene)

View File

@ -169,7 +169,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public bool m_ubOdeLib = false;
public bool m_OSOdeLib = false;
public bool m_suportCombine = false; // mega suport not tested
public Scene m_frameWorkScene = null;
@ -322,7 +322,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
IConfig physicsconfig = null;
public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool pubOdeLib)
public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool pOSOdeLib)
{
OdeLock = new Object();
@ -330,7 +330,10 @@ namespace OpenSim.Region.PhysicsModule.ubOde
PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName;
m_config = psourceconfig;
m_ubOdeLib = pubOdeLib;
m_OSOdeLib = pOSOdeLib;
// m_OSOdeLib = false; //debug
m_frameWorkScene = pscene;
m_frameWorkScene.RegisterModuleInterface<PhysicsScene>(this);
@ -1920,7 +1923,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
int regsizeY = (int)m_regionHeight + 3; // map size see setterrain number of samples
int regsize = regsizeX;
if (m_ubOdeLib)
if (m_OSOdeLib)
{
if (x < regsizeX - 1)
{
@ -2064,7 +2067,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
int ystep = regsizeX;
bool firstTri = false;
if (m_ubOdeLib)
if (m_OSOdeLib)
{
if (x < regsizeX - 1)
{
@ -2176,8 +2179,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
public void SetTerrain(float[] heightMap, Vector3 pOffset)
{
if (m_ubOdeLib)
ubSetTerrain(heightMap, pOffset);
if (m_OSOdeLib)
OSSetTerrain(heightMap, pOffset);
else
OriSetTerrain(heightMap, pOffset);
}
@ -2302,7 +2305,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
}
public void ubSetTerrain(float[] heightMap, Vector3 pOffset)
public void OSSetTerrain(float[] heightMap, Vector3 pOffset)
{
// assumes 1m size grid and constante size square regions
// needs to know about sims around in future
@ -2376,7 +2379,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
}
}
}
IntPtr HeightmapData = d.GeomubTerrainDataCreate();
IntPtr HeightmapData = d.GeomOSTerrainDataCreate();
const int wrap = 0;
float thickness = hfmin;
@ -2385,12 +2388,12 @@ namespace OpenSim.Region.PhysicsModule.ubOde
GCHandle _heightmaphandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned);
d.GeomubTerrainDataBuild(HeightmapData, _heightmaphandler.AddrOfPinnedObject(), 0, 1.0f,
d.GeomOSTerrainDataBuild(HeightmapData, _heightmaphandler.AddrOfPinnedObject(), 0, 1.0f,
(int)heightmapWidthSamples, (int)heightmapHeightSamples,
thickness, wrap);
// d.GeomubTerrainDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
GroundGeom = d.CreateubTerrain(GroundSpace, HeightmapData, 1);
// d.GeomOSTerrainDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
GroundGeom = d.CreateOSTerrain(GroundSpace, HeightmapData, 1);
if (GroundGeom != IntPtr.Zero)
{
d.GeomSetCategoryBits(GroundGeom, (uint)(CollisionCategories.Land));