本文整理汇总了C++中MyAvatar::scaleVectorRelativeToPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ MyAvatar::scaleVectorRelativeToPosition方法的具体用法?C++ MyAvatar::scaleVectorRelativeToPosition怎么用?C++ MyAvatar::scaleVectorRelativeToPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyAvatar
的用法示例。
在下文中一共展示了MyAvatar::scaleVectorRelativeToPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderLaserPointers
//Renders sixense laser pointers for UI selection in the oculus
void OculusManager::renderLaserPointers() {
#ifdef HAVE_LIBOVR
const float PALM_TIP_ROD_RADIUS = 0.002f;
MyAvatar* myAvatar = Application::getInstance()->getAvatar();
//If the Oculus is enabled, we will draw a blue cursor ray
for (size_t i = 0; i < myAvatar->getHand()->getNumPalms(); ++i) {
PalmData& palm = myAvatar->getHand()->getPalms()[i];
if (palm.isActive()) {
glColor4f(0, 1, 1, 1);
glm::vec3 tip = getLaserPointerTipPosition(&palm);
glm::vec3 root = palm.getPosition();
//Scale the root vector with the avatar scale
myAvatar->scaleVectorRelativeToPosition(root);
Avatar::renderJointConnectingCone(root, tip, PALM_TIP_ROD_RADIUS, PALM_TIP_ROD_RADIUS);
}
}
#endif
}
示例2: renderHandTargets
void Hand::renderHandTargets(bool isMine) {
glPushMatrix();
MyAvatar* myAvatar = Application::getInstance()->getAvatar();
const float avatarScale = Application::getInstance()->getAvatar()->getScale();
const float alpha = 1.0f;
const glm::vec3 handColor(1.0, 0.0, 0.0); // Color the hand targets red to be different than skin
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
if (isMine && Menu::getInstance()->isOptionChecked(MenuOption::DisplayHandTargets)) {
for (size_t i = 0; i < getNumPalms(); ++i) {
PalmData& palm = getPalms()[i];
if (!palm.isActive()) {
continue;
}
glm::vec3 targetPosition = palm.getTipPosition();
glPushMatrix();
glTranslatef(targetPosition.x, targetPosition.y, targetPosition.z);
const float collisionRadius = 0.05f;
glColor4f(0.5f,0.5f,0.5f, alpha);
DependencyManager::get<GeometryCache>()->renderSphere(collisionRadius, 10, 10, false);
glPopMatrix();
}
}
const float PALM_BALL_RADIUS = 0.03f * avatarScale;
const float PALM_DISK_RADIUS = 0.06f * avatarScale;
const float PALM_DISK_THICKNESS = 0.01f * avatarScale;
const float PALM_FINGER_ROD_RADIUS = 0.003f * avatarScale;
// Draw the palm ball and disk
for (size_t i = 0; i < getNumPalms(); ++i) {
PalmData& palm = getPalms()[i];
if (palm.isActive()) {
glColor4f(handColor.r, handColor.g, handColor.b, alpha);
glm::vec3 tip = palm.getTipPosition();
glm::vec3 root = palm.getPosition();
//Scale the positions based on avatar scale
myAvatar->scaleVectorRelativeToPosition(tip);
myAvatar->scaleVectorRelativeToPosition(root);
Avatar::renderJointConnectingCone(root, tip, PALM_FINGER_ROD_RADIUS, PALM_FINGER_ROD_RADIUS);
// Render sphere at palm/finger root
glm::vec3 offsetFromPalm = root + palm.getNormal() * PALM_DISK_THICKNESS;
Avatar::renderJointConnectingCone(root, offsetFromPalm, PALM_DISK_RADIUS, 0.0f);
glPushMatrix();
glTranslatef(root.x, root.y, root.z);
DependencyManager::get<GeometryCache>()->renderSphere(PALM_BALL_RADIUS, 20.0f, 20.0f);
glPopMatrix();
}
}
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
glPopMatrix();
}