aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-08-01 22:36:24 +0100
committerMelanie2012-08-01 22:37:38 +0100
commitcf16ca9bdaad75d42213089e18c0ee8f8422bbd6 (patch)
tree95535b154bbb2eda07d217d2c3ac82f8a08cecb8 /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-cf16ca9bdaad75d42213089e18c0ee8f8422bbd6.zip
opensim-SC-cf16ca9bdaad75d42213089e18c0ee8f8422bbd6.tar.gz
opensim-SC-cf16ca9bdaad75d42213089e18c0ee8f8422bbd6.tar.bz2
opensim-SC-cf16ca9bdaad75d42213089e18c0ee8f8422bbd6.tar.xz
Create the ability for physics modules to request assets on demand by
themselves. For that, the physics module simply calls RequestAssetMethod, which in turn points to Scene.PhysicsRequestAsset. This gives physics access to the asset system without introducing unwanted knowledge of the scene class.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs16
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs5
3 files changed, 22 insertions, 0 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index 4084741..37cfe1d 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -700,6 +700,7 @@ namespace OpenSim
700 scene.LoadWorldMap(); 700 scene.LoadWorldMap();
701 701
702 scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName); 702 scene.PhysicsScene = GetPhysicsScene(scene.RegionInfo.RegionName);
703 scene.PhysicsScene.RequestAssetMethod = scene.PhysicsRequestAsset;
703 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); 704 scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
704 scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight); 705 scene.PhysicsScene.SetWaterLevel((float) regionInfo.RegionSettings.WaterHeight);
705 706
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index eb4ba41..c77457c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -5421,5 +5421,21 @@ namespace OpenSim.Region.Framework.Scenes
5421 m_SpawnPoint = 1; 5421 m_SpawnPoint = 1;
5422 return m_SpawnPoint - 1; 5422 return m_SpawnPoint - 1;
5423 } 5423 }
5424
5425 // Wrappers to get physics modules retrieve assets. Has to be done this way
5426 // because we can't assign the asset service to physics directly - at the
5427 // time physics are instantiated it's not registered but it will be by
5428 // the time the first prim exists.
5429 public void PhysicsRequestAsset(UUID assetID, AssetReceivedDelegate callback)
5430 {
5431 AssetService.Get(assetID.ToString(), callback, PhysicsAssetReceived);
5432 }
5433
5434 private void PhysicsAssetReceived(string id, Object sender, AssetBase asset)
5435 {
5436 AssetReceivedDelegate callback = (AssetReceivedDelegate)sender;
5437
5438 callback(asset);
5439 }
5424 } 5440 }
5425} 5441}
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index b32cd30..6a0558a 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -43,6 +43,9 @@ namespace OpenSim.Region.Physics.Manager
43 public delegate void JointDeactivated(PhysicsJoint joint); 43 public delegate void JointDeactivated(PhysicsJoint joint);
44 public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation" 44 public delegate void JointErrorMessage(PhysicsJoint joint, string message); // this refers to an "error message due to a problem", not "amount of joint constraint violation"
45 45
46 public delegate void RequestAssetDelegate(UUID assetID, AssetReceivedDelegate callback);
47 public delegate void AssetReceivedDelegate(AssetBase asset);
48
46 /// <summary> 49 /// <summary>
47 /// Contact result from a raycast. 50 /// Contact result from a raycast.
48 /// </summary> 51 /// </summary>
@@ -73,6 +76,8 @@ namespace OpenSim.Region.Physics.Manager
73 get { return new NullPhysicsScene(); } 76 get { return new NullPhysicsScene(); }
74 } 77 }
75 78
79 public RequestAssetDelegate RequestAssetMethod { private get; set; }
80
76 public virtual void TriggerPhysicsBasedRestart() 81 public virtual void TriggerPhysicsBasedRestart()
77 { 82 {
78 physicsCrash handler = OnPhysicsCrash; 83 physicsCrash handler = OnPhysicsCrash;