From 1f7914766c7ddaef4dcbe898c1f1d885c07c05dc Mon Sep 17 00:00:00 2001 From: James Pollack Date: Fri, 25 Sep 2015 15:26:29 -0700 Subject: [PATCH 01/14] Add ability to prevent an object from being grabbable by specifying a custom key grabbableKey to grabbable:false --- examples/controllers/handControllerGrab.js | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index a13f1de86d..27ffbee60c 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -72,8 +72,9 @@ var STATE_NEAR_GRABBING_NON_COLLIDING = 5; var STATE_CONTINUE_NEAR_GRABBING_NON_COLLIDING = 6; var STATE_RELEASE = 7; - var GRAB_USER_DATA_KEY = "grabKey"; +var GRABBABLE_DATA_KEY = "grabbableKey"; + function MyController(hand, triggerAction) { this.hand = hand; if (this.hand === RIGHT_HAND) { @@ -182,6 +183,11 @@ function MyController(hand, triggerAction) { origin: handPosition, direction: Quat.getUp(this.getHandRotation()) }; + + var defaultGrabbableData = { + grabbable: true + }; + var intersection = Entities.findRayIntersection(pickRay, true); if (intersection.intersects && intersection.properties.collisionsWillMove === 1 && @@ -190,9 +196,15 @@ function MyController(hand, triggerAction) { var handControllerPosition = Controller.getSpatialControlPosition(this.palm); var intersectionDistance = Vec3.distance(handControllerPosition, intersection.intersection); this.grabbedEntity = intersection.entityID; + + var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, intersection.entityID, defaultGrabbableData); + if (grabbableData.grabbable === false) { + return; + } if (intersectionDistance < NEAR_PICK_MAX_DISTANCE) { // the hand is very close to the intersected object. go into close-grabbing mode. this.state = STATE_NEAR_GRABBING; + } else { // the hand is far from the intersected object. go into distance-holding mode this.state = STATE_DISTANCE_HOLDING; @@ -203,8 +215,16 @@ function MyController(hand, triggerAction) { var nearbyEntities = Entities.findEntities(handPosition, GRAB_RADIUS); var minDistance = GRAB_RADIUS; var i, props, distance; + for (i = 0; i < nearbyEntities.length; i++) { + + var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, nearbyEntities[i], defaultGrabbableData); + if (grabbableData.grabbable === false) { + return + } + props = Entities.getEntityProperties(nearbyEntities[i], ["position", "name", "collisionsWillMove", "locked"]); + distance = Vec3.distance(props.position, handPosition); if (distance < minDistance && props.name !== "pointer") { this.grabbedEntity = nearbyEntities[i]; @@ -383,7 +403,7 @@ function MyController(hand, triggerAction) { Entities.callEntityMethod(this.grabbedEntity, "continueNearGrabbingNonColliding"); }; - _this.allTouchedIDs={}; + _this.allTouchedIDs = {}; this.touchTest = function() { var maxDistance = 0.05; var leftHandPosition = MyAvatar.getLeftPalmPosition(); From 14fc39ffa3426764de43f34e6564348a8f912242 Mon Sep 17 00:00:00 2001 From: Thijs Wenker Date: Sat, 26 Sep 2015 02:36:01 +0200 Subject: [PATCH 02/14] Added JS access to the variables Stats.audioPacketlossUpstream Stats.audioPacketlossDownstream Which contain a floating point with the value between 0.0f and 1.0f which is the percentage of packet loss. --- interface/src/ui/Stats.cpp | 1 + interface/src/ui/Stats.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/interface/src/ui/Stats.cpp b/interface/src/ui/Stats.cpp index ebce4f2b96..831664e3e6 100644 --- a/interface/src/ui/Stats.cpp +++ b/interface/src/ui/Stats.cpp @@ -46,6 +46,7 @@ Stats::Stats(QQuickItem* parent) : QQuickItem(parent) { INSTANCE = this; const QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont); _monospaceFont = font.family(); + _audioStats = &DependencyManager::get()->getStats(); } bool Stats::includeTimingRecord(const QString& name) { diff --git a/interface/src/ui/Stats.h b/interface/src/ui/Stats.h index 2e4c5e4dca..d6aa255dc6 100644 --- a/interface/src/ui/Stats.h +++ b/interface/src/ui/Stats.h @@ -12,6 +12,7 @@ #include #include #include +#include #define STATS_PROPERTY(type, name, initialValue) \ Q_PROPERTY(type name READ name NOTIFY name##Changed) \ @@ -27,6 +28,8 @@ class Stats : public QQuickItem { Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded NOTIFY expandedChanged) Q_PROPERTY(bool timingExpanded READ isTimingExpanded NOTIFY timingExpandedChanged) Q_PROPERTY(QString monospaceFont READ monospaceFont CONSTANT) + Q_PROPERTY(float audioPacketlossUpstream READ getAudioPacketLossUpstream) + Q_PROPERTY(float audioPacketlossDownstream READ getAudioPacketLossDownstream) STATS_PROPERTY(int, serverCount, 0) STATS_PROPERTY(int, framerate, 0) @@ -81,6 +84,10 @@ public: const QString& monospaceFont() { return _monospaceFont; } + + float getAudioPacketLossUpstream() { return _audioStats->getMixerAvatarStreamStats()._packetStreamStats.getLostRate(); } + float getAudioPacketLossDownstream() { return _audioStats->getMixerDownstreamStats()._packetStreamStats.getLostRate(); } + void updateStats(bool force = false); bool isExpanded() { return _expanded; } @@ -149,6 +156,7 @@ private: bool _expanded{ false }; bool _timingExpanded{ false }; QString _monospaceFont; + const AudioIOStats* _audioStats; }; #endif // hifi_Stats_h From b254353b38272344afaf16a1c8f5135747939483 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Sat, 26 Sep 2015 07:09:41 -0700 Subject: [PATCH 03/14] Update collectHifiStats.js Clears the current batch after we send it to the endpoint. --- examples/example/misc/collectHifiStats.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/example/misc/collectHifiStats.js b/examples/example/misc/collectHifiStats.js index 3902622217..8501fbb057 100644 --- a/examples/example/misc/collectHifiStats.js +++ b/examples/example/misc/collectHifiStats.js @@ -90,4 +90,5 @@ function sendBatchToEndpoint(batch) { var req = new XMLHttpRequest(); req.open("POST", ENDPOINT_URL, false); req.send(JSON.stringify(batch)); -} \ No newline at end of file + batch = []; +} From a2562c92f44d4d54b914c74f58538191b1734b17 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Sun, 27 Sep 2015 16:24:55 -0700 Subject: [PATCH 04/14] Small changes to Anim System for Debugging * Added constant for Rig animation fade time * Added index output for AnimSkeleton::dump() --- libraries/animation/src/AnimSkeleton.cpp | 2 ++ libraries/animation/src/Rig.cpp | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libraries/animation/src/AnimSkeleton.cpp b/libraries/animation/src/AnimSkeleton.cpp index 6731756aeb..173e387608 100644 --- a/libraries/animation/src/AnimSkeleton.cpp +++ b/libraries/animation/src/AnimSkeleton.cpp @@ -173,6 +173,7 @@ void AnimSkeleton::dump() const { qCDebug(animation) << "["; for (int i = 0; i < getNumJoints(); i++) { qCDebug(animation) << " {"; + qCDebug(animation) << " index =" << i; qCDebug(animation) << " name =" << getJointName(i); qCDebug(animation) << " absBindPose =" << getAbsoluteBindPose(i); qCDebug(animation) << " relBindPose =" << getRelativeBindPose(i); @@ -188,6 +189,7 @@ void AnimSkeleton::dump(const AnimPoseVec& poses) const { qCDebug(animation) << "["; for (int i = 0; i < getNumJoints(); i++) { qCDebug(animation) << " {"; + qCDebug(animation) << " index =" << i; qCDebug(animation) << " name =" << getJointName(i); qCDebug(animation) << " absBindPose =" << getAbsoluteBindPose(i); qCDebug(animation) << " relBindPose =" << getRelativeBindPose(i); diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 1874939b3d..130398eb4a 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -145,16 +145,19 @@ AnimationHandlePointer Rig::addAnimationByRole(const QString& role, const QStrin } return handle; } + +const float FADE_FRAMES = 30.0f; + void Rig::startAnimationByRole(const QString& role, const QString& url, float fps, float priority, bool loop, bool hold, float firstFrame, float lastFrame, const QStringList& maskedJoints) { AnimationHandlePointer handle = addAnimationByRole(role, url, fps, priority, loop, hold, firstFrame, lastFrame, maskedJoints, true); - handle->setFadePerSecond(1.0f); // For now. Could be individualized later. + handle->setFadePerSecond(30.0f / FADE_FRAMES); // For now. Could be individualized later. } void Rig::stopAnimationByRole(const QString& role) { foreach (const AnimationHandlePointer& handle, getRunningAnimations()) { if (handle->getRole() == role) { - handle->setFadePerSecond(-1.0f); // For now. Could be individualized later. + handle->setFadePerSecond(-(30.0f / FADE_FRAMES)); // For now. Could be individualized later. } } } @@ -163,7 +166,7 @@ void Rig::stopAnimation(const QString& url) { foreach (const AnimationHandlePointer& handle, getRunningAnimations()) { if (handle->getURL() == url) { handle->setFade(0.0f); // right away. Will be remove during updateAnimations, without locking - handle->setFadePerSecond(-1.0f); // so that the updateAnimation code notices + handle->setFadePerSecond(-(30.0f / FADE_FRAMES)); // so that the updateAnimation code notices } } } From 5a24a020ca5069a0e23f3b0052744c9b1b18f435 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Sun, 27 Sep 2015 17:44:54 -0700 Subject: [PATCH 05/14] Fix for HMD rotation sticking between 2d & HMD mode The main fix for this was to set the JointState animation priority to 3.0 The secondary fix was only noticed when we changed the animation priority Basically, the debugRendering was using the JointStates after they were manipulated by SkeletonModel to 'relax' them toward thier default pose for IK purposes. --- interface/src/avatar/SkeletonModel.cpp | 53 ++++++++++++++------------ libraries/animation/src/Rig.cpp | 4 +- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index 703f3983ee..b1f6e6d8d1 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -246,33 +246,36 @@ void SkeletonModel::simulate(float deltaTime, bool fullUpdate) { Hand* hand = _owningAvatar->getHand(); hand->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex); - const float HAND_RESTORATION_RATE = 0.25f; - if (leftPalmIndex == -1 && rightPalmIndex == -1) { - // palms are not yet set, use mouse - if (_owningAvatar->getHandState() == HAND_STATE_NULL) { - restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); - } else { - // transform into model-frame - glm::vec3 handPosition = glm::inverse(_rotation) * (_owningAvatar->getHandPosition() - _translation); - applyHandPosition(geometry.rightHandJointIndex, handPosition); - } - restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); - - } else if (leftPalmIndex == rightPalmIndex) { - // right hand only - applyPalmData(geometry.rightHandJointIndex, hand->getPalms()[leftPalmIndex]); - restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); - - } else { - if (leftPalmIndex != -1) { - applyPalmData(geometry.leftHandJointIndex, hand->getPalms()[leftPalmIndex]); - } else { + // Don't Relax toward hand positions when in animGraph mode. + if (!_rig->getEnableAnimGraph()) { + const float HAND_RESTORATION_RATE = 0.25f; + if (leftPalmIndex == -1 && rightPalmIndex == -1) { + // palms are not yet set, use mouse + if (_owningAvatar->getHandState() == HAND_STATE_NULL) { + restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); + } else { + // transform into model-frame + glm::vec3 handPosition = glm::inverse(_rotation) * (_owningAvatar->getHandPosition() - _translation); + applyHandPosition(geometry.rightHandJointIndex, handPosition); + } restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); - } - if (rightPalmIndex != -1) { - applyPalmData(geometry.rightHandJointIndex, hand->getPalms()[rightPalmIndex]); + + } else if (leftPalmIndex == rightPalmIndex) { + // right hand only + applyPalmData(geometry.rightHandJointIndex, hand->getPalms()[leftPalmIndex]); + restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); + } else { - restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); + if (leftPalmIndex != -1) { + applyPalmData(geometry.leftHandJointIndex, hand->getPalms()[leftPalmIndex]); + } else { + restoreLeftHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); + } + if (rightPalmIndex != -1) { + applyPalmData(geometry.rightHandJointIndex, hand->getPalms()[rightPalmIndex]); + } else { + restoreRightHandPosition(HAND_RESTORATION_RATE, PALM_PRIORITY); + } } } } diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 130398eb4a..491a390025 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -591,9 +591,9 @@ void Rig::updateAnimations(float deltaTime, glm::mat4 rootTransform) { } // copy poses into jointStates - const float PRIORITY = 1.0f; + const float PRIORITY = 3.0f; for (size_t i = 0; i < poses.size(); i++) { - setJointRotationInConstrainedFrame((int)i, glm::inverse(_animSkeleton->getRelativeBindPose(i).rot) * poses[i].rot, PRIORITY, false); + setJointRotationInConstrainedFrame((int)i, glm::inverse(_animSkeleton->getRelativeBindPose(i).rot) * poses[i].rot, PRIORITY, false, 1.0f); } } else { From 4b31d87bf5b11c312d6d4f53db18bfd305487895 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Sun, 27 Sep 2015 17:52:53 -0700 Subject: [PATCH 06/14] renamed magic constant to FRAMES_PER_SECOND. --- libraries/animation/src/Rig.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 491a390025..a0cb278ef3 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -147,17 +147,18 @@ AnimationHandlePointer Rig::addAnimationByRole(const QString& role, const QStrin } const float FADE_FRAMES = 30.0f; +const float FRAMES_PER_SECOND = 30.0f; void Rig::startAnimationByRole(const QString& role, const QString& url, float fps, float priority, bool loop, bool hold, float firstFrame, float lastFrame, const QStringList& maskedJoints) { AnimationHandlePointer handle = addAnimationByRole(role, url, fps, priority, loop, hold, firstFrame, lastFrame, maskedJoints, true); - handle->setFadePerSecond(30.0f / FADE_FRAMES); // For now. Could be individualized later. + handle->setFadePerSecond(FRAMES_PER_SECOND / FADE_FRAMES); // For now. Could be individualized later. } void Rig::stopAnimationByRole(const QString& role) { foreach (const AnimationHandlePointer& handle, getRunningAnimations()) { if (handle->getRole() == role) { - handle->setFadePerSecond(-(30.0f / FADE_FRAMES)); // For now. Could be individualized later. + handle->setFadePerSecond(-(FRAMES_PER_SECOND / FADE_FRAMES)); // For now. Could be individualized later. } } } @@ -166,7 +167,7 @@ void Rig::stopAnimation(const QString& url) { foreach (const AnimationHandlePointer& handle, getRunningAnimations()) { if (handle->getURL() == url) { handle->setFade(0.0f); // right away. Will be remove during updateAnimations, without locking - handle->setFadePerSecond(-(30.0f / FADE_FRAMES)); // so that the updateAnimation code notices + handle->setFadePerSecond(-(FRAMES_PER_SECOND / FADE_FRAMES)); // so that the updateAnimation code notices } } } From c970ff0c0cc60fefba2041d09d0fd0f4534dce16 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Sun, 27 Sep 2015 18:25:28 -0700 Subject: [PATCH 07/14] Reset joint priorities back to 0 for new animation system. Added Rig::clearJointStatePriorities() to do this. --- libraries/animation/src/Rig.cpp | 10 +++++++++- libraries/animation/src/Rig.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index a0cb278ef3..192af54201 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -591,8 +591,10 @@ void Rig::updateAnimations(float deltaTime, glm::mat4 rootTransform) { _animVars.setTrigger(trigger); } + clearJointStatePriorities(); + // copy poses into jointStates - const float PRIORITY = 3.0f; + const float PRIORITY = 1.0f; for (size_t i = 0; i < poses.size(); i++) { setJointRotationInConstrainedFrame((int)i, glm::inverse(_animSkeleton->getRelativeBindPose(i).rot) * poses[i].rot, PRIORITY, false, 1.0f); } @@ -930,6 +932,12 @@ void Rig::updateVisibleJointStates() { } } +void Rig::clearJointStatePriorities() { + for (int i = 0; i < _jointStates.size(); i++) { + _jointStates[i].setAnimationPriority(0.0f); + } +} + void Rig::setJointVisibleTransform(int jointIndex, glm::mat4 newTransform) { if (jointIndex == -1 || jointIndex >= _jointStates.size()) { return; diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index 90082ca38b..6dad58db87 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -172,6 +172,7 @@ public: bool getJointRotationInConstrainedFrame(int jointIndex, glm::quat& rotOut) const; glm::quat getJointDefaultRotationInParentFrame(int jointIndex); void updateVisibleJointStates(); + void clearJointStatePriorities(); virtual void updateJointState(int index, glm::mat4 rootTransform) = 0; From affb0253db2976427b2e2d56bbcff2d891af7737 Mon Sep 17 00:00:00 2001 From: "James B. Pollack" Date: Mon, 28 Sep 2015 10:26:52 -0700 Subject: [PATCH 08/14] Update handControllerGrab.js added a semicolon to the end of a return statement --- examples/controllers/handControllerGrab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/controllers/handControllerGrab.js b/examples/controllers/handControllerGrab.js index 27ffbee60c..41f36c19d5 100644 --- a/examples/controllers/handControllerGrab.js +++ b/examples/controllers/handControllerGrab.js @@ -220,7 +220,7 @@ function MyController(hand, triggerAction) { var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, nearbyEntities[i], defaultGrabbableData); if (grabbableData.grabbable === false) { - return + return; } props = Entities.getEntityProperties(nearbyEntities[i], ["position", "name", "collisionsWillMove", "locked"]); @@ -546,4 +546,4 @@ function cleanup() { } Script.scriptEnding.connect(cleanup); -Script.update.connect(update); \ No newline at end of file +Script.update.connect(update); From a495a45ed0b939045f20a108cce1658fe8fe9a83 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Mon, 28 Sep 2015 11:10:22 -0700 Subject: [PATCH 09/14] unset "lean" when headParams.enableLean is false Also added AnimVariantMap::dump() which will print out all the currently set anim vars and their values. --- libraries/animation/src/AnimVariant.h | 33 +++++++++++++++++++++++++++ libraries/animation/src/Rig.cpp | 2 ++ 2 files changed, 35 insertions(+) diff --git a/libraries/animation/src/AnimVariant.h b/libraries/animation/src/AnimVariant.h index de224f936a..700a8b4121 100644 --- a/libraries/animation/src/AnimVariant.h +++ b/libraries/animation/src/AnimVariant.h @@ -16,6 +16,7 @@ #include #include #include +#include "AnimationLogging.h" class AnimVariant { public: @@ -46,6 +47,7 @@ public: bool isQuat() const { return _type == Type::Quat; } bool isMat4() const { return _type == Type::Mat4; } bool isString() const { return _type == Type::String; } + Type getType() const { return _type; } void setBool(bool value) { assert(_type == Type::Bool); _val.boolVal = value; } void setInt(int value) { assert(_type == Type::Int); _val.intVal = value; } @@ -156,6 +158,37 @@ public: bool hasKey(const QString& key) const { return _map.find(key) != _map.end(); } +#ifdef NDEBUG + void dump() const { + qCDebug(animation) << "AnimVariantMap ="; + for (auto& pair : _map) { + switch (pair.second.getType()) { + case AnimVariant::Type::Bool: + qCDebug(animation) << " " << pair.first << "=" << pair.second.getBool(); + break; + case AnimVariant::Type::Int: + qCDebug(animation) << " " << pair.first << "=" << pair.second.getInt(); + break; + case AnimVariant::Type::Float: + qCDebug(animation) << " " << pair.first << "=" << pair.second.getFloat(); + break; + case AnimVariant::Type::Vec3: + qCDebug(animation) << " " << pair.first << "=" << pair.second.getVec3(); + break; + case AnimVariant::Type::Quat: + qCDebug(animation) << " " << pair.first << "=" << pair.second.getQuat(); + break; + case AnimVariant::Type::Mat4: + qCDebug(animation) << " " << pair.first << "=" << pair.second.getMat4(); + break; + case AnimVariant::Type::String: + qCDebug(animation) << " " << pair.first << "=" << pair.second.getString(); + break; + } + } + } +#endif + protected: std::map _map; std::set _triggers; diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 192af54201..0022749d51 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -962,6 +962,8 @@ glm::quat Rig::getJointDefaultRotationInParentFrame(int jointIndex) { void Rig::updateFromHeadParameters(const HeadParameters& params, float dt) { if (params.enableLean) { updateLeanJoint(params.leanJointIndex, params.leanSideways, params.leanForward, params.torsoTwist); + } else { + _animVars.unset("lean"); } updateNeckJoint(params.neckJointIndex, params); updateEyeJoints(params.leftEyeJointIndex, params.rightEyeJointIndex, params.modelTranslation, params.modelRotation, From 06ca4dfbde8e601fc934d2e6c858108228d65478 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 28 Sep 2015 14:26:53 -0400 Subject: [PATCH 10/14] fix polyvox double name change command --- cmake/externals/LibOVR/CMakeLists.txt | 2 +- cmake/externals/polyvox/CMakeLists.txt | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/externals/LibOVR/CMakeLists.txt b/cmake/externals/LibOVR/CMakeLists.txt index e03a3af484..8d13882d48 100644 --- a/cmake/externals/LibOVR/CMakeLists.txt +++ b/cmake/externals/LibOVR/CMakeLists.txt @@ -43,7 +43,7 @@ if (WIN32) endif() elseif(APPLE) - + ExternalProject_Add( ${EXTERNAL_NAME} URL http://static.oculus.com/sdk-downloads/ovr_sdk_macos_0.5.0.1.tar.gz diff --git a/cmake/externals/polyvox/CMakeLists.txt b/cmake/externals/polyvox/CMakeLists.txt index 14712e5537..3740e26762 100644 --- a/cmake/externals/polyvox/CMakeLists.txt +++ b/cmake/externals/polyvox/CMakeLists.txt @@ -19,19 +19,20 @@ ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR) if (APPLE) set(INSTALL_NAME_LIBRARY_DIR ${INSTALL_DIR}/lib) - message(STATUS "in polyvox INSTALL_NAME_LIBRARY_DIR ${INSTALL_NAME_LIBRARY_DIR}") + ExternalProject_Add_Step( ${EXTERNAL_NAME} - change-install-name + change-install-name-debug COMMENT "Calling install_name_tool on libraries to fix install name for dylib linking" COMMAND ${CMAKE_COMMAND} -DINSTALL_NAME_LIBRARY_DIR=${INSTALL_NAME_LIBRARY_DIR}/Debug -P ${EXTERNAL_PROJECT_DIR}/OSXInstallNameChange.cmake DEPENDEES install WORKING_DIRECTORY LOG 1 ) + ExternalProject_Add_Step( ${EXTERNAL_NAME} - change-install-name + change-install-name-release COMMENT "Calling install_name_tool on libraries to fix install name for dylib linking" COMMAND ${CMAKE_COMMAND} -DINSTALL_NAME_LIBRARY_DIR=${INSTALL_NAME_LIBRARY_DIR}/Release -P ${EXTERNAL_PROJECT_DIR}/OSXInstallNameChange.cmake DEPENDEES install From 3744632122918f2bf7a7dcde49b192be9b39eae7 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 28 Sep 2015 14:37:59 -0400 Subject: [PATCH 11/14] allow SDK fallback if 10.9 not present --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b91fac2538..87bf29e0e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,13 +127,14 @@ if (APPLE) ) if (NOT _OSX_DESIRED_SDK_PATH) - message(FATAL_ERROR "Could not find OS X ${OSX_SDK} SDK. Please pass OSX_SDK_PATH to CMake to point us to your SDKs directory.") + message(STATUS "Could not find OS X ${OSX_SDK} SDK. Will fall back to default. If you want a specific SDK, please pass OSX_SDK and optionall OSX_SDK_PATH to CMake.") else () message(STATUS "Found OS X ${OSX_SDK} SDK at ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk") + + # set that as the SDK to use + set(CMAKE_OSX_SYSROOT ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk) endif () - # set that as the SDK to use - set(CMAKE_OSX_SYSROOT ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk) endif () # Hide automoc folders (for IDEs) From 386df86fd16ba2179a30aad1358ef663dcc21375 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 28 Sep 2015 14:52:17 -0400 Subject: [PATCH 12/14] use the OS X version as the desired SDK --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87bf29e0e2..0e6114b67c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,7 +112,12 @@ set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH}) if (APPLE) - SET(OSX_SDK "10.9" CACHE String "OS X SDK version to look for inside Xcode bundle or at OSX_SDK_PATH") + exec_program(sw_vers ARGS -productVersion OUTPUT_VARIABLE OSX_VERSION) + message(STATUS "${OSX_VERSION}") + string(REGEX MATCH "^[0-9]+\\.[0-9]+" OSX_VERSION ${OSX_VERSION}) + message(STATUS "Detected OS X version = ${OSX_VERSION}") + + set(OSX_SDK "${OSX_VERSION}" CACHE String "OS X SDK version to look for inside Xcode bundle or at OSX_SDK_PATH") # set our OS X deployment target set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) @@ -127,7 +132,7 @@ if (APPLE) ) if (NOT _OSX_DESIRED_SDK_PATH) - message(STATUS "Could not find OS X ${OSX_SDK} SDK. Will fall back to default. If you want a specific SDK, please pass OSX_SDK and optionall OSX_SDK_PATH to CMake.") + message(STATUS "Could not find OS X ${OSX_SDK} SDK. Will fall back to default. If you want a specific SDK, please pass OSX_SDK and optionally OSX_SDK_PATH to CMake.") else () message(STATUS "Found OS X ${OSX_SDK} SDK at ${_OSX_DESIRED_SDK_PATH}/MacOSX${OSX_SDK}.sdk") From 29765200614ad7e47fea8016ab77c388d3719fee Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 28 Sep 2015 14:53:51 -0400 Subject: [PATCH 13/14] remove an extra debug in root CMake --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e6114b67c..0e7df899ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,7 +113,6 @@ set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH}) if (APPLE) exec_program(sw_vers ARGS -productVersion OUTPUT_VARIABLE OSX_VERSION) - message(STATUS "${OSX_VERSION}") string(REGEX MATCH "^[0-9]+\\.[0-9]+" OSX_VERSION ${OSX_VERSION}) message(STATUS "Detected OS X version = ${OSX_VERSION}") From 203c601e95fcd1c1c320afaef62cc6e64b985222 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 28 Sep 2015 12:26:11 -0700 Subject: [PATCH 14/14] Fix for bad textures when using _glActiveBindTexture --- libraries/gpu/src/gpu/GLBackend.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/gpu/src/gpu/GLBackend.cpp b/libraries/gpu/src/gpu/GLBackend.cpp index e8bc32d567..aac2d63a9b 100644 --- a/libraries/gpu/src/gpu/GLBackend.cpp +++ b/libraries/gpu/src/gpu/GLBackend.cpp @@ -418,6 +418,8 @@ void GLBackend::resetStages() { #define DO_IT_NOW(call, offset) void Batch::_glActiveBindTexture(GLenum unit, GLenum target, GLuint texture) { + setResourceTexture(unit - GL_TEXTURE0, nullptr); + ADD_COMMAND_GL(glActiveBindTexture); _params.push_back(texture);