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