本文整理汇总了C++中MyAvatar::setOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ MyAvatar::setOrientation方法的具体用法?C++ MyAvatar::setOrientation怎么用?C++ MyAvatar::setOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyAvatar
的用法示例。
在下文中一共展示了MyAvatar::setOrientation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: goToOrientation
void LocationManager::goToOrientation(QString orientation) {
if (orientation.isEmpty()) {
return;
}
QStringList orientationItems = orientation.remove(' ').split(QRegExp("_|,"), QString::SkipEmptyParts);
const int NUMBER_OF_ORIENTATION_ITEMS = 4;
const int W_ITEM = 0;
const int X_ITEM = 1;
const int Y_ITEM = 2;
const int Z_ITEM = 3;
if (orientationItems.size() == NUMBER_OF_ORIENTATION_ITEMS) {
// replace last occurrence of '_' with decimal point
replaceLastOccurrence('-', '.', orientationItems[W_ITEM]);
replaceLastOccurrence('-', '.', orientationItems[X_ITEM]);
replaceLastOccurrence('-', '.', orientationItems[Y_ITEM]);
replaceLastOccurrence('-', '.', orientationItems[Z_ITEM]);
double w = orientationItems[W_ITEM].toDouble();
double x = orientationItems[X_ITEM].toDouble();
double y = orientationItems[Y_ITEM].toDouble();
double z = orientationItems[Z_ITEM].toDouble();
glm::quat newAvatarOrientation(w, x, y, z);
MyAvatar* myAvatar = Application::getInstance()->getAvatar();
glm::quat avatarOrientation = myAvatar->getOrientation();
if (newAvatarOrientation != avatarOrientation) {
myAvatar->setOrientation(newAvatarOrientation);
emit myAvatar->transformChanged();
}
}
}