aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs
diff options
context:
space:
mode:
authorUbitUmarov2015-09-08 21:41:52 +0100
committerUbitUmarov2015-09-08 21:41:52 +0100
commit254008cd1fe8d76c1eb7f2aeb2e8e55d923f2e4e (patch)
tree6f1ebc65e15552ea9392ef5eb461d2da64ec5275 /OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs
parentproperties folders (diff)
downloadopensim-SC_OLD-254008cd1fe8d76c1eb7f2aeb2e8e55d923f2e4e.zip
opensim-SC_OLD-254008cd1fe8d76c1eb7f2aeb2e8e55d923f2e4e.tar.gz
opensim-SC_OLD-254008cd1fe8d76c1eb7f2aeb2e8e55d923f2e4e.tar.bz2
opensim-SC_OLD-254008cd1fe8d76c1eb7f2aeb2e8e55d923f2e4e.tar.xz
and now.. seems to work.. but does it really work?
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs78
1 files changed, 43 insertions, 35 deletions
diff --git a/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs b/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs
index 7211774..6ad42bc 100644
--- a/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs
+++ b/OpenSim/Region/PhysicsModules/UbitOde/OdeScene.cs
@@ -408,8 +408,13 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
408 408
409 mesher = scene.RequestModuleInterface<IMesher>(); 409 mesher = scene.RequestModuleInterface<IMesher>();
410 if (mesher == null) 410 if (mesher == null)
411 m_log.WarnFormat("{0} No mesher. Things will not work well.", LogHeader); 411 {
412 m_log.WarnFormat("{0} No mesher. module disabled", LogHeader);
413 m_Enabled = false;
414 return;
415 }
412 416
417 region_loaded();
413 scene.PhysicsEnabled = true; 418 scene.PhysicsEnabled = true;
414 } 419 }
415 #endregion 420 #endregion
@@ -420,22 +425,22 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
420 /// These settings need to be tweaked 'exactly' right or weird stuff happens. 425 /// These settings need to be tweaked 'exactly' right or weird stuff happens.
421 /// </summary> 426 /// </summary>
422 private void Initialization(Vector3 regionExtent) 427 private void Initialization(Vector3 regionExtent)
423 { 428 {
424 429
425// checkThread(); 430 // checkThread();
426 431
427 OdeLock = new Object(); 432 OdeLock = new Object();
428 SimulationLock = new Object(); 433 SimulationLock = new Object();
429 434
430 nearCallback = near; 435 nearCallback = near;
431 436
432 m_rayCastManager = new ODERayCastRequestManager(this); 437 m_rayCastManager = new ODERayCastRequestManager(this);
433 438
434 lock (OdeLock) 439 lock (OdeLock)
435 { 440 {
436 // Create the world and the first space 441 // Create the world and the first space
437 try 442 try
438 { 443 {
439 world = d.WorldCreate(); 444 world = d.WorldCreate();
440 TopSpace = d.HashSpaceCreate(IntPtr.Zero); 445 TopSpace = d.HashSpaceCreate(IntPtr.Zero);
441 446
@@ -444,12 +449,12 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
444 CharsSpace = d.HashSpaceCreate(TopSpace); 449 CharsSpace = d.HashSpaceCreate(TopSpace);
445 StaticSpace = d.HashSpaceCreate(TopSpace); 450 StaticSpace = d.HashSpaceCreate(TopSpace);
446 GroundSpace = d.HashSpaceCreate(TopSpace); 451 GroundSpace = d.HashSpaceCreate(TopSpace);
447 } 452 }
448 catch 453 catch
449 { 454 {
450 // i must RtC#FM 455 // i must RtC#FM
451 // i did! 456 // i did!
452 } 457 }
453 458
454 d.HashSpaceSetLevels(TopSpace, -2, 8); 459 d.HashSpaceSetLevels(TopSpace, -2, 8);
455 d.HashSpaceSetLevels(ActiveSpace, -2, 8); 460 d.HashSpaceSetLevels(ActiveSpace, -2, 8);
@@ -485,8 +490,8 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
485 490
486 d.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space | 491 d.GeomSetCategoryBits(StaticSpace, (uint)(CollisionCategories.Space |
487 CollisionCategories.Geom | 492 CollisionCategories.Geom |
488// CollisionCategories.Land | 493 // CollisionCategories.Land |
489// CollisionCategories.Water | 494 // CollisionCategories.Water |
490 CollisionCategories.Phantom | 495 CollisionCategories.Phantom |
491 CollisionCategories.VolumeDtc 496 CollisionCategories.VolumeDtc
492 )); 497 ));
@@ -501,14 +506,17 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
501 d.WorldSetAutoDisableFlag(world, false); 506 d.WorldSetAutoDisableFlag(world, false);
502 } 507 }
503 508
504 WorldExtents.X = regionExtent.X; 509 WorldExtents.X = regionExtent.X;
505 m_regionWidth = (uint)regionExtent.X; 510 m_regionWidth = (uint)regionExtent.X;
506 WorldExtents.Y = regionExtent.Y; 511 WorldExtents.Y = regionExtent.Y;
507 m_regionHeight = (uint)regionExtent.Y; 512 m_regionHeight = (uint)regionExtent.Y;
508 513
509 m_suportCombine = false; 514 m_suportCombine = false;
510// checkThread(); 515 // checkThread();
516 }
511 517
518 private void region_loaded()
519 {
512 string ode_config = d.GetConfiguration(); 520 string ode_config = d.GetConfiguration();
513 if (ode_config != null && ode_config != "") 521 if (ode_config != null && ode_config != "")
514 { 522 {
@@ -537,7 +545,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
537 545
538 metersInSpace = physicsconfig.GetFloat("meters_in_small_space", metersInSpace); 546 metersInSpace = physicsconfig.GetFloat("meters_in_small_space", metersInSpace);
539 547
540// contactsurfacelayer = physicsconfig.GetFloat("world_contact_surface_layer", contactsurfacelayer); 548 // contactsurfacelayer = physicsconfig.GetFloat("world_contact_surface_layer", contactsurfacelayer);
541 549
542 ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", ODE_STEPSIZE); 550 ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", ODE_STEPSIZE);
543 551
@@ -579,7 +587,7 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
579 m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig); 587 m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig);
580 588
581 HalfOdeStep = ODE_STEPSIZE * 0.5f; 589 HalfOdeStep = ODE_STEPSIZE * 0.5f;
582 odetimestepMS = (int)(1000.0f * ODE_STEPSIZE +0.5f); 590 odetimestepMS = (int)(1000.0f * ODE_STEPSIZE + 0.5f);
583 591
584 ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * d.ContactGeom.unmanagedSizeOf); 592 ContactgeomsArray = Marshal.AllocHGlobal(contactsPerCollision * d.ContactGeom.unmanagedSizeOf);
585 GlobalContactsArray = Marshal.AllocHGlobal(maxContactsbeforedeath * d.Contact.unmanagedSizeOf); 593 GlobalContactsArray = Marshal.AllocHGlobal(maxContactsbeforedeath * d.Contact.unmanagedSizeOf);
@@ -631,13 +639,13 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
631 if (spaceGridMaxX > 24) 639 if (spaceGridMaxX > 24)
632 { 640 {
633 spaceGridMaxX = 24; 641 spaceGridMaxX = 24;
634 spacesPerMeterX = spaceGridMaxX / WorldExtents.X ; 642 spacesPerMeterX = spaceGridMaxX / WorldExtents.X;
635 } 643 }
636 644
637 if (spaceGridMaxY > 24) 645 if (spaceGridMaxY > 24)
638 { 646 {
639 spaceGridMaxY = 24; 647 spaceGridMaxY = 24;
640 spacesPerMeterY = spaceGridMaxY / WorldExtents.Y ; 648 spacesPerMeterY = spaceGridMaxY / WorldExtents.Y;
641 } 649 }
642 650
643 staticPrimspace = new IntPtr[spaceGridMaxX, spaceGridMaxY]; 651 staticPrimspace = new IntPtr[spaceGridMaxX, spaceGridMaxY];
@@ -674,23 +682,23 @@ namespace OpenSim.Region.PhysicsModule.UbitOde
674 staticPrimspaceOffRegion = new IntPtr[4]; 682 staticPrimspaceOffRegion = new IntPtr[4];
675 683
676 for (i = 0; i < 4; i++) 684 for (i = 0; i < 4; i++)
677 { 685 {
678 newspace = d.HashSpaceCreate(StaticSpace); 686 newspace = d.HashSpaceCreate(StaticSpace);
679 d.GeomSetCategoryBits(newspace, (int)CollisionCategories.Space); 687 d.GeomSetCategoryBits(newspace, (int)CollisionCategories.Space);
680 waitForSpaceUnlock(newspace); 688 waitForSpaceUnlock(newspace);
681 d.SpaceSetSublevel(newspace, 2); 689 d.SpaceSetSublevel(newspace, 2);
682 d.HashSpaceSetLevels(newspace, -2, 8); 690 d.HashSpaceSetLevels(newspace, -2, 8);
683 d.GeomSetCategoryBits(newspace, (uint)(CollisionCategories.Space | 691 d.GeomSetCategoryBits(newspace, (uint)(CollisionCategories.Space |
684 CollisionCategories.Geom | 692 CollisionCategories.Geom |
685 CollisionCategories.Land | 693 CollisionCategories.Land |
686 CollisionCategories.Water | 694 CollisionCategories.Water |
687 CollisionCategories.Phantom | 695 CollisionCategories.Phantom |
688 CollisionCategories.VolumeDtc 696 CollisionCategories.VolumeDtc
689 )); 697 ));
690 d.GeomSetCollideBits(newspace, 0); 698 d.GeomSetCollideBits(newspace, 0);
691 699
692 staticPrimspaceOffRegion[i] = newspace; 700 staticPrimspaceOffRegion[i] = newspace;
693 } 701 }
694 702
695 m_lastframe = DateTime.UtcNow; 703 m_lastframe = DateTime.UtcNow;
696 m_lastMeshExpire = m_lastframe; 704 m_lastMeshExpire = m_lastframe;