mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 13:56:24 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into DailyTests
This commit is contained in:
commit
00300f4b2f
12 changed files with 83 additions and 62 deletions
|
@ -163,10 +163,18 @@ TextField {
|
|||
text: textField.label
|
||||
colorScheme: textField.colorScheme
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
Binding on anchors.right {
|
||||
when: parent.right
|
||||
value: parent.right
|
||||
}
|
||||
Binding on wrapMode {
|
||||
when: parent.right
|
||||
value: Text.WordWrap
|
||||
}
|
||||
|
||||
anchors.bottom: parent.top
|
||||
anchors.bottomMargin: 3
|
||||
wrapMode: Text.WordWrap
|
||||
visible: label != ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4641,12 +4641,6 @@ void Application::idle() {
|
|||
|
||||
_overlayConductor.update(secondsSinceLastUpdate);
|
||||
|
||||
auto myAvatar = getMyAvatar();
|
||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN));
|
||||
cameraMenuChanged();
|
||||
}
|
||||
_gameLoopCounter.increment();
|
||||
}
|
||||
|
||||
|
@ -5193,6 +5187,21 @@ void Application::cameraModeChanged() {
|
|||
cameraMenuChanged();
|
||||
}
|
||||
|
||||
void Application::changeViewAsNeeded(float boomLength) {
|
||||
// Switch between first and third person views as needed
|
||||
// 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);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, true);
|
||||
cameraMenuChanged();
|
||||
} else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON && !boomLengthGreaterThanMinimum) {
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, true);
|
||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, false);
|
||||
cameraMenuChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::cameraMenuChanged() {
|
||||
auto menu = Menu::getInstance();
|
||||
|
|
|
@ -417,6 +417,8 @@ public slots:
|
|||
|
||||
void updateVerboseLogging();
|
||||
|
||||
void changeViewAsNeeded(float boomLength);
|
||||
|
||||
private slots:
|
||||
void onDesktopRootItemCreated(QQuickItem* qmlContext);
|
||||
void onDesktopRootContextCreated(QQmlContext* qmlContext);
|
||||
|
|
|
@ -2245,9 +2245,15 @@ void MyAvatar::updateActionMotor(float deltaTime) {
|
|||
_actionMotorVelocity = getSensorToWorldScale() * (_walkSpeed.get() * _walkSpeedScalar) * direction;
|
||||
}
|
||||
|
||||
float previousBoomLength = _boomLength;
|
||||
float boomChange = getDriveKey(ZOOM);
|
||||
_boomLength += 2.0f * _boomLength * boomChange + boomChange * boomChange;
|
||||
_boomLength = glm::clamp<float>(_boomLength, ZOOM_MIN, ZOOM_MAX);
|
||||
|
||||
// May need to change view if boom length has changed
|
||||
if (previousBoomLength != _boomLength) {
|
||||
qApp->changeViewAsNeeded(_boomLength);
|
||||
}
|
||||
}
|
||||
|
||||
void MyAvatar::updatePosition(float deltaTime) {
|
||||
|
|
|
@ -259,7 +259,6 @@ void Web3DOverlay::setupQmlSurface() {
|
|||
_webSurface->getSurfaceContext()->setContextProperty("Web3DOverlay", this);
|
||||
_webSurface->getSurfaceContext()->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data());
|
||||
_webSurface->getSurfaceContext()->setContextProperty("Reticle", qApp->getApplicationCompositor().getReticleInterface());
|
||||
_webSurface->getSurfaceContext()->setContextProperty("desktop", DependencyManager::get<OffscreenUi>()->getDesktop());
|
||||
_webSurface->getSurfaceContext()->setContextProperty("HiFiAbout", AboutUtil::getInstance());
|
||||
|
||||
// Override min fps for tablet UI, for silky smooth scrolling
|
||||
|
|
|
@ -252,11 +252,9 @@ void EntityMotionState::getWorldTransform(btTransform& worldTrans) const {
|
|||
|
||||
uint32_t thisStep = ObjectMotionState::getWorldSimulationStep();
|
||||
float dt = (thisStep - _lastKinematicStep) * PHYSICS_ENGINE_FIXED_SUBSTEP;
|
||||
_lastKinematicStep = thisStep;
|
||||
_entity->stepKinematicMotion(dt);
|
||||
|
||||
// bypass const-ness so we can remember the step
|
||||
const_cast<EntityMotionState*>(this)->_lastKinematicStep = thisStep;
|
||||
|
||||
// and set the acceleration-matches-gravity count high so that if we send an update
|
||||
// it will use the correct acceleration for remote simulations
|
||||
_accelerationNearlyGravityCount = (uint8_t)(-1);
|
||||
|
|
|
@ -184,7 +184,7 @@ protected:
|
|||
btRigidBody* _body { nullptr };
|
||||
float _density { 1.0f };
|
||||
|
||||
uint32_t _lastKinematicStep;
|
||||
mutable uint32_t _lastKinematicStep;
|
||||
bool _hasInternalKinematicChanges { false };
|
||||
};
|
||||
|
||||
|
|
|
@ -71,8 +71,8 @@ void PhysicsEngine::init() {
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t PhysicsEngine::getNumSubsteps() {
|
||||
return _numSubsteps;
|
||||
uint32_t PhysicsEngine::getNumSubsteps() const {
|
||||
return _dynamicsWorld->getNumSubsteps();
|
||||
}
|
||||
|
||||
// private
|
||||
|
@ -329,13 +329,9 @@ void PhysicsEngine::stepSimulation() {
|
|||
PHYSICS_ENGINE_FIXED_SUBSTEP, onSubStep);
|
||||
if (numSubsteps > 0) {
|
||||
BT_PROFILE("postSimulation");
|
||||
_numSubsteps += (uint32_t)numSubsteps;
|
||||
ObjectMotionState::setWorldSimulationStep(_numSubsteps);
|
||||
|
||||
if (_myAvatarController) {
|
||||
_myAvatarController->postSimulation();
|
||||
}
|
||||
|
||||
_hasOutgoingChanges = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
~PhysicsEngine();
|
||||
void init();
|
||||
|
||||
uint32_t getNumSubsteps();
|
||||
uint32_t getNumSubsteps() const;
|
||||
|
||||
void removeObjects(const VectorOfMotionStates& objects);
|
||||
void removeSetOfObjects(const SetOfMotionStates& objects); // only called during teardown
|
||||
|
@ -135,7 +135,6 @@ private:
|
|||
CharacterController* _myAvatarController;
|
||||
|
||||
uint32_t _numContactFrames = 0;
|
||||
uint32_t _numSubsteps;
|
||||
|
||||
bool _dumpNextStats { false };
|
||||
bool _saveNextStats { false };
|
||||
|
|
|
@ -59,14 +59,11 @@ int ThreadSafeDynamicsWorld::stepSimulationWithSubstepCallback(btScalar timeStep
|
|||
}
|
||||
}
|
||||
|
||||
/*//process some debugging flags
|
||||
if (getDebugDrawer()) {
|
||||
btIDebugDraw* debugDrawer = getDebugDrawer();
|
||||
gDisableDeactivation = (debugDrawer->getDebugMode() & btIDebugDraw::DBG_NoDeactivation) != 0;
|
||||
}*/
|
||||
if (subSteps) {
|
||||
//clamp the number of substeps, to prevent simulation grinding spiralling down to a halt
|
||||
int clampedSimulationSteps = (subSteps > maxSubSteps)? maxSubSteps : subSteps;
|
||||
_numSubsteps += clampedSimulationSteps;
|
||||
ObjectMotionState::setWorldSimulationStep(_numSubsteps);
|
||||
|
||||
saveKinematicState(fixedTimeStep*clampedSimulationSteps);
|
||||
|
||||
|
@ -98,28 +95,24 @@ int ThreadSafeDynamicsWorld::stepSimulationWithSubstepCallback(btScalar timeStep
|
|||
// call this instead of non-virtual btDiscreteDynamicsWorld::synchronizeSingleMotionState()
|
||||
void ThreadSafeDynamicsWorld::synchronizeMotionState(btRigidBody* body) {
|
||||
btAssert(body);
|
||||
if (body->getMotionState() && !body->isStaticObject()) {
|
||||
//we need to call the update at least once, even for sleeping objects
|
||||
//otherwise the 'graphics' transform never updates properly
|
||||
///@todo: add 'dirty' flag
|
||||
//if (body->getActivationState() != ISLAND_SLEEPING)
|
||||
{
|
||||
if (body->isKinematicObject()) {
|
||||
ObjectMotionState* objectMotionState = static_cast<ObjectMotionState*>(body->getMotionState());
|
||||
if (objectMotionState->hasInternalKinematicChanges()) {
|
||||
objectMotionState->clearInternalKinematicChanges();
|
||||
body->getMotionState()->setWorldTransform(body->getWorldTransform());
|
||||
}
|
||||
return;
|
||||
}
|
||||
btTransform interpolatedTransform;
|
||||
btTransformUtil::integrateTransform(body->getInterpolationWorldTransform(),
|
||||
body->getInterpolationLinearVelocity(),body->getInterpolationAngularVelocity(),
|
||||
(m_latencyMotionStateInterpolation && m_fixedTimeStep) ? m_localTime - m_fixedTimeStep : m_localTime*body->getHitFraction(),
|
||||
interpolatedTransform);
|
||||
body->getMotionState()->setWorldTransform(interpolatedTransform);
|
||||
btAssert(body->getMotionState());
|
||||
|
||||
if (body->isKinematicObject()) {
|
||||
ObjectMotionState* objectMotionState = static_cast<ObjectMotionState*>(body->getMotionState());
|
||||
if (objectMotionState->hasInternalKinematicChanges()) {
|
||||
// this is a special case where the kinematic motion has been updated by an Action
|
||||
// so we supply the body's current transform to the MotionState
|
||||
objectMotionState->clearInternalKinematicChanges();
|
||||
body->getMotionState()->setWorldTransform(body->getWorldTransform());
|
||||
}
|
||||
return;
|
||||
}
|
||||
btTransform interpolatedTransform;
|
||||
btTransformUtil::integrateTransform(body->getInterpolationWorldTransform(),
|
||||
body->getInterpolationLinearVelocity(),body->getInterpolationAngularVelocity(),
|
||||
(m_latencyMotionStateInterpolation && m_fixedTimeStep) ? m_localTime - m_fixedTimeStep : m_localTime*body->getHitFraction(),
|
||||
interpolatedTransform);
|
||||
body->getMotionState()->setWorldTransform(interpolatedTransform);
|
||||
}
|
||||
|
||||
void ThreadSafeDynamicsWorld::synchronizeMotionStates() {
|
||||
|
@ -164,24 +157,12 @@ void ThreadSafeDynamicsWorld::synchronizeMotionStates() {
|
|||
}
|
||||
|
||||
void ThreadSafeDynamicsWorld::saveKinematicState(btScalar timeStep) {
|
||||
///would like to iterate over m_nonStaticRigidBodies, but unfortunately old API allows
|
||||
///to switch status _after_ adding kinematic objects to the world
|
||||
///fix it for Bullet 3.x release
|
||||
DETAILED_PROFILE_RANGE(simulation_physics, "saveKinematicState");
|
||||
BT_PROFILE("saveKinematicState");
|
||||
for (int i=0;i<m_collisionObjects.size();i++)
|
||||
{
|
||||
btCollisionObject* colObj = m_collisionObjects[i];
|
||||
btRigidBody* body = btRigidBody::upcast(colObj);
|
||||
if (body && body->getActivationState() != ISLAND_SLEEPING)
|
||||
{
|
||||
if (body->isKinematicObject())
|
||||
{
|
||||
//to calculate velocities next frame
|
||||
body->saveKinematicState(timeStep);
|
||||
}
|
||||
for (int i=0;i<m_nonStaticRigidBodies.size();i++) {
|
||||
btRigidBody* body = m_nonStaticRigidBodies[i];
|
||||
if (body && body->isKinematicObject() && body->getActivationState() != ISLAND_SLEEPING) {
|
||||
body->saveKinematicState(timeStep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
btConstraintSolver* constraintSolver,
|
||||
btCollisionConfiguration* collisionConfiguration);
|
||||
|
||||
int getNumSubsteps() const { return _numSubsteps; }
|
||||
int stepSimulationWithSubstepCallback(btScalar timeStep, int maxSubSteps = 1,
|
||||
btScalar fixedTimeStep = btScalar(1.)/btScalar(60.),
|
||||
SubStepCallback onSubStep = []() { });
|
||||
|
@ -61,6 +62,7 @@ private:
|
|||
VectorOfMotionStates _deactivatedStates;
|
||||
SetOfMotionStates _activeStates;
|
||||
SetOfMotionStates _lastActiveStates;
|
||||
int _numSubsteps { 0 };
|
||||
};
|
||||
|
||||
#endif // hifi_ThreadSafeDynamicsWorld_h
|
||||
|
|
|
@ -171,4 +171,25 @@
|
|||
Messages.subscribe(HIFI_ADVANCED_MOVEMENT_DISABLER_CHANNEL);
|
||||
Messages.messageReceived.connect(handleMessage);
|
||||
|
||||
function initializeControls() {
|
||||
if(HMD.active) {
|
||||
if (Controller.Hardware.Vive !== undefined || Controller.Hardware.OculusTouch !== undefined) {
|
||||
if (MyAvatar.useAdvancedMovementControls) {
|
||||
Controller.disableMapping(DRIVING_MAPPING_NAME);
|
||||
} else {
|
||||
Controller.enableMapping(DRIVING_MAPPING_NAME);
|
||||
}
|
||||
|
||||
if (MyAvatar.getFlyingEnabled()) {
|
||||
Controller.disableMapping(FLYING_MAPPING_NAME);
|
||||
} else {
|
||||
Controller.enableMapping(FLYING_MAPPING_NAME);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
initializeControls();
|
||||
|
||||
}()); // END LOCAL_SCOPE
|
||||
|
|
Loading…
Reference in a new issue