diff options
author | Robert Adams | 2015-09-08 06:15:46 -0700 |
---|---|---|
committer | Robert Adams | 2015-09-08 06:15:46 -0700 |
commit | 4dd17c4117ea413fb0c4418511956cb3abfe258c (patch) | |
tree | 6f31a583610f8bf074d1f0b4e7ab6ccef37dec9a /OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |
parent | Merge of ubitworkvarnew with opensim/master as of 20150905. (diff) | |
download | opensim-SC-4dd17c4117ea413fb0c4418511956cb3abfe258c.zip opensim-SC-4dd17c4117ea413fb0c4418511956cb3abfe258c.tar.gz opensim-SC-4dd17c4117ea413fb0c4418511956cb3abfe258c.tar.bz2 opensim-SC-4dd17c4117ea413fb0c4418511956cb3abfe258c.tar.xz |
More 'everything is a module' merging.
Have most of UbitOde converted.
There are compile errors in OpenSimBase as the new modules stuff is not all there.
Removed ChOdePlugin as it's connection to OdePlugin was tangled.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeScene.cs (renamed from OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs) | 93 |
1 files changed, 77 insertions, 16 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeScene.cs index e8c219c..9373d2b 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/UbitOdePlugin/OdeScene.cs | |||
@@ -39,10 +39,11 @@ using log4net; | |||
39 | using Nini.Config; | 39 | using Nini.Config; |
40 | using OdeAPI; | 40 | using OdeAPI; |
41 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
42 | using OpenSim.Region.Physics.Manager; | 42 | using OpenSim.Region.Framework.Interfaces; |
43 | using OpenSim.Region.PhysicsModules.SharedBase; | ||
43 | using OpenMetaverse; | 44 | using OpenMetaverse; |
44 | 45 | ||
45 | namespace OpenSim.Region.Physics.OdePlugin | 46 | namespace OpenSim.Region.PhysicsModules.OdePlugin |
46 | { | 47 | { |
47 | // colision flags of things others can colide with | 48 | // colision flags of things others can colide with |
48 | // rays, sensors, probes removed since can't be colided with | 49 | // rays, sensors, probes removed since can't be colided with |
@@ -164,9 +165,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
164 | 165 | ||
165 | 166 | ||
166 | 167 | ||
167 | public class OdeScene : PhysicsScene | 168 | public class OdeScene : PhysicsScene, INonSharedRegionModule |
168 | { | 169 | { |
169 | private readonly ILog m_log; | 170 | private readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier); |
170 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); | 171 | // private Dictionary<string, sCollisionData> m_storedCollisions = new Dictionary<string, sCollisionData>(); |
171 | 172 | ||
172 | public bool OdeUbitLib = false; | 173 | public bool OdeUbitLib = false; |
@@ -324,18 +325,85 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
324 | } | 325 | } |
325 | } | 326 | } |
326 | */ | 327 | */ |
328 | #region INonSharedRegionModule | ||
329 | public string Name | ||
330 | { | ||
331 | get { return "UbitODE"; } | ||
332 | } | ||
333 | |||
334 | public Type ReplaceableInterface | ||
335 | { | ||
336 | get { return null; } | ||
337 | } | ||
338 | |||
339 | public void Initialise(IConfigSource source) | ||
340 | { | ||
341 | // TODO: Move this out of Startup | ||
342 | IConfig config = source.Configs["Startup"]; | ||
343 | if (config != null) | ||
344 | { | ||
345 | string physics = config.GetString("physics", string.Empty); | ||
346 | if (physics == Name) | ||
347 | { | ||
348 | m_Enabled = true; | ||
349 | m_Config = source; | ||
350 | } | ||
351 | } | ||
352 | |||
353 | } | ||
354 | |||
355 | public void Close() | ||
356 | { | ||
357 | } | ||
358 | |||
359 | public void AddRegion(Scene scene) | ||
360 | { | ||
361 | if (!m_Enabled) | ||
362 | return; | ||
363 | |||
364 | EngineType = Name; | ||
365 | RegionName = scene.RegionInfo.RegionName; | ||
366 | PhysicsSceneName = EngineType + "/" + RegionName; | ||
367 | |||
368 | scene.RegisterModuleInterface<PhysicsScene>(this); | ||
369 | Vector3 extent = new Vector3(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY, scene.RegionInfo.RegionSizeZ); | ||
370 | RawInitialization(); | ||
371 | Initialise(m_Config, extent); | ||
372 | |||
373 | base.Initialise(scene.PhysicsRequestAsset, | ||
374 | (scene.Heightmap != null ? scene.Heightmap.GetFloatsSerialised() : new float[scene.RegionInfo.RegionSizeX * scene.RegionInfo.RegionSizeY]), | ||
375 | (float)scene.RegionInfo.RegionSettings.WaterHeight); | ||
376 | |||
377 | } | ||
378 | |||
379 | public void RemoveRegion(Scene scene) | ||
380 | { | ||
381 | if (!m_Enabled) | ||
382 | return; | ||
383 | } | ||
384 | |||
385 | public void RegionLoaded(Scene scene) | ||
386 | { | ||
387 | if (!m_Enabled) | ||
388 | return; | ||
389 | |||
390 | mesher = scene.RequestModuleInterface<IMesher>(); | ||
391 | if (mesher == null) | ||
392 | m_log.WarnFormat("{0} No mesher. Things will not work well.", LogHeader); | ||
393 | |||
394 | scene.PhysicsEnabled = true; | ||
395 | } | ||
396 | #endregion | ||
397 | |||
327 | /// <summary> | 398 | /// <summary> |
328 | /// Initiailizes the scene | 399 | /// Initiailizes the scene |
329 | /// Sets many properties that ODE requires to be stable | 400 | /// Sets many properties that ODE requires to be stable |
330 | /// These settings need to be tweaked 'exactly' right or weird stuff happens. | 401 | /// These settings need to be tweaked 'exactly' right or weird stuff happens. |
331 | /// </summary> | 402 | /// </summary> |
332 | public OdeScene(string sceneIdentifier) | 403 | private void RawInitialization() |
333 | { | 404 | { |
334 | m_log | ||
335 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + sceneIdentifier); | ||
336 | 405 | ||
337 | // checkThread(); | 406 | // checkThread(); |
338 | Name = sceneIdentifier; | ||
339 | 407 | ||
340 | OdeLock = new Object(); | 408 | OdeLock = new Object(); |
341 | SimulationLock = new Object(); | 409 | SimulationLock = new Object(); |
@@ -415,7 +483,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
415 | } | 483 | } |
416 | } | 484 | } |
417 | 485 | ||
418 | public override void Initialise(IMesher meshmerizer, IConfigSource config, Vector3 regionExtent) | 486 | public void Initialise(IConfigSource config, Vector3 regionExtent) |
419 | { | 487 | { |
420 | WorldExtents.X = regionExtent.X; | 488 | WorldExtents.X = regionExtent.X; |
421 | m_regionWidth = (uint)regionExtent.X; | 489 | m_regionWidth = (uint)regionExtent.X; |
@@ -423,14 +491,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
423 | m_regionHeight = (uint)regionExtent.Y; | 491 | m_regionHeight = (uint)regionExtent.Y; |
424 | 492 | ||
425 | m_suportCombine = false; | 493 | m_suportCombine = false; |
426 | Initialise(meshmerizer, config); | ||
427 | } | ||
428 | |||
429 | |||
430 | public override void Initialise(IMesher meshmerizer, IConfigSource config) | ||
431 | { | ||
432 | // checkThread(); | 494 | // checkThread(); |
433 | mesher = meshmerizer; | ||
434 | m_config = config; | 495 | m_config = config; |
435 | 496 | ||
436 | string ode_config = d.GetConfiguration(); | 497 | string ode_config = d.GetConfiguration(); |