| 114 | } |
| 115 | |
| 116 | bool PvdImpl::connect(PxPvdTransport& transport, PxPvdInstrumentationFlags flags) |
| 117 | { |
| 118 | if(mIsConnected) |
| 119 | { |
| 120 | physx::shdfnd::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxPvd::connect - recall connect! Should call disconnect before re-connect."); |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | mFlags = flags; |
| 125 | mPvdTransport = &transport; |
| 126 | |
| 127 | mIsConnected = mPvdTransport->connect(); |
| 128 | |
| 129 | if(mIsConnected) |
| 130 | { |
| 131 | mSharedMetaProvider = PVD_NEW(MetaDataProvider); |
| 132 | sendTransportInitialization(); |
| 133 | |
| 134 | PvdDataStream* stream = PvdDataStream::create(this); |
| 135 | initializeModelTypes(*stream); |
| 136 | stream->release(); |
| 137 | |
| 138 | if(mFlags & PxPvdInstrumentationFlag::eMEMORY) |
| 139 | { |
| 140 | mMemClient = PVD_NEW(PvdMemClient)(*this); |
| 141 | mPvdClients.pushBack(mMemClient); |
| 142 | } |
| 143 | |
| 144 | if((mFlags & PxPvdInstrumentationFlag::ePROFILE) && mProfileZoneManager) |
| 145 | { |
| 146 | mPvdClients.pushBack(mProfileClient); |
| 147 | mProfileZone = &physx::profile::PxProfileZone::createProfileZone(&physx::shdfnd::getAllocator(),gSdkName,gProfileNameProvider.getProfileNames()); |
| 148 | } |
| 149 | |
| 150 | for(uint32_t i = 0; i < mPvdClients.size(); i++) |
| 151 | mPvdClients[i]->onPvdConnected(); |
| 152 | |
| 153 | if (mProfileZone) |
| 154 | { |
| 155 | mProfileZoneManager->addProfileZoneHandler(*mProfileClient); |
| 156 | mProfileZoneManager->addProfileZone( *mProfileZone ); |
| 157 | } |
| 158 | |
| 159 | if ((mFlags & PxPvdInstrumentationFlag::ePROFILE)) |
| 160 | { |
| 161 | PxSetProfilerCallback(this); |
| 162 | } |
| 163 | } |
| 164 | return mIsConnected; |
| 165 | } |
| 166 | |
| 167 | void PvdImpl::disconnect() |
| 168 | { |
no test coverage detected