mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-07 04:15:19 +02:00
It's working!
This commit is contained in:
parent
084f4d2ab0
commit
265f978a06
3 changed files with 27 additions and 37 deletions
|
@ -36,16 +36,16 @@ void HoverOverlayInterface::createHoverOverlay(const EntityItemID& entityItemID,
|
|||
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags);
|
||||
|
||||
if (_hoverOverlayID == UNKNOWN_OVERLAY_ID || !qApp->getOverlays().isAddedOverlay(_hoverOverlayID)) {
|
||||
_hoverOverlay = std::make_shared<Cube3DOverlay>();
|
||||
_hoverOverlay = std::make_shared<Image3DOverlay>();
|
||||
_hoverOverlay->setAlpha(1.0f);
|
||||
_hoverOverlay->setBorderSize(1.0f);
|
||||
_hoverOverlay->setColor({ 0xFF, 0xEF, 0x00 });
|
||||
_hoverOverlay->setIsSolid(true);
|
||||
_hoverOverlay->setPulseMin(0.5);
|
||||
_hoverOverlay->setPulseMax(1.0);
|
||||
_hoverOverlay->setColorPulse(1.0);
|
||||
_hoverOverlay->setPulseMin(0.75f);
|
||||
_hoverOverlay->setPulseMax(1.0f);
|
||||
_hoverOverlay->setColorPulse(1.0f);
|
||||
_hoverOverlay->setIgnoreRayIntersection(false);
|
||||
_hoverOverlay->setDrawInFront(false);
|
||||
_hoverOverlay->setDrawInFront(true);
|
||||
_hoverOverlay->setURL("http://i.imgur.com/gksZygp.png");
|
||||
_hoverOverlay->setIsFacingAvatar(true);
|
||||
_hoverOverlay->setDimensions(glm::vec2(0.2f, 0.2f) * glm::distance(entityProperties.getPosition(), qApp->getCamera().getPosition()));
|
||||
_hoverOverlayID = qApp->getOverlays().addOverlay(_hoverOverlay);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <DependencyManager.h>
|
||||
#include <PointerEvent.h>
|
||||
#include "EntityScriptingInterface.h"
|
||||
#include "ui/overlays/Cube3DOverlay.h"
|
||||
#include "ui/overlays/Image3DOverlay.h"
|
||||
#include "ui/overlays/Overlays.h"
|
||||
|
||||
#include "EntityTree.h"
|
||||
|
@ -35,7 +35,7 @@ class HoverOverlayInterface : public QObject, public Dependency {
|
|||
QSharedPointer<EntityScriptingInterface> _entityScriptingInterface;
|
||||
EntityPropertyFlags _entityPropertyFlags;
|
||||
OverlayID _hoverOverlayID { UNKNOWN_OVERLAY_ID };
|
||||
std::shared_ptr<Cube3DOverlay> _hoverOverlay { nullptr };
|
||||
std::shared_ptr<Image3DOverlay> _hoverOverlay { nullptr };
|
||||
public:
|
||||
HoverOverlayInterface();
|
||||
|
||||
|
|
|
@ -1391,11 +1391,6 @@ function MyController(hand) {
|
|||
color: color,
|
||||
endParentID: farParentID
|
||||
});
|
||||
|
||||
if (entityWithHoverOverlay) {
|
||||
HoverOverlay.destroyHoverOverlay(entityWithHoverOverlay);
|
||||
entityWithHoverOverlay = false;
|
||||
}
|
||||
} else {
|
||||
Overlays.editOverlay(this.overlayLine, {
|
||||
length: Vec3.distance(farPoint, closePoint),
|
||||
|
@ -2208,14 +2203,14 @@ function MyController(hand) {
|
|||
entityPropertiesCache.addEntity(rayPickInfo.entityID);
|
||||
}
|
||||
|
||||
if (rayPickInfo.entityID)
|
||||
if (rayPickInfo.entityID && (entityWithHoverOverlay !== rayPickInfo.entityID)) {
|
||||
if (entityWithHoverOverlay) {
|
||||
HoverOverlay.destroyHoverOverlay(entityWithHoverOverlay);
|
||||
}
|
||||
var pointerEvent = {
|
||||
type: "Move",
|
||||
id: this.hand + 1, // 0 is reserved for hardware mouse
|
||||
pos2D: projectOntoEntityXYPlane(entity, rayPickInfo.intersection),
|
||||
pos2D: projectOntoEntityXYPlane(rayPickInfo.entityID, rayPickInfo.intersection),
|
||||
pos3D: rayPickInfo.intersection,
|
||||
normal: rayPickInfo.normal,
|
||||
direction: rayPickInfo.searchRay.direction,
|
||||
|
@ -2479,27 +2474,24 @@ function MyController(hand) {
|
|||
var pointerEvent;
|
||||
if (rayPickInfo.overlayID) {
|
||||
var overlay = rayPickInfo.overlayID;
|
||||
if (Overlays.getProperty(overlay, "type") != "web3d") {
|
||||
return false;
|
||||
}
|
||||
if (Overlays.keyboardFocusOverlay != overlay) {
|
||||
if ((Overlays.getProperty(overlay, "type") == "web3d") && Overlays.keyboardFocusOverlay != overlay) {
|
||||
Entities.keyboardFocusEntity = null;
|
||||
Overlays.keyboardFocusOverlay = overlay;
|
||||
|
||||
pointerEvent = {
|
||||
type: "Move",
|
||||
id: HARDWARE_MOUSE_ID,
|
||||
pos2D: projectOntoOverlayXYPlane(overlay, rayPickInfo.intersection),
|
||||
pos3D: rayPickInfo.intersection,
|
||||
normal: rayPickInfo.normal,
|
||||
direction: rayPickInfo.searchRay.direction,
|
||||
button: "None"
|
||||
};
|
||||
|
||||
this.hoverOverlay = overlay;
|
||||
Overlays.sendHoverEnterOverlay(overlay, pointerEvent);
|
||||
}
|
||||
|
||||
pointerEvent = {
|
||||
type: "Move",
|
||||
id: HARDWARE_MOUSE_ID,
|
||||
pos2D: projectOntoOverlayXYPlane(overlay, rayPickInfo.intersection),
|
||||
pos3D: rayPickInfo.intersection,
|
||||
normal: rayPickInfo.normal,
|
||||
direction: rayPickInfo.searchRay.direction,
|
||||
button: "None"
|
||||
};
|
||||
|
||||
this.hoverOverlay = overlay;
|
||||
Overlays.sendHoverEnterOverlay(overlay, pointerEvent);
|
||||
|
||||
// Send mouse events for button highlights and tooltips.
|
||||
if (this.hand == mostRecentSearchingHand ||
|
||||
(this.hand !== mostRecentSearchingHand &&
|
||||
|
@ -3497,8 +3489,6 @@ function MyController(hand) {
|
|||
Entities.sendMousePressOnEntity(this.grabbedThingID, pointerEvent);
|
||||
Entities.sendClickDownOnEntity(this.grabbedThingID, pointerEvent);
|
||||
|
||||
//HoverOverlay
|
||||
|
||||
this.touchingEnterTimer = 0;
|
||||
this.touchingEnterPointerEvent = pointerEvent;
|
||||
this.touchingEnterPointerEvent.button = "None";
|
||||
|
@ -3595,7 +3585,7 @@ function MyController(hand) {
|
|||
};
|
||||
|
||||
this.overlayLaserTouchingEnter = function () {
|
||||
// Test for intersection between controller laser and Web overlay plane.
|
||||
// Test for intersection between controller laser and overlay plane.
|
||||
var controllerLocation = getControllerWorldLocation(this.handToController(), true);
|
||||
var intersectInfo = handLaserIntersectOverlay(this.grabbedOverlay, controllerLocation);
|
||||
if (intersectInfo) {
|
||||
|
|
Loading…
Reference in a new issue