Merge branch 'master' of https://github.com/highfidelity/hifi into pid-render-limits

This commit is contained in:
Howard Stearns 2015-12-17 16:51:04 -08:00
commit d6612d20ff
21 changed files with 421 additions and 107 deletions

View file

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12.2) cmake_minimum_required(VERSION 3.2)
if (USE_ANDROID_TOOLCHAIN) if (USE_ANDROID_TOOLCHAIN)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/android/android.toolchain.cmake") set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/android/android.toolchain.cmake")
@ -228,34 +228,4 @@ if (HIFI_MEMORY_DEBUGGING)
endif () endif ()
include_application_version() include_application_version()
generate_installers()
if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE)
message(STATUS "+++++ Package for deployment will be generated on this build +++++")
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/full-stack-deployment)
set(ICONPATH_INTERFACE "$INSTDIR/${PATH_INSTALL_DATA}/interface.ico")
set(ICONPATH_STACK_MANAGER "$INSTDIR/${PATH_INSTALL_DATA}/stack-manager.ico")
string(REPLACE "/" "\\\\" ICONPATH_INTERFACE ${ICONPATH_INTERFACE})
string(REPLACE "/" "\\\\" ICONPATH_STACK_MANAGER ${ICONPATH_STACK_MANAGER})
set(CPACK_PACKAGE_NAME "High Fidelity")
set(CPACK_PACKAGE_VENDOR "High Fidelity, Inc")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "High Fidelity Interface and Stack")
set(CPACK_PACKAGE_VERSION "${BUILD_SEQ}")
set(CPACK_PACKAGE_VERSION_MAJOR "${BUILD_SEQ}")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "High Fidelity-${BUILD_SEQ}")
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
set(CPACK_PACKAGE_EXECUTABLES
stack-manager "Stack Manager"
interface "Interface"
)
if (WIN32)
install(DIRECTORY ${CMAKE_BINARY_DIR}/full-stack-deployment/ DESTINATION "./")
endif (WIN32)
include(CPack)
endif ()

View file

@ -1,7 +1,7 @@
macro(CONSOLIDATE_STACK_COMPONENTS) macro(CONSOLIDATE_STACK_COMPONENTS)
if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE AND WIN32) if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE)
if (WIN32)
# Copy all the output for this target into the common deployment location # Copy all the output for this target into the common deployment location
add_custom_command( add_custom_command(
TARGET ${TARGET_NAME} POST_BUILD TARGET ${TARGET_NAME} POST_BUILD
@ -23,5 +23,6 @@ macro(CONSOLIDATE_STACK_COMPONENTS)
) )
endif () endif ()
endif () endif ()
endif ()
endmacro() endmacro()

View file

@ -0,0 +1,30 @@
#
# GenerateInstallers.cmake
# cmake/macros
#
# Created by Leonardo Murillo on 12/16/2015.
# Copyright 2015 High Fidelity, Inc.
#
# Distributed under the Apache License, Version 2.0.
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
#
macro(GENERATE_INSTALLERS)
if (DEFINED DEPLOY_PACKAGE AND DEPLOY_PACKAGE AND WIN32)
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/full-stack-deployment")
find_program(MAKENSIS_COMMAND makensis PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS])
if (NOT MAKENSIS_COMMAND)
message(FATAL_ERROR "The Nullsoft Scriptable Install Systems is required for generating packaged installers on Windows (http://nsis.sourceforge.net/)")
endif ()
add_custom_target(
build-package ALL
DEPENDS interface assignment-client domain-server stack-manager
COMMAND set INSTALLER_SOURCE_DIR=${CMAKE_BINARY_DIR}/full-stack-deployment
COMMAND set INSTALLER_NAME=${CMAKE_BINARY_DIR}/${INSTALLER_NAME}
COMMAND set INSTALLER_SCRIPTS_DIR=${CMAKE_SOURCE_DIR}/examples
COMMAND set INSTALLER_COMPANY=${INSTALLER_COMPANY}
COMMAND set INSTALLER_DIRECTORY=${INSTALLER_DIRECTORY}
COMMAND CMD /C "\"${MAKENSIS_COMMAND}\" ${CMAKE_SOURCE_DIR}/tools/nsis/release.nsi"
)
endif ()
endmacro()

View file

@ -16,11 +16,20 @@ macro(INCLUDE_APPLICATION_VERSION)
if (DEFINED ENV{JOB_ID}) if (DEFINED ENV{JOB_ID})
set(DEPLOY_PACKAGE 1) set(DEPLOY_PACKAGE 1)
set(BUILD_SEQ $ENV{JOB_ID}) set(BUILD_SEQ $ENV{JOB_ID})
set(INSTALLER_COMPANY "High Fidelity")
set(INSTALLER_DIRECTORY "${INSTALLER_COMPANY}")
set(INSTALLER_NAME "interface-win64-${BUILD_SEQ}.exe")
elseif (DEFINED ENV{ghprbPullId}) elseif (DEFINED ENV{ghprbPullId})
set(DEPLOY_PACKAGE 1) set(DEPLOY_PACKAGE 1)
set(BUILD_SEQ "PR-$ENV{ghprbPullId}") set(BUILD_SEQ "PR-$ENV{ghprbPullId}")
set(INSTALLER_COMPANY "High Fidelity - PR")
set(INSTALLER_DIRECTORY "${INSTALLER_COMPANY}\\${BUILD_SEQ}")
set(INSTALLER_NAME "pr-interface-win64-${BUILD_SEQ}.exe")
else () else ()
set(BUILD_SEQ "dev") set(BUILD_SEQ "dev")
set(INSTALLER_COMPANY "High Fidelity - Dev")
set(INSTALLER_DIRECTORY "${INSTALLER_COMPANY}")
set(INSTALLER_NAME "dev-interface-win64.exe")
endif () endif ()
configure_file("${MACRO_DIR}/ApplicationVersion.h.in" "${PROJECT_BINARY_DIR}/includes/ApplicationVersion.h") configure_file("${MACRO_DIR}/ApplicationVersion.h.in" "${PROJECT_BINARY_DIR}/includes/ApplicationVersion.h")
include_directories("${PROJECT_BINARY_DIR}/includes") include_directories("${PROJECT_BINARY_DIR}/includes")

View file

@ -2992,6 +2992,9 @@ void Application::update(float deltaTime) {
_physicsEngine->changeObjects(motionStates); _physicsEngine->changeObjects(motionStates);
myAvatar->prepareForPhysicsSimulation(); myAvatar->prepareForPhysicsSimulation();
_physicsEngine->forEachAction([&](EntityActionPointer action) {
action->prepareForPhysicsSimulation();
});
getEntities()->getTree()->withWriteLock([&] { getEntities()->getTree()->withWriteLock([&] {
_physicsEngine->stepSimulation(); _physicsEngine->stepSimulation();

View file

@ -14,6 +14,7 @@
#include <QVariantGLM.h> #include <QVariantGLM.h>
#include "avatar/AvatarManager.h" #include "avatar/AvatarManager.h"
#include "CharacterController.h"
const uint16_t AvatarActionHold::holdVersion = 1; const uint16_t AvatarActionHold::holdVersion = 1;
@ -32,6 +33,64 @@ AvatarActionHold::~AvatarActionHold() {
#endif #endif
} }
bool AvatarActionHold::getAvatarRigidBodyLocation(glm::vec3& avatarRigidBodyPosition, glm::quat& avatarRigidBodyRotation) {
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
MyCharacterController* controller = myAvatar ? myAvatar->getCharacterController() : nullptr;
if (!controller) {
qDebug() << "AvatarActionHold::getAvatarRigidBodyLocation failed to get character controller";
return false;
}
controller->getRigidBodyLocation(avatarRigidBodyPosition, avatarRigidBodyRotation);
return true;
}
void AvatarActionHold::prepareForPhysicsSimulation() {
auto avatarManager = DependencyManager::get<AvatarManager>();
auto holdingAvatar = std::static_pointer_cast<Avatar>(avatarManager->getAvatarBySessionID(_holderID));
if (!holdingAvatar || !holdingAvatar->isMyAvatar()) {
return;
}
withWriteLock([&]{
if (_ignoreIK) {
return;
}
glm::vec3 palmPosition;
glm::quat palmRotation;
if (_hand == "right") {
palmPosition = holdingAvatar->getRightPalmPosition();
palmRotation = holdingAvatar->getRightPalmRotation();
} else {
palmPosition = holdingAvatar->getLeftPalmPosition();
palmRotation = holdingAvatar->getLeftPalmRotation();
}
glm::vec3 avatarRigidBodyPosition;
glm::quat avatarRigidBodyRotation;
getAvatarRigidBodyLocation(avatarRigidBodyPosition, avatarRigidBodyRotation);
// determine the difference in translation and rotation between the avatar's
// rigid body and the palm position. The avatar's rigid body will be moved by bullet
// between this call and the call to getTarget, below. A call to get*PalmPosition in
// getTarget would get the palm position of the previous location of the avatar (because
// bullet has moved the av's rigid body but the rigid body's location has not yet been
// copied out into the Avatar class.
glm::quat avatarRotationInverse = glm::inverse(avatarRigidBodyRotation);
// the offset should be in the frame of the avatar, but something about the order
// things are updated makes this wrong:
// _palmOffsetFromRigidBody = avatarRotationInverse * (palmPosition - avatarRigidBodyPosition);
// I'll leave it here as a comment in case avatar handling changes.
_palmOffsetFromRigidBody = palmPosition - avatarRigidBodyPosition;
// rotation should also be needed, but again, the order of updates makes this unneeded. leaving
// code here for future reference.
// _palmRotationFromRigidBody = avatarRotationInverse * palmRotation;
});
}
std::shared_ptr<Avatar> AvatarActionHold::getTarget(glm::quat& rotation, glm::vec3& position) { std::shared_ptr<Avatar> AvatarActionHold::getTarget(glm::quat& rotation, glm::vec3& position) {
auto avatarManager = DependencyManager::get<AvatarManager>(); auto avatarManager = DependencyManager::get<AvatarManager>();
auto holdingAvatar = std::static_pointer_cast<Avatar>(avatarManager->getAvatarBySessionID(_holderID)); auto holdingAvatar = std::static_pointer_cast<Avatar>(avatarManager->getAvatarBySessionID(_holderID));
@ -40,7 +99,7 @@ std::shared_ptr<Avatar> AvatarActionHold::getTarget(glm::quat& rotation, glm::ve
return holdingAvatar; return holdingAvatar;
} }
withTryReadLock([&]{ withReadLock([&]{
bool isRightHand = (_hand == "right"); bool isRightHand = (_hand == "right");
glm::vec3 palmPosition { Vectors::ZERO }; glm::vec3 palmPosition { Vectors::ZERO };
glm::quat palmRotation { Quaternions::IDENTITY }; glm::quat palmRotation { Quaternions::IDENTITY };
@ -55,6 +114,31 @@ std::shared_ptr<Avatar> AvatarActionHold::getTarget(glm::quat& rotation, glm::ve
palmPosition = holdingAvatar->getHand()->getCopyOfPalmData(HandData::LeftHand).getPosition(); palmPosition = holdingAvatar->getHand()->getCopyOfPalmData(HandData::LeftHand).getPosition();
palmRotation = holdingAvatar->getHand()->getCopyOfPalmData(HandData::LeftHand).getRotation(); palmRotation = holdingAvatar->getHand()->getCopyOfPalmData(HandData::LeftHand).getRotation();
} }
} else if (holdingAvatar->isMyAvatar()) {
glm::vec3 avatarRigidBodyPosition;
glm::quat avatarRigidBodyRotation;
getAvatarRigidBodyLocation(avatarRigidBodyPosition, avatarRigidBodyRotation);
// the offset and rotation between the avatar's rigid body and the palm were determined earlier
// in prepareForPhysicsSimulation. At this point, the avatar's rigid body has been moved by bullet
// and the data in the Avatar class is stale. This means that the result of get*PalmPosition will
// be stale. Instead, determine the current palm position with the current avatar's rigid body
// location and the saved offsets.
// this line is more correct but breaks for the current way avatar data is updated.
// palmPosition = avatarRigidBodyPosition + avatarRigidBodyRotation * _palmOffsetFromRigidBody;
// instead, use this for now:
palmPosition = avatarRigidBodyPosition + _palmOffsetFromRigidBody;
// the item jitters the least by getting the rotation based on the opinion of Avatar.h rather
// than that of the rigid body. leaving this next line here for future reference:
// palmRotation = avatarRigidBodyRotation * _palmRotationFromRigidBody;
if (isRightHand) {
palmRotation = holdingAvatar->getRightPalmRotation();
} else {
palmRotation = holdingAvatar->getLeftPalmRotation();
}
} else { } else {
if (isRightHand) { if (isRightHand) {
palmPosition = holdingAvatar->getRightPalmPosition(); palmPosition = holdingAvatar->getRightPalmPosition();
@ -103,14 +187,13 @@ void AvatarActionHold::updateActionWorker(float deltaTimeStep) {
if (valid && holdCount > 0) { if (valid && holdCount > 0) {
position /= holdCount; position /= holdCount;
bool gotLock = withTryWriteLock([&]{ withWriteLock([&]{
_positionalTarget = position; _positionalTarget = position;
_rotationalTarget = rotation; _rotationalTarget = rotation;
_positionalTargetSet = true; _positionalTargetSet = true;
_rotationalTargetSet = true; _rotationalTargetSet = true;
_active = true; _active = true;
}); });
if (gotLock) {
if (_kinematic) { if (_kinematic) {
doKinematicUpdate(deltaTimeStep); doKinematicUpdate(deltaTimeStep);
} else { } else {
@ -120,7 +203,6 @@ void AvatarActionHold::updateActionWorker(float deltaTimeStep) {
} }
} }
} }
}
void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) { void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) {
auto ownerEntity = _ownerEntity.lock(); auto ownerEntity = _ownerEntity.lock();

View file

@ -25,18 +25,21 @@ public:
AvatarActionHold(const QUuid& id, EntityItemPointer ownerEntity); AvatarActionHold(const QUuid& id, EntityItemPointer ownerEntity);
virtual ~AvatarActionHold(); virtual ~AvatarActionHold();
virtual bool updateArguments(QVariantMap arguments); virtual bool updateArguments(QVariantMap arguments) override;
virtual QVariantMap getArguments(); virtual QVariantMap getArguments() override;
virtual void updateActionWorker(float deltaTimeStep); virtual void updateActionWorker(float deltaTimeStep) override;
QByteArray serialize() const; QByteArray serialize() const;
virtual void deserialize(QByteArray serializedArguments); virtual void deserialize(QByteArray serializedArguments) override;
virtual bool shouldSuppressLocationEdits() { return _active && !_ownerEntity.expired(); } virtual bool shouldSuppressLocationEdits() override { return _active && !_ownerEntity.expired(); }
bool getAvatarRigidBodyLocation(glm::vec3& avatarRigidBodyPosition, glm::quat& avatarRigidBodyRotation);
std::shared_ptr<Avatar> getTarget(glm::quat& rotation, glm::vec3& position); std::shared_ptr<Avatar> getTarget(glm::quat& rotation, glm::vec3& position);
virtual void prepareForPhysicsSimulation() override;
private: private:
void doKinematicUpdate(float deltaTimeStep); void doKinematicUpdate(float deltaTimeStep);
@ -56,6 +59,10 @@ private:
float _previousDeltaTimeStep = 0.0f; float _previousDeltaTimeStep = 0.0f;
glm::vec3 _previousPositionalDelta; glm::vec3 _previousPositionalDelta;
glm::vec3 _palmOffsetFromRigidBody;
// leaving this here for future refernece.
// glm::quat _palmRotationFromRigidBody;
}; };
#endif // hifi_AvatarActionHold_h #endif // hifi_AvatarActionHold_h

View file

@ -146,8 +146,13 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QUrl& url,
localFileData = localFileString.toLocal8Bit(); localFileData = localFileString.toLocal8Bit();
} }
connection->respond(HTTPConnection::StatusCode200, localFileData, // if this is an shtml file just make the MIME type match HTML so browsers aren't confused
qPrintable(mimeDatabase.mimeTypeForFile(filePath).name())); // otherwise use the mimeDatabase to look it up
auto mimeType = localFileInfo.suffix() == "shtml"
? QString { "text/html" }
: mimeDatabase.mimeTypeForFile(filePath).name();
connection->respond(HTTPConnection::StatusCode200, localFileData, qPrintable(mimeType));
return true; return true;
} }

View file

@ -625,3 +625,11 @@ glm::vec3 RenderableModelEntityItem::getAbsoluteJointTranslationInObjectFrame(in
} }
return glm::vec3(0.0f); return glm::vec3(0.0f);
} }
void RenderableModelEntityItem::locationChanged() {
EntityItem::locationChanged();
if (_model && _model->isActive()) {
_model->setRotation(getRotation());
_model->setTranslation(getPosition());
}
}

View file

@ -73,6 +73,7 @@ public:
virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const override; virtual glm::vec3 getAbsoluteJointTranslationInObjectFrame(int index) const override;
virtual void loader() override; virtual void loader() override;
virtual void locationChanged() override;
private: private:
void remapTextures(); void remapTextures();

View file

@ -58,6 +58,8 @@ public:
virtual bool shouldSuppressLocationEdits() { return false; } virtual bool shouldSuppressLocationEdits() { return false; }
virtual void prepareForPhysicsSimulation() { }
// these look in the arguments map for a named argument. if it's not found or isn't well formed, // these look in the arguments map for a named argument. if it's not found or isn't well formed,
// ok will be set to false (note that it's never set to true -- set it to true before calling these). // ok will be set to false (note that it's never set to true -- set it to true before calling these).
// if required is true, failure to extract an argument will cause a warning to be printed. // if required is true, failure to extract an argument will cause a warning to be printed.

View file

@ -595,18 +595,20 @@ void ParticleEffectEntityItem::integrateParticle(Particle& particle, float delta
void ParticleEffectEntityItem::stepSimulation(float deltaTime) { void ParticleEffectEntityItem::stepSimulation(float deltaTime) {
// update particles between head and tail // update particles between head and tail
int popCount = 0;
for (Particle& particle : _particles) { for (Particle& particle : _particles) {
particle.lifetime += deltaTime; particle.lifetime += deltaTime;
// if particle has died. // if particle has died.
if (particle.lifetime >= _lifespan) { if (particle.lifetime >= _lifespan) {
// move head forward // move head forward
_particles.pop_front(); popCount++;
} else { } else {
// Otherwise update it // Otherwise update it
integrateParticle(particle, deltaTime); integrateParticle(particle, deltaTime);
} }
} }
_particles.erase(_particles.begin(), _particles.begin() + popCount);
// emit new particles, but only if we are emmitting // emit new particles, but only if we are emmitting
if (getIsEmitting() && _emitRate > 0.0f && _lifespan > 0.0f && _polarStart <= _polarFinish) { if (getIsEmitting() && _emitRate > 0.0f && _lifespan > 0.0f && _polarStart <= _polarFinish) {

View file

@ -236,9 +236,15 @@ void Socket::readPendingDatagrams() {
auto buffer = std::unique_ptr<char[]>(new char[packetSizeWithHeader]); auto buffer = std::unique_ptr<char[]>(new char[packetSizeWithHeader]);
// pull the datagram // pull the datagram
_udpSocket.readDatagram(buffer.get(), packetSizeWithHeader, auto sizeRead = _udpSocket.readDatagram(buffer.get(), packetSizeWithHeader,
senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer()); senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer());
if (sizeRead <= 0) {
// we either didn't pull anything for this packet or there was an error reading (this seems to trigger
// on windows even if there's not a packet available)
continue;
}
auto it = _unfilteredHandlers.find(senderSockAddr); auto it = _unfilteredHandlers.find(senderSockAddr);
if (it != _unfilteredHandlers.end()) { if (it != _unfilteredHandlers.end()) {
@ -248,7 +254,7 @@ void Socket::readPendingDatagrams() {
it->second(std::move(basePacket)); it->second(std::move(basePacket));
} }
return; continue;
} }
// check if this was a control packet or a data packet // check if this was a control packet or a data packet
@ -276,7 +282,7 @@ void Socket::readPendingDatagrams() {
packet->getDataSize(), packet->getDataSize(),
packet->getPayloadSize())) { packet->getPayloadSize())) {
// the connection indicated that we should not continue processing this packet // the connection indicated that we should not continue processing this packet
return; continue;
} }
} }

View file

@ -15,6 +15,7 @@
#include "BulletUtil.h" #include "BulletUtil.h"
#include "PhysicsCollisionGroups.h" #include "PhysicsCollisionGroups.h"
#include "ObjectMotionState.h"
const btVector3 LOCAL_UP_AXIS(0.0f, 1.0f, 0.0f); const btVector3 LOCAL_UP_AXIS(0.0f, 1.0f, 0.0f);
const float JUMP_SPEED = 3.5f; const float JUMP_SPEED = 3.5f;
@ -379,3 +380,15 @@ void CharacterController::preSimulation() {
void CharacterController::postSimulation() { void CharacterController::postSimulation() {
// postSimulation() exists for symmetry and just in case we need to do something here later // postSimulation() exists for symmetry and just in case we need to do something here later
} }
bool CharacterController::getRigidBodyLocation(glm::vec3& avatarRigidBodyPosition, glm::quat& avatarRigidBodyRotation) {
if (!_rigidBody) {
return false;
}
const btTransform& worldTrans = _rigidBody->getCenterOfMassTransform();
avatarRigidBodyPosition = bulletToGLM(worldTrans.getOrigin()) + ObjectMotionState::getWorldOffset();
avatarRigidBodyRotation = bulletToGLM(worldTrans.getRotation());
return true;
}

View file

@ -79,6 +79,8 @@ public:
void setEnabled(bool enabled); void setEnabled(bool enabled);
bool isEnabled() const { return _enabled && _dynamicsWorld; } bool isEnabled() const { return _enabled && _dynamicsWorld; }
bool getRigidBodyLocation(glm::vec3& avatarRigidBodyPosition, glm::quat& avatarRigidBodyRotation);
protected: protected:
void updateUpAxis(const glm::quat& rotation); void updateUpAxis(const glm::quat& rotation);

View file

@ -29,12 +29,12 @@ public:
ObjectAction(EntityActionType type, const QUuid& id, EntityItemPointer ownerEntity); ObjectAction(EntityActionType type, const QUuid& id, EntityItemPointer ownerEntity);
virtual ~ObjectAction(); virtual ~ObjectAction();
virtual void removeFromSimulation(EntitySimulation* simulation) const; virtual void removeFromSimulation(EntitySimulation* simulation) const override;
virtual EntityItemWeakPointer getOwnerEntity() const { return _ownerEntity; } virtual EntityItemWeakPointer getOwnerEntity() const override { return _ownerEntity; }
virtual void setOwnerEntity(const EntityItemPointer ownerEntity) { _ownerEntity = ownerEntity; } virtual void setOwnerEntity(const EntityItemPointer ownerEntity) override { _ownerEntity = ownerEntity; }
virtual bool updateArguments(QVariantMap arguments); virtual bool updateArguments(QVariantMap arguments) override;
virtual QVariantMap getArguments(); virtual QVariantMap getArguments() override;
// this is called from updateAction and should be overridden by subclasses // this is called from updateAction and should be overridden by subclasses
virtual void updateActionWorker(float deltaTimeStep) = 0; virtual void updateActionWorker(float deltaTimeStep) = 0;
@ -43,25 +43,25 @@ public:
virtual void updateAction(btCollisionWorld* collisionWorld, btScalar deltaTimeStep); virtual void updateAction(btCollisionWorld* collisionWorld, btScalar deltaTimeStep);
virtual void debugDraw(btIDebugDraw* debugDrawer); virtual void debugDraw(btIDebugDraw* debugDrawer);
virtual QByteArray serialize() const = 0; virtual QByteArray serialize() const override = 0;
virtual void deserialize(QByteArray serializedArguments) = 0; virtual void deserialize(QByteArray serializedArguments) override = 0;
virtual bool lifetimeIsOver(); virtual bool lifetimeIsOver() override;
virtual quint64 getExpires() { return _expires; } virtual quint64 getExpires() override { return _expires; }
protected: protected:
quint64 localTimeToServerTime(quint64 timeValue) const; quint64 localTimeToServerTime(quint64 timeValue) const;
quint64 serverTimeToLocalTime(quint64 timeValue) const; quint64 serverTimeToLocalTime(quint64 timeValue) const;
virtual btRigidBody* getRigidBody(); virtual btRigidBody* getRigidBody();
virtual glm::vec3 getPosition(); virtual glm::vec3 getPosition() override;
virtual void setPosition(glm::vec3 position); virtual void setPosition(glm::vec3 position) override;
virtual glm::quat getRotation(); virtual glm::quat getRotation() override;
virtual void setRotation(glm::quat rotation); virtual void setRotation(glm::quat rotation) override;
virtual glm::vec3 getLinearVelocity(); virtual glm::vec3 getLinearVelocity() override;
virtual void setLinearVelocity(glm::vec3 linearVelocity); virtual void setLinearVelocity(glm::vec3 linearVelocity) override;
virtual glm::vec3 getAngularVelocity(); virtual glm::vec3 getAngularVelocity() override;
virtual void setAngularVelocity(glm::vec3 angularVelocity); virtual void setAngularVelocity(glm::vec3 angularVelocity) override;
virtual void activateBody(); virtual void activateBody();
virtual void forceBodyNonStatic(); virtual void forceBodyNonStatic();

View file

@ -22,13 +22,13 @@ public:
ObjectActionOffset(const QUuid& id, EntityItemPointer ownerEntity); ObjectActionOffset(const QUuid& id, EntityItemPointer ownerEntity);
virtual ~ObjectActionOffset(); virtual ~ObjectActionOffset();
virtual bool updateArguments(QVariantMap arguments); virtual bool updateArguments(QVariantMap arguments) override;
virtual QVariantMap getArguments(); virtual QVariantMap getArguments() override;
virtual void updateActionWorker(float deltaTimeStep); virtual void updateActionWorker(float deltaTimeStep) override;
virtual QByteArray serialize() const; virtual QByteArray serialize() const override;
virtual void deserialize(QByteArray serializedArguments); virtual void deserialize(QByteArray serializedArguments) override;
private: private:
static const uint16_t offsetVersion; static const uint16_t offsetVersion;

View file

@ -19,13 +19,13 @@ public:
ObjectActionSpring(const QUuid& id, EntityItemPointer ownerEntity); ObjectActionSpring(const QUuid& id, EntityItemPointer ownerEntity);
virtual ~ObjectActionSpring(); virtual ~ObjectActionSpring();
virtual bool updateArguments(QVariantMap arguments); virtual bool updateArguments(QVariantMap arguments) override;
virtual QVariantMap getArguments(); virtual QVariantMap getArguments() override;
virtual void updateActionWorker(float deltaTimeStep); virtual void updateActionWorker(float deltaTimeStep) override;
virtual QByteArray serialize() const; virtual QByteArray serialize() const override;
virtual void deserialize(QByteArray serializedArguments); virtual void deserialize(QByteArray serializedArguments) override;
protected: protected:
static const uint16_t springVersion; static const uint16_t springVersion;

View file

@ -497,3 +497,11 @@ void PhysicsEngine::removeAction(const QUuid actionID) {
_objectActions.remove(actionID); _objectActions.remove(actionID);
} }
} }
void PhysicsEngine::forEachAction(std::function<void(EntityActionPointer)> actor) {
QHashIterator<QUuid, EntityActionPointer> iter(_objectActions);
while (iter.hasNext()) {
iter.next();
actor(iter.value());
}
}

View file

@ -97,6 +97,7 @@ public:
EntityActionPointer getActionByID(const QUuid& actionID) const; EntityActionPointer getActionByID(const QUuid& actionID) const;
void addAction(EntityActionPointer action); void addAction(EntityActionPointer action);
void removeAction(const QUuid actionID); void removeAction(const QUuid actionID);
void forEachAction(std::function<void(EntityActionPointer)> actor);
private: private:
void removeContacts(ObjectMotionState* motionState); void removeContacts(ObjectMotionState* motionState);

164
tools/nsis/release.nsi Normal file
View file

@ -0,0 +1,164 @@
!include LogicLib.nsh
!include x64.nsh
!define srcdir "$%INSTALLER_SOURCE_DIR%"
!define setup "$%INSTALLER_NAME%"
!define scriptsdir "$%INSTALLER_SCRIPTS_DIR%"
!define company "$%INSTALLER_COMPANY%"
!define install_directory "$%INSTALLER_DIRECTORY%"
!define interface_exec "interface.exe"
!define stack_manager_exec "stack-manager.exe"
!define interface_icon "interface.ico"
!define stack_manager_icon "stack-manager.ico"
!define regkey "Software\${company}"
!define uninstkey "Software\Microsoft\Windows\CurrentVersion\Uninstall\${company}"
!define install_dir_company "$PROGRAMFILES64\${install_directory}"
!define startmenu_company "$SMPROGRAMS\${install_directory}"
!define uninstaller "uninstall.exe"
;--------------------------------
XPStyle on
ShowInstDetails hide
ShowUninstDetails hide
Name "${company}"
Caption "${company}"
!ifdef icon
Icon "${icon}"
!endif
OutFile "${setup}"
SetDateSave on
SetDatablockOptimize on
CRCCheck on
SilentInstall normal
InstallDir "${install_dir_company}"
InstallDirRegKey HKLM "${regkey}" ""
; Page components
Page directory
Page components
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
;--------------------------------
AutoCloseWindow true
ShowInstDetails show
!ifdef screenimage
; set up background image
; uses BgImage plugin
Function .onGUIInit
; extract background BMP into temp plugin directory
InitPluginsDir
File /oname=$PLUGINSDIR\1.bmp "${screenimage}"
BgImage::SetBg /NOUNLOAD /FILLSCREEN $PLUGINSDIR\1.bmp
BgImage::Redraw /NOUNLOAD
FunctionEnd
Function .onGUIEnd
; Destroy must not have /NOUNLOAD so NSIS will be able to unload and delete BgImage before it exits
BgImage::Destroy
FunctionEnd
!endif
; Optional Component Selection
Section /o "DDE Face Recognition" SEC01
SetOutPath "$INSTDIR"
CreateDirectory $INSTDIR\dde
NSISdl::download "https://s3-us-west-1.amazonaws.com/hifi-production/optionals/dde-installer.exe" "$INSTDIR\dde-installer.exe"
ExecWait '"$INSTDIR\dde-installer.exe" /q:a /t:"$INSTDIR\dde"'
SectionEnd
; beginning (invisible) section
Section "Registry Entries and Procotol Handler" SEC02
SectionIn RO
WriteRegStr HKLM "${regkey}" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "${uninstkey}" "DisplayName" "${company} (remove only)"
WriteRegStr HKLM "${uninstkey}" "UninstallString" '"$INSTDIR\${uninstaller}"'
WriteRegStr HKCR "${company}\Shell\open\command\" "" '"$INSTDIR\${interface_exec} "%1"'
WriteRegStr HKCR "${company}\DefaultIcon" "" "$INSTDIR\${interface_icon}"
; hifi:// protocol handler registry entries
WriteRegStr HKCR 'hifi' '' 'URL:Alert Protocol'
WriteRegStr HKCR 'hifi' 'URL Protocol' ''
WriteRegStr HKCR 'hifi\DefaultIcon' '' '$INSTDIR\${interface_icon},1'
WriteRegStr HKCR 'hifi\shell\open\command' '' '$INSTDIR\${interface_exec} --url "%1"'
SetOutPath $INSTDIR
; package all files, recursively, preserving attributes
; assume files are in the correct places
File /r "${srcdir}\"
File /a "${srcdir}\${interface_icon}"
File /a "${srcdir}\${stack_manager_icon}"
; any application-specific files
!ifdef files
!include "${files}"
!endif
WriteUninstaller "${uninstaller}"
Exec '"$INSTDIR\2013_vcredist_x64.exe" /q /norestart'
Exec '"$INSTDIR\2010_vcredist_x86.exe" /q /norestart'
SectionEnd
; create shortcuts
Section "Start Menu Shortcuts" SEC03
SectionIn RO
; This should install the shortcuts for "All Users"
SetShellVarContext all
CreateDirectory "${startmenu_company}"
SetOutPath $INSTDIR ; for working directory
CreateShortCut "${startmenu_company}\Interface.lnk" "$INSTDIR\${interface_exec}" "" "$INSTDIR\${interface_icon}"
CreateShortCut "${startmenu_company}\Stack Manager.lnk" "$INSTDIR\${stack_manager_exec}" "" "$INSTDIR\${stack_manager_icon}"
CreateShortCut "${startmenu_company}\Uninstall ${company}.lnk" "$INSTDIR\${uninstaller}"
SectionEnd
; Uninstaller
; All section names prefixed by "Un" will be in the uninstaller
UninstallText "This will uninstall ${company}."
!ifdef icon
UninstallIcon "${interface_icon}"
!endif
Section "Uninstall" SEC04
SectionIn RO
; Explicitly remove all added shortcuts
SetShellVarContext all
DELETE "${startmenu_company}\Interface.lnk"
DELETE "${startmenu_company}\Stack Manager.lnk"
DELETE "${startmenu_company}\Uninstall ${company}.lnk"
RMDIR "${startmenu_company}"
RMDIR /r "$INSTDIR"
; This should remove the High Fidelity folder in Program Files if it's empty
RMDIR "${install_dir_company}"
!ifdef unfiles
!include "${unfiles}"
!endif
; It's good practice to put the registry key removal at the very end
DeleteRegKey HKLM "${uninstkey}"
DeleteRegKey HKLM "${regkey}"
DeleteRegKey HKCR 'hifi'
SectionEnd