Merge branch 'master' of github.com:highfidelity/hifi into oculus-store-commerce

This commit is contained in:
Howard Stearns 2018-10-23 13:09:33 -07:00
commit a79fe4df79
15 changed files with 1076 additions and 1050 deletions

View file

@ -36,6 +36,7 @@ module.exports = {
"GlobalServices": false,
"GooglePoly": false,
"Graphics": false,
"HifiAbout": false,
"HMD": false,
"LaserPointers": false,
"location": true,

View file

@ -14,14 +14,17 @@ using namespace gl;
void Uniform::load(GLuint glprogram, int index) {
this->index = index;
const GLint NAME_LENGTH = 256;
GLchar glname[NAME_LENGTH];
GLint length = 0;
glGetActiveUniform(glprogram, index, NAME_LENGTH, &length, &size, &type, glname);
// Length does NOT include the null terminator
// https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glGetActiveUniform.xhtml
name = std::string(glname, length);
binding = glGetUniformLocation(glprogram, glname);
if (index >= 0) {
static const GLint NAME_LENGTH = 1024;
GLchar glname[NAME_LENGTH];
memset(glname, 0, NAME_LENGTH);
GLint length = 0;
glGetActiveUniform(glprogram, index, NAME_LENGTH, &length, &size, &type, glname);
// Length does NOT include the null terminator
// https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glGetActiveUniform.xhtml
name = std::string(glname, length);
binding = glGetUniformLocation(glprogram, name.c_str());
}
}
bool isTextureType(GLenum type) {

View file

@ -528,6 +528,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
Selection.disableListHighlight(DISPATCHER_HOVERING_LIST);
};
}
function mouseReleaseOnOverlay(overlayID, event) {
if (HMD.homeButtonID && overlayID === HMD.homeButtonID && event.button === "Primary") {
Messages.sendLocalMessage("home", overlayID);
@ -546,9 +547,11 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
}
}
}
Overlays.mouseReleaseOnOverlay.connect(mouseReleaseOnOverlay);
Overlays.mousePressOnOverlay.connect(mousePress);
Entities.mousePressOnEntity.connect(mousePress);
var controllerDispatcher = new ControllerDispatcher();
Messages.subscribe('Hifi-Hand-RayPick-Blacklist');
Messages.messageReceived.connect(controllerDispatcher.handleHandMessage);

View file

@ -427,7 +427,8 @@ Script.include("/~/system/libraries/controllers.js");
this.hand === RIGHT_HAND ? "RightFarTriggerEntity" : "LeftFarTriggerEntity",
this.hand === RIGHT_HAND ? "RightNearActionGrabEntity" : "LeftNearActionGrabEntity",
this.hand === RIGHT_HAND ? "RightNearParentingGrabEntity" : "LeftNearParentingGrabEntity",
this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay"
this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay",
this.hand === RIGHT_HAND ? "RightNearTabletHighlight" : "LeftNearTabletHighlight"
];
var nearGrabReadiness = [];

View file

@ -376,7 +376,8 @@ Script.include("/~/system/libraries/controllers.js");
this.hand === RIGHT_HAND ? "RightFarTriggerEntity" : "LeftFarTriggerEntity",
this.hand === RIGHT_HAND ? "RightNearActionGrabEntity" : "LeftNearActionGrabEntity",
this.hand === RIGHT_HAND ? "RightNearParentingGrabEntity" : "LeftNearParentingGrabEntity",
this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay"
this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay",
this.hand === RIGHT_HAND ? "RightNearTabletHighlight" : "LeftNearTabletHighlight"
];
var nearGrabReadiness = [];

View file

@ -469,7 +469,8 @@ Script.include("/~/system/libraries/controllers.js");
this.hand === RIGHT_HAND ? "RightFarTriggerEntity" : "LeftFarTriggerEntity",
this.hand === RIGHT_HAND ? "RightNearActionGrabEntity" : "LeftNearActionGrabEntity",
this.hand === RIGHT_HAND ? "RightNearParentingGrabEntity" : "LeftNearParentingGrabEntity",
this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay"
this.hand === RIGHT_HAND ? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay",
this.hand === RIGHT_HAND ? "RightNearTabletHighlight" : "LeftNearTabletHighlight"
];
var nearGrabReadiness = [];

View file

@ -158,11 +158,12 @@ Script.include("/~/system/libraries/utils.js");
}
}
var nearOverlay = getEnabledModuleByName(this.hand === RIGHT_HAND
? "RightNearParentingGrabOverlay" : "LeftNearParentingGrabOverlay");
if (nearOverlay) {
var nearOverlayReady = nearOverlay.isReady(controllerData);
if (nearOverlayReady.active && HMD.tabletID && nearOverlay.grabbedThingID === HMD.tabletID) {
// Tablet highlight and grabbing.
var tabletHighlight = getEnabledModuleByName(this.hand === RIGHT_HAND
? "RightNearTabletHighlight" : "LeftNearTabletHighlight");
if (tabletHighlight) {
var tabletHighlightReady = tabletHighlight.isReady(controllerData);
if (tabletHighlightReady.active) {
return this.exitModule();
}
}

View file

@ -101,13 +101,12 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
}
}
// Tablet grabbing.
var nearOverlay = getEnabledModuleByName(this.hand === RIGHT_HAND ?
"RightNearParentingGrabOverlay" :
"LeftNearParentingGrabOverlay");
if (nearOverlay) {
var nearOverlayReady = nearOverlay.isReady(controllerData);
if (nearOverlayReady.active && HMD.tabletID && nearOverlay.grabbedThingID === HMD.tabletID) {
// Tablet highlight and grabbing.
var tabletHighlight = getEnabledModuleByName(this.hand === RIGHT_HAND
? "RightNearTabletHighlight" : "LeftNearTabletHighlight");
if (tabletHighlight) {
var tabletHighlightReady = tabletHighlight.isReady(controllerData);
if (tabletHighlightReady.active) {
return this.exitModule();
}
}

View file

@ -0,0 +1,121 @@
//
// nearTabletHighlight.js
//
// Highlight the tablet if a hand is near enough to grab it and it isn't grabbed.
//
// Created by David Rowe on 28 Aug 2018.
// Copyright 2018 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
//
/* global LEFT_HAND, RIGHT_HAND, makeDispatcherModuleParameters, makeRunningValues, enableDispatcherModule,
* disableDispatcherModule */
Script.include("/~/system/libraries/controllerDispatcherUtils.js");
(function () {
"use strict";
var TABLET_GRABBABLE_SELECTION_NAME = "tabletGrabbableSelection";
var TABLET_GRABBABLE_SELECTION_STYLE = {
outlineUnoccludedColor: { red: 0, green: 180, blue: 239 }, // #00b4ef
outlineUnoccludedAlpha: 1,
outlineOccludedColor: { red: 0, green: 0, blue: 0 },
outlineOccludedAlpha: 0,
fillUnoccludedColor: { red: 0, green: 0, blue: 0 },
fillUnoccludedAlpha: 0,
fillOccludedColor: { red: 0, green: 0, blue: 0 },
fillOccludedAlpha: 0,
outlineWidth: 4,
isOutlineSmooth: false
};
var isTabletNearGrabbable = [false, false];
var isTabletHighlighted = false;
function setTabletNearGrabbable(hand, enabled) {
if (enabled === isTabletNearGrabbable[hand]) {
return;
}
isTabletNearGrabbable[hand] = enabled;
if (isTabletNearGrabbable[LEFT_HAND] || isTabletNearGrabbable[RIGHT_HAND]) {
if (!isTabletHighlighted) {
Selection.addToSelectedItemsList(TABLET_GRABBABLE_SELECTION_NAME, "overlay", HMD.tabletID);
isTabletHighlighted = true;
}
} else {
if (isTabletHighlighted) {
Selection.removeFromSelectedItemsList(TABLET_GRABBABLE_SELECTION_NAME, "overlay", HMD.tabletID);
isTabletHighlighted = false;
}
}
}
function NearTabletHighlight(hand) {
this.hand = hand;
this.parameters = makeDispatcherModuleParameters(
95,
this.hand === RIGHT_HAND ? ["rightHand"] : ["leftHand"],
[],
100
);
this.isNearTablet = function (controllerData) {
return HMD.tabletID && controllerData.nearbyOverlayIDs[this.hand].indexOf(HMD.tabletID) !== -1;
};
this.isReady = function (controllerData) {
if (this.isNearTablet(controllerData)) {
return makeRunningValues(true, [], []);
}
setTabletNearGrabbable(this.hand, false);
return makeRunningValues(false, [], []);
};
this.run = function (controllerData) {
if (!this.isNearTablet(controllerData)) {
setTabletNearGrabbable(this.hand, false);
return makeRunningValues(false, [], []);
}
if (controllerData.triggerClicks[this.hand] || controllerData.secondaryValues[this.hand]) {
setTabletNearGrabbable(this.hand, false);
return makeRunningValues(false, [], []);
}
setTabletNearGrabbable(this.hand, true);
return makeRunningValues(true, [], []);
};
}
var leftNearTabletHighlight = new NearTabletHighlight(LEFT_HAND);
var rightNearTabletHighlight = new NearTabletHighlight(RIGHT_HAND);
enableDispatcherModule("LeftNearTabletHighlight", leftNearTabletHighlight);
enableDispatcherModule("RightNearTabletHighlight", rightNearTabletHighlight);
function onDisplayModeChanged() {
if (HMD.active) {
Selection.enableListHighlight(TABLET_GRABBABLE_SELECTION_NAME, TABLET_GRABBABLE_SELECTION_STYLE);
} else {
Selection.disableListHighlight(TABLET_GRABBABLE_SELECTION_NAME);
Selection.clearSelectedItemsList(TABLET_GRABBABLE_SELECTION_NAME);
}
}
HMD.displayModeChanged.connect(onDisplayModeChanged);
HMD.mountedChanged.connect(onDisplayModeChanged);
onDisplayModeChanged();
function cleanUp() {
disableDispatcherModule("LeftNearTabletHighlight");
disableDispatcherModule("RightNearTabletHighlight");
Selection.disableListHighlight(TABLET_GRABBABLE_SELECTION_NAME);
}
Script.scriptEnding.connect(cleanUp);
}());

View file

@ -61,7 +61,13 @@ Script.include("/~/system/libraries/controllers.js");
var farGrabModuleName = this.hand === RIGHT_HAND ? "RightFarActionGrabEntity" : "LeftFarActionGrabEntity";
var farGrabModule = getEnabledModuleByName(farGrabModuleName);
var farGrabModuleReady = farGrabModule ? farGrabModule.isReady(controllerData) : makeRunningValues(false, [], []);
return grabOverlayModuleReady.active || farGrabModuleReady.active || grabEntityModuleReady.active;
var nearTabletHighlightModuleName =
this.hand === RIGHT_HAND ? "RightNearTabletHighlight" : "LeftNearTabletHighlight";
var nearTabletHighlightModule = getEnabledModuleByName(nearTabletHighlightModuleName);
var nearTabletHighlightModuleReady = nearTabletHighlightModule
? nearTabletHighlightModule.isReady(controllerData) : makeRunningValues(false, [], []);
return grabOverlayModuleReady.active || farGrabModuleReady.active || grabEntityModuleReady.active
|| nearTabletHighlightModuleReady.active;
};
this.overlayLaserActive = function(controllerData) {

View file

@ -58,6 +58,13 @@ Script.include("/~/system/libraries/controllers.js");
}
}
}
var nearTabletHighlightModule = getEnabledModuleByName(this.hand === RIGHT_HAND
? "RightNearTabletHighlight" : "LeftNearTabletHighlight");
if (nearTabletHighlightModule) {
return nearTabletHighlightModule.isNearTablet(controllerData);
}
return false;
};

View file

@ -37,7 +37,8 @@ var CONTOLLER_SCRIPTS = [
"controllerModules/scaleEntity.js",
"controllerModules/highlightNearbyEntities.js",
"controllerModules/nearGrabHyperLinkEntity.js",
"controllerModules/mouseHighlightEntities.js"
"controllerModules/mouseHighlightEntities.js",
"controllerModules/nearTabletHighlight.js"
];
var DEBUG_MENU_ITEM = "Debug defaultScripts.js";

File diff suppressed because it is too large Load diff

View file

@ -8,8 +8,8 @@
""
],
"devDependencies": {
"electron-packager": "^12.0.0",
"electron": "1.8.4"
"electron": "^3.0.0",
"electron-packager": "^12.1.2"
},
"repository": {
"type": "git",
@ -23,14 +23,15 @@
"packager": "node packager.js"
},
"dependencies": {
"always-tail": "0.2.0",
"cheerio": "^0.19.0",
"always-tail": "^0.2.0",
"cheerio": "^0.22.0",
"debug": "^4.0.1",
"electron-log": "1.1.1",
"extend": "^3.0.0",
"fs-extra": "^6.0.0",
"node-notifier": "^5.2.1",
"os-homedir": "^1.0.1",
"request": "^2.85.0",
"request": "^2.88.0",
"request-progress": "1.0.2",
"tar-fs": "^1.12.0",
"yargs": "^3.30.0"

View file

@ -247,15 +247,12 @@ process.on('uncaughtException', function(err) {
log.error(err.stack);
});
var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
// Someone tried to run a second instance, focus the window (if there is one)
return true;
});
const gotTheLock = app.requestSingleInstanceLock()
if (shouldQuit) {
log.warn("Another instance of the Sandbox is already running - this instance will quit.");
app.exit(0);
return;
if (!gotTheLock) {
log.warn("Another instance of the Sandbox is already running - this instance will quit.");
app.exit(0);
return;
}
// Check command line arguments to see how to find binaries