Пример #1
0
 template <> void payloadRender(const Overlay::Pointer& overlay, RenderArgs* args) {
     if (args) {
         if (overlay->getAnchor() == Overlay::MY_AVATAR) {
             auto batch = args->_batch;
             MyAvatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
             glm::quat myAvatarRotation = avatar->getOrientation();
             glm::vec3 myAvatarPosition = avatar->getPosition();
             float angle = glm::degrees(glm::angle(myAvatarRotation));
             glm::vec3 axis = glm::axis(myAvatarRotation);
             float myAvatarScale = avatar->getScale();
             Transform transform = Transform();
             transform.setTranslation(myAvatarPosition);
             transform.setRotation(glm::angleAxis(angle, axis));
             transform.setScale(myAvatarScale);
             batch->setModelTransform(transform);
             overlay->render(args);
         } else {
             overlay->render(args);
         }
     }
 }
Пример #2
0
    template <> void payloadRender(const Overlay::Pointer& overlay, RenderArgs* args) {
        if (args) {
            if (overlay->getAnchor() == Overlay::MY_AVATAR) {
                glPushMatrix();
                MyAvatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
                glm::quat myAvatarRotation = avatar->getOrientation();
                glm::vec3 myAvatarPosition = avatar->getPosition();
                float angle = glm::degrees(glm::angle(myAvatarRotation));
                glm::vec3 axis = glm::axis(myAvatarRotation);
                float myAvatarScale = avatar->getScale();

                glTranslatef(myAvatarPosition.x, myAvatarPosition.y, myAvatarPosition.z);
                glRotatef(angle, axis.x, axis.y, axis.z);
                glScalef(myAvatarScale, myAvatarScale, myAvatarScale);
                overlay->render(args);
                glPopMatrix();
            } else {
                overlay->render(args);
            }
        }
    }
Пример #3
0
 template <> void payloadRender(const Overlay::Pointer& overlay, RenderArgs* args) {
     if (args) {
         overlay->render(args);
     }
 }