bool MSTracker::updateTexture(char *name, MSTexture *tex) { bool success = false; for (int i = 0; i < this->dataset->getNumTrackables(); ++i) { QCAR::Trackable *track = this->dataset->getTrackable(i); if (!strcmp(name, track->getName())) { MSTargetInfo *inf = static_cast<MSTargetInfo *>(track->getUserData()); inf->updateTexture(tex); track->setUserData(inf); success = true; } } return success; }
MSTracker::~MSTracker() { QCAR::TrackerManager& trackerManager = QCAR::TrackerManager::getInstance(); QCAR::ImageTracker* imageTracker = static_cast<QCAR::ImageTracker*>( trackerManager.getTracker(QCAR::Tracker::IMAGE_TRACKER)); if (imageTracker != NULL && this->dataset != 0) { imageTracker->deactivateDataSet(this->dataset); int n = this->dataset->getNumTrackables(); for (int i = 0; i < n; ++i) { QCAR::Trackable *t = this->dataset->getTrackable(i); if (t->getUserData()) { MSTargetInfo *info = static_cast<MSTargetInfo *>(t->getUserData()); delete info; t->setUserData(NULL); } } imageTracker->destroyDataSet(this->dataset); this->dataset = NULL; } trackerManager.deinitTracker(QCAR::Tracker::IMAGE_TRACKER); }