Merge branch 'master' of https://github.com/highfidelity/hifi into addViewFrustumToAvatarMixer

This commit is contained in:
Brad Hefta-Gaub 2016-12-21 08:59:29 -08:00
commit be62df2001
5 changed files with 52 additions and 36 deletions

View file

@ -66,7 +66,6 @@
#include <ErrorDialog.h>
#include <FileScriptingInterface.h>
#include <Finally.h>
#include <FingerprintUtils.h>
#include <FramebufferCache.h>
#include <gpu/Batch.h>
#include <gpu/Context.h>
@ -614,9 +613,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
// TODO: This is temporary, while developing
FingerprintUtils::getMachineFingerprint();
// End TODO
auto nodeList = DependencyManager::get<NodeList>();
// Set up a watchdog thread to intentionally crash the application on deadlocks

View file

@ -134,11 +134,16 @@ void AvatarHashMap::processAvatarIdentityPacket(QSharedPointer<ReceivedMessage>
// make sure this isn't for an ignored avatar
auto nodeList = DependencyManager::get<NodeList>();
static auto EMPTY = QUuid();
if (identity.uuid == _avatarHash.value(EMPTY)->getSessionUUID()) {
// We add MyAvatar to _avatarHash with an empty UUID. Code relies on this. In order to correctly handle an
// identity packet for ourself (such as when we are assigned a sessionDisplayName by the mixer upon joining),
// we make things match here.
identity.uuid = EMPTY;
{
QReadLocker locker(&_hashLock);
auto me = _avatarHash.find(EMPTY);
if ((me != _avatarHash.end()) && (identity.uuid == me.value()->getSessionUUID())) {
// We add MyAvatar to _avatarHash with an empty UUID. Code relies on this. In order to correctly handle an
// identity packet for ourself (such as when we are assigned a sessionDisplayName by the mixer upon joining),
// we make things match here.
identity.uuid = EMPTY;
}
}
if (!nodeList->isIgnoringNode(identity.uuid)) {
// mesh URL for a UUID, find avatar in our list

View file

@ -373,9 +373,9 @@ void NodeList::sendDomainServerCheckIn() {
packetStream << hardwareAddress;
// add in machine fingerprint
QUuid machineFingerprint = FingerprintUtils::getMachineFingerprint();
packetStream << machineFingerprint;
// now add the machine fingerprint - a null UUID if logged in, real one if not logged in
auto accountManager = DependencyManager::get<AccountManager>();
packetStream << (accountManager->isLoggedIn() ? QUuid() : FingerprintUtils::getMachineFingerprint());
}
// pack our data to send to the domain-server including

View file

@ -823,7 +823,7 @@ function MyController(hand) {
if (this.hand === RIGHT_HAND && this.state === STATE_SEARCHING && this.getOtherHandController().state === STATE_SEARCHING) {
this.maybeScaleMyAvatar();
}
if (this.ignoreInput()) {
this.turnOffVisualizations();
return;
@ -1062,12 +1062,6 @@ function MyController(hand) {
this.secondaryPress = function(value) {
_this.rawSecondaryValue = value;
// The value to check if we will allow the release function to be called
var allowReleaseValue = 0.1;
if (value > 0 && _this.state == STATE_HOLD) {
_this.release();
}
};
this.updateSmoothedTrigger = function() {
@ -1118,19 +1112,18 @@ function MyController(hand) {
};
this.off = function(deltaTime, timestamp) {
if (this.triggerSmoothedReleased()) {
if (this.triggerSmoothedReleased() && this.secondaryReleased()) {
this.waitForTriggerRelease = false;
}
if (!this.waitForTriggerRelease && this.triggerSmoothedSqueezed()) {
if (!this.waitForTriggerRelease && (this.triggerSmoothedSqueezed() || this.secondarySqueezed())) {
this.lastPickTime = 0;
this.startingHandRotation = getControllerWorldLocation(this.handToController(), true).orientation;
if (this.triggerSmoothedSqueezed()) {
this.setState(STATE_SEARCHING, "trigger squeeze detected");
return;
}
this.searchStartTime = Date.now();
this.setState(STATE_SEARCHING, "trigger squeeze detected");
return;
}
var controllerLocation = getControllerWorldLocation(this.handToController(), true);
var worldHandPosition = controllerLocation.position;
@ -1469,15 +1462,19 @@ function MyController(hand) {
this.search = function(deltaTime, timestamp) {
var _this = this;
var name;
var FAR_SEARCH_DELAY = 0; // msecs before search beam appears
var farSearching = this.triggerSmoothedSqueezed() && (Date.now() - this.searchStartTime > FAR_SEARCH_DELAY);
this.grabbedEntity = null;
this.grabbedOverlay = null;
this.isInitialGrab = false;
this.shouldResetParentOnRelease = false;
this.preparingHoldRelease = false;
this.checkForStrayChildren();
if (this.triggerSmoothedReleased()) {
if ((this.triggerSmoothedReleased() && this.secondaryReleased())) {
this.setState(STATE_OFF, "trigger released");
return;
}
@ -1496,10 +1493,11 @@ function MyController(hand) {
var potentialEquipHotspot = this.chooseBestEquipHotspot(candidateHotSpotEntities);
if (potentialEquipHotspot) {
if (this.triggerSmoothedGrab() && holdEnabled) {
if ((this.triggerSmoothedGrab() || this.secondarySqueezed()) && holdEnabled) {
this.grabbedHotspot = potentialEquipHotspot;
this.grabbedEntity = potentialEquipHotspot.entityID;
this.setState(STATE_HOLD, "equipping '" + entityPropertiesCache.getProps(this.grabbedEntity).name + "'");
return;
}
}
@ -1539,7 +1537,8 @@ function MyController(hand) {
// potentialNearTriggerEntity = entity;
}
} else {
if (this.triggerSmoothedGrab() && nearGrabEnabled) {
// If near something grabbable, grab it!
if ((this.triggerSmoothedGrab() || this.secondarySqueezed()) && nearGrabEnabled) {
var props = entityPropertiesCache.getProps(entity);
var grabProps = entityPropertiesCache.getGrabProps(entity);
var refCount = grabProps.refCount ? grabProps.refCount : 0;
@ -1629,7 +1628,7 @@ function MyController(hand) {
// potentialFarTriggerEntity = entity;
}
} else if (this.entityIsDistanceGrabbable(rayPickInfo.entityID, handPosition)) {
if (this.triggerSmoothedGrab() && !isEditing() && farGrabEnabled) {
if (this.triggerSmoothedGrab() && !isEditing() && farGrabEnabled && farSearching) {
this.grabbedEntity = entity;
this.setState(STATE_DISTANCE_HOLDING, "distance hold '" + name + "'");
return;
@ -1706,7 +1705,7 @@ function MyController(hand) {
equipHotspotBuddy.highlightHotspot(potentialEquipHotspot);
}
if (farGrabEnabled) {
if (farGrabEnabled && farSearching) {
this.searchIndicatorOn(rayPickInfo.searchRay);
}
Reticle.setVisible(false);
@ -2145,7 +2144,7 @@ function MyController(hand) {
this.grabPointSphereOff();
if (this.state == STATE_NEAR_GRABBING && !this.triggerClicked) {
if (this.state == STATE_NEAR_GRABBING && (!this.triggerClicked && this.secondaryReleased())) {
this.callEntityMethodOnGrabbed("releaseGrab");
this.setState(STATE_OFF, "trigger released");
return;
@ -2153,6 +2152,22 @@ function MyController(hand) {
if (this.state == STATE_HOLD) {
if (this.secondarySqueezed()) {
// this.secondaryReleased() will always be true when not depressed
// so we cannot simply rely on that for release - ensure that the
// trigger was first "prepared" by being pushed in before the release
this.preparingHoldRelease = true;
}
if (this.preparingHoldRelease && this.secondaryReleased()) {
// we have an equipped object and the secondary trigger was released
// short-circuit the other checks and release it
this.preparingHoldRelease = false;
this.release();
return;
}
var dropDetected = this.dropGestureProcess(deltaTime);
if (this.triggerSmoothedReleased()) {
@ -2648,7 +2663,7 @@ function MyController(hand) {
this.grabbedOverlay = null;
this.grabbedHotspot = null;
if (this.triggerSmoothedGrab()) {
if (this.triggerSmoothedGrab() || this.secondarySqueezed()) {
this.waitForTriggerRelease = true;
}
};

View file

@ -53,9 +53,9 @@ function animStateHandler(props) {
}
function update(dt) {
var leftTrigger = normalizeControllerValue(Controller.getValue(Controller.Standard.LT));
var rightTrigger = normalizeControllerValue(Controller.getValue(Controller.Standard.RT));
var leftTrigger = clamp(Controller.getValue(Controller.Standard.LT) + Controller.getValue(Controller.Standard.LeftGrip), 0, 1);
var rightTrigger = clamp(Controller.getValue(Controller.Standard.RT) + Controller.getValue(Controller.Standard.RightGrip), 0, 1);
// Average last few trigger values together for a bit of smoothing
var tau = clamp(dt / TRIGGER_SMOOTH_TIMESCALE, 0, 1);
lastLeftTrigger = lerp(leftTrigger, lastLeftTrigger, tau);