mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-11 05:43:04 +02:00
Merge pull request #16379 from highfidelity/master
Merge master into instancing
This commit is contained in:
commit
5d91d22314
19 changed files with 179 additions and 69 deletions
|
@ -448,13 +448,6 @@ void AvatarMixerSlave::broadcastAvatarDataToAgent(const SharedNodePointer& node)
|
|||
// or that somehow we haven't sent
|
||||
if (lastSeqToReceiver == lastSeqFromSender && lastSeqToReceiver != 0) {
|
||||
++numAvatarsHeldBack;
|
||||
|
||||
// BUGZ-781 verbose debugging:
|
||||
auto usecLastTimeSent = destinationNodeData->getLastOtherAvatarEncodeTime(sourceAvatarNodeData->getNodeLocalID());
|
||||
if (usecLastTimeSent != 0 && startIgnoreCalculation - usecLastTimeSent > 10 * USECS_PER_SECOND) {
|
||||
qCDebug(avatars) << "Not sent avatar" << *sourceAvatarNode << "to Node" << *destinationNode << "in > 10 s";
|
||||
}
|
||||
|
||||
sendAvatar = false;
|
||||
} else if (lastSeqFromSender == 0) {
|
||||
// We have have not yet received any data about this avatar. Ignore it for now
|
||||
|
|
4
cmake/externals/wasapi/CMakeLists.txt
vendored
4
cmake/externals/wasapi/CMakeLists.txt
vendored
|
@ -6,8 +6,8 @@ if (WIN32)
|
|||
include(ExternalProject)
|
||||
ExternalProject_Add(
|
||||
${EXTERNAL_NAME}
|
||||
URL https://public.highfidelity.com/dependencies/qtaudio_wasapi11.zip
|
||||
URL_MD5 d0eb8489455e7f79d59155535a2c8861
|
||||
URL https://public.highfidelity.com/dependencies/qtaudio_wasapi12.zip
|
||||
URL_MD5 9e2eef41165f85344808f754b48bf08d
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
|
|
|
@ -78,6 +78,15 @@
|
|||
"to": "Actions.Yaw"
|
||||
},
|
||||
|
||||
{ "from": { "makeAxis" : [
|
||||
["Keyboard.Left"],
|
||||
["Keyboard.Right"]
|
||||
]
|
||||
},
|
||||
"when": ["Application.CameraFirstPersonLookat", "!Keyboard.Shift"],
|
||||
"to": "Actions.Yaw"
|
||||
},
|
||||
|
||||
{ "from": { "makeAxis" : [
|
||||
["Keyboard.Left"],
|
||||
["Keyboard.Right"]
|
||||
|
@ -113,7 +122,16 @@
|
|||
"when": ["Application.CameraFirstPerson", "!Keyboard.Control"],
|
||||
"to": "Actions.Yaw"
|
||||
},
|
||||
|
||||
|
||||
{ "from": { "makeAxis" : [
|
||||
["Keyboard.A"],
|
||||
["Keyboard.D"]
|
||||
]
|
||||
},
|
||||
"when": ["Application.CameraFirstPersonLookat", "!Keyboard.Control"],
|
||||
"to": "Actions.Yaw"
|
||||
},
|
||||
|
||||
{ "from": { "makeAxis" : [
|
||||
["Keyboard.A"],
|
||||
["Keyboard.D"]
|
||||
|
@ -149,6 +167,15 @@
|
|||
"when": "Application.CameraFirstPerson",
|
||||
"to": "Actions.Yaw"
|
||||
},
|
||||
|
||||
{ "from": { "makeAxis" : [
|
||||
["Keyboard.TouchpadLeft"],
|
||||
["Keyboard.TouchpadRight"]
|
||||
]
|
||||
},
|
||||
"when": "Application.CameraFirstPersonLookat",
|
||||
"to": "Actions.Yaw"
|
||||
},
|
||||
|
||||
{ "from": { "makeAxis" : [
|
||||
["Keyboard.TouchpadLeft"],
|
||||
|
@ -222,10 +249,12 @@
|
|||
{ "from": "Keyboard.Left", "when": "Keyboard.Shift", "to": "Actions.LATERAL_LEFT" },
|
||||
{ "from": "Keyboard.Right", "when": "Keyboard.Shift", "to": "Actions.LATERAL_RIGHT" },
|
||||
{ "from": "Keyboard.Up", "when": "Application.CameraFirstPerson", "to": "Actions.LONGITUDINAL_FORWARD" },
|
||||
{ "from": "Keyboard.Up", "when": "Application.CameraFirstPersonLookat", "to": "Actions.LONGITUDINAL_FORWARD" },
|
||||
{ "from": "Keyboard.Up", "when": "Application.CameraThirdPerson", "to": "Actions.LONGITUDINAL_FORWARD" },
|
||||
{ "from": "Keyboard.Up", "when": "Application.CameraLookAt", "to": "Actions.LONGITUDINAL_FORWARD" },
|
||||
{ "from": "Keyboard.Up", "when": "Application.CameraSelfie", "to": "Actions.LONGITUDINAL_BACKWARD" },
|
||||
{ "from": "Keyboard.Down", "when": "Application.CameraFirstPerson", "to": "Actions.LONGITUDINAL_BACKWARD" },
|
||||
{ "from": "Keyboard.Down", "when": "Application.CameraFirstPersonLookat", "to": "Actions.LONGITUDINAL_BACKWARD" },
|
||||
{ "from": "Keyboard.Down", "when": "Application.CameraThirdPerson", "to": "Actions.LONGITUDINAL_BACKWARD" },
|
||||
{ "from": "Keyboard.Down", "when": "Application.CameraLookAt", "to": "Actions.LONGITUDINAL_BACKWARD" },
|
||||
{ "from": "Keyboard.Down", "when": "Application.CameraSelfie", "to": "Actions.LONGITUDINAL_FORWARD" },
|
||||
|
|
|
@ -225,9 +225,9 @@ Flickable {
|
|||
SimplifiedControls.RadioButton {
|
||||
id: firstPerson
|
||||
text: "First Person View"
|
||||
checked: Camera.mode === "first person"
|
||||
checked: Camera.mode === "first person look at"
|
||||
onClicked: {
|
||||
Camera.mode = "first person"
|
||||
Camera.mode = "first person look at"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ Flickable {
|
|||
target: Camera
|
||||
|
||||
onModeUpdated: {
|
||||
if (Camera.mode === "first person") {
|
||||
if (Camera.mode === "first person look at") {
|
||||
firstPerson.checked = true
|
||||
} else if (Camera.mode === "look at") {
|
||||
thirdPerson.checked = true
|
||||
|
|
|
@ -718,6 +718,7 @@ private:
|
|||
static const QString STATE_IN_HMD = "InHMD";
|
||||
static const QString STATE_CAMERA_FULL_SCREEN_MIRROR = "CameraFSM";
|
||||
static const QString STATE_CAMERA_FIRST_PERSON = "CameraFirstPerson";
|
||||
static const QString STATE_CAMERA_FIRST_PERSON_LOOK_AT = "CameraFirstPersonLookat";
|
||||
static const QString STATE_CAMERA_THIRD_PERSON = "CameraThirdPerson";
|
||||
static const QString STATE_CAMERA_ENTITY = "CameraEntity";
|
||||
static const QString STATE_CAMERA_INDEPENDENT = "CameraIndependent";
|
||||
|
@ -939,7 +940,8 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
|||
DependencyManager::set<AudioInjectorManager>();
|
||||
DependencyManager::set<MessagesClient>();
|
||||
controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR,
|
||||
STATE_CAMERA_FIRST_PERSON, STATE_CAMERA_THIRD_PERSON, STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT, STATE_CAMERA_LOOK_AT, STATE_CAMERA_SELFIE,
|
||||
STATE_CAMERA_FIRST_PERSON, STATE_CAMERA_FIRST_PERSON_LOOK_AT, STATE_CAMERA_THIRD_PERSON,
|
||||
STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT, STATE_CAMERA_LOOK_AT, STATE_CAMERA_SELFIE,
|
||||
STATE_SNAP_TURN, STATE_ADVANCED_MOVEMENT_CONTROLS, STATE_GROUNDED, STATE_NAV_FOCUSED,
|
||||
STATE_PLATFORM_WINDOWS, STATE_PLATFORM_MAC, STATE_PLATFORM_ANDROID, STATE_LEFT_HAND_DOMINANT, STATE_RIGHT_HAND_DOMINANT, STATE_STRAFE_ENABLED } });
|
||||
DependencyManager::set<UserInputMapper>();
|
||||
|
@ -1887,6 +1889,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
_applicationStateDevice->setInputVariant(STATE_CAMERA_FIRST_PERSON, []() -> float {
|
||||
return qApp->getCamera().getMode() == CAMERA_MODE_FIRST_PERSON ? 1 : 0;
|
||||
});
|
||||
_applicationStateDevice->setInputVariant(STATE_CAMERA_FIRST_PERSON_LOOK_AT, []() -> float {
|
||||
return qApp->getCamera().getMode() == CAMERA_MODE_FIRST_PERSON_LOOK_AT ? 1 : 0;
|
||||
});
|
||||
_applicationStateDevice->setInputVariant(STATE_CAMERA_THIRD_PERSON, []() -> float {
|
||||
return qApp->getCamera().getMode() == CAMERA_MODE_THIRD_PERSON ? 1 : 0;
|
||||
});
|
||||
|
@ -1996,7 +2001,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
settingsTimer->start();
|
||||
}, QThread::LowestPriority);
|
||||
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson)) {
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::FirstPersonLookAt)) {
|
||||
getMyAvatar()->setBoomLength(MyAvatar::ZOOM_MIN); // So that camera doesn't auto-switch to third person.
|
||||
}
|
||||
|
||||
|
@ -2959,13 +2964,29 @@ Application::~Application() {
|
|||
qInstallMessageHandler(LogHandler::verboseMessageHandler);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
// 10/16/2019 - Disabling this call. This causes known crashes (A), and it is not
|
||||
// fully understood whether it might cause other unknown crashes (B).
|
||||
//
|
||||
// (A) Although we try to shutdown the ScriptEngine threads in onAboutToQuit, there is
|
||||
// currently no guarantee that they have stopped. Waiting on them to stop has so far appeared to
|
||||
// never return on Mac, causing the application to hang on shutdown. Because ScriptEngines
|
||||
// may still be running, they may end up receiving events that are triggered from this processEvents call,
|
||||
// and then try to access resources that are no longer available at this point in time.
|
||||
// If the ScriptEngine threads were fully destroyed before getting here, this would
|
||||
// not be an issue.
|
||||
//
|
||||
// (B) It seems likely that a bunch of potential event handlers are dependent on Application
|
||||
// and other common dependencies to be available and not destroyed or in the middle of being
|
||||
// destroyed.
|
||||
|
||||
|
||||
// Clear the event queue before application is totally destructed.
|
||||
// This will drain the messasge queue of pending "deleteLaters" queued up
|
||||
// during shutdown of the script engines.
|
||||
// We do this here because there is a possiblty that [NSApplication terminate:]
|
||||
// will be called during processEvents which will invoke all static destructors.
|
||||
// We want to postpone this utill the last possible moment.
|
||||
QCoreApplication::processEvents();
|
||||
//QCoreApplication::processEvents();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3611,12 +3632,15 @@ void Application::updateCamera(RenderArgs& renderArgs, float deltaTime) {
|
|||
// Using the latter will cause the camera to wobble with idle animations,
|
||||
// or with changes from the face tracker
|
||||
CameraMode mode = _myCamera.getMode();
|
||||
if (mode == CAMERA_MODE_FIRST_PERSON) {
|
||||
if (mode == CAMERA_MODE_FIRST_PERSON || mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT) {
|
||||
_thirdPersonHMDCameraBoomValid= false;
|
||||
if (isHMDMode()) {
|
||||
mat4 camMat = myAvatar->getSensorToWorldMatrix() * myAvatar->getHMDSensorMatrix();
|
||||
_myCamera.setPosition(extractTranslation(camMat));
|
||||
_myCamera.setOrientation(glmExtractRotation(camMat));
|
||||
} else if (mode == CAMERA_MODE_FIRST_PERSON) {
|
||||
_myCamera.setPosition(myAvatar->getDefaultEyePosition());
|
||||
_myCamera.setOrientation(myAvatar->getMyHead()->getHeadOrientation());
|
||||
} else {
|
||||
_myCamera.setPosition(myAvatar->getCameraEyesPosition(deltaTime));
|
||||
_myCamera.setOrientation(myAvatar->getLookAtRotation());
|
||||
|
@ -4407,7 +4431,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
|||
|
||||
case Qt::Key_1: {
|
||||
Menu* menu = Menu::getInstance();
|
||||
menu->triggerOption(MenuOption::FirstPerson);
|
||||
menu->triggerOption(MenuOption::FirstPersonLookAt);
|
||||
break;
|
||||
}
|
||||
case Qt::Key_2: {
|
||||
|
@ -5492,7 +5516,7 @@ void Application::loadSettings() {
|
|||
isFirstPerson = menu->isOptionChecked(MenuOption::FirstPersonHMD);
|
||||
} else {
|
||||
// if HMD is not active, only use first person if the menu option is checked
|
||||
isFirstPerson = menu->isOptionChecked(MenuOption::FirstPerson);
|
||||
isFirstPerson = menu->isOptionChecked(MenuOption::FirstPersonLookAt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5507,9 +5531,9 @@ void Application::loadSettings() {
|
|||
|
||||
// finish initializing the camera, based on everything we checked above. Third person camera will be used if no settings
|
||||
// dictated that we should be in first person
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, isFirstPerson);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPersonLookAt, isFirstPerson);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !isFirstPerson);
|
||||
_myCamera.setMode((isFirstPerson) ? CAMERA_MODE_FIRST_PERSON : CAMERA_MODE_LOOK_AT);
|
||||
_myCamera.setMode((isFirstPerson) ? CAMERA_MODE_FIRST_PERSON_LOOK_AT : CAMERA_MODE_LOOK_AT);
|
||||
cameraMenuChanged();
|
||||
|
||||
auto inputs = pluginManager->getInputPlugins();
|
||||
|
@ -5673,7 +5697,7 @@ void Application::pauseUntilLoginDetermined() {
|
|||
menu->getMenu("Developer")->setVisible(false);
|
||||
}
|
||||
_previousCameraMode = _myCamera.getMode();
|
||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON_LOOK_AT);
|
||||
cameraModeChanged();
|
||||
|
||||
// disconnect domain handler.
|
||||
|
@ -5862,11 +5886,11 @@ void Application::cycleCamera() {
|
|||
if (menu->isOptionChecked(MenuOption::FullscreenMirror)) {
|
||||
|
||||
menu->setIsOptionChecked(MenuOption::FullscreenMirror, false);
|
||||
menu->setIsOptionChecked(MenuOption::FirstPerson, true);
|
||||
menu->setIsOptionChecked(MenuOption::FirstPersonLookAt, true);
|
||||
|
||||
} else if (menu->isOptionChecked(MenuOption::FirstPerson)) {
|
||||
} else if (menu->isOptionChecked(MenuOption::FirstPersonLookAt)) {
|
||||
|
||||
menu->setIsOptionChecked(MenuOption::FirstPerson, false);
|
||||
menu->setIsOptionChecked(MenuOption::FirstPersonLookAt, false);
|
||||
menu->setIsOptionChecked(MenuOption::LookAtCamera, true);
|
||||
|
||||
} else if (menu->isOptionChecked(MenuOption::LookAtCamera)) {
|
||||
|
@ -5885,8 +5909,8 @@ void Application::cycleCamera() {
|
|||
|
||||
void Application::cameraModeChanged() {
|
||||
switch (_myCamera.getMode()) {
|
||||
case CAMERA_MODE_FIRST_PERSON:
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, true);
|
||||
case CAMERA_MODE_FIRST_PERSON_LOOK_AT:
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPersonLookAt, true);
|
||||
break;
|
||||
case CAMERA_MODE_LOOK_AT:
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::LookAtCamera, true);
|
||||
|
@ -5906,12 +5930,12 @@ void Application::changeViewAsNeeded(float boomLength) {
|
|||
// This is called when the boom length has changed
|
||||
bool boomLengthGreaterThanMinimum = (boomLength > MyAvatar::ZOOM_MIN);
|
||||
|
||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON && boomLengthGreaterThanMinimum) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, false);
|
||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON_LOOK_AT && boomLengthGreaterThanMinimum) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPersonLookAt, false);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::LookAtCamera, true);
|
||||
cameraMenuChanged();
|
||||
} else if (_myCamera.getMode() == CAMERA_MODE_LOOK_AT && !boomLengthGreaterThanMinimum) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, true);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPersonLookAt, true);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::LookAtCamera, false);
|
||||
cameraMenuChanged();
|
||||
}
|
||||
|
@ -5919,9 +5943,9 @@ void Application::changeViewAsNeeded(float boomLength) {
|
|||
|
||||
void Application::cameraMenuChanged() {
|
||||
auto menu = Menu::getInstance();
|
||||
if (menu->isOptionChecked(MenuOption::FirstPerson)) {
|
||||
if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) {
|
||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
||||
if (menu->isOptionChecked(MenuOption::FirstPersonLookAt)) {
|
||||
if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON_LOOK_AT) {
|
||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON_LOOK_AT);
|
||||
getMyAvatar()->setBoomLength(MyAvatar::ZOOM_MIN);
|
||||
}
|
||||
} else if (menu->isOptionChecked(MenuOption::LookAtCamera)) {
|
||||
|
@ -9022,7 +9046,7 @@ void Application::setDisplayPlugin(DisplayPluginPointer newDisplayPlugin) {
|
|||
}
|
||||
|
||||
if (isHmd && menu->isOptionChecked(MenuOption::FirstPersonHMD)) {
|
||||
menu->setIsOptionChecked(MenuOption::FirstPerson, true);
|
||||
menu->setIsOptionChecked(MenuOption::FirstPersonLookAt, true);
|
||||
cameraMenuChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ Menu::Menu() {
|
|||
|
||||
// View > First Person
|
||||
auto firstPersonAction = cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash(
|
||||
viewMenu, MenuOption::FirstPerson, 0,
|
||||
viewMenu, MenuOption::FirstPersonLookAt, 0,
|
||||
true, qApp, SLOT(cameraMenuChanged())));
|
||||
|
||||
firstPersonAction->setProperty(EXCLUSION_GROUP_KEY, QVariant::fromValue(cameraModeGroup));
|
||||
|
|
|
@ -111,7 +111,8 @@ namespace MenuOption {
|
|||
const QString ExpandSimulationTiming = "Expand /simulation";
|
||||
const QString ExpandPhysicsTiming = "Expand /physics";
|
||||
const QString ExpandUpdateTiming = "Expand /update";
|
||||
const QString FirstPerson = "First Person";
|
||||
const QString FirstPerson = "First Person Legacy";
|
||||
const QString FirstPersonLookAt = "First Person";
|
||||
const QString FirstPersonHMD = "Enter First Person Mode in HMD";
|
||||
const QString FivePointCalibration = "5 Point Calibration";
|
||||
const QString FixGaze = "Fix Gaze (no saccade)";
|
||||
|
|
|
@ -958,7 +958,8 @@ void MyAvatar::simulate(float deltaTime, bool inView) {
|
|||
head->setScale(getModelScale());
|
||||
head->simulate(deltaTime);
|
||||
CameraMode mode = qApp->getCamera().getMode();
|
||||
if (_scriptControlsHeadLookAt || mode == CAMERA_MODE_FIRST_PERSON || mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE) {
|
||||
if (_scriptControlsHeadLookAt || mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT || mode == CAMERA_MODE_FIRST_PERSON ||
|
||||
mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE) {
|
||||
if (!_pointAtActive || !_isPointTargetValid) {
|
||||
updateHeadLookAt(deltaTime);
|
||||
} else {
|
||||
|
@ -2178,7 +2179,7 @@ void MyAvatar::computeMyLookAtTarget(const AvatarHash& hash) {
|
|||
glm::vec3 myForward = _lookAtYaw * IDENTITY_FORWARD;
|
||||
glm::vec3 myPosition = getHead()->getEyePosition();
|
||||
CameraMode mode = qApp->getCamera().getMode();
|
||||
if (mode == CAMERA_MODE_FIRST_PERSON) {
|
||||
if (mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT || mode == CAMERA_MODE_FIRST_PERSON) {
|
||||
myPosition = qApp->getCamera().getPosition();
|
||||
}
|
||||
|
||||
|
@ -2719,7 +2720,7 @@ void MyAvatar::updateMotors() {
|
|||
if (_characterController.getState() == CharacterController::State::Hover ||
|
||||
_characterController.computeCollisionMask() == BULLET_COLLISION_MASK_COLLISIONLESS) {
|
||||
CameraMode mode = qApp->getCamera().getMode();
|
||||
if (!qApp->isHMDMode() && (mode == CAMERA_MODE_FIRST_PERSON || mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE)) {
|
||||
if (!qApp->isHMDMode() && (mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT || mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE)) {
|
||||
motorRotation = getLookAtRotation();
|
||||
} else {
|
||||
motorRotation = getMyHead()->getHeadOrientation();
|
||||
|
@ -3399,7 +3400,8 @@ bool MyAvatar::cameraInsideHead(const glm::vec3& cameraPosition) const {
|
|||
|
||||
bool MyAvatar::shouldRenderHead(const RenderArgs* renderArgs) const {
|
||||
bool defaultMode = renderArgs->_renderMode == RenderArgs::DEFAULT_RENDER_MODE;
|
||||
bool firstPerson = qApp->getCamera().getMode() == CAMERA_MODE_FIRST_PERSON;
|
||||
bool firstPerson = qApp->getCamera().getMode() == CAMERA_MODE_FIRST_PERSON_LOOK_AT ||
|
||||
qApp->getCamera().getMode() == CAMERA_MODE_FIRST_PERSON;
|
||||
bool overrideAnim = _skeletonModel ? _skeletonModel->getRig().isPlayingOverrideAnimation() : false;
|
||||
bool insideHead = cameraInsideHead(renderArgs->getViewFrustum().getPosition());
|
||||
return !defaultMode || (!firstPerson && !insideHead) || (overrideAnim && !insideHead);
|
||||
|
@ -3444,8 +3446,8 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
float targetSpeed = getDriveKey(YAW) * _yawSpeed;
|
||||
CameraMode mode = qApp->getCamera().getMode();
|
||||
bool computeLookAt = isReadyForPhysics() && !qApp->isHMDMode() &&
|
||||
(mode == CAMERA_MODE_FIRST_PERSON || mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE);
|
||||
bool smoothCameraYaw = computeLookAt && mode != CAMERA_MODE_FIRST_PERSON;
|
||||
(mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT || mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE);
|
||||
bool smoothCameraYaw = computeLookAt && mode != CAMERA_MODE_FIRST_PERSON_LOOK_AT;
|
||||
if (smoothCameraYaw) {
|
||||
// For "Look At" and "Selfie" camera modes we also smooth the yaw rotation from right-click mouse movement.
|
||||
float speedFromDeltaYaw = deltaTime > FLT_EPSILON ? getDriveKey(DELTA_YAW) / deltaTime : 0.0f;
|
||||
|
@ -3569,11 +3571,11 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
if (isMovingFwdBwd) {
|
||||
if (isMovingSideways) {
|
||||
// Reorient avatar to face camera diagonal
|
||||
blend = mode == CAMERA_MODE_FIRST_PERSON ? 1.0f : DIAGONAL_TURN_BLEND;
|
||||
blend = mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT ? 1.0f : DIAGONAL_TURN_BLEND;
|
||||
float turnSign = getDriveKey(TRANSLATE_Z) < 0.0f ? -1.0f : 1.0f;
|
||||
turnSign = getDriveKey(TRANSLATE_X) > 0.0f ? -turnSign : turnSign;
|
||||
faceRotation = _lookAtYaw * glm::angleAxis(turnSign * 0.25f * PI, Vectors::UP);
|
||||
} else if (mode == CAMERA_MODE_FIRST_PERSON) {
|
||||
} else if (mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT) {
|
||||
blend = 1.0f;
|
||||
}
|
||||
}
|
||||
|
@ -3644,11 +3646,11 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
glm::vec3 ajustedYawVector = cameraYawVector;
|
||||
float limitAngle = 0.0f;
|
||||
float triggerAngle = -glm::sin(glm::radians(TRIGGER_REORIENT_ANGLE));
|
||||
if (mode == CAMERA_MODE_FIRST_PERSON) {
|
||||
if (mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT) {
|
||||
limitAngle = glm::sin(glm::radians(90.0f - FIRST_PERSON_TRIGGER_REORIENT_ANGLE));
|
||||
triggerAngle = limitAngle;
|
||||
}
|
||||
float reorientAngle = mode == CAMERA_MODE_FIRST_PERSON ? FIRST_PERSON_REORIENT_ANGLE : DEFAULT_REORIENT_ANGLE;
|
||||
float reorientAngle = mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT ? FIRST_PERSON_REORIENT_ANGLE : DEFAULT_REORIENT_ANGLE;
|
||||
if (frontBackDot < limitAngle) {
|
||||
if (frontBackDot < 0.0f) {
|
||||
ajustedYawVector = (leftRightDot < 0.0f ? -avatarVectorRight : avatarVectorRight);
|
||||
|
@ -3684,7 +3686,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
|||
}
|
||||
_headLookAtActive = true;
|
||||
const float FIRST_PERSON_RECENTER_SECONDS = 15.0f;
|
||||
if (mode == CAMERA_MODE_FIRST_PERSON) {
|
||||
if (mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT) {
|
||||
if (getDriveKey(YAW) + getDriveKey(STEP_YAW) + getDriveKey(DELTA_YAW) == 0.0f) {
|
||||
if (_firstPersonSteadyHeadTimer < FIRST_PERSON_RECENTER_SECONDS) {
|
||||
if (_firstPersonSteadyHeadTimer > 0.0f) {
|
||||
|
@ -3772,7 +3774,7 @@ glm::vec3 MyAvatar::scaleMotorSpeed(const glm::vec3 forward, const glm::vec3 rig
|
|||
// Desktop mode.
|
||||
direction = (zSpeed * forward) + (xSpeed * right);
|
||||
CameraMode mode = qApp->getCamera().getMode();
|
||||
if ((mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_FIRST_PERSON || mode == CAMERA_MODE_SELFIE) &&
|
||||
if ((mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT || mode == CAMERA_MODE_SELFIE) &&
|
||||
zSpeed != 0.0f && xSpeed != 0.0f && !isFlying()){
|
||||
direction = (zSpeed * forward);
|
||||
}
|
||||
|
@ -5437,7 +5439,7 @@ glm::quat MyAvatar::getOrientationForAudio() {
|
|||
case AudioListenerMode::FROM_HEAD: {
|
||||
// Using the camera's orientation instead, when the current mode is controlling the avatar's head.
|
||||
CameraMode mode = qApp->getCamera().getMode();
|
||||
bool headFollowsCamera = mode == CAMERA_MODE_FIRST_PERSON || mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE;
|
||||
bool headFollowsCamera = mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT || mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE;
|
||||
result = headFollowsCamera ? qApp->getCamera().getOrientation() : getHead()->getFinalOrientationInWorldFrame();
|
||||
break;
|
||||
}
|
||||
|
@ -6821,32 +6823,48 @@ glm::vec3 MyAvatar::getCameraEyesPosition(float deltaTime) {
|
|||
glm::vec3 avatarUpVector = getWorldOrientation() * Vectors::UP;
|
||||
// Compute the offset between the default and real eye positions.
|
||||
glm::vec3 defaultEyesToEyesVector = getHead()->getEyePosition() - defaultEyesPosition;
|
||||
float FRONT_OFFSET_IDLE_MULTIPLIER = 2.0f;
|
||||
float FRONT_OFFSET_IDLE_MULTIPLIER = 2.5f;
|
||||
float FRONT_OFFSET_JUMP_MULTIPLIER = 1.5f;
|
||||
float frontOffset = FRONT_OFFSET_IDLE_MULTIPLIER * glm::length(defaultEyesPosition - getDefaultEyePosition());
|
||||
|
||||
// Looking down will aproximate move the camera forward to meet the real eye position
|
||||
float mixAlpha = glm::dot(_lookAtPitch * Vectors::FRONT, -avatarUpVector);
|
||||
|
||||
bool isLanding = false;
|
||||
// When jumping the camera should follow the real eye on the Y coordenate
|
||||
float upOffset = 0.0f;
|
||||
if (isJumping() || _characterController.getState() == CharacterController::State::Takeoff) {
|
||||
upOffset = glm::dot(defaultEyesToEyesVector, avatarUpVector);
|
||||
|
||||
frontOffset = glm::dot(defaultEyesToEyesVector, avatarFrontVector) * FRONT_OFFSET_JUMP_MULTIPLIER;
|
||||
mixAlpha = 1.0f;
|
||||
_landingAfterJumpTime = 0.0f;
|
||||
} else {
|
||||
// Limit the range effect from 45 to 90 degrees
|
||||
const float HEAD_OFFSET_DOT_THRESHOLD = 0.7f; // 45 degrees aprox
|
||||
mixAlpha = mixAlpha < HEAD_OFFSET_DOT_THRESHOLD ? 0.0f : (mixAlpha - HEAD_OFFSET_DOT_THRESHOLD) /
|
||||
(1.0f - HEAD_OFFSET_DOT_THRESHOLD);
|
||||
// Limit the range effect from 45 to 0 degrees
|
||||
// between the front camera and the down vectors
|
||||
const float HEAD_OFFSET_RANGE_IN_DEGREES = 45.0f;
|
||||
const float HEAD_OFFSET_RANGE_OUT_DEGREES = 0.0f;
|
||||
float rangeIn = glm::cos(glm::radians(HEAD_OFFSET_RANGE_IN_DEGREES));
|
||||
float rangeOut = glm::cos(glm::radians(HEAD_OFFSET_RANGE_OUT_DEGREES));
|
||||
mixAlpha = mixAlpha < rangeIn ? 0.0f : (mixAlpha - rangeIn) / (rangeOut - rangeIn);
|
||||
const float WAIT_TO_LAND_TIME = 1.0f;
|
||||
if (_landingAfterJumpTime < WAIT_TO_LAND_TIME) {
|
||||
_landingAfterJumpTime += deltaTime;
|
||||
isLanding = true;
|
||||
}
|
||||
}
|
||||
const float FPS = 60.0f;
|
||||
float timeScale = deltaTime * FPS;
|
||||
frontOffset = frontOffset < 0.0f ? 0.0f : mixAlpha * frontOffset;
|
||||
glm::vec3 cameraOffset = upOffset * Vectors::UP + frontOffset * Vectors::FRONT;
|
||||
const float TAU = 0.1f;
|
||||
_cameraEyesOffset = _cameraEyesOffset + (cameraOffset - _cameraEyesOffset) * min(1.0f, TAU * timeScale);
|
||||
const float JUMPING_TAU = 0.1f;
|
||||
const float NO_JUMP_TAU = 0.3f;
|
||||
const float LANDING_TAU = 0.05f;
|
||||
float tau = NO_JUMP_TAU;
|
||||
if (isJumping()) {
|
||||
tau = JUMPING_TAU;
|
||||
} else if (isLanding) {
|
||||
tau = LANDING_TAU;
|
||||
}
|
||||
_cameraEyesOffset = _cameraEyesOffset + (cameraOffset - _cameraEyesOffset) * min(1.0f, tau * timeScale);
|
||||
glm::vec3 estimatedCameraPosition = defaultEyesPosition + getWorldOrientation() * _cameraEyesOffset;
|
||||
return estimatedCameraPosition;
|
||||
}
|
||||
|
|
|
@ -2977,6 +2977,7 @@ private:
|
|||
bool _endSitKeyPressComplete { false };
|
||||
|
||||
glm::vec3 _cameraEyesOffset;
|
||||
float _landingAfterJumpTime { 0.0f };
|
||||
};
|
||||
|
||||
QScriptValue audioListenModeToScriptValue(QScriptEngine* engine, const AudioListenerMode& audioListenerMode);
|
||||
|
|
|
@ -82,11 +82,18 @@ void RenderScriptingInterface::forceShadowsEnabled(bool enabled) {
|
|||
_shadowsEnabled = (enabled);
|
||||
_shadowsEnabledSetting.set(enabled);
|
||||
|
||||
auto lightingModelConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<MakeLightingModel>("RenderMainView.LightingModel");
|
||||
auto renderConfig = qApp->getRenderEngine()->getConfiguration();
|
||||
assert(renderConfig);
|
||||
auto lightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderMainView.LightingModel");
|
||||
if (lightingModelConfig) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::Shadows, enabled);
|
||||
lightingModelConfig->setShadow(enabled);
|
||||
}
|
||||
auto secondaryLightingModelConfig = renderConfig->getConfig<MakeLightingModel>("RenderSecondView.LightingModel");
|
||||
if (secondaryLightingModelConfig) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::Shadows, enabled);
|
||||
secondaryLightingModelConfig->setShadow(enabled);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -854,7 +854,8 @@ void Avatar::render(RenderArgs* renderArgs) {
|
|||
float distanceToTarget = glm::length(toTarget);
|
||||
const float DISPLAYNAME_DISTANCE = 20.0f;
|
||||
updateDisplayNameAlpha(distanceToTarget < DISPLAYNAME_DISTANCE);
|
||||
if (!isMyAvatar() || renderArgs->_cameraMode != (int8_t)CAMERA_MODE_FIRST_PERSON) {
|
||||
if (!isMyAvatar() || !(renderArgs->_cameraMode == (int8_t)CAMERA_MODE_FIRST_PERSON_LOOK_AT
|
||||
|| renderArgs->_cameraMode == (int8_t)CAMERA_MODE_FIRST_PERSON)) {
|
||||
auto& frustum = renderArgs->getViewFrustum();
|
||||
auto textPosition = getDisplayNamePosition();
|
||||
if (frustum.pointIntersectsFrustum(textPosition)) {
|
||||
|
|
|
@ -64,6 +64,11 @@ void RecordingScriptingInterface::playClip(NetworkClipLoaderPointer clipLoader,
|
|||
}
|
||||
|
||||
void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue callback) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
BLOCKING_INVOKE_METHOD(this, "loadRecording", Q_ARG(const QString&, url), Q_ARG(QScriptValue, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
auto clipLoader = DependencyManager::get<recording::ClipCache>()->getClipLoader(url);
|
||||
|
||||
if (clipLoader->isLoaded()) {
|
||||
|
@ -117,6 +122,11 @@ void RecordingScriptingInterface::startPlaying() {
|
|||
}
|
||||
|
||||
void RecordingScriptingInterface::setPlayerVolume(float volume) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
BLOCKING_INVOKE_METHOD(this, "setPlayerVolume", Q_ARG(float, volume));
|
||||
return;
|
||||
}
|
||||
|
||||
_player->setVolume(std::min(std::max(volume, 0.0f), 1.0f));
|
||||
}
|
||||
|
||||
|
@ -137,6 +147,11 @@ void RecordingScriptingInterface::setPlayFromCurrentLocation(bool playFromCurren
|
|||
}
|
||||
|
||||
void RecordingScriptingInterface::setPlayerLoop(bool loop) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
BLOCKING_INVOKE_METHOD(this, "setPlayerLoop", Q_ARG(bool, loop));
|
||||
return;
|
||||
}
|
||||
|
||||
_player->loop(loop);
|
||||
}
|
||||
|
||||
|
@ -195,6 +210,16 @@ void RecordingScriptingInterface::startRecording() {
|
|||
}
|
||||
|
||||
void RecordingScriptingInterface::stopRecording() {
|
||||
if (!_recorder->isRecording()) {
|
||||
qCWarning(scriptengine) << "Recorder is not running";
|
||||
return;
|
||||
}
|
||||
|
||||
if (QThread::currentThread() != thread()) {
|
||||
BLOCKING_INVOKE_METHOD(this, "stopRecording");
|
||||
return;
|
||||
}
|
||||
|
||||
_recorder->stop();
|
||||
_lastClip = _recorder->getClip();
|
||||
_lastClip->seek(0);
|
||||
|
|
|
@ -25,8 +25,14 @@
|
|||
* <tr>
|
||||
* <td><strong>First Person</strong></td>
|
||||
* <td><code>"first person"</code></td>
|
||||
* <td>The camera is positioned such that you have the same view as your avatar. The camera moves and rotates with your
|
||||
* avatar.</td>
|
||||
* <td>Legacy first person camera mode. The camera is positioned such that you have the same view as your avatar.
|
||||
* The camera moves and rotates with your avatar.</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td><strong>First Person Look At</strong></td>
|
||||
* <td><code>"first person look at"</code></td>
|
||||
* <td>Default first person camera mode. The camera is positioned such that you have the same view as your avatar.
|
||||
* The camera moves and rotates with your avatar's head.</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td><strong>Third Person</strong></td>
|
||||
|
@ -73,6 +79,8 @@ CameraMode stringToMode(const QString& mode) {
|
|||
return CAMERA_MODE_THIRD_PERSON;
|
||||
} else if (mode == "first person") {
|
||||
return CAMERA_MODE_FIRST_PERSON;
|
||||
} else if (mode == "first person look at") {
|
||||
return CAMERA_MODE_FIRST_PERSON_LOOK_AT;
|
||||
} else if (mode == "mirror") {
|
||||
return CAMERA_MODE_MIRROR;
|
||||
} else if (mode == "independent") {
|
||||
|
@ -92,6 +100,8 @@ QString modeToString(CameraMode mode) {
|
|||
return "third person";
|
||||
} else if (mode == CAMERA_MODE_FIRST_PERSON) {
|
||||
return "first person";
|
||||
} else if (mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT) {
|
||||
return "first person look at";
|
||||
} else if (mode == CAMERA_MODE_MIRROR) {
|
||||
return "mirror";
|
||||
} else if (mode == CAMERA_MODE_INDEPENDENT) {
|
||||
|
|
|
@ -19,6 +19,7 @@ enum CameraMode
|
|||
{
|
||||
CAMERA_MODE_NULL = -1,
|
||||
CAMERA_MODE_THIRD_PERSON,
|
||||
CAMERA_MODE_FIRST_PERSON_LOOK_AT,
|
||||
CAMERA_MODE_FIRST_PERSON,
|
||||
CAMERA_MODE_MIRROR,
|
||||
CAMERA_MODE_INDEPENDENT,
|
||||
|
|
|
@ -663,7 +663,7 @@ function handleSecondLaunchWindowVisibleChanged(shouldBeVisible) {
|
|||
|
||||
function onDisplayModeChanged(isHMDMode) {
|
||||
if (isHMDMode) {
|
||||
Camera.setModeString("first person");
|
||||
Camera.setModeString("first person look at");
|
||||
}
|
||||
|
||||
if (isHMDMode) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
// Automatically enter first person mode when entering HMD mode
|
||||
HMD.displayModeChanged.connect(function(isHMDMode) {
|
||||
if (isHMDMode) {
|
||||
Camera.setModeString("first person");
|
||||
Camera.setModeString("first person look at");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@
|
|||
currentProgress = 0.0;
|
||||
connectionToDomainFailed = false;
|
||||
previousCameraMode = Camera.mode;
|
||||
Camera.mode = "first person";
|
||||
Camera.mode = "first person look at";
|
||||
updateProgressBar(0.0);
|
||||
scaleInterstitialPage(MyAvatar.sensorToWorldScale);
|
||||
timer = Script.setTimeout(update, 2000);
|
||||
|
|
|
@ -52,8 +52,8 @@ function calcSpawnInfo(hand, landscape) {
|
|||
|
||||
var LEFT_HAND = Controller.Standard.LeftHand;
|
||||
var sensorToWorldScale = MyAvatar.sensorToWorldScale;
|
||||
var headPos = (HMD.active && Camera.mode === "first person") ? HMD.position : Camera.position;
|
||||
var headRot = Quat.cancelOutRollAndPitch((HMD.active && Camera.mode === "first person") ?
|
||||
var headPos = (HMD.active && (Camera.mode === "first person" || Camera.mode === "first person look at")) ? HMD.position : Camera.position;
|
||||
var headRot = Quat.cancelOutRollAndPitch((HMD.active && (Camera.mode === "first person" || Camera.mode === "first person look at")) ?
|
||||
HMD.orientation : Camera.orientation);
|
||||
|
||||
var right = Quat.getRight(headRot);
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
function handJointName(hand) {
|
||||
var jointName;
|
||||
if (hand === LEFT_HAND) {
|
||||
if (Camera.mode === "first person") {
|
||||
if (Camera.mode === "first person" || Camera.mode === "first person look at") {
|
||||
jointName = "_CONTROLLER_LEFTHAND";
|
||||
} else if (Camera.mode === "third person") {
|
||||
jointName = "_CAMERA_RELATIVE_CONTROLLER_LEFTHAND";
|
||||
|
@ -61,7 +61,7 @@
|
|||
jointName = "LeftHand";
|
||||
}
|
||||
} else {
|
||||
if (Camera.mode === "first person") {
|
||||
if (Camera.mode === "first person" || Camera.mode === "first person look at") {
|
||||
jointName = "_CONTROLLER_RIGHTHAND";
|
||||
} else if (Camera.mode === "third person") {
|
||||
jointName = "_CAMERA_RELATIVE_CONTROLLER_RIGHTHAND";
|
||||
|
|
Loading…
Reference in a new issue