private CreatePhysicalHull ( |
||
physicsScene | ||
prim | ||
newHullKey | System.UInt64 | |
pbs | PrimitiveBaseShape | |
size | OpenMetaverse | |
lod | float | |
리턴 |
public static BSShape GetReference(BSScene physicsScene, bool forceRebuild, BSPhysObject prim) { float lod; UInt64 newHullKey = BSShape.ComputeShapeKey(prim.Size, prim.BaseShape, out lod); BSShapeHull retHull; bool foundHull = false; lock (Hulls) foundHull = Hulls.TryGetValue (newHullKey, out retHull); if (foundHull) { // The mesh has already been created. Return a new reference to same. retHull.IncrementReference(); } else { retHull = new BSShapeHull(new BulletShape()); // An instance of this mesh has not been created. Build and remember same. BulletShape newShape = retHull.CreatePhysicalHull(physicsScene, prim, newHullKey, prim.BaseShape, prim.Size, lod); // Check to see if hull was created (might require an asset). newShape = VerifyMeshCreated(physicsScene, newShape, prim); if (!newShape.isNativeShape || prim.AssetFailed()) { // If a mesh was what was created, remember the built shape for later sharing. lock(Hulls) Hulls.Add(newHullKey, retHull); } retHull.physShapeInfo = newShape; } physicsScene.DetailLog("{0},BSShapeHull,getReference,hull={1},size={2},lod={3}", prim.LocalID, retHull, prim.Size, lod); return retHull; }