void CinderOpenNISkeleton::update() { gCinderOpenNISkeleton->mContext.WaitAndUpdateAll(); gCinderOpenNISkeleton->mDepthGenerator.GetMetaData(gCinderOpenNISkeleton->mDepthMD); gCinderOpenNISkeleton->mUserGenerator.GetUserPixels(0, gCinderOpenNISkeleton->mSceneMD); setDepthSurface(); }
void CinderOpenNISkeleton::update() { int iteration = 0; while (!_stopRequested) { XnStatus nRetVal = XN_STATUS_OK; // nRetVal = skeleton->mContext.WaitOneUpdateAll( skeleton->mDepthGenerator ); nRetVal = mContext.WaitAndUpdateAll(); if( nRetVal != XN_STATUS_OK ) { // Update printf("WaitAndUpdateAll failed: %s\n", xnGetStatusString(nRetVal)); continue; } if( !mUserGenerator ) { // User gen std::cout << "No user generator" << std::endl; return; } // Get depthgenerator nRetVal = mContext.FindExistingNode(XN_NODE_TYPE_DEPTH, mDepthGenerator); if( nRetVal != XN_STATUS_OK ) { printf("FindExistingNode failed: %s\n", xnGetStatusString(nRetVal)); continue; } // Cannot retrieve FPS or depthGenerator if(!&xnFPS) { std::cout << "(Oneday) OpenNIThreadRunner Not ready!" << std::endl; continue; } // All clear - update maxUsers = 15; mUserGenerator.GetUsers(currentUsers, maxUsers); mDepthGenerator.GetMetaData( mDepthMD ); mUserGenerator.GetUserPixels(0, mSceneMD); setDepthSurface(); updateUsers(); ++iteration; } }