| 920 | } |
| 921 | |
| 922 | void IslandSim::processNewEdges() |
| 923 | { |
| 924 | PX_PROFILE_ZONE("Basic.processNewEdges", getContextId()); |
| 925 | //Stage 1: we process the list of new pairs. To do this, we need to first sort them based on a predicate... |
| 926 | |
| 927 | insertNewEdges(); |
| 928 | |
| 929 | mHopCounts.resize(mNodes.size()); //Make sure we have enough space for hop counts for all nodes |
| 930 | mFastRoute.resize(mNodes.size()); |
| 931 | |
| 932 | |
| 933 | for(PxU32 i = 0; i < Edge::eEDGE_TYPE_COUNT; ++i) |
| 934 | { |
| 935 | for(PxU32 a = 0; a < mDirtyEdges[i].size(); ++a) |
| 936 | { |
| 937 | EdgeIndex edgeIndex = mDirtyEdges[i][a]; |
| 938 | Edge& edge = mEdges[edgeIndex]; |
| 939 | |
| 940 | /*PX_ASSERT(edge.mState != Edge::eDESTROYED || ((edge.mNode1.index() == IG_INVALID_NODE || mNodes[edge.mNode1.index()].isKinematic() || mNodes[edge.mNode1.index()].isActive() == false) && |
| 941 | (edge.mNode2.index() == IG_INVALID_NODE || mNodes[edge.mNode2.index()].isKinematic() || mNodes[edge.mNode2.index()].isActive() == false)));*/ |
| 942 | |
| 943 | //edge.clearInDirtyList(); |
| 944 | |
| 945 | |
| 946 | //We do not process either destroyed or disconnected edges |
| 947 | if(/*edge.isConnected() && */!edge.isPendingDestroyed()) |
| 948 | { |
| 949 | //Conditions: |
| 950 | //(1) Neither body is in an island (static/kinematics are never in islands) so we need to create a new island containing these bodies |
| 951 | // or just 1 body if the other is kinematic/static |
| 952 | //(2) Both bodies are already in the same island. Update root node hop count estimates for the bodies if a route through the new connection |
| 953 | // is shorter for either body |
| 954 | //(3) One body is already in an island and the other isn't, so we just add the new body to the existing island. |
| 955 | //(4) Both bodies are in different islands. In that case, we merge the islands |
| 956 | |
| 957 | NodeIndex nodeIndex1 = mEdgeNodeIndices[2 * edgeIndex]; |
| 958 | NodeIndex nodeIndex2 = mEdgeNodeIndices[2 * edgeIndex+1]; |
| 959 | |
| 960 | IslandId islandId1 = nodeIndex1.index() == IG_INVALID_NODE ? IG_INVALID_ISLAND : mIslandIds[nodeIndex1.index()]; |
| 961 | IslandId islandId2 = nodeIndex2.index() == IG_INVALID_NODE ? IG_INVALID_ISLAND : mIslandIds[nodeIndex2.index()]; |
| 962 | |
| 963 | //TODO - wake ups!!!! |
| 964 | //If one of the nodes is awake and the other is asleep, we need to wake 'em up |
| 965 | |
| 966 | //When a node is activated, the island must also be activated... |
| 967 | |
| 968 | bool active1 = nodeIndex1.index() != IG_INVALID_NODE && mNodes[nodeIndex1.index()].isActive(); |
| 969 | bool active2 = nodeIndex2.index() != IG_INVALID_NODE && mNodes[nodeIndex2.index()].isActive(); |
| 970 | |
| 971 | IslandId islandId = IG_INVALID_ISLAND; |
| 972 | |
| 973 | if(islandId1 == IG_INVALID_ISLAND && islandId2 == IG_INVALID_ISLAND) |
| 974 | { |
| 975 | //All nodes should be introduced in an island now unless they are static or kinematic. Therefore, if we get here, we have an edge |
| 976 | //between 2 kinematic nodes or a kinematic and static node. These should not influence island management so we should just ignore |
| 977 | //these edges. |
| 978 | } |
| 979 | else if(islandId1 == islandId2) |
no test coverage detected