making requested changes

This commit is contained in:
druiz17 2018-06-07 14:04:39 -07:00
parent 5a89a51b85
commit 8c83bd29a3
4 changed files with 16 additions and 35 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -56,6 +56,8 @@ class QScriptEngine;
* @property {Uuid} tabletID - The UUID of the tablet body model overlay. * @property {Uuid} tabletID - The UUID of the tablet body model overlay.
* @property {Uuid} tabletScreenID - The UUID of the tablet's screen overlay. * @property {Uuid} tabletScreenID - The UUID of the tablet's screen overlay.
* @property {Uuid} homeButtonID - The UUID of the tablet's "home" button overlay. * @property {Uuid} homeButtonID - The UUID of the tablet's "home" button overlay.
* @property {Uuid} homeButtonHighlightMaterialID - The UUID of the material entity used to highlight tablet button
* @property {Uuid} homeButtonUnhighlightMaterialID - The UUID of the material entity use to unhighlight the entity
*/ */
class HMDScriptingInterface : public AbstractHMDScriptingInterface, public Dependency { class HMDScriptingInterface : public AbstractHMDScriptingInterface, public Dependency {
Q_OBJECT Q_OBJECT
@ -67,6 +69,8 @@ class HMDScriptingInterface : public AbstractHMDScriptingInterface, public Depen
Q_PROPERTY(QUuid tabletID READ getCurrentTabletFrameID WRITE setCurrentTabletFrameID) Q_PROPERTY(QUuid tabletID READ getCurrentTabletFrameID WRITE setCurrentTabletFrameID)
Q_PROPERTY(QUuid homeButtonID READ getCurrentHomeButtonID WRITE setCurrentHomeButtonID) Q_PROPERTY(QUuid homeButtonID READ getCurrentHomeButtonID WRITE setCurrentHomeButtonID)
Q_PROPERTY(QUuid tabletScreenID READ getCurrentTabletScreenID WRITE setCurrentTabletScreenID) Q_PROPERTY(QUuid tabletScreenID READ getCurrentTabletScreenID WRITE setCurrentTabletScreenID)
Q_PROPERTY(QUuid homeButtonHighlightMaterialID READ getCurrentHomeButtonHighlightMaterialID WRITE setCurrentHomeButtonHighlightMaterialID)
Q_PROPERTY(QUuid homeButtonUnhighlightMaterialID READ getCurrentHomeButtonUnhighlightMaterialID WRITE setCurrentHomeButtonUnhighlightMaterialID)
public: public:
@ -373,6 +377,12 @@ public:
void setCurrentTabletScreenID(QUuid tabletID) { _tabletScreenID = tabletID; } void setCurrentTabletScreenID(QUuid tabletID) { _tabletScreenID = tabletID; }
QUuid getCurrentTabletScreenID() const { return _tabletScreenID; } QUuid getCurrentTabletScreenID() const { return _tabletScreenID; }
void setCurrentHomeButtonHighlightMaterialID(QUuid homeButtonHighlightMaterialID) { _homeButtonHighlightMaterialID = homeButtonHighlightMaterialID; }
QUuid getCurrentHomeButtonHighlightMaterialID() { return _homeButtonHighlightMaterialID; }
void setCurrentHomeButtonUnhighlightMaterialID(QUuid homeButtonUnhighlightMaterialID) { _homeButtonUnhighlightMaterialID = homeButtonUnhighlightMaterialID; }
QUuid getCurrentHomeButtonUnhighlightMaterialID() { return _homeButtonUnhighlightMaterialID; }
private: private:
bool _showTablet { false }; bool _showTablet { false };
bool _tabletContextualMode { false }; bool _tabletContextualMode { false };
@ -380,6 +390,8 @@ private:
QUuid _tabletScreenID; // this is the overlayID which is part of (a child of) the tablet-ui. QUuid _tabletScreenID; // this is the overlayID which is part of (a child of) the tablet-ui.
QUuid _homeButtonID; QUuid _homeButtonID;
QUuid _tabletEntityID; QUuid _tabletEntityID;
QUuid _homeButtonHighlightMaterialID;
QUuid _homeButtonUnhighlightMaterialID;
// Get the position of the HMD // Get the position of the HMD
glm::vec3 getPosition() const; glm::vec3 getPosition() const;

View file

@ -176,22 +176,6 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
parentJointIndex: -1 parentJointIndex: -1
}); });
this.homeButtonMaterial = Entities.addEntity({
type: "Material",
materialURL: "materialData",
priority: 1,
materialData: JSON.stringify({
materials: {
albedoMap: HOME_BUTTON_TEXTURE
}
}),
userData: JSON.stringify({
"grabbableKey": {"grabbable": false}
}),
parentMaterialName: 4,
parentID: this.tabletEntityID
});
this.homeButtonUnhighlightMaterial = Entities.addEntity({ this.homeButtonUnhighlightMaterial = Entities.addEntity({
type: "Material", type: "Material",
materialURL: "materialData", materialURL: "materialData",
@ -386,7 +370,6 @@ WebTablet.prototype.destroy = function () {
Overlays.deleteOverlay(this.webOverlayID); Overlays.deleteOverlay(this.webOverlayID);
Overlays.deleteOverlay(this.tabletEntityID); Overlays.deleteOverlay(this.tabletEntityID);
Overlays.deleteOverlay(this.homeButtonID); Overlays.deleteOverlay(this.homeButtonID);
Entities.deleteEntity(this.homeButtonMaterial);
Entities.deleteEntity(this.homeButtonUnhighlightMaterial); Entities.deleteEntity(this.homeButtonUnhighlightMaterial);
Entities.deleteEntity(this.homeButtonHighlightMaterial); Entities.deleteEntity(this.homeButtonHighlightMaterial);
HMD.displayModeChanged.disconnect(this.myOnHmdChanged); HMD.displayModeChanged.disconnect(this.myOnHmdChanged);
@ -627,20 +610,6 @@ WebTablet.prototype.scheduleMouseMoveProcessor = function() {
} }
}; };
WebTablet.prototype.handleHomeButtonHover = function(x, y) {
var pickRay = Camera.computePickRay(x, y);
var entityPickResults;
var homebuttonHovered = false;
entityPickResults = Overlays.findRayIntersection(pickRay, true, [this.tabletEntityID]);
if (entityPickResults.intersects && (entityPickResults.entityID === this.tabletEntityID ||
entityPickResults.overlayID === this.tabletEntityID)) {
var overlayPickResults = Overlays.findRayIntersection(pickRay, true, [this.homeButtonID], []);
if (overlayPickResults.intersects && overlayPickResults.overlayID === this.homeButtonID) {
homebuttonHovered = true;
}
}
}
WebTablet.prototype.mouseMoveEvent = function (event) { WebTablet.prototype.mouseMoveEvent = function (event) {
if (this.dragging) { if (this.dragging) {
this.currentMouse = { this.currentMouse = {
@ -648,8 +617,6 @@ WebTablet.prototype.mouseMoveEvent = function (event) {
y: event.y y: event.y
}; };
this.scheduleMouseMoveProcessor(); this.scheduleMouseMoveProcessor();
} else {
this.handleHomeButtonHover(event.x, event.y);
} }
}; };
@ -676,8 +643,6 @@ WebTablet.prototype.mouseMoveProcessor = function () {
}); });
} }
this.scheduleMouseMoveProcessor(); this.scheduleMouseMoveProcessor();
} else {
this.handleHomeButtonHover(this.currentMouse.x, this.currentMouse.y);
} }
}; };

View file

@ -104,6 +104,8 @@
HMD.tabletID = UIWebTablet.tabletEntityID; HMD.tabletID = UIWebTablet.tabletEntityID;
HMD.homeButtonID = UIWebTablet.homeButtonID; HMD.homeButtonID = UIWebTablet.homeButtonID;
HMD.tabletScreenID = UIWebTablet.webOverlayID; HMD.tabletScreenID = UIWebTablet.webOverlayID;
HMD.homeButtonHighlightMaterialID = UIWebTablet.homeButtonHighlightMaterial;
HMD.homeButtonUnhighlightMaterialID = UIWebTablet.homeButtonUnhighlightMaterial;
HMD.displayModeChanged.connect(onHmdChanged); HMD.displayModeChanged.connect(onHmdChanged);
MyAvatar.sensorToWorldScaleChanged.connect(onSensorToWorldScaleChanged); MyAvatar.sensorToWorldScaleChanged.connect(onSensorToWorldScaleChanged);
@ -322,5 +324,7 @@
HMD.tabletID = null; HMD.tabletID = null;
HMD.homeButtonID = null; HMD.homeButtonID = null;
HMD.tabletScreenID = null; HMD.tabletScreenID = null;
HMD.homeButtonHighlightMaterialID = null;
HMD.homeButtonUnhighlightMaterialID = null;
}); });
}()); // END LOCAL_SCOPE }()); // END LOCAL_SCOPE