Showing the changes to interface/src/Application.cpp (1 of 160 files). Show all
Unified · Split
| @@ -1014,6 +1014,7 @@ void Application::paintGL() { · 1013 unmodified lines | |||
| 1014 | 1014 | ||
| 1015 | void Application::runTests() { | 1015 | void Application::runTests() { |
| 1016 | runTimingTests(); | 1016 | runTimingTests(); |
| 1017 | runUnitTests(); | ||
| 1017 | } | 1018 | } |
| 1018 | 1019 | ||
| 1019 | void Application::audioMuteToggled() { | 1020 | void Application::audioMuteToggled() { |
| @@ -2308,38 +2309,42 @@ void Application::updateMyAvatarLookAtPosition() { · 1288 unmodified lines | |||
| 2308 | bool isLookingAtSomeone = false; | 2309 | bool isLookingAtSomeone = false; |
| 2309 | glm::vec3 lookAtSpot; | 2310 | glm::vec3 lookAtSpot; |
| 2310 | if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { | 2311 | if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 2311 | // When I am in mirror mode, just look right at the camera (myself) | 2312 | // When I am in mirror mode, just look right at the camera (myself); don't switch gaze points because when physically |
| 2313 | // looking in a mirror one's eyes appear steady. | ||
| 2312 | if (!OculusManager::isConnected()) { | 2314 | if (!OculusManager::isConnected()) { |
| 2313 | lookAtSpot = _myCamera.getPosition(); | 2315 | lookAtSpot = _myCamera.getPosition(); |
| 2314 | } else { | 2316 | } else { |
| 2315 | if (_myAvatar->isLookingAtLeftEye()) { | 2317 | lookAtSpot = _myCamera.getPosition() + OculusManager::getMidEyePosition(); |
| 2316 | lookAtSpot = OculusManager::getLeftEyePosition(); | ||
| 2317 | } else { | ||
| 2318 | lookAtSpot = OculusManager::getRightEyePosition(); | ||
| 2319 | } | ||
| 2320 | } | 2318 | } |
| 2321 | |||
| 2322 | } else { | 2319 | } else { |
| 2323 | AvatarSharedPointer lookingAt = _myAvatar->getLookAtTargetAvatar().lock(); | 2320 | AvatarSharedPointer lookingAt = _myAvatar->getLookAtTargetAvatar().lock(); |
| 2324 | if (lookingAt && _myAvatar != lookingAt.get()) { | 2321 | if (lookingAt && _myAvatar != lookingAt.get()) { |
| 2325 | isLookingAtSomeone = true; | ||
| 2326 | // If I am looking at someone else, look directly at one of their eyes | 2322 | // If I am looking at someone else, look directly at one of their eyes |
| 2327 | if (tracker && !tracker->isMuted()) { | 2323 | isLookingAtSomeone = true; |
| 2328 | // If a face tracker is active, look at the eye for the side my gaze is biased toward | 2324 | Head* lookingAtHead = static_cast<Avatar*>(lookingAt.get())->getHead(); |
| 2329 | if (tracker->getEstimatedEyeYaw() > _myAvatar->getHead()->getFinalYaw()) { | 2325 | |
| 2330 | // Look at their right eye | 2326 | const float MAXIMUM_FACE_ANGLE = 65.0f * RADIANS_PER_DEGREE; |
| 2331 | lookAtSpot = static_cast<Avatar*>(lookingAt.get())->getHead()->getRightEyePosition(); | 2327 | glm::vec3 lookingAtFaceOrientation = lookingAtHead->getFinalOrientationInWorldFrame() * IDENTITY_FRONT; |
| 2332 | } else { | 2328 | glm::vec3 fromLookingAtToMe = glm::normalize(_myAvatar->getHead()->getEyePosition() |
| 2333 | // Look at their left eye | 2329 | - lookingAtHead->getEyePosition()); |
| 2334 | lookAtSpot = static_cast<Avatar*>(lookingAt.get())->getHead()->getLeftEyePosition(); | 2330 | float faceAngle = glm::angle(lookingAtFaceOrientation, fromLookingAtToMe); |
| 2331 | |||
| 2332 | if (faceAngle < MAXIMUM_FACE_ANGLE) { | ||
| 2333 | // Randomly look back and forth between look targets | ||
| 2334 | switch (_myAvatar->getEyeContactTarget()) { | ||
| 2335 | case LEFT_EYE: | ||
| 2336 | lookAtSpot = lookingAtHead->getLeftEyePosition(); | ||
| 2337 | break; | ||
| 2338 | case RIGHT_EYE: | ||
| 2339 | lookAtSpot = lookingAtHead->getRightEyePosition(); | ||
| 2340 | break; | ||
| 2341 | case MOUTH: | ||
| 2342 | lookAtSpot = lookingAtHead->getMouthPosition(); | ||
| 2343 | break; | ||
| 2335 | } | 2344 | } |
| 2336 | } else { | 2345 | } else { |
| 2337 | // Need to add randomly looking back and forth between left and right eye for case with no tracker | 2346 | // Just look at their head (mid point between eyes) |
| 2338 | if (_myAvatar->isLookingAtLeftEye()) { | 2347 | lookAtSpot = lookingAtHead->getEyePosition(); |
| 2339 | lookAtSpot = static_cast<Avatar*>(lookingAt.get())->getHead()->getLeftEyePosition(); | ||
| 2340 | } else { | ||
| 2341 | lookAtSpot = static_cast<Avatar*>(lookingAt.get())->getHead()->getRightEyePosition(); | ||
| 2342 | } | ||
| 2343 | } | 2348 | } |
| 2344 | } else { | 2349 | } else { |
| 2345 | // I am not looking at anyone else, so just look forward | 2350 | // I am not looking at anyone else, so just look forward |
| @@ -2347,14 +2352,13 @@ void Application::updateMyAvatarLookAtPosition() { · 1 unmodified line | |||
| 2347 | (_myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE)); | 2352 | (_myAvatar->getHead()->getFinalOrientationInWorldFrame() * glm::vec3(0.0f, 0.0f, -TREE_SCALE)); |
| 2348 | } | 2353 | } |
| 2349 | } | 2354 | } |
| 2350 | // | 2355 | |
| 2351 | // Deflect the eyes a bit to match the detected Gaze from 3D camera if active | 2356 | // Deflect the eyes a bit to match the detected gaze from Faceshift if active. |
| 2352 | // | 2357 | // DDE doesn't track eyes. |
| 2353 | if (tracker && !tracker->isMuted()) { | 2358 | if (tracker && typeid(*tracker) == typeid(Faceshift) && !tracker->isMuted()) { |
| 2354 | float eyePitch = tracker->getEstimatedEyePitch(); | 2359 | float eyePitch = tracker->getEstimatedEyePitch(); |
| 2355 | float eyeYaw = tracker->getEstimatedEyeYaw(); | 2360 | float eyeYaw = tracker->getEstimatedEyeYaw(); |
| 2356 | const float GAZE_DEFLECTION_REDUCTION_DURING_EYE_CONTACT = 0.1f; | 2361 | const float GAZE_DEFLECTION_REDUCTION_DURING_EYE_CONTACT = 0.1f; |
| 2357 | // deflect using Faceshift gaze data | ||
| 2358 | glm::vec3 origin = _myAvatar->getHead()->getEyePosition(); | 2362 | glm::vec3 origin = _myAvatar->getHead()->getEyePosition(); |
| 2359 | float pitchSign = (_myCamera.getMode() == CAMERA_MODE_MIRROR) ? -1.0f : 1.0f; | 2363 | float pitchSign = (_myCamera.getMode() == CAMERA_MODE_MIRROR) ? -1.0f : 1.0f; |
| 2360 | float deflection = DependencyManager::get<Faceshift>()->getEyeDeflection(); | 2364 | float deflection = DependencyManager::get<Faceshift>()->getEyeDeflection(); |
| @@ -3530,6 +3534,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 1169 unmodified lines | |||
| 3530 | renderContext._maxDrawnTransparentItems = sceneInterface->getEngineMaxDrawnTransparentItems(); | 3534 | renderContext._maxDrawnTransparentItems = sceneInterface->getEngineMaxDrawnTransparentItems(); |
| 3531 | renderContext._maxDrawnOverlay3DItems = sceneInterface->getEngineMaxDrawnOverlay3DItems(); | 3535 | renderContext._maxDrawnOverlay3DItems = sceneInterface->getEngineMaxDrawnOverlay3DItems(); |
| 3532 | 3536 | ||
| 3537 | renderContext._drawItemStatus = sceneInterface->doEngineDisplayItemStatus(); | ||
| 3538 | |||
| 3533 | renderArgs->_shouldRender = LODManager::shouldRender; | 3539 | renderArgs->_shouldRender = LODManager::shouldRender; |
| 3534 | 3540 | ||
| 3535 | renderContext.args = renderArgs; | 3541 | renderContext.args = renderArgs; |