| 2109 | } |
| 2110 | |
| 2111 | bool NpScene::fetchResults(bool block, PxU32* errorState) |
| 2112 | { |
| 2113 | if(getSimulationStage() != Sc::SimulationStage::eADVANCE) |
| 2114 | { |
| 2115 | Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxScene::fetchResults: fetchResults() called illegally! It must be called after advance() or simulate()"); |
| 2116 | return false; |
| 2117 | } |
| 2118 | |
| 2119 | if(!checkResultsInternal(block)) |
| 2120 | return false; |
| 2121 | |
| 2122 | { |
| 2123 | PX_SIMD_GUARD; |
| 2124 | |
| 2125 | // take write check *after* simulation has finished, otherwise |
| 2126 | // we will block simulation callbacks from using the API |
| 2127 | // disallow re-entry to detect callbacks making write calls |
| 2128 | NP_WRITE_CHECK_NOREENTRY(this); |
| 2129 | |
| 2130 | // we use cross thread profile here, to show the event in cross thread view |
| 2131 | // PT: TODO: why do we want to show it in the cross thread view? |
| 2132 | PX_PROFILE_START_CROSSTHREAD("Basic.fetchResults", getContextId()); |
| 2133 | PX_PROFILE_ZONE("Sim.fetchResults", getContextId()); |
| 2134 | |
| 2135 | fetchResultsPreContactCallbacks(); |
| 2136 | |
| 2137 | { |
| 2138 | // PT: TODO: why a cross-thread event here? |
| 2139 | PX_PROFILE_START_CROSSTHREAD("Basic.processCallbacks", getContextId()); |
| 2140 | mScene.fireQueuedContactCallbacks(); |
| 2141 | PX_PROFILE_STOP_CROSSTHREAD("Basic.processCallbacks", getContextId()); |
| 2142 | } |
| 2143 | |
| 2144 | fetchResultsPostContactCallbacks(); |
| 2145 | |
| 2146 | PX_PROFILE_STOP_CROSSTHREAD("Basic.fetchResults", getContextId()); |
| 2147 | PX_PROFILE_STOP_CROSSTHREAD("Basic.simulate", getContextId()); |
| 2148 | |
| 2149 | if(errorState) |
| 2150 | *errorState = 0; |
| 2151 | } |
| 2152 | |
| 2153 | #if PX_SUPPORT_PVD |
| 2154 | { |
| 2155 | PX_SIMD_GUARD; |
| 2156 | mScene.getScenePvdClient().frameEnd(); |
| 2157 | } |
| 2158 | #endif |
| 2159 | return true; |
| 2160 | } |
| 2161 | |
| 2162 | bool NpScene::fetchResultsStart(const PxContactPairHeader*& contactPairs, PxU32& nbContactPairs, bool block) |
| 2163 | { |
no test coverage detected