| 783 | } |
| 784 | |
| 785 | void IslandSim::wakeIslands2() |
| 786 | { |
| 787 | PxU32 originalActiveIslands = mActiveIslands.size(); |
| 788 | |
| 789 | for (PxU32 a = 0; a < mActivatingNodes.size(); ++a) |
| 790 | { |
| 791 | NodeIndex wakeNode = mActivatingNodes[a]; |
| 792 | |
| 793 | IslandId islandId = mIslandIds[wakeNode.index()]; |
| 794 | |
| 795 | Node& node = mNodes[wakeNode.index()]; |
| 796 | node.clearActivating(); |
| 797 | if (islandId != IG_INVALID_ISLAND) |
| 798 | { |
| 799 | if (!mIslandAwake.test(islandId)) |
| 800 | { |
| 801 | markIslandActive(islandId); |
| 802 | } |
| 803 | mActiveNodeIndex[wakeNode.index()] = IG_INVALID_NODE; //Mark active node as invalid. |
| 804 | activateNodeInternal(wakeNode); |
| 805 | } |
| 806 | else |
| 807 | { |
| 808 | PX_ASSERT(node.isKinematic()); |
| 809 | node.setActive(); |
| 810 | PX_ASSERT(mActiveNodeIndex[wakeNode.index()] == a); |
| 811 | mActiveNodeIndex[wakeNode.index()] = mActiveKinematicNodes.size(); |
| 812 | mActiveKinematicNodes.pushBack(wakeNode); |
| 813 | |
| 814 | //Wake up the islands connected to this waking kinematic! |
| 815 | EdgeInstanceIndex index = node.mFirstEdgeIndex; |
| 816 | while (index != IG_INVALID_EDGE) |
| 817 | { |
| 818 | EdgeInstance& edgeInstance = mEdgeInstances[index]; |
| 819 | |
| 820 | NodeIndex outboundNode = mEdgeNodeIndices[index ^ 1]; |
| 821 | //Edge& edge = mEdges[index/2]; |
| 822 | //if(edge.isConnected()) //Only wake up if the edge is not connected... |
| 823 | NodeIndex nodeIndex = outboundNode; |
| 824 | |
| 825 | if (nodeIndex.isStaticBody() || mIslandIds[nodeIndex.index()] == IG_INVALID_ISLAND) |
| 826 | { |
| 827 | //If the edge connects to a static body *or* it connects to a node which is not part of an island (i.e. a kinematic), then activate the edge |
| 828 | EdgeIndex idx = index / 2; |
| 829 | Edge& edge = mEdges[idx]; |
| 830 | if (!edge.isActive() && edge.getEdgeType() != IG::Edge::eCONSTRAINT) |
| 831 | { |
| 832 | //Make the edge active... |
| 833 | PX_ASSERT(mEdgeNodeIndices[idx * 2].index() == IG_INVALID_NODE || !mNodes[mEdgeNodeIndices[idx * 2].index()].isActive() || mNodes[mEdgeNodeIndices[idx * 2].index()].isKinematic()); |
| 834 | PX_ASSERT(mEdgeNodeIndices[idx * 2 + 1].index() == IG_INVALID_NODE || !mNodes[mEdgeNodeIndices[idx * 2 + 1].index()].isActive() || mNodes[mEdgeNodeIndices[idx * 2 + 1].index()].isKinematic()); |
| 835 | |
| 836 | markEdgeActive(idx); |
| 837 | edge.activateEdge(); |
| 838 | |
| 839 | } |
| 840 | } |
| 841 | else |
| 842 | { |
no test coverage detected