aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODEPrim.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs55
1 files changed, 52 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index eb02536..7a0857f 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -100,6 +100,9 @@ namespace OpenSim.Region.Physics.OdePlugin
100 private Vector3 m_taintAngularLock = Vector3.One; 100 private Vector3 m_taintAngularLock = Vector3.One;
101 private IntPtr Amotor = IntPtr.Zero; 101 private IntPtr Amotor = IntPtr.Zero;
102 102
103 private object m_assetsLock = new object();
104 private bool m_assetFailed = false;
105
103 private Vector3 m_PIDTarget; 106 private Vector3 m_PIDTarget;
104 private float m_PIDTau; 107 private float m_PIDTau;
105 private float PID_D = 35f; 108 private float PID_D = 35f;
@@ -282,6 +285,7 @@ namespace OpenSim.Region.Physics.OdePlugin
282 } 285 }
283 286
284 m_taintadd = true; 287 m_taintadd = true;
288 m_assetFailed = false;
285 _parent_scene.AddPhysicsActorTaint(this); 289 _parent_scene.AddPhysicsActorTaint(this);
286 } 290 }
287 291
@@ -604,8 +608,8 @@ namespace OpenSim.Region.Physics.OdePlugin
604 break; 608 break;
605 609
606 case HollowShape.Circle: 610 case HollowShape.Circle:
607 // Hollow shape is a perfect cylinder in respect to the cube's scale 611 // Hollow shape is a perfect cyllinder in respect to the cube's scale
608 // Cylinder hollow volume calculation 612 // Cyllinder hollow volume calculation
609 613
610 hollowVolume *= 0.1963495f * 3.07920140172638f; 614 hollowVolume *= 0.1963495f * 3.07920140172638f;
611 break; 615 break;
@@ -1498,6 +1502,8 @@ Console.WriteLine("CreateGeom:");
1498 mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical); 1502 mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical);
1499 // createmesh returns null when it's a shape that isn't a cube. 1503 // createmesh returns null when it's a shape that isn't a cube.
1500 // m_log.Debug(m_localID); 1504 // m_log.Debug(m_localID);
1505 if (mesh == null)
1506 CheckMeshAsset();
1501 } 1507 }
1502 1508
1503#if SPAM 1509#if SPAM
@@ -1997,7 +2003,12 @@ Console.WriteLine(" JointCreateFixed");
1997 // Don't need to re-enable body.. it's done in SetMesh 2003 // Don't need to re-enable body.. it's done in SetMesh
1998 2004
1999 if (_parent_scene.needsMeshing(_pbs)) 2005 if (_parent_scene.needsMeshing(_pbs))
2006 {
2000 mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical); 2007 mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical);
2008 if (mesh == null)
2009 CheckMeshAsset();
2010 }
2011
2001 } 2012 }
2002 2013
2003 CreateGeom(m_targetSpace, mesh); 2014 CreateGeom(m_targetSpace, mesh);
@@ -2057,6 +2068,8 @@ Console.WriteLine(" JointCreateFixed");
2057 /// </summary> 2068 /// </summary>
2058 private void changeshape() 2069 private void changeshape()
2059 { 2070 {
2071 m_taintshape = false;
2072
2060 // Cleanup of old prim geometry and Bodies 2073 // Cleanup of old prim geometry and Bodies
2061 if (IsPhysical && Body != IntPtr.Zero) 2074 if (IsPhysical && Body != IntPtr.Zero)
2062 { 2075 {
@@ -2084,6 +2097,7 @@ Console.WriteLine(" JointCreateFixed");
2084 2097
2085 IMesh mesh = null; 2098 IMesh mesh = null;
2086 2099
2100
2087 if (_parent_scene.needsMeshing(_pbs)) 2101 if (_parent_scene.needsMeshing(_pbs))
2088 { 2102 {
2089 // Don't need to re-enable body.. it's done in CreateMesh 2103 // Don't need to re-enable body.. it's done in CreateMesh
@@ -2094,6 +2108,8 @@ Console.WriteLine(" JointCreateFixed");
2094 2108
2095 // createmesh returns null when it doesn't mesh. 2109 // createmesh returns null when it doesn't mesh.
2096 mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical); 2110 mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical);
2111 if (mesh == null)
2112 CheckMeshAsset();
2097 } 2113 }
2098 2114
2099 CreateGeom(m_targetSpace, mesh); 2115 CreateGeom(m_targetSpace, mesh);
@@ -2130,7 +2146,7 @@ Console.WriteLine(" JointCreateFixed");
2130 } 2146 }
2131 2147
2132 resetCollisionAccounting(); 2148 resetCollisionAccounting();
2133 m_taintshape = false; 2149// m_taintshape = false;
2134 } 2150 }
2135 2151
2136 /// <summary> 2152 /// <summary>
@@ -2396,6 +2412,7 @@ Console.WriteLine(" JointCreateFixed");
2396 set 2412 set
2397 { 2413 {
2398 _pbs = value; 2414 _pbs = value;
2415 m_assetFailed = false;
2399 m_taintshape = true; 2416 m_taintshape = true;
2400 } 2417 }
2401 } 2418 }
@@ -3234,5 +3251,37 @@ Console.WriteLine(" JointCreateFixed");
3234 { 3251 {
3235 m_material = pMaterial; 3252 m_material = pMaterial;
3236 } 3253 }
3254
3255
3256 private void CheckMeshAsset()
3257 {
3258 if (_pbs.SculptEntry && !m_assetFailed && _pbs.SculptTexture != UUID.Zero)
3259 {
3260 m_assetFailed = true;
3261 Util.FireAndForget(delegate
3262 {
3263 RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod;
3264 if (assetProvider != null)
3265 assetProvider(_pbs.SculptTexture, MeshAssetReveived);
3266 });
3267 }
3268 }
3269
3270 void MeshAssetReveived(AssetBase asset)
3271 {
3272 if (asset.Data != null && asset.Data.Length > 0)
3273 {
3274 if (!_pbs.SculptEntry)
3275 return;
3276 if (_pbs.SculptTexture.ToString() != asset.ID)
3277 return;
3278
3279 _pbs.SculptData = new byte[asset.Data.Length];
3280 asset.Data.CopyTo(_pbs.SculptData, 0);
3281 m_assetFailed = false;
3282 m_taintshape = true;
3283 _parent_scene.AddPhysicsActorTaint(this);
3284 }
3285 }
3237 } 3286 }
3238} \ No newline at end of file 3287} \ No newline at end of file