BulletSim: fix CPU loop that occurs when any 'degenerate' sculptie

is in a region. This fixes the high CPU usage for regions with nothing
else going on.
0.7.5-pf-bulletsim
Robert Adams 2013-05-10 14:48:52 -07:00
parent d48c9b433a
commit bd9b5927d8
1 changed files with 6 additions and 2 deletions

View File

@ -368,9 +368,10 @@ public class BSShapeMesh : BSShape
// Check to see if mesh was created (might require an asset). // Check to see if mesh was created (might require an asset).
newShape = VerifyMeshCreated(physicsScene, newShape, prim); newShape = VerifyMeshCreated(physicsScene, newShape, prim);
if (!newShape.isNativeShape) if (!newShape.isNativeShape || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed)
{ {
// If a mesh was what was created, remember the built shape for later sharing. // If a mesh was what was created, remember the built shape for later sharing.
// Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh.
Meshes.Add(newMeshKey, retMesh); Meshes.Add(newMeshKey, retMesh);
} }
@ -481,8 +482,11 @@ public class BSShapeMesh : BSShape
} }
else else
{ {
// Force the asset condition to 'failed' so we won't try to keep fetching and processing this mesh.
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}", physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}",
LogHeader, prim.PhysObjectName, prim.RawPosition, physicsScene.Name); LogHeader, prim.PhysObjectName, prim.RawPosition, physicsScene.Name);
physicsScene.DetailLog("{0},BSShapeMesh.CreatePhysicalMesh,allDegenerate,key={1}", prim.LocalID, newMeshKey);
} }
} }
newShape.shapeKey = newMeshKey; newShape.shapeKey = newMeshKey;
@ -521,7 +525,7 @@ public class BSShapeHull : BSShape
// Check to see if hull was created (might require an asset). // Check to see if hull was created (might require an asset).
newShape = VerifyMeshCreated(physicsScene, newShape, prim); newShape = VerifyMeshCreated(physicsScene, newShape, prim);
if (!newShape.isNativeShape) if (!newShape.isNativeShape || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed)
{ {
// If a mesh was what was created, remember the built shape for later sharing. // If a mesh was what was created, remember the built shape for later sharing.
Hulls.Add(newHullKey, retHull); Hulls.Add(newHullKey, retHull);