本文整理汇总了C++中avatarhash::iterator类的典型用法代码示例。如果您正苦于以下问题:C++ iterator类的具体用法?C++ iterator怎么用?C++ iterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了iterator类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: updateOtherAvatars
void AvatarManager::updateOtherAvatars(float deltaTime) {
PerformanceWarning warn(Application::getInstance()->getPipelineWarningsOption(), "Application::updateAvatars()");
Application* applicationInstance = Application::getInstance();
glm::vec3 mouseOrigin = applicationInstance->getMouseRayOrigin();
glm::vec3 mouseDirection = applicationInstance->getMouseRayDirection();
// simulate avatars
AvatarHash::iterator avatarIterator = _avatarHash.begin();
while (avatarIterator != _avatarHash.end()) {
Avatar* avatar = static_cast<Avatar*>(avatarIterator.value().data());
if (avatar == static_cast<Avatar*>(_myAvatar.data())) {
// DO NOT update _myAvatar! Its update has already been done earlier in the main loop.
//updateMyAvatar(deltaTime);
++avatarIterator;
continue;
}
if (avatar->getOwningAvatarMixer()) {
// this avatar's mixer is still around, go ahead and simulate it
avatar->simulate(deltaTime);
avatar->setMouseRay(mouseOrigin, mouseDirection);
++avatarIterator;
} else {
// the mixer that owned this avatar is gone, give it to the vector of fades and kill it
avatarIterator = erase(avatarIterator);
}
}
// simulate avatar fades
simulateAvatarFades(deltaTime);
}
开发者ID:hifialanwu,项目名称:hifi,代码行数:31,代码来源:AvatarManager.cpp
示例2: updateOtherAvatars
void AvatarManager::updateOtherAvatars(float deltaTime) {
if (_avatarHash.size() < 2 && _avatarFades.isEmpty()) {
return;
}
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateAvatars()");
PerformanceTimer perfTimer("otherAvatars");
// simulate avatars
AvatarHash::iterator avatarIterator = _avatarHash.begin();
while (avatarIterator != _avatarHash.end()) {
auto avatar = std::dynamic_pointer_cast<Avatar>(avatarIterator.value());
if (avatar == _myAvatar || !avatar->isInitialized()) {
// DO NOT update _myAvatar! Its update has already been done earlier in the main loop.
// DO NOT update or fade out uninitialized Avatars
++avatarIterator;
} else if (avatar->shouldDie()) {
removeAvatarMotionState(avatar);
_avatarFades.push_back(avatarIterator.value());
avatarIterator = _avatarHash.erase(avatarIterator);
} else {
avatar->simulate(deltaTime);
++avatarIterator;
}
}
// simulate avatar fades
simulateAvatarFades(deltaTime);
}
开发者ID:DaveDubUK,项目名称:hifi,代码行数:31,代码来源:AvatarManager.cpp
示例3: updateOtherAvatars
void AvatarManager::updateOtherAvatars(float deltaTime) {
if (_avatarHash.size() < 2 && _avatarFades.isEmpty()) {
return;
}
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateAvatars()");
PerformanceTimer perfTimer("otherAvatars");
// simulate avatars
AvatarHash::iterator avatarIterator = _avatarHash.begin();
while (avatarIterator != _avatarHash.end()) {
AvatarSharedPointer sharedAvatar = avatarIterator.value();
Avatar* avatar = reinterpret_cast<Avatar*>(sharedAvatar.data());
if (sharedAvatar == _myAvatar || !avatar->isInitialized()) {
// DO NOT update _myAvatar! Its update has already been done earlier in the main loop.
// DO NOT update uninitialized Avatars
++avatarIterator;
continue;
}
if (!shouldKillAvatar(sharedAvatar)) {
// this avatar's mixer is still around, go ahead and simulate it
avatar->simulate(deltaTime);
++avatarIterator;
} else {
// the mixer that owned this avatar is gone, give it to the vector of fades and kill it
avatarIterator = erase(avatarIterator);
}
}
// simulate avatar fades
simulateAvatarFades(deltaTime);
}
开发者ID:RyanDowne,项目名称:hifi,代码行数:34,代码来源:AvatarManager.cpp
示例4: containsAvatarWithDisplayName
bool AvatarHashMap::containsAvatarWithDisplayName(const QString& displayName) {
AvatarHash::iterator avatarIterator = _avatarHash.begin();
while (avatarIterator != _avatarHash.end()) {
AvatarSharedPointer sharedAvatar = avatarIterator.value();
if (avatarIterator.value()->getDisplayName() == displayName) {
// this is a match
// check if this avatar should still be around
if (!shouldKillAvatar(sharedAvatar)) {
// we have a match, return true
return true;
} else {
// we should remove this avatar, do that now
erase(avatarIterator);
}
break;
} else {
++avatarIterator;
}
}
// return false, no match
return false;
}
开发者ID:JeroMiya,项目名称:hifi,代码行数:25,代码来源:AvatarHashMap.cpp
示例5: postUpdate
void AvatarManager::postUpdate(float deltaTime, const render::ScenePointer& scene) {
auto hashCopy = getHashCopy();
AvatarHash::iterator avatarIterator = hashCopy.begin();
for (avatarIterator = hashCopy.begin(); avatarIterator != hashCopy.end(); avatarIterator++) {
auto avatar = std::static_pointer_cast<Avatar>(avatarIterator.value());
avatar->postUpdate(deltaTime, scene);
}
}
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:8,代码来源:AvatarManager.cpp
示例6: removeAvatar
// virtual
void AvatarManager::removeAvatar(const QUuid& sessionUUID) {
AvatarHash::iterator avatarIterator = _avatarHash.find(sessionUUID);
if (avatarIterator != _avatarHash.end()) {
std::shared_ptr<Avatar> avatar = std::dynamic_pointer_cast<Avatar>(avatarIterator.value());
if (avatar != _myAvatar && avatar->isInitialized()) {
removeAvatarMotionState(avatar);
_avatarFades.push_back(avatarIterator.value());
_avatarHash.erase(avatarIterator);
}
}
}
开发者ID:DaveDubUK,项目名称:hifi,代码行数:12,代码来源:AvatarManager.cpp
示例7: deleteAllAvatars
void AvatarManager::deleteAllAvatars() {
assert(_otherAvatarsToChangeInPhysics.empty());
QReadLocker locker(&_hashLock);
AvatarHash::iterator avatarIterator = _avatarHash.begin();
while (avatarIterator != _avatarHash.end()) {
auto avatar = std::static_pointer_cast<Avatar>(avatarIterator.value());
avatarIterator = _avatarHash.erase(avatarIterator);
avatar->die();
if (avatar != _myAvatar) {
auto otherAvatar = std::static_pointer_cast<OtherAvatar>(avatar);
assert(!otherAvatar->_motionState);
assert(otherAvatar->getDetailedMotionStates().size() == 0);
}
}
}
开发者ID:AndrewMeadows,项目名称:hifi,代码行数:15,代码来源:AvatarManager.cpp
示例8: clearOtherAvatars
void AvatarManager::clearOtherAvatars() {
// clear any avatars that came from an avatar-mixer
AvatarHash::iterator avatarIterator = _avatarHash.begin();
while (avatarIterator != _avatarHash.end()) {
auto avatar = std::static_pointer_cast<Avatar>(avatarIterator.value());
if (avatar == _myAvatar || !avatar->isInitialized()) {
// don't remove myAvatar or uninitialized avatars from the list
++avatarIterator;
} else {
removeAvatarMotionState(avatar);
_avatarFades.push_back(avatarIterator.value());
avatarIterator = _avatarHash.erase(avatarIterator);
}
}
_myAvatar->clearLookAtTargetAvatar();
}
开发者ID:DaveDubUK,项目名称:hifi,代码行数:16,代码来源:AvatarManager.cpp
示例9: clearOtherAvatars
void AvatarManager::clearOtherAvatars() {
// clear any avatars that came from an avatar-mixer
QWriteLocker locker(&_hashLock);
AvatarHash::iterator avatarIterator = _avatarHash.begin();
while (avatarIterator != _avatarHash.end()) {
auto avatar = std::static_pointer_cast<Avatar>(avatarIterator.value());
if (avatar == _myAvatar || !avatar->isInitialized()) {
// don't remove myAvatar or uninitialized avatars from the list
++avatarIterator;
} else {
auto removedAvatar = avatarIterator.value();
avatarIterator = _avatarHash.erase(avatarIterator);
handleRemovedAvatar(removedAvatar);
}
}
_myAvatar->clearLookAtTargetAvatar();
}
开发者ID:vastcharade,项目名称:hifi,代码行数:19,代码来源:AvatarManager.cpp
示例10: updateOtherAvatars
void AvatarManager::updateOtherAvatars(float deltaTime) {
// lock the hash for read to check the size
QReadLocker lock(&_hashLock);
if (_avatarHash.size() < 2 && _avatarFades.isEmpty()) {
return;
}
lock.unlock();
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateAvatars()");
PerformanceTimer perfTimer("otherAvatars");
// simulate avatars
auto hashCopy = getHashCopy();
AvatarHash::iterator avatarIterator = hashCopy.begin();
while (avatarIterator != hashCopy.end()) {
auto avatar = std::static_pointer_cast<Avatar>(avatarIterator.value());
if (avatar == _myAvatar || !avatar->isInitialized()) {
// DO NOT update _myAvatar! Its update has already been done earlier in the main loop.
// DO NOT update or fade out uninitialized Avatars
++avatarIterator;
} else if (avatar->shouldDie()) {
removeAvatar(avatarIterator.key());
++avatarIterator;
} else {
avatar->startUpdate();
avatar->simulate(deltaTime);
avatar->endUpdate();
++avatarIterator;
}
}
// simulate avatar fades
simulateAvatarFades(deltaTime);
}
开发者ID:vastcharade,项目名称:hifi,代码行数:40,代码来源:AvatarManager.cpp
示例11: erase
AvatarHash::iterator AvatarHashMap::erase(const AvatarHash::iterator& iterator) {
qDebug() << "Removing Avatar with UUID" << iterator.key() << "from AvatarHashMap.";
return _avatarHash.erase(iterator);
}
开发者ID:ey6es,项目名称:hifi,代码行数:4,代码来源:AvatarHashMap.cpp
注:本文中的avatarhash::iterator类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论