diff options
author | BlueWall | 2012-10-20 05:25:58 -0400 |
---|---|---|
committer | BlueWall | 2012-10-20 05:25:58 -0400 |
commit | 07f1d44174f5e2b4e3d5ffdec3619bb84f357af2 (patch) | |
tree | 83cc0442b2c1b89a5b3dd94cff23d5098415777e /OpenSim/Region/Physics/OdePlugin | |
parent | Merge branch 'master' into connector_plugin (diff) | |
parent | Fix: invinite loading for Viewer3 : parcelinfo request of traffic-value (impl... (diff) | |
download | opensim-SC-07f1d44174f5e2b4e3d5ffdec3619bb84f357af2.zip opensim-SC-07f1d44174f5e2b4e3d5ffdec3619bb84f357af2.tar.gz opensim-SC-07f1d44174f5e2b4e3d5ffdec3619bb84f357af2.tar.bz2 opensim-SC-07f1d44174f5e2b4e3d5ffdec3619bb84f357af2.tar.xz |
Merge branch 'master' into connector_plugin
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 174 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 2 |
2 files changed, 154 insertions, 22 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index e7b3b2b..2548648 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -67,6 +67,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
67 | private int m_expectedCollisionContacts = 0; | 67 | private int m_expectedCollisionContacts = 0; |
68 | 68 | ||
69 | /// <summary> | 69 | /// <summary> |
70 | /// Gets collide bits so that we can still perform land collisions if a mesh fails to load. | ||
71 | /// </summary> | ||
72 | private int BadMeshAssetCollideBits | ||
73 | { | ||
74 | get { return m_isphysical ? (int)CollisionCategories.Land : 0; } | ||
75 | } | ||
76 | |||
77 | /// <summary> | ||
70 | /// Is this prim subject to physics? Even if not, it's still solid for collision purposes. | 78 | /// Is this prim subject to physics? Even if not, it's still solid for collision purposes. |
71 | /// </summary> | 79 | /// </summary> |
72 | public override bool IsPhysical | 80 | public override bool IsPhysical |
@@ -100,6 +108,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
100 | private Vector3 m_taintAngularLock = Vector3.One; | 108 | private Vector3 m_taintAngularLock = Vector3.One; |
101 | private IntPtr Amotor = IntPtr.Zero; | 109 | private IntPtr Amotor = IntPtr.Zero; |
102 | 110 | ||
111 | private object m_assetsLock = new object(); | ||
112 | private bool m_assetFailed = false; | ||
113 | |||
103 | private Vector3 m_PIDTarget; | 114 | private Vector3 m_PIDTarget; |
104 | private float m_PIDTau; | 115 | private float m_PIDTau; |
105 | private float PID_D = 35f; | 116 | private float PID_D = 35f; |
@@ -282,6 +293,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
282 | } | 293 | } |
283 | 294 | ||
284 | m_taintadd = true; | 295 | m_taintadd = true; |
296 | m_assetFailed = false; | ||
285 | _parent_scene.AddPhysicsActorTaint(this); | 297 | _parent_scene.AddPhysicsActorTaint(this); |
286 | } | 298 | } |
287 | 299 | ||
@@ -337,8 +349,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
337 | prim_geom = geom; | 349 | prim_geom = geom; |
338 | //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); | 350 | //Console.WriteLine("SetGeom to " + prim_geom + " for " + Name); |
339 | 351 | ||
340 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 352 | if (m_assetFailed) |
341 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 353 | { |
354 | d.GeomSetCategoryBits(prim_geom, 0); | ||
355 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); | ||
356 | } | ||
357 | else | ||
358 | { | ||
359 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
360 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
361 | } | ||
342 | 362 | ||
343 | _parent_scene.geom_name_map[prim_geom] = Name; | 363 | _parent_scene.geom_name_map[prim_geom] = Name; |
344 | _parent_scene.actor_name_map[prim_geom] = this; | 364 | _parent_scene.actor_name_map[prim_geom] = this; |
@@ -401,8 +421,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
401 | myrot.W = _orientation.W; | 421 | myrot.W = _orientation.W; |
402 | d.BodySetQuaternion(Body, ref myrot); | 422 | d.BodySetQuaternion(Body, ref myrot); |
403 | d.GeomSetBody(prim_geom, Body); | 423 | d.GeomSetBody(prim_geom, Body); |
404 | m_collisionCategories |= CollisionCategories.Body; | 424 | |
405 | m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); | 425 | if (m_assetFailed) |
426 | { | ||
427 | d.GeomSetCategoryBits(prim_geom, 0); | ||
428 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); | ||
429 | } | ||
430 | else | ||
431 | { | ||
432 | m_collisionCategories |= CollisionCategories.Body; | ||
433 | m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); | ||
434 | } | ||
406 | 435 | ||
407 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 436 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); |
408 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 437 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
@@ -774,8 +803,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
774 | m_collisionCategories &= ~CollisionCategories.Body; | 803 | m_collisionCategories &= ~CollisionCategories.Body; |
775 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 804 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
776 | 805 | ||
777 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 806 | if (m_assetFailed) |
778 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 807 | { |
808 | d.GeomSetCategoryBits(prim_geom, 0); | ||
809 | d.GeomSetCollideBits(prim_geom, 0); | ||
810 | } | ||
811 | else | ||
812 | { | ||
813 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
814 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
815 | } | ||
779 | 816 | ||
780 | d.BodyDestroy(Body); | 817 | d.BodyDestroy(Body); |
781 | lock (childrenPrim) | 818 | lock (childrenPrim) |
@@ -799,8 +836,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
799 | m_collisionCategories &= ~CollisionCategories.Body; | 836 | m_collisionCategories &= ~CollisionCategories.Body; |
800 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); | 837 | m_collisionFlags &= ~(CollisionCategories.Wind | CollisionCategories.Land); |
801 | 838 | ||
802 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 839 | if (m_assetFailed) |
803 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 840 | { |
841 | d.GeomSetCategoryBits(prim_geom, 0); | ||
842 | d.GeomSetCollideBits(prim_geom, 0); | ||
843 | } | ||
844 | else | ||
845 | { | ||
846 | |||
847 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
848 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
849 | } | ||
804 | 850 | ||
805 | Body = IntPtr.Zero; | 851 | Body = IntPtr.Zero; |
806 | } | 852 | } |
@@ -1090,8 +1136,16 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1090 | prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); | 1136 | prm.m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); |
1091 | 1137 | ||
1092 | //Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name); | 1138 | //Console.WriteLine(" GeomSetCategoryBits 1: " + prm.prim_geom + " - " + (int)prm.m_collisionCategories + " for " + Name); |
1093 | d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories); | 1139 | if (prm.m_assetFailed) |
1094 | d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags); | 1140 | { |
1141 | d.GeomSetCategoryBits(prm.prim_geom, 0); | ||
1142 | d.GeomSetCollideBits(prm.prim_geom, prm.BadMeshAssetCollideBits); | ||
1143 | } | ||
1144 | else | ||
1145 | { | ||
1146 | d.GeomSetCategoryBits(prm.prim_geom, (int)prm.m_collisionCategories); | ||
1147 | d.GeomSetCollideBits(prm.prim_geom, (int)prm.m_collisionFlags); | ||
1148 | } | ||
1095 | 1149 | ||
1096 | d.Quaternion quat = new d.Quaternion(); | 1150 | d.Quaternion quat = new d.Quaternion(); |
1097 | quat.W = prm._orientation.W; | 1151 | quat.W = prm._orientation.W; |
@@ -1136,10 +1190,18 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1136 | m_collisionCategories |= CollisionCategories.Body; | 1190 | m_collisionCategories |= CollisionCategories.Body; |
1137 | m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); | 1191 | m_collisionFlags |= (CollisionCategories.Land | CollisionCategories.Wind); |
1138 | 1192 | ||
1139 | //Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name); | 1193 | if (m_assetFailed) |
1140 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 1194 | { |
1141 | //Console.WriteLine(" Post GeomSetCategoryBits 2"); | 1195 | d.GeomSetCategoryBits(prim_geom, 0); |
1142 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 1196 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
1197 | } | ||
1198 | else | ||
1199 | { | ||
1200 | //Console.WriteLine("GeomSetCategoryBits 2: " + prim_geom + " - " + (int)m_collisionCategories + " for " + Name); | ||
1201 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
1202 | //Console.WriteLine(" Post GeomSetCategoryBits 2"); | ||
1203 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
1204 | } | ||
1143 | 1205 | ||
1144 | d.Quaternion quat2 = new d.Quaternion(); | 1206 | d.Quaternion quat2 = new d.Quaternion(); |
1145 | quat2.W = _orientation.W; | 1207 | quat2.W = _orientation.W; |
@@ -1300,8 +1362,16 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1300 | disableBodySoft(); | 1362 | disableBodySoft(); |
1301 | } | 1363 | } |
1302 | 1364 | ||
1303 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 1365 | if (m_assetFailed) |
1304 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 1366 | { |
1367 | d.GeomSetCategoryBits(prim_geom, 0); | ||
1368 | d.GeomSetCollideBits(prim_geom, 0); | ||
1369 | } | ||
1370 | else | ||
1371 | { | ||
1372 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
1373 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
1374 | } | ||
1305 | 1375 | ||
1306 | if (IsPhysical) | 1376 | if (IsPhysical) |
1307 | { | 1377 | { |
@@ -1322,8 +1392,16 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1322 | if (m_collidesWater) | 1392 | if (m_collidesWater) |
1323 | m_collisionFlags |= CollisionCategories.Water; | 1393 | m_collisionFlags |= CollisionCategories.Water; |
1324 | 1394 | ||
1325 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | 1395 | if (m_assetFailed) |
1326 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 1396 | { |
1397 | d.GeomSetCategoryBits(prim_geom, 0); | ||
1398 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); | ||
1399 | } | ||
1400 | else | ||
1401 | { | ||
1402 | d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); | ||
1403 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
1404 | } | ||
1327 | 1405 | ||
1328 | if (IsPhysical) | 1406 | if (IsPhysical) |
1329 | { | 1407 | { |
@@ -1498,6 +1576,10 @@ Console.WriteLine("CreateGeom:"); | |||
1498 | mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical); | 1576 | 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. | 1577 | // createmesh returns null when it's a shape that isn't a cube. |
1500 | // m_log.Debug(m_localID); | 1578 | // m_log.Debug(m_localID); |
1579 | if (mesh == null) | ||
1580 | CheckMeshAsset(); | ||
1581 | else | ||
1582 | m_assetFailed = false; | ||
1501 | } | 1583 | } |
1502 | 1584 | ||
1503 | #if SPAM | 1585 | #if SPAM |
@@ -1997,7 +2079,14 @@ Console.WriteLine(" JointCreateFixed"); | |||
1997 | // Don't need to re-enable body.. it's done in SetMesh | 2079 | // Don't need to re-enable body.. it's done in SetMesh |
1998 | 2080 | ||
1999 | if (_parent_scene.needsMeshing(_pbs)) | 2081 | if (_parent_scene.needsMeshing(_pbs)) |
2082 | { | ||
2000 | mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical); | 2083 | mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical); |
2084 | if (mesh == null) | ||
2085 | CheckMeshAsset(); | ||
2086 | else | ||
2087 | m_assetFailed = false; | ||
2088 | } | ||
2089 | |||
2001 | } | 2090 | } |
2002 | 2091 | ||
2003 | CreateGeom(m_targetSpace, mesh); | 2092 | CreateGeom(m_targetSpace, mesh); |
@@ -2049,14 +2138,19 @@ Console.WriteLine(" JointCreateFixed"); | |||
2049 | m_collisionFlags &= ~CollisionCategories.Water; | 2138 | m_collisionFlags &= ~CollisionCategories.Water; |
2050 | } | 2139 | } |
2051 | 2140 | ||
2052 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 2141 | if (m_assetFailed) |
2053 | } | 2142 | d.GeomSetCollideBits(prim_geom, BadMeshAssetCollideBits); |
2143 | else | ||
2054 | 2144 | ||
2145 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | ||
2146 | } | ||
2055 | /// <summary> | 2147 | /// <summary> |
2056 | /// Change prim in response to a shape taint. | 2148 | /// Change prim in response to a shape taint. |
2057 | /// </summary> | 2149 | /// </summary> |
2058 | private void changeshape() | 2150 | private void changeshape() |
2059 | { | 2151 | { |
2152 | m_taintshape = false; | ||
2153 | |||
2060 | // Cleanup of old prim geometry and Bodies | 2154 | // Cleanup of old prim geometry and Bodies |
2061 | if (IsPhysical && Body != IntPtr.Zero) | 2155 | if (IsPhysical && Body != IntPtr.Zero) |
2062 | { | 2156 | { |
@@ -2084,6 +2178,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2084 | 2178 | ||
2085 | IMesh mesh = null; | 2179 | IMesh mesh = null; |
2086 | 2180 | ||
2181 | |||
2087 | if (_parent_scene.needsMeshing(_pbs)) | 2182 | if (_parent_scene.needsMeshing(_pbs)) |
2088 | { | 2183 | { |
2089 | // Don't need to re-enable body.. it's done in CreateMesh | 2184 | // Don't need to re-enable body.. it's done in CreateMesh |
@@ -2094,6 +2189,10 @@ Console.WriteLine(" JointCreateFixed"); | |||
2094 | 2189 | ||
2095 | // createmesh returns null when it doesn't mesh. | 2190 | // createmesh returns null when it doesn't mesh. |
2096 | mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical); | 2191 | mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, meshlod, IsPhysical); |
2192 | if (mesh == null) | ||
2193 | CheckMeshAsset(); | ||
2194 | else | ||
2195 | m_assetFailed = false; | ||
2097 | } | 2196 | } |
2098 | 2197 | ||
2099 | CreateGeom(m_targetSpace, mesh); | 2198 | CreateGeom(m_targetSpace, mesh); |
@@ -2130,7 +2229,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2130 | } | 2229 | } |
2131 | 2230 | ||
2132 | resetCollisionAccounting(); | 2231 | resetCollisionAccounting(); |
2133 | m_taintshape = false; | 2232 | // m_taintshape = false; |
2134 | } | 2233 | } |
2135 | 2234 | ||
2136 | /// <summary> | 2235 | /// <summary> |
@@ -2396,6 +2495,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2396 | set | 2495 | set |
2397 | { | 2496 | { |
2398 | _pbs = value; | 2497 | _pbs = value; |
2498 | m_assetFailed = false; | ||
2399 | m_taintshape = true; | 2499 | m_taintshape = true; |
2400 | } | 2500 | } |
2401 | } | 2501 | } |
@@ -3234,5 +3334,37 @@ Console.WriteLine(" JointCreateFixed"); | |||
3234 | { | 3334 | { |
3235 | m_material = pMaterial; | 3335 | m_material = pMaterial; |
3236 | } | 3336 | } |
3337 | |||
3338 | |||
3339 | private void CheckMeshAsset() | ||
3340 | { | ||
3341 | if (_pbs.SculptEntry && !m_assetFailed && _pbs.SculptTexture != UUID.Zero) | ||
3342 | { | ||
3343 | m_assetFailed = true; | ||
3344 | Util.FireAndForget(delegate | ||
3345 | { | ||
3346 | RequestAssetDelegate assetProvider = _parent_scene.RequestAssetMethod; | ||
3347 | if (assetProvider != null) | ||
3348 | assetProvider(_pbs.SculptTexture, MeshAssetReveived); | ||
3349 | }); | ||
3350 | } | ||
3351 | } | ||
3352 | |||
3353 | void MeshAssetReveived(AssetBase asset) | ||
3354 | { | ||
3355 | if (asset.Data != null && asset.Data.Length > 0) | ||
3356 | { | ||
3357 | if (!_pbs.SculptEntry) | ||
3358 | return; | ||
3359 | if (_pbs.SculptTexture.ToString() != asset.ID) | ||
3360 | return; | ||
3361 | |||
3362 | _pbs.SculptData = new byte[asset.Data.Length]; | ||
3363 | asset.Data.CopyTo(_pbs.SculptData, 0); | ||
3364 | // m_assetFailed = false; | ||
3365 | m_taintshape = true; | ||
3366 | _parent_scene.AddPhysicsActorTaint(this); | ||
3367 | } | ||
3368 | } | ||
3237 | } | 3369 | } |
3238 | } \ No newline at end of file | 3370 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index cbe21e2..d53bd90 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs | |||
@@ -4320,4 +4320,4 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
4320 | m_stats[ODEPrimUpdateFrameMsStatName] = 0; | 4320 | m_stats[ODEPrimUpdateFrameMsStatName] = 0; |
4321 | } | 4321 | } |
4322 | } | 4322 | } |
4323 | } \ No newline at end of file | 4323 | } |