diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs (renamed from OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs) | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index bd0e372..a2dd885 100644 --- a/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | |||
@@ -45,7 +45,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
45 | using OpenSim.Region.PhysicsModules.SharedBase; | 45 | using OpenSim.Region.PhysicsModules.SharedBase; |
46 | using OpenMetaverse; | 46 | using OpenMetaverse; |
47 | 47 | ||
48 | namespace OpenSim.Region.PhysicsModule.UbitOde | 48 | namespace OpenSim.Region.PhysicsModule.ubOde |
49 | { | 49 | { |
50 | // colision flags of things others can colide with | 50 | // colision flags of things others can colide with |
51 | // rays, sensors, probes removed since can't be colided with | 51 | // rays, sensors, probes removed since can't be colided with |
@@ -169,7 +169,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
169 | { | 169 | { |
170 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 170 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
171 | 171 | ||
172 | public bool m_odeUbitLib = false; | 172 | public bool m_ubOdeLib = false; |
173 | public bool m_suportCombine = false; // mega suport not tested | 173 | public bool m_suportCombine = false; // mega suport not tested |
174 | public Scene m_frameWorkScene = null; | 174 | public Scene m_frameWorkScene = null; |
175 | 175 | ||
@@ -213,7 +213,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
213 | 213 | ||
214 | // private int m_meshExpireCntr; | 214 | // private int m_meshExpireCntr; |
215 | 215 | ||
216 | private float avDensity = 3f; | 216 | private float avDensity = 80f; |
217 | private float avMovementDivisorWalk = 1.3f; | 217 | private float avMovementDivisorWalk = 1.3f; |
218 | private float avMovementDivisorRun = 0.8f; | 218 | private float avMovementDivisorRun = 0.8f; |
219 | private float minimumGroundFlightOffset = 3f; | 219 | private float minimumGroundFlightOffset = 3f; |
@@ -327,7 +327,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
327 | 327 | ||
328 | IConfig physicsconfig = null; | 328 | IConfig physicsconfig = null; |
329 | 329 | ||
330 | public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool podeUbitLib) | 330 | public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool pubOdeLib) |
331 | { | 331 | { |
332 | OdeLock = new Object(); | 332 | OdeLock = new Object(); |
333 | 333 | ||
@@ -335,7 +335,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
335 | PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName; | 335 | PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName; |
336 | 336 | ||
337 | m_config = psourceconfig; | 337 | m_config = psourceconfig; |
338 | m_odeUbitLib = podeUbitLib; | 338 | m_ubOdeLib = pubOdeLib; |
339 | m_frameWorkScene = pscene; | 339 | m_frameWorkScene = pscene; |
340 | 340 | ||
341 | m_frameWorkScene.RegisterModuleInterface<PhysicsScene>(this); | 341 | m_frameWorkScene.RegisterModuleInterface<PhysicsScene>(this); |
@@ -354,7 +354,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
354 | mesher = m_frameWorkScene.RequestModuleInterface<IMesher>(); | 354 | mesher = m_frameWorkScene.RequestModuleInterface<IMesher>(); |
355 | if (mesher == null) | 355 | if (mesher == null) |
356 | { | 356 | { |
357 | m_log.WarnFormat("[UbitODE] No mesher. module disabled"); | 357 | m_log.WarnFormat("[ubOde] No mesher. module disabled"); |
358 | return; | 358 | return; |
359 | } | 359 | } |
360 | 360 | ||
@@ -492,6 +492,8 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
492 | 492 | ||
493 | minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", minimumGroundFlightOffset); | 493 | minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", minimumGroundFlightOffset); |
494 | maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", maximumMassObject); | 494 | maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", maximumMassObject); |
495 | |||
496 | avDensity *= 3f / 80f; // scale other engines density option to this | ||
495 | } | 497 | } |
496 | } | 498 | } |
497 | 499 | ||
@@ -1927,7 +1929,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
1927 | int regsizeY = (int)m_regionHeight + 3; // map size see setterrain number of samples | 1929 | int regsizeY = (int)m_regionHeight + 3; // map size see setterrain number of samples |
1928 | int regsize = regsizeX; | 1930 | int regsize = regsizeX; |
1929 | 1931 | ||
1930 | if (m_odeUbitLib) | 1932 | if (m_ubOdeLib) |
1931 | { | 1933 | { |
1932 | if (x < regsizeX - 1) | 1934 | if (x < regsizeX - 1) |
1933 | { | 1935 | { |
@@ -2071,7 +2073,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
2071 | int ystep = regsizeX; | 2073 | int ystep = regsizeX; |
2072 | bool firstTri = false; | 2074 | bool firstTri = false; |
2073 | 2075 | ||
2074 | if (m_odeUbitLib) | 2076 | if (m_ubOdeLib) |
2075 | { | 2077 | { |
2076 | if (x < regsizeX - 1) | 2078 | if (x < regsizeX - 1) |
2077 | { | 2079 | { |
@@ -2183,8 +2185,8 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
2183 | 2185 | ||
2184 | public void SetTerrain(float[] heightMap, Vector3 pOffset) | 2186 | public void SetTerrain(float[] heightMap, Vector3 pOffset) |
2185 | { | 2187 | { |
2186 | if (m_odeUbitLib) | 2188 | if (m_ubOdeLib) |
2187 | UbitSetTerrain(heightMap, pOffset); | 2189 | ubSetTerrain(heightMap, pOffset); |
2188 | else | 2190 | else |
2189 | OriSetTerrain(heightMap, pOffset); | 2191 | OriSetTerrain(heightMap, pOffset); |
2190 | } | 2192 | } |
@@ -2315,7 +2317,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
2315 | } | 2317 | } |
2316 | } | 2318 | } |
2317 | 2319 | ||
2318 | public void UbitSetTerrain(float[] heightMap, Vector3 pOffset) | 2320 | public void ubSetTerrain(float[] heightMap, Vector3 pOffset) |
2319 | { | 2321 | { |
2320 | // assumes 1m size grid and constante size square regions | 2322 | // assumes 1m size grid and constante size square regions |
2321 | // needs to know about sims around in future | 2323 | // needs to know about sims around in future |
@@ -2389,7 +2391,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
2389 | } | 2391 | } |
2390 | } | 2392 | } |
2391 | } | 2393 | } |
2392 | IntPtr HeightmapData = d.GeomUbitTerrainDataCreate(); | 2394 | IntPtr HeightmapData = d.GeomubTerrainDataCreate(); |
2393 | 2395 | ||
2394 | const int wrap = 0; | 2396 | const int wrap = 0; |
2395 | float thickness = hfmin; | 2397 | float thickness = hfmin; |
@@ -2398,12 +2400,12 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
2398 | 2400 | ||
2399 | GCHandle _heightmaphandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned); | 2401 | GCHandle _heightmaphandler = GCHandle.Alloc(_heightmap, GCHandleType.Pinned); |
2400 | 2402 | ||
2401 | d.GeomUbitTerrainDataBuild(HeightmapData, _heightmaphandler.AddrOfPinnedObject(), 0, 1.0f, | 2403 | d.GeomubTerrainDataBuild(HeightmapData, _heightmaphandler.AddrOfPinnedObject(), 0, 1.0f, |
2402 | (int)heightmapWidthSamples, (int)heightmapHeightSamples, | 2404 | (int)heightmapWidthSamples, (int)heightmapHeightSamples, |
2403 | thickness, wrap); | 2405 | thickness, wrap); |
2404 | 2406 | ||
2405 | // d.GeomUbitTerrainDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); | 2407 | // d.GeomubTerrainDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1); |
2406 | GroundGeom = d.CreateUbitTerrain(GroundSpace, HeightmapData, 1); | 2408 | GroundGeom = d.CreateubTerrain(GroundSpace, HeightmapData, 1); |
2407 | if (GroundGeom != IntPtr.Zero) | 2409 | if (GroundGeom != IntPtr.Zero) |
2408 | { | 2410 | { |
2409 | d.GeomSetCategoryBits(GroundGeom, (uint)(CollisionCategories.Land)); | 2411 | d.GeomSetCategoryBits(GroundGeom, (uint)(CollisionCategories.Land)); |
@@ -2446,13 +2448,18 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
2446 | 2448 | ||
2447 | public override void Dispose() | 2449 | public override void Dispose() |
2448 | { | 2450 | { |
2449 | if (m_meshWorker != null) | 2451 | if (m_rayCastManager == null) // if this is null we already did dispose |
2450 | m_meshWorker.Stop(); | 2452 | return; |
2451 | |||
2452 | lock (OdeLock) | 2453 | lock (OdeLock) |
2453 | { | 2454 | { |
2454 | m_rayCastManager.Dispose(); | 2455 | if (m_meshWorker != null) |
2455 | m_rayCastManager = null; | 2456 | m_meshWorker.Stop(); |
2457 | |||
2458 | if (m_rayCastManager != null) | ||
2459 | { | ||
2460 | m_rayCastManager.Dispose(); | ||
2461 | m_rayCastManager = null; | ||
2462 | } | ||
2456 | 2463 | ||
2457 | lock (_prims) | 2464 | lock (_prims) |
2458 | { | 2465 | { |
@@ -2476,7 +2483,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde | |||
2476 | foreach (OdeCharacter ch in chtorem) | 2483 | foreach (OdeCharacter ch in chtorem) |
2477 | ch.DoAChange(changes.Remove, null); | 2484 | ch.DoAChange(changes.Remove, null); |
2478 | 2485 | ||
2479 | 2486 | ||
2480 | foreach (IntPtr GroundGeom in RegionTerrain.Values) | 2487 | foreach (IntPtr GroundGeom in RegionTerrain.Values) |
2481 | { | 2488 | { |
2482 | if (GroundGeom != IntPtr.Zero) | 2489 | if (GroundGeom != IntPtr.Zero) |