コード例 #1
0
ファイル: BSShapes.cs プロジェクト: Michelle-Argus/opensim
    // Loop through all the known hulls and return the description based on the physical address.
    public static bool TryGetGImpactByPtr(BulletShape pShape, out BSShapeGImpact outHull)
    {
        bool ret = false;
        BSShapeGImpact foundDesc = null;
        lock (GImpacts)
        {
            foreach (BSShapeGImpact sh in GImpacts.Values)
            {
                if (sh.physShapeInfo.ReferenceSame(pShape))
                {
                    foundDesc = sh;
                    ret = true;
                    break;
                }

            }
        }
        outHull = foundDesc;
        return ret;
    }
コード例 #2
0
ファイル: BSShapes.cs プロジェクト: Michelle-Argus/opensim
    public static BSShape GetReference(BSScene physicsScene, bool forceRebuild, BSPhysObject prim)
    {
        float lod;
        System.UInt64 newMeshKey = BSShape.ComputeShapeKey(prim.Size, prim.BaseShape, out lod);

        physicsScene.DetailLog("{0},BSShapeGImpact,getReference,newKey={1},size={2},lod={3}",
                                prim.LocalID, newMeshKey.ToString("X"), prim.Size, lod);

        BSShapeGImpact retGImpact = null;
        lock (GImpacts)
        {
            if (GImpacts.TryGetValue(newMeshKey, out retGImpact))
            {
                // The mesh has already been created. Return a new reference to same.
                retGImpact.IncrementReference();
            }
            else
            {
                retGImpact = new BSShapeGImpact(new BulletShape());
                BulletShape newShape = retGImpact.CreatePhysicalGImpact(physicsScene, prim, newMeshKey, prim.BaseShape, prim.Size, lod);

                // Check to see if mesh was created (might require an asset).
                newShape = VerifyMeshCreated(physicsScene, newShape, prim);
                newShape.shapeKey = newMeshKey;
                if (!newShape.isNativeShape 
                            || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
                            || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
                {
                    // 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.
                    GImpacts.Add(newMeshKey, retGImpact);
                }

                retGImpact.physShapeInfo = newShape;
            }
        }
        return retGImpact;
    }