mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:42:58 +02:00
Merge branch 'stable' of https://github.com/highfidelity/hifi into new-master
This commit is contained in:
commit
920263ef49
9 changed files with 34 additions and 62 deletions
|
@ -4,8 +4,8 @@ set(EXTERNAL_NAME serverless-content)
|
||||||
|
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
${EXTERNAL_NAME}
|
${EXTERNAL_NAME}
|
||||||
URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC68.zip
|
URL http://cdn.highfidelity.com/content-sets/serverless-tutorial-RC68-v2.zip
|
||||||
URL_MD5 a068f74d4045e257cfa7926fe6e38ad5
|
URL_MD5 f7d290471baf7f5694c147217b8fc548
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
|
|
|
@ -1439,17 +1439,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
// add firstRun flag from settings to launch event
|
// add firstRun flag from settings to launch event
|
||||||
Setting::Handle<bool> firstRun { Settings::firstRun, true };
|
Setting::Handle<bool> firstRun { Settings::firstRun, true };
|
||||||
|
|
||||||
// once the settings have been loaded, check if we need to flip the default for UserActivityLogger
|
|
||||||
auto& userActivityLogger = UserActivityLogger::getInstance();
|
|
||||||
if (!userActivityLogger.isDisabledSettingSet()) {
|
|
||||||
// the user activity logger is opt-out for Interface
|
|
||||||
// but it's defaulted to disabled for other targets
|
|
||||||
// so we need to enable it here if it has never been disabled by the user
|
|
||||||
userActivityLogger.disable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString machineFingerPrint = uuidStringWithoutCurlyBraces(FingerprintUtils::getMachineFingerprint());
|
QString machineFingerPrint = uuidStringWithoutCurlyBraces(FingerprintUtils::getMachineFingerprint());
|
||||||
|
|
||||||
|
auto& userActivityLogger = UserActivityLogger::getInstance();
|
||||||
if (userActivityLogger.isEnabled()) {
|
if (userActivityLogger.isEnabled()) {
|
||||||
// sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value.
|
// sessionRunTime will be reset soon by loadSettings. Grab it now to get previous session value.
|
||||||
// The value will be 0 if the user blew away settings this session, which is both a feature and a bug.
|
// The value will be 0 if the user blew away settings this session, which is both a feature and a bug.
|
||||||
|
|
|
@ -124,7 +124,7 @@ Menu::Menu() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Edit > Delete
|
// Edit > Delete
|
||||||
auto deleteAction =addActionToQMenuAndActionHash(editMenu, "Delete", QKeySequence::Delete);
|
auto deleteAction = addActionToQMenuAndActionHash(editMenu, "Delete", QKeySequence::Delete);
|
||||||
connect(deleteAction, &QAction::triggered, [] {
|
connect(deleteAction, &QAction::triggered, [] {
|
||||||
QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Delete, Qt::ControlModifier);
|
QKeyEvent* keyEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Delete, Qt::ControlModifier);
|
||||||
QCoreApplication::postEvent(QCoreApplication::instance(), keyEvent);
|
QCoreApplication::postEvent(QCoreApplication::instance(), keyEvent);
|
||||||
|
|
|
@ -21,17 +21,6 @@ AvatarMotionState::AvatarMotionState(AvatarSharedPointer avatar, const btCollisi
|
||||||
_type = MOTIONSTATE_TYPE_AVATAR;
|
_type = MOTIONSTATE_TYPE_AVATAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarMotionState::handleEasyChanges(uint32_t& flags) {
|
|
||||||
ObjectMotionState::handleEasyChanges(flags);
|
|
||||||
if (flags & Simulation::DIRTY_PHYSICS_ACTIVATION && !_body->isActive()) {
|
|
||||||
_body->activate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AvatarMotionState::handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine* engine) {
|
|
||||||
return ObjectMotionState::handleHardAndEasyChanges(flags, engine);
|
|
||||||
}
|
|
||||||
|
|
||||||
AvatarMotionState::~AvatarMotionState() {
|
AvatarMotionState::~AvatarMotionState() {
|
||||||
assert(_avatar);
|
assert(_avatar);
|
||||||
_avatar = nullptr;
|
_avatar = nullptr;
|
||||||
|
@ -57,9 +46,6 @@ PhysicsMotionType AvatarMotionState::computePhysicsMotionType() const {
|
||||||
const btCollisionShape* AvatarMotionState::computeNewShape() {
|
const btCollisionShape* AvatarMotionState::computeNewShape() {
|
||||||
ShapeInfo shapeInfo;
|
ShapeInfo shapeInfo;
|
||||||
std::static_pointer_cast<Avatar>(_avatar)->computeShapeInfo(shapeInfo);
|
std::static_pointer_cast<Avatar>(_avatar)->computeShapeInfo(shapeInfo);
|
||||||
glm::vec3 halfExtents = shapeInfo.getHalfExtents();
|
|
||||||
halfExtents.y = 0.0f;
|
|
||||||
_diameter = 2.0f * glm::length(halfExtents);
|
|
||||||
return getShapeManager()->getShape(shapeInfo);
|
return getShapeManager()->getShape(shapeInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,31 +60,25 @@ void AvatarMotionState::getWorldTransform(btTransform& worldTrans) const {
|
||||||
worldTrans.setRotation(glmToBullet(getObjectRotation()));
|
worldTrans.setRotation(glmToBullet(getObjectRotation()));
|
||||||
if (_body) {
|
if (_body) {
|
||||||
_body->setLinearVelocity(glmToBullet(getObjectLinearVelocity()));
|
_body->setLinearVelocity(glmToBullet(getObjectLinearVelocity()));
|
||||||
_body->setAngularVelocity(glmToBullet(getObjectAngularVelocity()));
|
_body->setAngularVelocity(glmToBullet(getObjectLinearVelocity()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
void AvatarMotionState::setWorldTransform(const btTransform& worldTrans) {
|
void AvatarMotionState::setWorldTransform(const btTransform& worldTrans) {
|
||||||
|
// HACK: The PhysicsEngine does not actually move OTHER avatars -- instead it slaves their local RigidBody to the transform
|
||||||
|
// as specified by a remote simulation. However, to give the remote simulation time to respond to our own objects we tie
|
||||||
|
// the other avatar's body to its true position with a simple spring. This is a HACK that will have to be improved later.
|
||||||
const float SPRING_TIMESCALE = 0.5f;
|
const float SPRING_TIMESCALE = 0.5f;
|
||||||
float tau = PHYSICS_ENGINE_FIXED_SUBSTEP / SPRING_TIMESCALE;
|
float tau = PHYSICS_ENGINE_FIXED_SUBSTEP / SPRING_TIMESCALE;
|
||||||
btVector3 currentPosition = worldTrans.getOrigin();
|
btVector3 currentPosition = worldTrans.getOrigin();
|
||||||
btVector3 offsetToTarget = glmToBullet(getObjectPosition()) - currentPosition;
|
btVector3 targetPosition = glmToBullet(getObjectPosition());
|
||||||
float distance = offsetToTarget.length();
|
btTransform newTransform;
|
||||||
if ((1.0f - tau) * distance > _diameter) {
|
newTransform.setOrigin((1.0f - tau) * currentPosition + tau * targetPosition);
|
||||||
// the avatar body is far from its target --> slam position
|
newTransform.setRotation(glmToBullet(getObjectRotation()));
|
||||||
btTransform newTransform;
|
_body->setWorldTransform(newTransform);
|
||||||
newTransform.setOrigin(currentPosition + offsetToTarget);
|
_body->setLinearVelocity(glmToBullet(getObjectLinearVelocity()));
|
||||||
newTransform.setRotation(glmToBullet(getObjectRotation()));
|
_body->setAngularVelocity(glmToBullet(getObjectLinearVelocity()));
|
||||||
_body->setWorldTransform(newTransform);
|
|
||||||
_body->setLinearVelocity(glmToBullet(getObjectLinearVelocity()));
|
|
||||||
_body->setAngularVelocity(glmToBullet(getObjectAngularVelocity()));
|
|
||||||
} else {
|
|
||||||
// the avatar body is near its target --> slam velocity
|
|
||||||
btVector3 velocity = glmToBullet(getObjectLinearVelocity()) + (1.0f / SPRING_TIMESCALE) * offsetToTarget;
|
|
||||||
_body->setLinearVelocity(velocity);
|
|
||||||
_body->setAngularVelocity(glmToBullet(getObjectAngularVelocity()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// These pure virtual methods must be implemented for each MotionState type
|
// These pure virtual methods must be implemented for each MotionState type
|
||||||
|
@ -165,8 +145,3 @@ void AvatarMotionState::computeCollisionGroupAndMask(int32_t& group, int32_t& ma
|
||||||
mask = Physics::getDefaultCollisionMask(group);
|
mask = Physics::getDefaultCollisionMask(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual
|
|
||||||
float AvatarMotionState::getMass() const {
|
|
||||||
return std::static_pointer_cast<Avatar>(_avatar)->computeMass();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,6 @@ class AvatarMotionState : public ObjectMotionState {
|
||||||
public:
|
public:
|
||||||
AvatarMotionState(AvatarSharedPointer avatar, const btCollisionShape* shape);
|
AvatarMotionState(AvatarSharedPointer avatar, const btCollisionShape* shape);
|
||||||
|
|
||||||
virtual void handleEasyChanges(uint32_t& flags) override;
|
|
||||||
virtual bool handleHardAndEasyChanges(uint32_t& flags, PhysicsEngine* engine) override;
|
|
||||||
|
|
||||||
virtual PhysicsMotionType getMotionType() const override { return _motionType; }
|
virtual PhysicsMotionType getMotionType() const override { return _motionType; }
|
||||||
|
|
||||||
virtual uint32_t getIncomingDirtyFlags() override;
|
virtual uint32_t getIncomingDirtyFlags() override;
|
||||||
|
@ -67,8 +64,6 @@ public:
|
||||||
|
|
||||||
virtual void computeCollisionGroupAndMask(int32_t& group, int32_t& mask) const override;
|
virtual void computeCollisionGroupAndMask(int32_t& group, int32_t& mask) const override;
|
||||||
|
|
||||||
virtual float getMass() const override;
|
|
||||||
|
|
||||||
friend class AvatarManager;
|
friend class AvatarManager;
|
||||||
friend class Avatar;
|
friend class Avatar;
|
||||||
|
|
||||||
|
@ -81,7 +76,6 @@ protected:
|
||||||
virtual const btCollisionShape* computeNewShape() override;
|
virtual const btCollisionShape* computeNewShape() override;
|
||||||
|
|
||||||
AvatarSharedPointer _avatar;
|
AvatarSharedPointer _avatar;
|
||||||
float _diameter { 0.0f };
|
|
||||||
|
|
||||||
uint32_t _dirtyFlags;
|
uint32_t _dirtyFlags;
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,6 +81,13 @@ int main(int argc, const char* argv[]) {
|
||||||
|
|
||||||
// Instance UserActivityLogger now that the settings are loaded
|
// Instance UserActivityLogger now that the settings are loaded
|
||||||
auto& ual = UserActivityLogger::getInstance();
|
auto& ual = UserActivityLogger::getInstance();
|
||||||
|
// once the settings have been loaded, check if we need to flip the default for UserActivityLogger
|
||||||
|
if (!ual.isDisabledSettingSet()) {
|
||||||
|
// the user activity logger is opt-out for Interface
|
||||||
|
// but it's defaulted to disabled for other targets
|
||||||
|
// so we need to enable it here if it has never been disabled by the user
|
||||||
|
ual.disable(false);
|
||||||
|
}
|
||||||
qDebug() << "UserActivityLogger is enabled:" << ual.isEnabled();
|
qDebug() << "UserActivityLogger is enabled:" << ual.isEnabled();
|
||||||
|
|
||||||
if (ual.isEnabled()) {
|
if (ual.isEnabled()) {
|
||||||
|
|
|
@ -861,6 +861,7 @@ bool Avatar::shouldRenderHead(const RenderArgs* renderArgs) const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// virtual
|
||||||
void Avatar::simulateAttachments(float deltaTime) {
|
void Avatar::simulateAttachments(float deltaTime) {
|
||||||
assert(_attachmentModels.size() == _attachmentModelsTexturesLoaded.size());
|
assert(_attachmentModels.size() == _attachmentModelsTexturesLoaded.size());
|
||||||
PerformanceTimer perfTimer("attachments");
|
PerformanceTimer perfTimer("attachments");
|
||||||
|
@ -1543,14 +1544,12 @@ void Avatar::updateDisplayNameAlpha(bool showDisplayName) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// virtual
|
||||||
void Avatar::computeShapeInfo(ShapeInfo& shapeInfo) {
|
void Avatar::computeShapeInfo(ShapeInfo& shapeInfo) {
|
||||||
float uniformScale = getModelScale();
|
float uniformScale = getModelScale();
|
||||||
float radius = uniformScale * _skeletonModel->getBoundingCapsuleRadius();
|
shapeInfo.setCapsuleY(uniformScale * _skeletonModel->getBoundingCapsuleRadius(),
|
||||||
float height = uniformScale * _skeletonModel->getBoundingCapsuleHeight();
|
0.5f * uniformScale * _skeletonModel->getBoundingCapsuleHeight());
|
||||||
shapeInfo.setCapsuleY(radius, 0.5f * height);
|
shapeInfo.setOffset(uniformScale * _skeletonModel->getBoundingCapsuleOffset());
|
||||||
|
|
||||||
glm::vec3 offset = uniformScale * _skeletonModel->getBoundingCapsuleOffset();
|
|
||||||
shapeInfo.setOffset(offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::getCapsule(glm::vec3& start, glm::vec3& end, float& radius) {
|
void Avatar::getCapsule(glm::vec3& start, glm::vec3& end, float& radius) {
|
||||||
|
@ -1573,8 +1572,9 @@ float Avatar::computeMass() {
|
||||||
return _density * TWO_PI * radius * radius * (glm::length(end - start) + 2.0f * radius / 3.0f);
|
return _density * TWO_PI * radius * radius * (glm::length(end - start) + 2.0f * radius / 3.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// virtual
|
||||||
void Avatar::rebuildCollisionShape() {
|
void Avatar::rebuildCollisionShape() {
|
||||||
addPhysicsFlags(Simulation::DIRTY_SHAPE | Simulation::DIRTY_MASS);
|
addPhysicsFlags(Simulation::DIRTY_SHAPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::setPhysicsCallback(AvatarPhysicsCallback cb) {
|
void Avatar::setPhysicsCallback(AvatarPhysicsCallback cb) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ public:
|
||||||
virtual PhysicsMotionType getMotionType() const { return _motionType; }
|
virtual PhysicsMotionType getMotionType() const { return _motionType; }
|
||||||
|
|
||||||
void setMass(float mass);
|
void setMass(float mass);
|
||||||
virtual float getMass() const;
|
float getMass() const;
|
||||||
|
|
||||||
void setBodyLinearVelocity(const glm::vec3& velocity) const;
|
void setBodyLinearVelocity(const glm::vec3& velocity) const;
|
||||||
void setBodyAngularVelocity(const glm::vec3& velocity) const;
|
void setBodyAngularVelocity(const glm::vec3& velocity) const;
|
||||||
|
|
|
@ -105,6 +105,10 @@ void PhysicsEngine::addObjectToDynamicsWorld(ObjectMotionState* motionState) {
|
||||||
}
|
}
|
||||||
case MOTION_TYPE_DYNAMIC: {
|
case MOTION_TYPE_DYNAMIC: {
|
||||||
mass = motionState->getMass();
|
mass = motionState->getMass();
|
||||||
|
if (mass != mass || mass < 1.0f) {
|
||||||
|
qCDebug(physics) << "mass is too low, setting to 1.0 Kg --" << mass;
|
||||||
|
mass = 1.0f;
|
||||||
|
}
|
||||||
btCollisionShape* shape = const_cast<btCollisionShape*>(motionState->getShape());
|
btCollisionShape* shape = const_cast<btCollisionShape*>(motionState->getShape());
|
||||||
assert(shape);
|
assert(shape);
|
||||||
shape->calculateLocalInertia(mass, inertia);
|
shape->calculateLocalInertia(mass, inertia);
|
||||||
|
|
Loading…
Reference in a new issue