aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs13
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsActor.cs17
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs40
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs56
4 files changed, 85 insertions, 41 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 633cd3b..66d85c4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1583,7 +1583,9 @@ namespace OpenSim.Region.Framework.Scenes
1583 1583
1584 float cost = 0.1f; 1584 float cost = 0.1f;
1585 if (PhysActor != null) 1585 if (PhysActor != null)
1586// cost += PhysActor.Cost; 1586 cost = PhysActor.PhysicsCost;
1587 else
1588 cost = 0.1f;
1587 1589
1588 if ((Flags & PrimFlags.Physics) != 0) 1590 if ((Flags & PrimFlags.Physics) != 0)
1589 cost *= (1.0f + 0.01333f * Scale.LengthSquared()); // 0.01333 == 0.04/3 1591 cost *= (1.0f + 0.01333f * Scale.LengthSquared()); // 0.01333 == 0.04/3
@@ -1596,9 +1598,12 @@ namespace OpenSim.Region.Framework.Scenes
1596 { 1598 {
1597 get 1599 get
1598 { 1600 {
1599 1601 float cost;
1600 1602 if (PhysActor != null)
1601 return 0.1f; 1603 cost = PhysActor.StreamCost;
1604 else
1605 cost = 1.0f;
1606 return 1.0f;
1602 } 1607 }
1603 } 1608 }
1604 1609
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
index a2c72c3..14f65b8 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs
@@ -315,6 +315,23 @@ namespace OpenSim.Region.Physics.Manager
315 } 315 }
316 } 316 }
317 317
318
319 public virtual float PhysicsCost
320 {
321 get
322 {
323 return 0.1f;
324 }
325 }
326
327 public virtual float StreamCost
328 {
329 get
330 {
331 return 1.0f;
332 }
333 }
334
318 /// <summary> 335 /// <summary>
319 /// Velocity of this actor. 336 /// Velocity of this actor.
320 /// </summary> 337 /// </summary>
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
index 3fcbb1b..6bdc089 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
@@ -40,8 +40,6 @@ namespace OpenSim.Region.Physics.OdePlugin
40 40
41 public float volume; 41 public float volume;
42 42
43 public float physCost;
44 public float streamCost;
45 public byte shapetype; 43 public byte shapetype;
46 public bool hasOBB; 44 public bool hasOBB;
47 public bool hasMeshVolume; 45 public bool hasMeshVolume;
@@ -121,8 +119,14 @@ namespace OpenSim.Region.Physics.OdePlugin
121 119
122 public void Stop() 120 public void Stop()
123 { 121 {
124 m_running = false; 122 try
125 m_thread.Abort(); 123 {
124 m_thread.Abort();
125 createqueue.Clear();
126 }
127 catch
128 {
129 }
126 } 130 }
127 131
128 public void ChangeActorPhysRep(PhysicsActor actor, PrimitiveBaseShape pbs, 132 public void ChangeActorPhysRep(PhysicsActor actor, PrimitiveBaseShape pbs,
@@ -172,10 +176,15 @@ namespace OpenSim.Region.Physics.OdePlugin
172 if (repData.assetState != AssetState.needAsset) 176 if (repData.assetState != AssetState.needAsset)
173 return; 177 return;
174 178
179 repData.mesh = null;
180
175 if (repData.assetID == null || repData.assetID == UUID.Zero) 181 if (repData.assetID == null || repData.assetID == UUID.Zero)
182 {
183 repData.assetState = AssetState.noNeedAsset;
184 repData.comand = meshWorkerCmnds.changefull;
185 createqueue.Enqueue(repData);
176 return; 186 return;
177 187 }
178 repData.mesh = null;
179 188
180 repData.assetState = AssetState.loadingAsset; 189 repData.assetState = AssetState.loadingAsset;
181 190
@@ -211,9 +220,6 @@ namespace OpenSim.Region.Physics.OdePlugin
211 repData.OBBOffset = mesh.GetCentroid(); 220 repData.OBBOffset = mesh.GetCentroid();
212 repData.OBB = mesh.GetOBB(); 221 repData.OBB = mesh.GetOBB();
213 repData.hasOBB = true; 222 repData.hasOBB = true;
214 repData.physCost = 0.0013f * (float)indexCount;
215 // todo
216 repData.streamCost = 1.0f;
217 mesh.releaseSourceMeshData(); 223 mesh.releaseSourceMeshData();
218 } 224 }
219 } 225 }
@@ -427,11 +433,14 @@ namespace OpenSim.Region.Physics.OdePlugin
427 if (pbs.SculptTexture != null && pbs.SculptTexture != UUID.Zero) 433 if (pbs.SculptTexture != null && pbs.SculptTexture != UUID.Zero)
428 { 434 {
429 repData.assetID = pbs.SculptTexture; 435 repData.assetID = pbs.SculptTexture;
430 repData.assetState = AssetState.needAsset; 436 repData.assetState = AssetState.needAsset;
431 } 437 }
432 else 438 else
433 repData.assetState = AssetState.AssetFailed; 439 repData.assetState = AssetState.AssetFailed;
434 } 440 }
441 else
442 repData.assetState = AssetState.needAsset;
443
435 return false; 444 return false;
436 } 445 }
437 446
@@ -828,14 +837,6 @@ namespace OpenSim.Region.Physics.OdePlugin
828 if (repData.hasOBB) 837 if (repData.hasOBB)
829 { 838 {
830 Vector3 OBB = repData.OBB; 839 Vector3 OBB = repData.OBB;
831 float pc = repData.physCost;
832 float psf = OBB.X * (OBB.Y + OBB.Z) + OBB.Y * OBB.Z;
833 psf *= 1.33f * .2f;
834 pc *= psf;
835 if (pc < 0.1f)
836 pc = 0.1f;
837
838 repData.physCost = pc;
839 } 840 }
840 else 841 else
841 { 842 {
@@ -846,9 +847,6 @@ namespace OpenSim.Region.Physics.OdePlugin
846 847
847 repData.OBB = OBB; 848 repData.OBB = OBB;
848 repData.OBBOffset = Vector3.Zero; 849 repData.OBBOffset = Vector3.Zero;
849
850 repData.physCost = 0.1f;
851 repData.streamCost = 1.0f;
852 } 850 }
853 851
854 CalculateBasicPrimVolume(repData); 852 CalculateBasicPrimVolume(repData);
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index cbe129a..4c16f8e 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -277,7 +277,23 @@ namespace OpenSim.Region.Physics.OdePlugin
277 cdata.mu *= veh.FrictionFactor; 277 cdata.mu *= veh.FrictionFactor;
278// cdata.mu *= 0; 278// cdata.mu *= 0;
279 } 279 }
280 } 280 }
281
282 public override float PhysicsCost
283 {
284 get
285 {
286 return m_physCost;
287 }
288 }
289
290 public override float StreamCost
291 {
292 get
293 {
294 return m_streamCost;
295 }
296 }
281 297
282 public override int PhysicsActorType 298 public override int PhysicsActorType
283 { 299 {
@@ -1373,6 +1389,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1373 m_mesh = null; 1389 m_mesh = null;
1374 return false; 1390 return false;
1375 } 1391 }
1392
1393 m_physCost = 0.0013f * (float)indexCount;
1394 // todo
1395 m_streamCost = 1.0f;
1396
1376 return true; 1397 return true;
1377 } 1398 }
1378 1399
@@ -1386,7 +1407,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1386 if (m_assetState == AssetState.AssetFailed) 1407 if (m_assetState == AssetState.AssetFailed)
1387 m_NoColide = true; 1408 m_NoColide = true;
1388 1409
1389 else if (m_mesh != null) 1410 else if(m_mesh != null)
1390 { 1411 {
1391 if (GetMeshGeom()) 1412 if (GetMeshGeom())
1392 hasMesh = true; 1413 hasMesh = true;
@@ -2058,7 +2079,23 @@ namespace OpenSim.Region.Physics.OdePlugin
2058 m_OBBOffset.Y, 2079 m_OBBOffset.Y,
2059 m_OBBOffset.Z); 2080 m_OBBOffset.Z);
2060 2081
2061 primOOBradiusSQ = m_OBBOffset.LengthSquared(); 2082 primOOBradiusSQ = m_OBB.LengthSquared();
2083
2084 if (_triMeshData != IntPtr.Zero)
2085 {
2086 float pc = m_physCost;
2087 float psf = primOOBradiusSQ;
2088 psf *= 1.33f * .2f;
2089 pc *= psf;
2090 if (pc < 0.1f)
2091 pc = 0.1f;
2092
2093 m_physCost = pc;
2094 }
2095 else
2096 m_physCost = 0.1f;
2097
2098 m_streamCost = 1.0f;
2062 } 2099 }
2063 2100
2064 #endregion 2101 #endregion
@@ -2717,10 +2754,6 @@ namespace OpenSim.Region.Physics.OdePlugin
2717 m_OBBOffset = repData.OBBOffset; 2754 m_OBBOffset = repData.OBBOffset;
2718 m_OBB = repData.OBB; 2755 m_OBB = repData.OBB;
2719 2756
2720// m_NoColide = repData.NoColide;
2721 m_physCost = repData.physCost;
2722 m_streamCost = repData.streamCost;
2723
2724 primVolume = repData.volume; 2757 primVolume = repData.volume;
2725 2758
2726 CreateGeom(); 2759 CreateGeom();
@@ -2793,9 +2826,6 @@ namespace OpenSim.Region.Physics.OdePlugin
2793 m_OBBOffset = repData.OBBOffset; 2826 m_OBBOffset = repData.OBBOffset;
2794 m_OBB = repData.OBB; 2827 m_OBB = repData.OBB;
2795 2828
2796 m_physCost = repData.physCost;
2797 m_streamCost = repData.streamCost;
2798
2799 primVolume = repData.volume; 2829 primVolume = repData.volume;
2800 2830
2801 CreateGeom(); 2831 CreateGeom();
@@ -2806,14 +2836,8 @@ namespace OpenSim.Region.Physics.OdePlugin
2806 2836
2807 UpdatePrimBodyData(); 2837 UpdatePrimBodyData();
2808 2838
2809 try
2810 {
2811 _parent_scene.actor_name_map[prim_geom] = this; 2839 _parent_scene.actor_name_map[prim_geom] = this;
2812 }
2813 catch
2814 {
2815 2840
2816 }
2817 2841
2818 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); 2842 d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z);
2819 d.Quaternion myrot = new d.Quaternion(); 2843 d.Quaternion myrot = new d.Quaternion();