mirror of
https://github.com/lubosz/overte.git
synced 2025-04-08 01:22:08 +02:00
Replace 3d Overlays by Local Entities
Replace 3d Overlays by Local Entities This is for the system files. Another PR will follow for the developer scripts.
This commit is contained in:
parent
e14ae4a96a
commit
0f663d1a4d
14 changed files with 777 additions and 690 deletions
|
@ -1,19 +1,19 @@
|
|||
"use strict";
|
||||
//
|
||||
// audioMuteOverlay.js
|
||||
//
|
||||
// client script that creates an overlay to provide mute feedback
|
||||
//
|
||||
// Created by Triplelexx on 17/03/09
|
||||
// Reworked by Seth Alves on 2019-2-17
|
||||
// Created by Triplelexx on March 9th, 2017
|
||||
// Reworked by Seth Alves on February 17th, 2019
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
// Copyright 2023 Overte e.V.
|
||||
//
|
||||
// client script that creates an overlay to provide mute feedback
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
"use strict";
|
||||
|
||||
/* global Audio, Script, Overlays, Quat, MyAvatar, HMD */
|
||||
/* global Audio, Script, Entities, Quat, MyAvatar, HMD */
|
||||
|
||||
(function() { // BEGIN LOCAL_SCOPE
|
||||
|
||||
|
@ -41,24 +41,27 @@
|
|||
}
|
||||
|
||||
if (HMD.active) {
|
||||
//V8TODO: change to local entity
|
||||
warningOverlayID = Overlays.addOverlay("text3d", {
|
||||
name: "Muted-Warning",
|
||||
localPosition: { x: 0.0, y: -0.45, z: -1.0 },
|
||||
localOrientation: Quat.fromVec3Degrees({ x: 0.0, y: 0.0, z: 0.0, w: 1.0 }),
|
||||
text: warningText,
|
||||
textAlpha: 1,
|
||||
textColor: { red: 226, green: 51, blue: 77 },
|
||||
backgroundAlpha: 0,
|
||||
lineHeight: 0.042,
|
||||
dimensions: { x: 0.11, y: 0.05 },
|
||||
visible: true,
|
||||
ignoreRayIntersection: true,
|
||||
drawInFront: true,
|
||||
grabbable: false,
|
||||
parentID: MyAvatar.SELF_ID,
|
||||
parentJointIndex: MyAvatar.getJointIndex("_CAMERA_MATRIX")
|
||||
});
|
||||
warningOverlayID = Entities.addEntity({
|
||||
"type": "Text",
|
||||
"name": "Muted-Warning",
|
||||
"localPosition": { "x": 0.0, "y": -0.45, "z": -1.0 },
|
||||
"localRotation": Quat.fromVec3Degrees({ "x": 0.0, "y": 0.0, "z": 0.0, "w": 1.0 }),
|
||||
"text": warningText,
|
||||
"unlit": true,
|
||||
"textAlpha": 1.0,
|
||||
"textColor": { "red": 245, "green": 44, "blue": 74 },
|
||||
"backgroundAlpha": 0.0,
|
||||
"lineHeight": 0.042,
|
||||
"dimensions": {"x": 0.11, "y": 0.05, "z": 0.01 },
|
||||
"visible": true,
|
||||
"ignorePickIntersection": true,
|
||||
"renderLayer": "front",
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
},
|
||||
"parentID": MyAvatar.SELF_ID,
|
||||
"parentJointIndex": MyAvatar.getJointIndex("_CAMERA_MATRIX")
|
||||
}, "local");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +69,7 @@
|
|||
if (!warningOverlayID) {
|
||||
return;
|
||||
}
|
||||
Overlays.deleteOverlay(warningOverlayID);
|
||||
Entities.deleteEntity(warningOverlayID);
|
||||
warningOverlayID = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// avatarFinderBeacon.js
|
||||
//
|
||||
// Created by Thijs Wenker on 12/7/16
|
||||
// Created by Thijs Wenker on December 7th, 2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
// Copyright 2023 Overte e.V.
|
||||
//
|
||||
// Shows 2km long red beams for each avatar outside of the 20 meter radius of your avatar, tries to ignore AC Agents.
|
||||
//
|
||||
|
@ -9,7 +10,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
var MIN_DISPLAY_DISTANCE = 20.0; // meters
|
||||
var BEAM_COLOR = {red: 255, green: 0, blue: 0};
|
||||
var BEAM_COLOR = {"red": 255, "green": 0, "blue": 0};
|
||||
var SHOW_THROUGH_WALLS = false;
|
||||
var BEACON_LENGTH = 2000.0; // meters
|
||||
var TRY_TO_IGNORE_AC_AGENTS = true;
|
||||
|
@ -27,29 +28,38 @@ var POSSIBLE_AC_AVATARS = [
|
|||
AvatarFinderBeacon = function(avatar) {
|
||||
var visible = false;
|
||||
var avatarSessionUUID = avatar.sessionUUID;
|
||||
//V8TODO: change to local entity
|
||||
this.overlay = Overlays.addOverlay('line3d', {
|
||||
color: BEAM_COLOR,
|
||||
dashed: false,
|
||||
start: Vec3.sum(avatar.position, {x: 0, y: -HALF_BEACON_LENGTH, z: 0}),
|
||||
end: Vec3.sum(avatar.position, {x: 0, y: HALF_BEACON_LENGTH, z: 0}),
|
||||
rotation: {x: 0, y: 0, z: 0, w: 1},
|
||||
visible: visible,
|
||||
drawInFront: SHOW_THROUGH_WALLS,
|
||||
ignoreRayIntersection: true,
|
||||
parentID: avatarSessionUUID,
|
||||
parentJointIndex: -2
|
||||
});
|
||||
var renderLayer = "world";
|
||||
if (SHOW_THROUGH_WALLS) {
|
||||
renderLayer = "front";
|
||||
}
|
||||
this.overlay = Entities.addEntity({
|
||||
"type": "PolyLine",
|
||||
"color": BEAM_COLOR,
|
||||
"linePoints": [
|
||||
Vec3.sum(avatar.position, {"x": 0, "y": -HALF_BEACON_LENGTH, "z": 0}),
|
||||
Vec3.sum(avatar.position, {"x": 0, "y": HALF_BEACON_LENGTH, "z": 0})
|
||||
],
|
||||
"strokeWidths": [
|
||||
0.02,
|
||||
0.02
|
||||
],
|
||||
"rotation": {"x": 0, "y": 0, "z": 0, "w": 1},
|
||||
"visible": visible,
|
||||
"renderLayer": renderLayer,
|
||||
"ignorePickIntersection": true,
|
||||
"parentID": avatarSessionUUID,
|
||||
"parentJointIndex": -2
|
||||
}, "local");
|
||||
this.cleanup = function() {
|
||||
Overlays.deleteOverlay(this.overlay);
|
||||
Entities.deleteEntity(this.overlay);
|
||||
};
|
||||
this.shouldShow = function() {
|
||||
return Vec3.distance(MyAvatar.position, avatar.position) >= MIN_DISPLAY_DISTANCE;
|
||||
};
|
||||
this.update = function() {
|
||||
avatar = AvatarList.getAvatar(avatarSessionUUID);
|
||||
Overlays.editOverlay(this.overlay, {
|
||||
visible: this.shouldShow()
|
||||
Entities.editEntity(this.overlay, {
|
||||
"visible": this.shouldShow()
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
"use strict";
|
||||
|
||||
//
|
||||
// away.js
|
||||
//
|
||||
// Created by Howard Stearns 11/3/15
|
||||
// Created by Howard Stearns November, 3rd, 2015
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
// Copyright 2021 Vircadia contributors.
|
||||
// Copyright 2023 Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
@ -21,31 +21,31 @@ var BASIC_TIMER_INTERVAL = 50; // 50ms = 20hz
|
|||
var OVERLAY_WIDTH = 1920;
|
||||
var OVERLAY_HEIGHT = 1080;
|
||||
var OVERLAY_DATA = {
|
||||
width: OVERLAY_WIDTH,
|
||||
height: OVERLAY_HEIGHT,
|
||||
imageURL: Script.resolvePath("assets/images/Overlay-Viz-blank.png"),
|
||||
emissive: true,
|
||||
drawInFront: true,
|
||||
alpha: 1
|
||||
"width": OVERLAY_WIDTH,
|
||||
"height": OVERLAY_HEIGHT,
|
||||
"imageURL": Script.resolvePath("assets/images/Overlay-Viz-blank.png"),
|
||||
"emissive": true,
|
||||
"drawInFront": true,
|
||||
"alpha": 1.0
|
||||
};
|
||||
var AVATAR_MOVE_FOR_ACTIVE_DISTANCE = 0.8; // meters -- no longer away if avatar moves this far while away
|
||||
|
||||
var CAMERA_MATRIX = -7;
|
||||
|
||||
var OVERLAY_DATA_HMD = {
|
||||
localPosition: {x: 0, y: 0, z: -1 * MyAvatar.sensorToWorldScale},
|
||||
localRotation: {x: 0, y: 0, z: 0, w: 1},
|
||||
width: OVERLAY_WIDTH,
|
||||
height: OVERLAY_HEIGHT,
|
||||
url: Script.resolvePath("assets/images/Overlay-Viz-blank.png"),
|
||||
color: {red: 255, green: 255, blue: 255},
|
||||
alpha: 1,
|
||||
scale: 2 * MyAvatar.sensorToWorldScale,
|
||||
emissive: true,
|
||||
drawInFront: true,
|
||||
parentID: MyAvatar.SELF_ID,
|
||||
parentJointIndex: CAMERA_MATRIX,
|
||||
ignorePickIntersection: true
|
||||
"type": "Image",
|
||||
"localPosition": {"x": 0, "y": 0, "z": -1 * MyAvatar.sensorToWorldScale},
|
||||
"localRotation": {"x": 0, "y": 0, "z": 0, "w": 1},
|
||||
"keepAspectRatio": true,
|
||||
"imageURL": Script.resolvePath("assets/images/Overlay-Viz-blank.png"),
|
||||
"color": {"red": 255, "green": 255, "blue": 255},
|
||||
"alpha": 1.0,
|
||||
"dimensions": Vec3.multiply({"x": 2, "y": 2, "z": 2}, MyAvatar.sensorToWorldScale),
|
||||
"emissive": true,
|
||||
"renderLayer": "front",
|
||||
"parentID": MyAvatar.SELF_ID,
|
||||
"parentJointIndex": CAMERA_MATRIX,
|
||||
"ignorePickIntersection": true
|
||||
};
|
||||
|
||||
var AWAY_INTRO = {
|
||||
|
@ -89,33 +89,32 @@ function stopAwayAnimation() {
|
|||
|
||||
// OVERLAY
|
||||
var overlay = Overlays.addOverlay("image", OVERLAY_DATA);
|
||||
//V8TODO: change to local entity
|
||||
var overlayHMD = Overlays.addOverlay("image3d", OVERLAY_DATA_HMD);
|
||||
var overlayHMD = Entities.addEntity(OVERLAY_DATA_HMD, "local");
|
||||
|
||||
function showOverlay() {
|
||||
if (HMD.active) {
|
||||
// make sure desktop version is hidden
|
||||
Overlays.editOverlay(overlay, { visible: false });
|
||||
Overlays.editOverlay(overlayHMD, { visible: true });
|
||||
Overlays.editOverlay(overlay, { "visible": false });
|
||||
Entities.editEntity(overlayHMD, { "visible": true });
|
||||
} else {
|
||||
// make sure HMD is hidden
|
||||
Overlays.editOverlay(overlayHMD, { visible: false });
|
||||
Entities.editEntity(overlayHMD, { "visible": false });
|
||||
|
||||
// Update for current screen size, keeping overlay proportions constant.
|
||||
var screen = Controller.getViewportDimensions();
|
||||
|
||||
// keep the overlay it's natural size and always center it...
|
||||
Overlays.editOverlay(overlay, {
|
||||
visible: true,
|
||||
x: ((screen.x - OVERLAY_WIDTH) / 2),
|
||||
y: ((screen.y - OVERLAY_HEIGHT) / 2)
|
||||
"visible": true,
|
||||
"x": ((screen.x - OVERLAY_WIDTH) / 2),
|
||||
"y": ((screen.y - OVERLAY_HEIGHT) / 2)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function hideOverlay() {
|
||||
Overlays.editOverlay(overlay, {visible: false});
|
||||
Overlays.editOverlay(overlayHMD, {visible: false});
|
||||
Overlays.editOverlay(overlay, {"visible": false});
|
||||
Entities.editEntity(overlayHMD, {"visible": false});
|
||||
}
|
||||
|
||||
hideOverlay();
|
||||
|
@ -132,10 +131,10 @@ function maybeMoveOverlay() {
|
|||
|
||||
var sensorScaleFactor = MyAvatar.sensorToWorldScale;
|
||||
var localPosition = {x: 0, y: 0, z: -1 * sensorScaleFactor};
|
||||
Overlays.editOverlay(overlayHMD, { visible: true, localPosition: localPosition, scale: 2 * sensorScaleFactor });
|
||||
Entities.editEntity(overlayHMD, { "visible": true, "localPosition": localPosition, "dimensions": Vec3.multiply({"x": 2, "y": 2, "z": 2}, MyAvatar.sensorToWorldScale )});
|
||||
|
||||
// make sure desktop version is hidden
|
||||
Overlays.editOverlay(overlay, { visible: false });
|
||||
Overlays.editOverlay(overlay, { "visible": false });
|
||||
|
||||
// also remember avatar position
|
||||
avatarPosition = MyAvatar.position;
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
//
|
||||
// bubble.js
|
||||
// scripts/system/
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 11/18/2016
|
||||
// Created by Brad Hefta-Gaub on November 18th, 2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
// Copyright 2023 Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
/* global Script, Users, Overlays, AvatarList, Controller, Camera, getControllerWorldLocation, UserActivityLogger */
|
||||
/* global Script, Users, Entities, AvatarList, Controller, Camera, getControllerWorldLocation, UserActivityLogger */
|
||||
|
||||
(function () { // BEGIN LOCAL_SCOPE
|
||||
var button;
|
||||
|
@ -21,16 +21,19 @@
|
|||
// Affects bubble height
|
||||
var BUBBLE_HEIGHT_SCALE = 0.15;
|
||||
// The bubble model itself
|
||||
//V8TODO: change to local entity
|
||||
var bubbleOverlay = Overlays.addOverlay("model", {
|
||||
url: Script.resolvePath("assets/models/Bubble-v14.fbx"), // If you'd like to change the model, modify this line (and the dimensions below)
|
||||
dimensions: { x: MyAvatar.sensorToWorldScale, y: 0.75 * MyAvatar.sensorToWorldScale, z: MyAvatar.sensorToWorldScale },
|
||||
position: { x: MyAvatar.position.x, y: -MyAvatar.scale * 2 + MyAvatar.position.y + MyAvatar.scale * BUBBLE_HEIGHT_SCALE, z: MyAvatar.position.z },
|
||||
rotation: Quat.multiply(MyAvatar.orientation, Quat.fromVec3Degrees({x: 0.0, y: 180.0, z: 0.0})),
|
||||
scale: { x: 2 , y: MyAvatar.scale * 0.5 + 0.5, z: 2 },
|
||||
visible: false,
|
||||
ignoreRayIntersection: true
|
||||
});
|
||||
var bubbleOverlay = Entities.addEntity({
|
||||
"type": "Model",
|
||||
"modelURL": Script.resolvePath("assets/models/Bubble-v14.fbx"), // If you'd like to change the model, modify this line (and the dimensions below)
|
||||
"dimensions": {
|
||||
"x": MyAvatar.sensorToWorldScale * 2,
|
||||
"y": (0.75 * MyAvatar.sensorToWorldScale) * ((MyAvatar.scale * 0.5) + 0.5),
|
||||
"z": MyAvatar.sensorToWorldScale * 2
|
||||
},
|
||||
"position": { "x": MyAvatar.position.x, "y": -MyAvatar.scale * 2 + MyAvatar.position.y + MyAvatar.scale * BUBBLE_HEIGHT_SCALE, "z": MyAvatar.position.z },
|
||||
"rotation": Quat.multiply(MyAvatar.orientation, Quat.fromVec3Degrees({"x": 0.0, "y": 180.0, "z": 0.0})),
|
||||
"visible": false,
|
||||
"ignorePickIntersection": true
|
||||
}, "local");
|
||||
// The bubble activation sound
|
||||
var bubbleActivateSound = SoundCache.getSound(Script.resolvePath("assets/sounds/bubble.wav"));
|
||||
// Is the update() function connected?
|
||||
|
@ -42,8 +45,8 @@
|
|||
|
||||
// Hides the bubble model overlay
|
||||
function hideOverlays() {
|
||||
Overlays.editOverlay(bubbleOverlay, {
|
||||
visible: false
|
||||
Entities.editEntity(bubbleOverlay, {
|
||||
"visible": false
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -85,24 +88,19 @@
|
|||
Script.update.disconnect(update);
|
||||
}
|
||||
|
||||
Overlays.editOverlay(bubbleOverlay, {
|
||||
dimensions: {
|
||||
x: MyAvatar.sensorToWorldScale,
|
||||
y: 0.75 * MyAvatar.sensorToWorldScale,
|
||||
z: MyAvatar.sensorToWorldScale
|
||||
Entities.editEntity(bubbleOverlay, {
|
||||
"dimensions": {
|
||||
"x": MyAvatar.sensorToWorldScale * 2,
|
||||
"y": (0.75 * MyAvatar.sensorToWorldScale) * ((MyAvatar.scale * 0.5) + 0.5),
|
||||
"z": MyAvatar.sensorToWorldScale * 2
|
||||
},
|
||||
position: {
|
||||
x: MyAvatar.position.x,
|
||||
y: -MyAvatar.scale * 2 + MyAvatar.position.y + MyAvatar.scale * BUBBLE_HEIGHT_SCALE,
|
||||
z: MyAvatar.position.z
|
||||
"position": {
|
||||
"x": MyAvatar.position.x,
|
||||
"y": -MyAvatar.scale * 2 + MyAvatar.position.y + MyAvatar.scale * BUBBLE_HEIGHT_SCALE,
|
||||
"z": MyAvatar.position.z
|
||||
},
|
||||
rotation: Quat.multiply(MyAvatar.orientation, Quat.fromVec3Degrees({x: 0.0, y: 180.0, z: 0.0})),
|
||||
scale: {
|
||||
x: 2 ,
|
||||
y: MyAvatar.scale * 0.5 + 0.5 ,
|
||||
z: 2
|
||||
},
|
||||
visible: true
|
||||
"rotation": Quat.multiply(MyAvatar.orientation, Quat.fromVec3Degrees({"x": 0.0, "y": 180.0, "z": 0.0})),
|
||||
"visible": true
|
||||
});
|
||||
bubbleOverlayTimestamp = nowTimestamp;
|
||||
Script.update.connect(update);
|
||||
|
@ -127,44 +125,34 @@
|
|||
var overlayAlpha = 1.0 - (delay / BUBBLE_VISIBLE_DURATION_MS);
|
||||
if (overlayAlpha > 0) {
|
||||
if (delay < BUBBLE_RAISE_ANIMATION_DURATION_MS) {
|
||||
Overlays.editOverlay(bubbleOverlay, {
|
||||
dimensions: {
|
||||
x: MyAvatar.sensorToWorldScale,
|
||||
y: 0.75 * MyAvatar.sensorToWorldScale,
|
||||
z: MyAvatar.sensorToWorldScale
|
||||
Entities.editEntity(bubbleOverlay, {
|
||||
"dimensions": {
|
||||
"x": MyAvatar.sensorToWorldScale * 2,
|
||||
"y": (0.75 * MyAvatar.sensorToWorldScale) * ((1 - ((BUBBLE_RAISE_ANIMATION_DURATION_MS - delay) / BUBBLE_RAISE_ANIMATION_DURATION_MS)) * MyAvatar.scale * 0.5 + 0.5),
|
||||
"z": MyAvatar.sensorToWorldScale * 2
|
||||
},
|
||||
// Quickly raise the bubble from the ground up
|
||||
position: {
|
||||
x: MyAvatar.position.x,
|
||||
y: (-((BUBBLE_RAISE_ANIMATION_DURATION_MS - delay) / BUBBLE_RAISE_ANIMATION_DURATION_MS)) * MyAvatar.scale * 2 + MyAvatar.position.y + MyAvatar.scale * BUBBLE_HEIGHT_SCALE,
|
||||
z: MyAvatar.position.z
|
||||
"position": {
|
||||
"x": MyAvatar.position.x,
|
||||
"y": (-((BUBBLE_RAISE_ANIMATION_DURATION_MS - delay) / BUBBLE_RAISE_ANIMATION_DURATION_MS)) * MyAvatar.scale * 2 + MyAvatar.position.y + MyAvatar.scale * BUBBLE_HEIGHT_SCALE,
|
||||
"z": MyAvatar.position.z
|
||||
},
|
||||
rotation: Quat.multiply(MyAvatar.orientation, Quat.fromVec3Degrees({x: 0.0, y: 180.0, z: 0.0})),
|
||||
scale: {
|
||||
x: 2 ,
|
||||
y: ((1 - ((BUBBLE_RAISE_ANIMATION_DURATION_MS - delay) / BUBBLE_RAISE_ANIMATION_DURATION_MS)) * MyAvatar.scale * 0.5 + 0.5),
|
||||
z: 2
|
||||
}
|
||||
"rotation": Quat.multiply(MyAvatar.orientation, Quat.fromVec3Degrees({"x": 0.0, "y": 180.0, "z": 0.0}))
|
||||
});
|
||||
} else {
|
||||
// Keep the bubble in place for a couple seconds
|
||||
Overlays.editOverlay(bubbleOverlay, {
|
||||
dimensions: {
|
||||
x: MyAvatar.sensorToWorldScale,
|
||||
y: 0.75 * MyAvatar.sensorToWorldScale,
|
||||
z: MyAvatar.sensorToWorldScale
|
||||
Entities.editEntity(bubbleOverlay, {
|
||||
"dimensions": {
|
||||
"x": MyAvatar.sensorToWorldScale * 2,
|
||||
"y": (0.75 * MyAvatar.sensorToWorldScale) * ((MyAvatar.scale * 0.5) + 0.5),
|
||||
"z": MyAvatar.sensorToWorldScale * 2
|
||||
},
|
||||
position: {
|
||||
x: MyAvatar.position.x,
|
||||
y: MyAvatar.position.y + MyAvatar.scale * BUBBLE_HEIGHT_SCALE,
|
||||
z: MyAvatar.position.z
|
||||
"position": {
|
||||
"x": MyAvatar.position.x,
|
||||
"y": MyAvatar.position.y + MyAvatar.scale * BUBBLE_HEIGHT_SCALE,
|
||||
"z": MyAvatar.position.z
|
||||
},
|
||||
rotation: Quat.multiply(MyAvatar.orientation, Quat.fromVec3Degrees({x: 0.0, y: 180.0, z: 0.0})),
|
||||
scale: {
|
||||
x: 2,
|
||||
y: MyAvatar.scale * 0.5 + 0.5 ,
|
||||
z: 2
|
||||
}
|
||||
"rotation": Quat.multiply(MyAvatar.orientation, Quat.fromVec3Degrees({"x": 0.0, "y": 180.0, "z": 0.0}))
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -222,7 +210,7 @@
|
|||
}
|
||||
Users.ignoreRadiusEnabledChanged.disconnect(onBubbleToggled);
|
||||
Users.enteredIgnoreRadius.disconnect(enteredIgnoreRadius);
|
||||
Overlays.deleteOverlay(bubbleOverlay);
|
||||
Entities.deleteEntity(bubbleOverlay);
|
||||
if (updateConnected === true) {
|
||||
Script.update.disconnect(update);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
"use strict";
|
||||
|
||||
//
|
||||
// Chat.js
|
||||
// By Don Hopkins (dhopkins@donhopkins.com)
|
||||
//
|
||||
// By Don Hopkins (dhopkins@donhopkins.com) on May 5th, 2017
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
// Copyright 2023 Overte e.V.
|
||||
//
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
@ -45,17 +49,19 @@
|
|||
var speechBubbleLineHeight = 0.05; // The height of a line of text in the speech bubble.
|
||||
var SPEECH_BUBBLE_MAX_WIDTH = 1; // meters
|
||||
|
||||
//V8TODO: change to local entity
|
||||
var textSizeOverlay = Overlays.addOverlay("text3d", {
|
||||
position: MyAvatar.position,
|
||||
lineHeight: speechBubbleLineHeight,
|
||||
leftMargin: 0,
|
||||
topMargin: 0,
|
||||
rightMargin: 0,
|
||||
bottomMargin: 0,
|
||||
ignoreRayIntersection: true,
|
||||
visible: false
|
||||
});
|
||||
var textSizeOverlay = Entities.addEntity({
|
||||
"type": "Text",
|
||||
"position": MyAvatar.position,
|
||||
"lineHeight": speechBubbleLineHeight,
|
||||
"leftMargin": 0,
|
||||
"topMargin": 0,
|
||||
"rightMargin": 0,
|
||||
"bottomMargin": 0,
|
||||
"unlit": true,
|
||||
"alignment": "center",
|
||||
"ignorePickIntersection": true,
|
||||
"visible": false
|
||||
}, "local");
|
||||
|
||||
// Load the persistent variables from the Settings, with defaults.
|
||||
function loadSettings() {
|
||||
|
@ -75,8 +81,8 @@
|
|||
speechBubbleOffset = Settings.getValue('Chat_speechBubbleOffset', {x: 0.0, y: 0.3, z:0.0});
|
||||
speechBubbleJointName = Settings.getValue('Chat_speechBubbleJointName', 'Head');
|
||||
speechBubbleLineHeight = Settings.getValue('Chat_speechBubbleLineHeight', 0.05);
|
||||
Overlays.editOverlay(textSizeOverlay, {
|
||||
lineHeight: speechBubbleLineHeight
|
||||
Entities.editEntity(textSizeOverlay, {
|
||||
"lineHeight": speechBubbleLineHeight
|
||||
});
|
||||
|
||||
saveSettings();
|
||||
|
@ -291,20 +297,23 @@
|
|||
}
|
||||
|
||||
var identifierParams = {
|
||||
parentID: myAvatarID,
|
||||
parentJointIndex: myJointIndex,
|
||||
lifetime: identifyAvatarDuration,
|
||||
start: myJointPosition,
|
||||
endParentID: yourAvatarID,
|
||||
endParentJointIndex: yourJointIndex,
|
||||
end: yourJointPosition,
|
||||
color: identifyAvatarLineColor,
|
||||
alpha: 1
|
||||
"type": "PolyLine",
|
||||
"parentID": myAvatarID,
|
||||
"parentJointIndex": myJointIndex,
|
||||
"lifetime": identifyAvatarDuration,
|
||||
"linePoints": [
|
||||
myJointPosition,
|
||||
yourJointPosition
|
||||
],
|
||||
"strokeWidths": [ 0.02, 0.02],
|
||||
//endParentID: yourAvatarID, //Currently doesn't work. Never implemented.
|
||||
//endParentJointIndex: yourJointIndex, //Currently doesn't work. Never implemented.
|
||||
"color": identifyAvatarLineColor
|
||||
};
|
||||
|
||||
avatarIdentifiers[yourAvatarID] = identifierParams;
|
||||
|
||||
identifierParams.lineID = Overlays.addOverlay("line3d", identifierParams);
|
||||
identifierParams.lineID = Entities.addEntity(identifierParams, "local");
|
||||
|
||||
//print("ADDOVERLAY lineID", lineID, "myJointPosition", JSON.stringify(myJointPosition), "yourJointPosition", JSON.stringify(yourJointPosition), "lineData", JSON.stringify(lineData));
|
||||
|
||||
|
@ -330,7 +339,7 @@
|
|||
}
|
||||
|
||||
if (identifierParams.lineID) {
|
||||
Overlays.deleteOverlay(identifierParams.lineID);
|
||||
Entities.deleteEntity(identifierParams.lineID);
|
||||
}
|
||||
|
||||
delete avatarIdentifiers[yourAvatarID];
|
||||
|
@ -624,37 +633,36 @@
|
|||
|
||||
var jointIndex = MyAvatar.getJointIndex(speechBubbleJointName);
|
||||
var dimensions = {
|
||||
x: 100.0,
|
||||
y: 100.0,
|
||||
z: 0.1
|
||||
"x": 100.0,
|
||||
"y": 100.0,
|
||||
"z": 0.1
|
||||
};
|
||||
|
||||
speechBubbleParams = {
|
||||
type: "Text",
|
||||
lifetime: speechBubbleDuration,
|
||||
parentID: MyAvatar.sessionUUID,
|
||||
jointIndex: jointIndex,
|
||||
dimensions: dimensions,
|
||||
lineHeight: speechBubbleLineHeight,
|
||||
leftMargin: 0,
|
||||
topMargin: 0,
|
||||
rightMargin: 0,
|
||||
bottomMargin: 0,
|
||||
faceCamera: true,
|
||||
drawInFront: true,
|
||||
ignoreRayIntersection: true,
|
||||
text: speechBubbleMessage,
|
||||
textColor: speechBubbleTextColor,
|
||||
color: speechBubbleTextColor,
|
||||
backgroundColor: speechBubbleBackgroundColor
|
||||
"type": "Text",
|
||||
"lifetime": speechBubbleDuration,
|
||||
"parentID": MyAvatar.sessionUUID,
|
||||
"jointIndex": jointIndex,
|
||||
"dimensions": dimensions,
|
||||
"lineHeight": speechBubbleLineHeight,
|
||||
"leftMargin": 0,
|
||||
"topMargin": 0,
|
||||
"rightMargin": 0,
|
||||
"bottomMargin": 0,
|
||||
"billboardMode": "full",
|
||||
"renderLayer": "front",
|
||||
"ignorePickIntersection": true,
|
||||
"text": speechBubbleMessage,
|
||||
"textColor": speechBubbleTextColor,
|
||||
"backgroundColor": speechBubbleBackgroundColor
|
||||
};
|
||||
|
||||
// Only overlay text3d has a way to measure the text, not entities.
|
||||
// So we make a temporary one just for measuring text, then delete it.
|
||||
var speechBubbleTextOverlayID = Overlays.addOverlay("text3d", speechBubbleParams);
|
||||
var textSize = Overlays.textSize(textSizeOverlay, speechBubbleMessage);
|
||||
var speechBubbleTextOverlayID = Entities.addEntity(speechBubbleParams, "local");
|
||||
var textSize = Entities.textSize(textSizeOverlay, speechBubbleMessage);
|
||||
try {
|
||||
Overlays.deleteOverlay(speechBubbleTextOverlayID);
|
||||
Entities.deleteEntity(speechBubbleTextOverlayID);
|
||||
} catch (e) {}
|
||||
|
||||
//print("updateSpeechBubble:", "speechBubbleMessage", speechBubbleMessage, "textSize", textSize.width, textSize.height);
|
||||
|
@ -986,7 +994,7 @@
|
|||
unidentifyAvatars();
|
||||
disconnectWebHandler();
|
||||
|
||||
Overlays.deleteOverlay(textSizeOverlay);
|
||||
Entities.deleteEntity(textSizeOverlay);
|
||||
|
||||
if (onChatPage) {
|
||||
tablet.gotoHomeScreen();
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
// controllerDispatcher.js
|
||||
//
|
||||
// Copyright 2017-2020 High Fidelity, Inc.
|
||||
// Copyright 2023 Overte e.V.
|
||||
// Created by Seth Alves, July 27th, 2017.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
// Copyright 2023, Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
@ -261,10 +262,11 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
_this.dataGatherers.rightControllerLocation()
|
||||
];
|
||||
|
||||
// find 3d overlays near each hand
|
||||
// find 3d overlays/Local Entities near each hand
|
||||
var nearbyOverlayIDs = [];
|
||||
var h;
|
||||
/*for (h = LEFT_HAND; h <= RIGHT_HAND; h++) {
|
||||
//V8TODO: Overlays.findOverlays might not work here
|
||||
for (h = LEFT_HAND; h <= RIGHT_HAND; h++) {
|
||||
if (controllerLocations[h].valid) {
|
||||
var nearbyOverlays =
|
||||
Overlays.findOverlays(controllerLocations[h].position, NEAR_MAX_RADIUS * sensorScaleFactor);
|
||||
|
@ -287,9 +289,9 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
}
|
||||
|
||||
nearbyOverlays.sort(function (a, b) {
|
||||
var aPosition = Overlays.getProperty(a, "position");
|
||||
var aPosition = Entities.getEntityProperties(a, ["position"]).position;
|
||||
var aDistance = Vec3.distance(aPosition, controllerLocations[h].position);
|
||||
var bPosition = Overlays.getProperty(b, "position");
|
||||
var bPosition = Entities.getEntityProperties(b, ["position"]).position;
|
||||
var bDistance = Vec3.distance(bPosition, controllerLocations[h].position);
|
||||
return aDistance - bDistance;
|
||||
});
|
||||
|
@ -298,7 +300,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
} else {
|
||||
nearbyOverlayIDs.push([]);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// find entities near each hand
|
||||
var nearbyEntityProperties = [[], []];
|
||||
|
@ -310,21 +312,31 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
|
||||
if (SHOW_GRAB_SPHERE) {
|
||||
if (this.grabSphereOverlays[h]) {
|
||||
Overlays.editOverlay(this.grabSphereOverlays[h], { position: controllerLocations[h].position });
|
||||
Entities.editEntity(this.grabSphereOverlays[h], { "position": controllerLocations[h].position });
|
||||
} else {
|
||||
var grabSphereSize = findRadius * 2;
|
||||
//V8TODO: change to local entity
|
||||
this.grabSphereOverlays[h] = Overlays.addOverlay("sphere", {
|
||||
position: controllerLocations[h].position,
|
||||
dimensions: { x: grabSphereSize, y: grabSphereSize, z: grabSphereSize },
|
||||
color: { red: 30, green: 30, blue: 255 },
|
||||
alpha: 0.3,
|
||||
solid: true,
|
||||
visible: true,
|
||||
// lineWidth: 2.0,
|
||||
drawInFront: false,
|
||||
grabbable: false
|
||||
});
|
||||
this.grabSphereOverlays[h] = Entities.addEntity({
|
||||
"type": "Shape",
|
||||
"shape": "Sphere",
|
||||
"position": controllerLocations[h].position,
|
||||
"dimensions": {
|
||||
"x": grabSphereSize,
|
||||
"y": grabSphereSize,
|
||||
"z": grabSphereSize
|
||||
},
|
||||
"color": {
|
||||
"red": 30,
|
||||
"green": 30,
|
||||
"blue": 255
|
||||
},
|
||||
"alpha": 0.3,
|
||||
"primitiveMode": "solid",
|
||||
"visible": true,
|
||||
"renderLayer": "front",
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
}
|
||||
}, "local");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -656,8 +668,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
Controller.disableMapping(MAPPING_NAME);
|
||||
_this.pointerManager.removePointers();
|
||||
Pointers.removePointer(this.mouseRayPointer);
|
||||
Overlays.mouseReleaseOnOverlay.disconnect(mouseReleaseOnOverlay);
|
||||
Overlays.mousePressOnOverlay.disconnect(mousePress);
|
||||
Entities.mouseReleaseOnEntity.disconnect(mouseReleaseOn);
|
||||
Entities.mousePressOnEntity.disconnect(mousePress);
|
||||
Messages.messageReceived.disconnect(controllerDispatcher.handleMessage);
|
||||
if (_this.debugPanelID) {
|
||||
|
@ -668,30 +679,30 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
|
||||
if (DEBUG) {
|
||||
this.debugPanelID = Entities.addEntity({
|
||||
name: "controllerDispatcher debug panel",
|
||||
type: "Text",
|
||||
dimensions: { x: 1.0, y: 0.3, z: 0.01 },
|
||||
parentID: MyAvatar.sessionUUID,
|
||||
"name": "controllerDispatcher debug panel",
|
||||
"type": "Text",
|
||||
"dimensions": { "x": 1.0, "y": 0.3, "z": 0.01 },
|
||||
"parentID": MyAvatar.sessionUUID,
|
||||
// parentJointIndex: MyAvatar.getJointIndex("_CAMERA_MATRIX"),
|
||||
parentJointIndex: -1,
|
||||
localPosition: { x: -0.25, y: 0.8, z: -1.2 },
|
||||
textColor: { red: 255, green: 255, blue: 255},
|
||||
backgroundColor: { red: 0, green: 0, blue: 0},
|
||||
text: "",
|
||||
lineHeight: 0.03,
|
||||
leftMargin: 0.015,
|
||||
topMargin: 0.01,
|
||||
backgroundAlpha: 0.7,
|
||||
textAlpha: 1.0,
|
||||
unlit: true,
|
||||
ignorePickIntersection: true
|
||||
"parentJointIndex": -1,
|
||||
"localPosition": { "x": -0.25, "y": 0.8, "z": -1.2 },
|
||||
"textColor": { "red": 255, "green": 255, "blue": 255},
|
||||
"backgroundColor": { "red": 0, "green": 0, "blue": 0},
|
||||
"text": "",
|
||||
"lineHeight": 0.03,
|
||||
"leftMargin": 0.015,
|
||||
"topMargin": 0.01,
|
||||
"backgroundAlpha": 0.7,
|
||||
"textAlpha": 1.0,
|
||||
"unlit": true,
|
||||
"ignorePickIntersection": true
|
||||
}, "local");
|
||||
}
|
||||
}
|
||||
|
||||
function mouseReleaseOnOverlay(overlayID, event) {
|
||||
if (HMD.homeButtonID && overlayID === HMD.homeButtonID && event.button === "Primary") {
|
||||
Messages.sendLocalMessage("home", overlayID);
|
||||
function mouseReleaseOn(id, event) {
|
||||
if (HMD.homeButtonID && id === HMD.homeButtonID && event.button === "Primary") {
|
||||
Messages.sendLocalMessage("home", id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -708,8 +719,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
}
|
||||
}
|
||||
|
||||
Overlays.mouseReleaseOnOverlay.connect(mouseReleaseOnOverlay);
|
||||
Overlays.mousePressOnOverlay.connect(mousePress);
|
||||
Entities.mouseReleaseOnEntity.connect(mouseReleaseOn);
|
||||
Entities.mousePressOnEntity.connect(mousePress);
|
||||
|
||||
var controllerDispatcher = new ControllerDispatcher();
|
||||
|
|
|
@ -3,11 +3,13 @@
|
|||
//
|
||||
// Created by Anthony J. Thibault on 10/20/16
|
||||
// Originally created by Ryan Huffman on 9/21/2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
// Copyright 2023, Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
/* globals createControllerDisplay:true, deleteControllerDisplay:true, Controller, Overlays, Vec3, MyAvatar, Quat */
|
||||
/* globals createControllerDisplay:true, deleteControllerDisplay:true, Controller, Entities, Vec3, MyAvatar, Quat */
|
||||
|
||||
function clamp(value, min, max) {
|
||||
if (value < min) {
|
||||
|
@ -51,8 +53,8 @@ createControllerDisplay = function(config) {
|
|||
|
||||
setVisible: function(visible) {
|
||||
for (var i = 0; i < this.overlays.length; ++i) {
|
||||
Overlays.editOverlay(this.overlays[i], {
|
||||
visible: visible
|
||||
Entities.editEntity(this.overlays[i], {
|
||||
"visible": visible
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -62,8 +64,8 @@ createControllerDisplay = function(config) {
|
|||
/*
|
||||
if (partName in this.partOverlays) {
|
||||
for (var i = 0; i < this.partOverlays[partName].length; ++i) {
|
||||
Overlays.editOverlay(this.partOverlays[partName][i], {
|
||||
//visible: visible
|
||||
Entities.editEntity(this.partOverlays[partName][i], {
|
||||
//"visible": visible
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +82,8 @@ createControllerDisplay = function(config) {
|
|||
textures[part.textureName] = layer.defaultTextureURL;
|
||||
}
|
||||
for (var i = 0; i < this.partOverlays[partName].length; ++i) {
|
||||
Overlays.editOverlay(this.partOverlays[partName][i], {
|
||||
textures: textures
|
||||
Entities.editEntity(this.partOverlays[partName][i], {
|
||||
"textures": textures
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -93,14 +95,14 @@ createControllerDisplay = function(config) {
|
|||
var controller = config.controllers[0];
|
||||
var position = controller.position;
|
||||
|
||||
// first overlay is main body.
|
||||
// first overlay/Local Entity is main body.
|
||||
var overlayID = this.overlays[0];
|
||||
var localPosition = Vec3.multiply(sensorScaleFactor, Vec3.sum(Vec3.multiplyQbyV(controller.rotation, controller.naturalPosition), position));
|
||||
var dimensions = Vec3.multiply(sensorScaleFactor, controller.dimensions);
|
||||
|
||||
Overlays.editOverlay(overlayID, {
|
||||
dimensions: dimensions,
|
||||
localPosition: localPosition
|
||||
Entities.editEntity(overlayID, {
|
||||
"dimensions": dimensions,
|
||||
"localPosition": localPosition
|
||||
});
|
||||
|
||||
if (controller.parts) {
|
||||
|
@ -143,15 +145,15 @@ createControllerDisplay = function(config) {
|
|||
}
|
||||
}
|
||||
if (localRotation !== undefined) {
|
||||
Overlays.editOverlay(overlayID, {
|
||||
dimensions: Vec3.multiply(sensorScaleFactor, part.naturalDimensions),
|
||||
localPosition: Vec3.multiply(sensorScaleFactor, localPosition),
|
||||
localRotation: localRotation
|
||||
Entities.editEntity(overlayID, {
|
||||
"dimensions": Vec3.multiply(sensorScaleFactor, part.naturalDimensions),
|
||||
"localPosition": Vec3.multiply(sensorScaleFactor, localPosition),
|
||||
"localRotation": localRotation
|
||||
});
|
||||
} else {
|
||||
Overlays.editOverlay(overlayID, {
|
||||
dimensions: Vec3.multiply(sensorScaleFactor, part.naturalDimensions),
|
||||
localPosition: Vec3.multiply(sensorScaleFactor, localPosition)
|
||||
Entities.editEntity(overlayID, {
|
||||
"dimensions": Vec3.multiply(sensorScaleFactor, part.naturalDimensions),
|
||||
"localPosition": Vec3.multiply(sensorScaleFactor, localPosition)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -172,16 +174,16 @@ createControllerDisplay = function(config) {
|
|||
controller.naturalPosition = { x: 0, y: 0, z: 0 };
|
||||
}
|
||||
|
||||
//V8TODO: change to local entity
|
||||
var baseOverlayID = Overlays.addOverlay("model", {
|
||||
url: controller.modelURL,
|
||||
dimensions: Vec3.multiply(sensorScaleFactor, controller.dimensions),
|
||||
localRotation: controller.rotation,
|
||||
localPosition: Vec3.multiply(sensorScaleFactor, position),
|
||||
parentID: MyAvatar.SELF_ID,
|
||||
parentJointIndex: controller.jointIndex,
|
||||
ignoreRayIntersection: true
|
||||
});
|
||||
var baseOverlayID = Entities.addEntity({
|
||||
"type": "Model",
|
||||
"modelURL": controller.modelURL,
|
||||
"dimensions": Vec3.multiply(sensorScaleFactor, controller.dimensions),
|
||||
"localRotation": controller.rotation,
|
||||
"localPosition": Vec3.multiply(sensorScaleFactor, position),
|
||||
"parentID": MyAvatar.SELF_ID,
|
||||
"parentJointIndex": controller.jointIndex,
|
||||
"ignorePickIntersection": true
|
||||
}, "local");
|
||||
|
||||
controllerDisplay.overlays.push(baseOverlayID);
|
||||
|
||||
|
@ -194,11 +196,12 @@ createControllerDisplay = function(config) {
|
|||
controllerDisplay.parts[partName] = controller.parts[partName];
|
||||
|
||||
var properties = {
|
||||
url: part.modelURL,
|
||||
localPosition: localPosition,
|
||||
localRotation: localRotation,
|
||||
parentID: baseOverlayID,
|
||||
ignoreRayIntersection: true
|
||||
"type": "Model",
|
||||
"modelURL": part.modelURL,
|
||||
"localPosition": localPosition,
|
||||
"localRotation": localRotation,
|
||||
"parentID": baseOverlayID,
|
||||
"ignorePickIntersection": true
|
||||
};
|
||||
|
||||
if (part.defaultTextureLayer) {
|
||||
|
@ -207,8 +210,7 @@ createControllerDisplay = function(config) {
|
|||
properties.textures = textures;
|
||||
}
|
||||
|
||||
//V8TODO: change to local entity
|
||||
var overlayID = Overlays.addOverlay("model", properties);
|
||||
var overlayID = Entities.addEntity(properties, "local");
|
||||
|
||||
if (part.type === "rotational") {
|
||||
var input = resolveHardware(part.input);
|
||||
|
@ -288,7 +290,7 @@ createControllerDisplay = function(config) {
|
|||
|
||||
deleteControllerDisplay = function(controllerDisplay) {
|
||||
for (var i = 0; i < controllerDisplay.overlays.length; ++i) {
|
||||
Overlays.deleteOverlay(controllerDisplay.overlays[i]);
|
||||
Entities.deleteEntity(controllerDisplay.overlays[i]);
|
||||
}
|
||||
Controller.disableMapping(controllerDisplay.mappingName);
|
||||
};
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
// equipEntity.js
|
||||
//
|
||||
// Created by Seth Alves, August 14th, 2017.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
// Copyright 2023, Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
|
@ -74,20 +78,20 @@ EquipHotspotBuddy.prototype.updateHotspot = function(hotspot, timestamp) {
|
|||
}
|
||||
|
||||
// override default sphere with a user specified model, if it exists.
|
||||
//V8TODO: change to local entity
|
||||
overlayInfoSet.overlays.push(Overlays.addOverlay("model", {
|
||||
name: "hotspot overlay",
|
||||
url: hotspot.indicatorURL ? hotspot.indicatorURL : DEFAULT_SPHERE_MODEL_URL,
|
||||
position: hotspot.worldPosition,
|
||||
rotation: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
w: 1
|
||||
overlayInfoSet.overlays.push(Entities.addEntity({
|
||||
"type": "Model",
|
||||
"name": "hotspot overlay",
|
||||
"modelURL": hotspot.indicatorURL ? hotspot.indicatorURL : DEFAULT_SPHERE_MODEL_URL,
|
||||
"position": hotspot.worldPosition,
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
dimensions: dimensions,
|
||||
ignoreRayIntersection: true
|
||||
}));
|
||||
"dimensions": dimensions,
|
||||
"ignorePickIntersection": true
|
||||
}, "local"));
|
||||
overlayInfoSet.type = "model";
|
||||
this.map[hotspot.key] = overlayInfoSet;
|
||||
} else {
|
||||
|
@ -132,7 +136,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
|||
|
||||
if (overlayInfoSet.timestamp !== timestamp && overlayInfoSet.currentSize <= 0.05) {
|
||||
// this is an old overlay, that has finished fading out, delete it!
|
||||
overlayInfoSet.overlays.forEach(Overlays.deleteOverlay);
|
||||
overlayInfoSet.overlays.forEach(Entities.deleteEntity);
|
||||
delete this.map[keys[i]];
|
||||
} else {
|
||||
// update overlay position, rotation to follow the object it's attached to.
|
||||
|
@ -154,14 +158,14 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
|||
}
|
||||
|
||||
overlayInfoSet.overlays.forEach(function(overlay) {
|
||||
Overlays.editOverlay(overlay, {
|
||||
position: position,
|
||||
rotation: props.rotation,
|
||||
dimensions: dimensions
|
||||
Entities.editEntity(overlay, {
|
||||
"position": position,
|
||||
"rotation": props.rotation,
|
||||
"dimensions": dimensions
|
||||
});
|
||||
});
|
||||
} else {
|
||||
overlayInfoSet.overlays.forEach(Overlays.deleteOverlay);
|
||||
overlayInfoSet.overlays.forEach(Entities.deleteEntity);
|
||||
delete this.map[keys[i]];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
//
|
||||
// WebTablet.js
|
||||
//
|
||||
// Created by Anthony J. Thibault on 8/8/2016
|
||||
// Created by Anthony J. Thibault on August 8th, 2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
// Copyright 2023, Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
@ -119,17 +120,16 @@ WebTablet = function (url, width, dpi, hand, location, visible) {
|
|||
|
||||
var modelURL = LOCAL_TABLET_MODEL_PATH;
|
||||
var tabletProperties = {
|
||||
name: "WebTablet Tablet",
|
||||
type: "Model",
|
||||
modelURL: modelURL,
|
||||
url: modelURL, // for overlay
|
||||
grabbable: true, // for overlay
|
||||
loadPriority: 10.0, // for overlay
|
||||
grab: { grabbable: true },
|
||||
dimensions: { x: tabletWidth, y: tabletHeight, z: tabletDepth },
|
||||
parentID: MyAvatar.SELF_ID,
|
||||
visible: visible,
|
||||
isGroupCulled: true
|
||||
"name": "WebTablet Tablet",
|
||||
"type": "Model",
|
||||
"modelURL": modelURL,
|
||||
"grab": {
|
||||
"grabbable": true
|
||||
},
|
||||
"dimensions": { "x": tabletWidth, "y": tabletHeight, "z": tabletDepth },
|
||||
"parentID": MyAvatar.SELF_ID,
|
||||
"visible": visible,
|
||||
"groupCulled": true
|
||||
};
|
||||
|
||||
// compute position, rotation & parentJointIndex of the tablet
|
||||
|
@ -142,68 +142,87 @@ WebTablet = function (url, width, dpi, hand, location, visible) {
|
|||
this.cleanUpOldTablets();
|
||||
cleanUpOldMaterialEntities();
|
||||
|
||||
//V8TODO: change to local entity
|
||||
this.tabletEntityID = Overlays.addOverlay("model", tabletProperties);
|
||||
this.tabletEntityID = Entities.addEntity(tabletProperties, "local");
|
||||
|
||||
if (this.webOverlayID) {
|
||||
Overlays.deleteOverlay(this.webOverlayID);
|
||||
Entities.deleteEntity(this.webOverlayID);
|
||||
}
|
||||
|
||||
var WEB_ENTITY_Z_OFFSET = (tabletDepth / 2.5) * sensorScaleFactor;
|
||||
var WEB_ENTITY_Y_OFFSET = 1.25 * tabletScaleFactor;
|
||||
var screenWidth = 0.9367 * tabletWidth;
|
||||
var screenHeight = 0.9000 * tabletHeight;
|
||||
//V8TODO: change to local entity
|
||||
this.webOverlayID = Overlays.addOverlay("web3d", {
|
||||
name: "WebTablet Web",
|
||||
url: url,
|
||||
localPosition: { x: 0, y: WEB_ENTITY_Y_OFFSET, z: -WEB_ENTITY_Z_OFFSET },
|
||||
localRotation: Quat.angleAxis(180, Y_AXIS),
|
||||
dimensions: {x: screenWidth, y: screenHeight, z: 1.0},
|
||||
dpi: tabletDpi,
|
||||
color: { red: 255, green: 255, blue: 255 },
|
||||
alpha: 1.0,
|
||||
parentID: this.tabletEntityID,
|
||||
parentJointIndex: -1,
|
||||
showKeyboardFocusHighlight: false,
|
||||
grabbable: false,
|
||||
visible: visible
|
||||
});
|
||||
this.webOverlayID = Entities.addEntity({
|
||||
"type": "Web",
|
||||
"name": "WebTablet Web",
|
||||
"sourceUrl": url,
|
||||
"localPosition": { "x": 0, "y": WEB_ENTITY_Y_OFFSET, "z": -WEB_ENTITY_Z_OFFSET },
|
||||
"localRotation": Quat.angleAxis(180, Y_AXIS),
|
||||
"dimensions": {"x": screenWidth, "y": screenHeight, "z": 1.0},
|
||||
"dpi": tabletDpi,
|
||||
"color": { "red": 255, "green": 255, "blue": 255 },
|
||||
"alpha": 1.0,
|
||||
"parentID": this.tabletEntityID,
|
||||
"showKeyboardFocusHighlight": false,
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
},
|
||||
"visible": visible
|
||||
}, "local");
|
||||
|
||||
var homeButtonDim = 4.0 * tabletScaleFactor / 1.5;
|
||||
var HOME_BUTTON_X_OFFSET = 0.00079 * sensorScaleFactor;
|
||||
var HOME_BUTTON_Y_OFFSET = -1 * ((tabletHeight / 2) - (4.0 * tabletScaleFactor / 2));
|
||||
var HOME_BUTTON_Z_OFFSET = (tabletDepth / 1.9) * sensorScaleFactor;
|
||||
//V8TODO: change to local entity
|
||||
this.homeButtonID = Overlays.addOverlay("circle3d", {
|
||||
name: "homeButton",
|
||||
localPosition: { x: HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
||||
localRotation: Quat.fromVec3Degrees({ x: 180, y: 180, z: 0}),
|
||||
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim },
|
||||
solid: true,
|
||||
alpha: 0.0,
|
||||
visible: visible,
|
||||
drawInFront: false,
|
||||
parentID: this.tabletEntityID,
|
||||
parentJointIndex: -1
|
||||
});
|
||||
this.homeButtonID = Entities.addEntity({
|
||||
"type": "Gizmo",
|
||||
"gizmoType": "ring",
|
||||
"name": "homeButton",
|
||||
"localPosition": { "x": HOME_BUTTON_X_OFFSET, "y": HOME_BUTTON_Y_OFFSET, "z": -HOME_BUTTON_Z_OFFSET },
|
||||
"localRotation": Quat.fromVec3Degrees({ "x": 90, "y": 0, "z": 0}),
|
||||
"dimensions": { "x": homeButtonDim, "y": homeButtonDim, "z": homeButtonDim },
|
||||
"primitiveMode": "solid",
|
||||
"ring": {
|
||||
"innerStartAlpha": 0.0,
|
||||
"innerEndAlpha": 0.0,
|
||||
"outerStartAlpha": 0.0,
|
||||
"outerEndAlpha": 0.0,
|
||||
},
|
||||
"visible": visible,
|
||||
"renderLayer": "world",
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
},
|
||||
"parentID": this.tabletEntityID
|
||||
}, "local");
|
||||
|
||||
//V8TODO: change to local entity
|
||||
this.homeButtonHighlightID = Overlays.addOverlay("circle3d", {
|
||||
name: "homeButtonHighlight",
|
||||
localPosition: { x: -HOME_BUTTON_X_OFFSET, y: HOME_BUTTON_Y_OFFSET, z: -HOME_BUTTON_Z_OFFSET },
|
||||
localRotation: Quat.fromVec3Degrees({ x: 180, y: 180, z: 0}),
|
||||
dimensions: { x: homeButtonDim, y: homeButtonDim, z: homeButtonDim },
|
||||
color: {red: 255, green: 255, blue: 255},
|
||||
solid: true,
|
||||
innerRadius: 0.9,
|
||||
ignorePickIntersection: true,
|
||||
alpha: 0.0,
|
||||
visible: visible,
|
||||
drawInFront: false,
|
||||
parentID: this.tabletEntityID,
|
||||
parentJointIndex: -1
|
||||
});
|
||||
this.homeButtonHighlightID = Entities.addEntity({
|
||||
"type": "Gizmo",
|
||||
"gizmoType": "ring",
|
||||
"name": "homeButtonHighlight",
|
||||
"localPosition": { "x": -HOME_BUTTON_X_OFFSET, "y": HOME_BUTTON_Y_OFFSET, "z": -HOME_BUTTON_Z_OFFSET },
|
||||
"localRotation": Quat.fromVec3Degrees({ "x": 90, "y": 0, "z": 0}),
|
||||
"dimensions": { "x": homeButtonDim, "y": homeButtonDim, "z": homeButtonDim },
|
||||
"primitiveMode": "solid",
|
||||
"ring": {
|
||||
"innerStartColor": {"red": 255, "green": 255, "blue": 255},
|
||||
"innerEndColor": {"red": 255, "green": 255, "blue": 255},
|
||||
"outerStartColor": {"red": 255, "green": 255, "blue": 255},
|
||||
"outerEndColor": {"red": 255, "green": 255, "blue": 255},
|
||||
"innerStartAlpha": 0.0,
|
||||
"innerEndAlpha": 0.0,
|
||||
"outerStartAlpha": 0.0,
|
||||
"outerEndAlpha": 0.0,
|
||||
"innerRadius": 0.9,
|
||||
},
|
||||
"ignorePickIntersection": true,
|
||||
"visible": visible,
|
||||
"renderLayer": "world",
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
},
|
||||
"parentID": this.tabletEntityID
|
||||
}, "local");
|
||||
|
||||
this.receive = function (channel, senderID, senderUUID, localOnly) {
|
||||
if (_this.homeButtonID === senderID) {
|
||||
|
@ -289,8 +308,8 @@ WebTablet.prototype.setLandscape = function(newLandscapeValue) {
|
|||
this.landscape = newLandscapeValue;
|
||||
var cameraOrientation = Quat.cancelOutRollAndPitch(Camera.orientation);
|
||||
var tabletRotation = Quat.multiply(cameraOrientation, this.landscape ? ROT_LANDSCAPE : ROT_Y_180);
|
||||
Overlays.editOverlay(this.tabletEntityID, {
|
||||
rotation: tabletRotation
|
||||
Entities.editEntity(this.tabletEntityID, {
|
||||
"rotation": tabletRotation
|
||||
});
|
||||
|
||||
var tabletWidth = getTabletWidthFromSettings() * MyAvatar.sensorToWorldScale;
|
||||
|
@ -299,18 +318,18 @@ WebTablet.prototype.setLandscape = function(newLandscapeValue) {
|
|||
var screenWidth = 0.9275 * tabletWidth;
|
||||
var screenHeight = 0.8983 * tabletHeight;
|
||||
var screenRotation = Quat.angleAxis(180, Vec3.UP);
|
||||
Overlays.editOverlay(this.webOverlayID, {
|
||||
localRotation: this.landscape ? Quat.multiply(screenRotation, Quat.angleAxis(-90, Vec3.FRONT)) : screenRotation,
|
||||
dimensions: {x: this.landscape ? screenHeight : screenWidth, y: this.landscape ? screenWidth : screenHeight, z: 0.1}
|
||||
Entities.editEntity(this.webOverlayID, {
|
||||
"localRotation": this.landscape ? Quat.multiply(screenRotation, Quat.angleAxis(-90, Vec3.FRONT)) : screenRotation,
|
||||
"dimensions": {"x": this.landscape ? screenHeight : screenWidth, "y": this.landscape ? screenWidth : screenHeight, "z": 0.1}
|
||||
});
|
||||
};
|
||||
|
||||
WebTablet.prototype.getLocation = function() {
|
||||
var location = Overlays.getProperty(this.tabletEntityID, "localPosition");
|
||||
var orientation = Overlays.getProperty(this.tabletEntityID, "localOrientation");
|
||||
var location = Entities.getEntityProperties(this.tabletEntityID, ["localPosition"]).localPosition;
|
||||
var orientation = Entities.getEntityProperties(this.tabletEntityID, ["localRotation"]).localRotation;
|
||||
return {
|
||||
localPosition: location,
|
||||
localRotation: orientation
|
||||
"localPosition": location,
|
||||
"localRotation": orientation
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -320,11 +339,11 @@ WebTablet.prototype.setHomeButtonTexture = function() {
|
|||
};
|
||||
|
||||
WebTablet.prototype.setURL = function (url) {
|
||||
Overlays.editOverlay(this.webOverlayID, { url: url });
|
||||
Entities.editEntity(this.webOverlayID, { "sourceUrl": url });
|
||||
};
|
||||
|
||||
WebTablet.prototype.setScriptURL = function (scriptURL) {
|
||||
Overlays.editOverlay(this.webOverlayID, { scriptURL: scriptURL });
|
||||
Entities.editEntity(this.webOverlayID, { "scriptURL": scriptURL });
|
||||
};
|
||||
|
||||
WebTablet.prototype.getOverlayObject = function () {
|
||||
|
@ -337,10 +356,10 @@ WebTablet.prototype.setWidth = function (width) {
|
|||
};
|
||||
|
||||
WebTablet.prototype.destroy = function () {
|
||||
Overlays.deleteOverlay(this.webOverlayID);
|
||||
Overlays.deleteOverlay(this.tabletEntityID);
|
||||
Overlays.deleteOverlay(this.homeButtonID);
|
||||
Overlays.deleteOverlay(this.homeButtonHighlightID);
|
||||
Entities.deleteEntity(this.webOverlayID);
|
||||
Entities.deleteEntity(this.tabletEntityID);
|
||||
Entities.deleteEntity(this.homeButtonID);
|
||||
Entities.deleteEntity(this.homeButtonHighlightID);
|
||||
HMD.displayModeChanged.disconnect(this.myOnHmdChanged);
|
||||
|
||||
Controller.mousePressEvent.disconnect(this.myMousePressEvent);
|
||||
|
@ -356,7 +375,7 @@ WebTablet.prototype.geometryChanged = function (geometry) {
|
|||
var tabletProperties = {};
|
||||
// compute position, rotation & parentJointIndex of the tablet
|
||||
this.calculateTabletAttachmentProperties(NO_HANDS, false, tabletProperties);
|
||||
Overlays.editOverlay(HMD.tabletID, tabletProperties);
|
||||
Entities.editEntity(HMD.tabletID, tabletProperties);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -468,7 +487,7 @@ WebTablet.prototype.onHmdChanged = function () {
|
|||
var tabletProperties = {};
|
||||
// compute position, rotation & parentJointIndex of the tablet
|
||||
this.calculateTabletAttachmentProperties(NO_HANDS, false, tabletProperties);
|
||||
Overlays.editOverlay(HMD.tabletID, tabletProperties);
|
||||
Entities.editEntity(HMD.tabletID, tabletProperties);
|
||||
};
|
||||
|
||||
WebTablet.prototype.pickle = function () {
|
||||
|
@ -514,7 +533,7 @@ WebTablet.unpickle = function (string) {
|
|||
};
|
||||
|
||||
WebTablet.prototype.getPosition = function () {
|
||||
return Overlays.getProperty(this.webOverlayID, "position");
|
||||
return Entities.getEntityProperties(this.webOverlayID, ["position"]).position;
|
||||
};
|
||||
|
||||
WebTablet.prototype.mousePressEvent = function (event) {
|
||||
|
@ -527,7 +546,7 @@ WebTablet.prototype.mousePressEvent = function (event) {
|
|||
this.dragging = true;
|
||||
var invCameraXform = new Xform(Camera.orientation, Camera.position).inv();
|
||||
this.initialLocalIntersectionPoint = invCameraXform.xformPoint(tabletBackPickResults.intersection);
|
||||
this.initialLocalPosition = Overlays.getProperty(this.tabletEntityID, "localPosition");
|
||||
this.initialLocalPosition = Entities.getEntityProperties(this.tabletEntityID, ["localPosition"]).localPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -561,7 +580,15 @@ WebTablet.prototype.scheduleMouseMoveProcessor = function() {
|
|||
WebTablet.prototype.handleHomeButtonHover = function(x, y) {
|
||||
var pickRay = Camera.computePickRay(x, y);
|
||||
var homePickResult = Overlays.findRayIntersection(pickRay, true, [this.homeButtonID]);
|
||||
Overlays.editOverlay(this.homeButtonHighlightID, { alpha: homePickResult.intersects ? 1.0 : 0.0 });
|
||||
var alpha = homePickResult.intersects ? 1.0 : 0.0;
|
||||
Entities.editEntity(this.homeButtonHighlightID, {
|
||||
"ring": {
|
||||
"innerStartAlpha": alpha,
|
||||
"innerEndAlpha": alpha,
|
||||
"outerStartAlpha": alpha,
|
||||
"outerEndAlpha": alpha
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
WebTablet.prototype.mouseMoveEvent = function (event) {
|
||||
|
@ -594,8 +621,8 @@ WebTablet.prototype.mouseMoveProcessor = function () {
|
|||
var localIntersectionPoint = Vec3.sum(localPickRay.origin, Vec3.multiply(localPickRay.direction, result.distance));
|
||||
var localOffset = Vec3.subtract(localIntersectionPoint, this.initialLocalIntersectionPoint);
|
||||
var localPosition = Vec3.sum(this.initialLocalPosition, localOffset);
|
||||
Overlays.editOverlay(this.tabletEntityID, {
|
||||
localPosition: localPosition
|
||||
Entities.editEntity(this.tabletEntityID, {
|
||||
"localPosition": localPosition
|
||||
});
|
||||
}
|
||||
this.scheduleMouseMoveProcessor();
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
//
|
||||
// miniTablet.js
|
||||
//
|
||||
// Created by David Rowe on 9 Aug 2018.
|
||||
// Created by David Rowe on August 9th, 2018.
|
||||
// Copyright 2018 High Fidelity, Inc.
|
||||
// Copyright 2023 Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
/* global getTabletWidthFromSettings, handsAreTracked, TRIGGER_OFF_VALUE, Controller, Script, Camera, Tablet, MyAvatar,
|
||||
Quat, SoundCache, HMD, Overlays, Vec3, Uuid, Messages */
|
||||
Quat, SoundCache, HMD, Vec3, Uuid, Messages */
|
||||
|
||||
(function () {
|
||||
|
||||
|
@ -265,7 +266,7 @@
|
|||
}
|
||||
|
||||
function getMiniTabletProperties() {
|
||||
var properties = Overlays.getProperties(miniOverlay, ["position", "orientation"]);
|
||||
var properties = Entities.getEntityProperties(miniOverlay, ["position", "orientation"]);
|
||||
return {
|
||||
position: properties.position,
|
||||
orientation: properties.orientation
|
||||
|
@ -282,22 +283,24 @@
|
|||
|
||||
uiHand = hand;
|
||||
|
||||
Overlays.editOverlay(miniOverlay, {
|
||||
parentID: MyAvatar.SELF_ID,
|
||||
parentJointIndex: handJointIndex(hand),
|
||||
localPosition: Vec3.multiply(MyAvatar.sensorToWorldScale, MINI_POSITIONS[hand]),
|
||||
localRotation: MINI_ROTATIONS[hand],
|
||||
dimensions: Vec3.multiply(initialScale, MINI_DIMENSIONS),
|
||||
grabbable: true,
|
||||
visible: true
|
||||
Entities.editEntity(miniOverlay, {
|
||||
"parentID": MyAvatar.SELF_ID,
|
||||
"parentJointIndex": handJointIndex(hand),
|
||||
"localPosition": Vec3.multiply(MyAvatar.sensorToWorldScale, MINI_POSITIONS[hand]),
|
||||
"localRotation": MINI_ROTATIONS[hand],
|
||||
"dimensions": Vec3.multiply(initialScale, MINI_DIMENSIONS),
|
||||
"grab": {
|
||||
"grabbable": true
|
||||
},
|
||||
"visible": true
|
||||
});
|
||||
Overlays.editOverlay(miniUIOverlay, {
|
||||
url: handsAreTracked() ? MINI_HAND_UI_HTML : MINI_UI_HTML,
|
||||
localPosition: Vec3.multiply(MyAvatar.sensorToWorldScale, MINI_UI_LOCAL_POSITION),
|
||||
localRotation: MINI_UI_LOCAL_ROTATION,
|
||||
dimensions: Vec3.multiply(initialScale, MINI_UI_DIMENSIONS),
|
||||
dpi: MINI_UI_DPI / initialScale,
|
||||
visible: true
|
||||
Entities.editEntity(miniUIOverlay, {
|
||||
"sourceUrl": handsAreTracked() ? MINI_HAND_UI_HTML : MINI_UI_HTML,
|
||||
"localPosition": Vec3.multiply(MyAvatar.sensorToWorldScale, MINI_UI_LOCAL_POSITION),
|
||||
"localRotation": MINI_UI_LOCAL_ROTATION,
|
||||
"dimensions": Vec3.multiply(initialScale, MINI_UI_DIMENSIONS),
|
||||
"dpi": MINI_UI_DPI / initialScale,
|
||||
"visible": true
|
||||
});
|
||||
|
||||
updateMiniTabletID();
|
||||
|
@ -306,20 +309,20 @@
|
|||
// Overlay content is created the first time it is visible to the user. The initial creation displays artefacts.
|
||||
// Delay showing UI overlay until after giving it time for its content to be created.
|
||||
Script.setTimeout(function () {
|
||||
Overlays.editOverlay(miniUIOverlay, { alpha: 1.0 });
|
||||
Entities.editEntity(miniUIOverlay, { "alpha": 1.0 });
|
||||
}, MINI_UI_OVERLAY_ENABLED_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
function size(scaleFactor) {
|
||||
// Scale UI in place.
|
||||
Overlays.editOverlay(miniOverlay, {
|
||||
dimensions: Vec3.multiply(scaleFactor, MINI_DIMENSIONS)
|
||||
Entities.editEntity(miniOverlay, {
|
||||
"dimensions": Vec3.multiply(scaleFactor, MINI_DIMENSIONS)
|
||||
});
|
||||
Overlays.editOverlay(miniUIOverlay, {
|
||||
localPosition: Vec3.multiply(scaleFactor, MINI_UI_LOCAL_POSITION),
|
||||
dimensions: Vec3.multiply(scaleFactor, MINI_UI_DIMENSIONS),
|
||||
dpi: MINI_UI_DPI / scaleFactor
|
||||
Entities.editEntity(miniUIOverlay, {
|
||||
"localPosition": Vec3.multiply(scaleFactor, MINI_UI_LOCAL_POSITION),
|
||||
"dimensions": Vec3.multiply(scaleFactor, MINI_UI_DIMENSIONS),
|
||||
"dpi": MINI_UI_DPI / scaleFactor
|
||||
});
|
||||
updateRotation();
|
||||
}
|
||||
|
@ -335,7 +338,7 @@
|
|||
}
|
||||
|
||||
// Grab details.
|
||||
var properties = Overlays.getProperties(miniOverlay, ["localPosition", "localRotation"]);
|
||||
var properties = Entities.getEntityProperties(miniOverlay, ["localPosition", "localRotation"]);
|
||||
miniExpandHand = hand;
|
||||
miniExpandLocalRotation = properties.localRotation;
|
||||
miniExpandLocalPosition = Vec3.sum(properties.localPosition,
|
||||
|
@ -369,19 +372,19 @@
|
|||
Vec3.multiplyQbyV(miniExpandLocalRotation, { x: 0, y: 0.5 * -dimensions.y, z: 0 }));
|
||||
localPosition = Vec3.sum(localPosition,
|
||||
Vec3.multiplyQbyV(localRotation, { x: 0, y: 0.5 * dimensions.y, z: 0 }));
|
||||
Overlays.editOverlay(miniOverlay, {
|
||||
localPosition: localPosition,
|
||||
localRotation: localRotation,
|
||||
dimensions: dimensions
|
||||
Entities.editEntity(miniOverlay, {
|
||||
"localPosition": localPosition,
|
||||
"localRotation": localRotation,
|
||||
"dimensions": dimensions
|
||||
});
|
||||
// FIXME: Temporary code change to try not displaying UI when mini tablet is expanding to become the tablet proper.
|
||||
Overlays.editOverlay(miniUIOverlay, {
|
||||
Entities.editEntity(miniUIOverlay, {
|
||||
/*
|
||||
localPosition: Vec3.multiply(tabletScaleFactor, MINI_UI_LOCAL_POSITION),
|
||||
dimensions: Vec3.multiply(tabletScaleFactor, MINI_UI_DIMENSIONS),
|
||||
dpi: MINI_UI_DPI / tabletScaleFactor
|
||||
"localPosition": Vec3.multiply(tabletScaleFactor, MINI_UI_LOCAL_POSITION),
|
||||
"dimensions": Vec3.multiply(tabletScaleFactor, MINI_UI_DIMENSIONS),
|
||||
"dpi": MINI_UI_DPI / tabletScaleFactor
|
||||
*/
|
||||
visible: false
|
||||
"visible": false
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -402,7 +405,7 @@
|
|||
deltaRotation,
|
||||
localRotation;
|
||||
|
||||
if (Overlays.getProperty(miniOverlay, "parentJointIndex") !== handJointIndex(uiHand)) {
|
||||
if (Entities.getEntityProperties(miniOverlay, ["parentJointIndex"]).parentJointIndex !== handJointIndex(uiHand)) {
|
||||
// Overlay has been grabbed by other hand but this script hasn't received notification yet.
|
||||
return;
|
||||
}
|
||||
|
@ -430,24 +433,26 @@
|
|||
deltaRotation = Quat.angleAxis(deltaAngle, Vec3.multiplyQbyV(defaultLocalRotation, Vec3.UNIT_Z));
|
||||
localRotation = Quat.multiply(deltaRotation, defaultLocalRotation);
|
||||
}
|
||||
Overlays.editOverlay(miniOverlay, {
|
||||
localRotation: localRotation
|
||||
Entities.editEntity(miniOverlay, {
|
||||
"localRotation": localRotation
|
||||
});
|
||||
}
|
||||
|
||||
function release() {
|
||||
Overlays.editOverlay(miniOverlay, {
|
||||
parentID: Uuid.NULL, // Release hold so that hand can grab tablet proper.
|
||||
grabbable: false
|
||||
Entities.editEntity(miniOverlay, {
|
||||
"parentID": Uuid.NULL, // Release hold so that hand can grab tablet proper.
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function hide() {
|
||||
Overlays.editOverlay(miniOverlay, {
|
||||
visible: false
|
||||
Entities.editEntity(miniOverlay, {
|
||||
"visible": false
|
||||
});
|
||||
Overlays.editOverlay(miniUIOverlay, {
|
||||
visible: false
|
||||
Entities.editEntity(miniUIOverlay, {
|
||||
"visible": false
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -458,37 +463,40 @@
|
|||
return;
|
||||
}
|
||||
|
||||
miniOverlayObject = Overlays.getOverlayObject(miniUIOverlay);
|
||||
miniOverlayObject = Entities.getEntityObject(miniUIOverlay);
|
||||
if (miniOverlayObject) {
|
||||
miniOverlayObject.webEventReceived.connect(onWebEventReceived);
|
||||
}
|
||||
}
|
||||
|
||||
function create() {
|
||||
//V8TODO: change to local entity
|
||||
miniOverlay = Overlays.addOverlay("model", {
|
||||
url: MINI_MODEL,
|
||||
dimensions: Vec3.multiply(MyAvatar.sensorToWorldScale, MINI_DIMENSIONS),
|
||||
solid: true,
|
||||
grabbable: true,
|
||||
showKeyboardFocusHighlight: false,
|
||||
drawInFront: false,
|
||||
visible: false
|
||||
});
|
||||
//V8TODO: change to local entity
|
||||
miniUIOverlay = Overlays.addOverlay("web3d", {
|
||||
url: handsAreTracked() ? MINI_HAND_UI_HTML : MINI_UI_HTML,
|
||||
parentID: miniOverlay,
|
||||
localPosition: Vec3.multiply(MyAvatar.sensorToWorldScale, MINI_UI_LOCAL_POSITION),
|
||||
localRotation: MINI_UI_LOCAL_ROTATION,
|
||||
dimensions: Vec3.multiply(MyAvatar.sensorToWorldScale, MINI_UI_DIMENSIONS),
|
||||
dpi: MINI_UI_DPI / MyAvatar.sensorToWorldScale,
|
||||
alpha: 0, // Hide overlay while its content is being created.
|
||||
grabbable: false,
|
||||
showKeyboardFocusHighlight: false,
|
||||
drawInFront: false,
|
||||
visible: false
|
||||
});
|
||||
miniOverlay = Entities.addEntity({
|
||||
"type": "Model",
|
||||
"modelURL": MINI_MODEL,
|
||||
"dimensions": Vec3.multiply(MyAvatar.sensorToWorldScale, MINI_DIMENSIONS),
|
||||
"primitiveMode": "solid",
|
||||
"grab": {
|
||||
"grabbable": true
|
||||
},
|
||||
"renderLayer": "world",
|
||||
"visible": false
|
||||
}, "local");
|
||||
miniUIOverlay = Entities.addEntity({
|
||||
"type": "Web",
|
||||
"sourceUrl": handsAreTracked() ? MINI_HAND_UI_HTML : MINI_UI_HTML,
|
||||
"parentID": miniOverlay,
|
||||
"localPosition": Vec3.multiply(MyAvatar.sensorToWorldScale, MINI_UI_LOCAL_POSITION),
|
||||
"localRotation": MINI_UI_LOCAL_ROTATION,
|
||||
"dimensions": Vec3.multiply(MyAvatar.sensorToWorldScale, MINI_UI_DIMENSIONS),
|
||||
"dpi": MINI_UI_DPI / MyAvatar.sensorToWorldScale,
|
||||
"alpha": 0, // Hide overlay while its content is being created.
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
},
|
||||
"showKeyboardFocusHighlight": false,
|
||||
"renderLayer": "world",
|
||||
"visible": false
|
||||
}, "local");
|
||||
|
||||
miniUIOverlayEnabled = false; // This and alpha = 0 hides overlay while its content is being created.
|
||||
|
||||
|
@ -498,8 +506,8 @@
|
|||
function destroy() {
|
||||
if (miniOverlayObject) {
|
||||
miniOverlayObject.webEventReceived.disconnect(onWebEventReceived);
|
||||
Overlays.deleteOverlay(miniUIOverlay);
|
||||
Overlays.deleteOverlay(miniOverlay);
|
||||
Entities.deleteEntity(miniUIOverlay);
|
||||
Entities.deleteEntity(miniOverlay);
|
||||
miniOverlayObject = null;
|
||||
miniUIOverlay = null;
|
||||
miniOverlay = null;
|
||||
|
@ -917,9 +925,9 @@
|
|||
ui.release();
|
||||
miniTabletProperties = ui.getMiniTabletProperties();
|
||||
|
||||
Overlays.editOverlay(HMD.tabletID, {
|
||||
position: miniTabletProperties.position,
|
||||
orientation: miniTabletProperties.orientation
|
||||
Entities.editEntity(HMD.tabletID, {
|
||||
"position": miniTabletProperties.position,
|
||||
"orientation": miniTabletProperties.orientation
|
||||
});
|
||||
|
||||
HMD.openTablet(true);
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
"use strict";
|
||||
|
||||
//
|
||||
// mod.js
|
||||
// scripts/system/
|
||||
//
|
||||
// Created by Stephen Birarda on 07/11/2016
|
||||
// Created by Stephen Birarda on July 11th, 2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
// Copyright 2023 Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
/* global Toolbars, Script, Users, Overlays, AvatarList, Controller, Camera, getControllerWorldLocation */
|
||||
|
||||
|
||||
(function() { // BEGIN LOCAL_SCOPE
|
||||
|
||||
Script.include("/~/system/libraries/controllers.js");
|
||||
|
@ -48,7 +47,7 @@ function removeOverlays() {
|
|||
for (var i = 0; i < modOverlayKeys.length; ++i) {
|
||||
var avatarID = modOverlayKeys[i];
|
||||
for (var j = 0; j < modOverlays[avatarID].length; ++j) {
|
||||
Overlays.deleteOverlay(modOverlays[avatarID][j]);
|
||||
Entities.deleteEntity(modOverlays[avatarID][j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,45 +106,44 @@ function updateOverlays() {
|
|||
|
||||
if (avatarID in modOverlays) {
|
||||
// keep the overlay above the current position of this avatar
|
||||
Overlays.editOverlay(modOverlays[avatarID][0], {
|
||||
position: kickOverlayPosition,
|
||||
url: kickOverlayURL()
|
||||
Entities.editEntity(modOverlays[avatarID][0], {
|
||||
"position": kickOverlayPosition,
|
||||
"imageURL": kickOverlayURL()
|
||||
});
|
||||
if (Users.canKick) {
|
||||
Overlays.editOverlay(modOverlays[avatarID][1], {
|
||||
position: muteOverlayPosition,
|
||||
url: muteOverlayURL()
|
||||
Entities.editEntity(modOverlays[avatarID][1], {
|
||||
"position": muteOverlayPosition,
|
||||
"imageURL": muteOverlayURL()
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// add the overlay above this avatar
|
||||
var newKickOverlay = Overlays.addOverlay("image3d", {
|
||||
url: kickOverlayURL(),
|
||||
position: kickOverlayPosition,
|
||||
size: 1,
|
||||
scale: 0.4,
|
||||
color: { red: 255, green: 255, blue: 255},
|
||||
alpha: 1,
|
||||
solid: true,
|
||||
isFacingAvatar: true,
|
||||
drawInFront: true
|
||||
});
|
||||
var newKickOverlay = Entities.addEntity({
|
||||
"type": "Image",
|
||||
"imageURL": kickOverlayURL(),
|
||||
"position": kickOverlayPosition,
|
||||
"dimensions": { "x": 0.4, "y": 0.4, "z": 0.4},
|
||||
"color": { "red": 255, "green": 255, "blue": 255},
|
||||
"alpha": 1,
|
||||
"primitiveMode": "solid",
|
||||
"billboardMode": "full",
|
||||
"renderLayer": "front"
|
||||
}, "local");
|
||||
|
||||
modOverlays[avatarID]=[newKickOverlay];
|
||||
|
||||
if (Users.canKick) {
|
||||
//V8TODO: change to local entity
|
||||
var newMuteOverlay = Overlays.addOverlay("image3d", {
|
||||
url: muteOverlayURL(),
|
||||
position: muteOverlayPosition,
|
||||
size: 1,
|
||||
scale: 0.4,
|
||||
color: { red: 255, green: 255, blue: 255},
|
||||
alpha: 1,
|
||||
solid: true,
|
||||
isFacingAvatar: true,
|
||||
drawInFront: true
|
||||
});
|
||||
var newMuteOverlay = Entities.addEntity({
|
||||
"type": "Image",
|
||||
"imageURL": muteOverlayURL(),
|
||||
"position": muteOverlayPosition,
|
||||
"dimensions": { "x": 0.4, "y": 0.4, "z": 0.4},
|
||||
"color": { "red": 255, "green": 255, "blue": 255},
|
||||
"alpha": 1,
|
||||
"primitiveMode": "solid",
|
||||
"billboardMode": "full",
|
||||
"renderLayer": "front"
|
||||
}, "local");
|
||||
// push this overlay to our array of overlays
|
||||
modOverlays[avatarID].push(newMuteOverlay);
|
||||
}
|
||||
|
@ -162,7 +160,7 @@ AvatarList.avatarRemovedEvent.connect(function(avatarID){
|
|||
|
||||
// first remove the rendered overlays
|
||||
for (var j = 0; j < modOverlays[avatarID].length; ++j) {
|
||||
Overlays.deleteOverlay(modOverlays[avatarID][j]);
|
||||
Entities.deleteEntity(modOverlays[avatarID][j]);
|
||||
}
|
||||
|
||||
// delete the saved ID of the overlay from our mod overlays object
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
"use strict";
|
||||
//
|
||||
// pal.js
|
||||
//
|
||||
// Created by Howard Stearns on December 9th, 2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
// Copyright 2023 Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
/* jslint vars:true, plusplus:true, forin:true */
|
||||
/* global Tablet, Settings, Script, AvatarList, Users, Entities,
|
||||
MyAvatar, Camera, Overlays, Vec3, Quat, HMD, Controller, Account,
|
||||
|
@ -6,14 +16,6 @@
|
|||
*/
|
||||
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
|
||||
//
|
||||
// pal.js
|
||||
//
|
||||
// Created by Howard Stearns on December 9, 2016
|
||||
// Copyright 2016 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
|
||||
//
|
||||
|
||||
(function () { // BEGIN LOCAL_SCOPE
|
||||
|
||||
|
@ -62,14 +64,15 @@ function angleBetweenVectorsInPlane(from, to, normal) {
|
|||
//
|
||||
var overlays = {}; // Keeps track of all our extended overlay data objects, keyed by target identifier.
|
||||
|
||||
function ExtendedOverlay(key, type, properties, selected, hasModel) { // A wrapper around overlays to store the key it is associated with.
|
||||
function ExtendedOverlay(key, properties, selected, hasModel) { // A wrapper around overlays to store the key it is associated with.
|
||||
overlays[key] = this;
|
||||
if (hasModel) {
|
||||
var modelKey = key + "-m";
|
||||
this.model = new ExtendedOverlay(modelKey, "model", {
|
||||
url: Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx"),
|
||||
textures: textures(selected),
|
||||
ignoreRayIntersection: true
|
||||
this.model = new ExtendedOverlay(modelKey, {
|
||||
"type": "Model",
|
||||
"modelURL": Script.resolvePath("./assets/models/Avatar-Overlay-v1.fbx"),
|
||||
"textures": textures(selected),
|
||||
"ignorePickIntersection": true
|
||||
}, false, false);
|
||||
} else {
|
||||
this.model = undefined;
|
||||
|
@ -77,17 +80,16 @@ function ExtendedOverlay(key, type, properties, selected, hasModel) { // A wrapp
|
|||
this.key = key;
|
||||
this.selected = selected || false; // not undefined
|
||||
this.hovering = false;
|
||||
//V8TODO: check if it uses 3d overlays
|
||||
this.activeOverlay = Overlays.addOverlay(type, properties); // We could use different overlays for (un)selected...
|
||||
this.activeOverlay = Entities.addEntity(properties, "local"); // We could use different overlays for (un)selected...
|
||||
}
|
||||
// Instance methods:
|
||||
ExtendedOverlay.prototype.deleteOverlay = function () { // remove display and data of this overlay
|
||||
Overlays.deleteOverlay(this.activeOverlay);
|
||||
Entities.deleteEntity(this.activeOverlay);
|
||||
delete overlays[this.key];
|
||||
};
|
||||
|
||||
ExtendedOverlay.prototype.editOverlay = function (properties) { // change display of this overlay
|
||||
Overlays.editOverlay(this.activeOverlay, properties);
|
||||
Entities.editEntity(this.activeOverlay, properties);
|
||||
};
|
||||
|
||||
function color(selected, hovering, level) {
|
||||
|
@ -184,36 +186,37 @@ ExtendedOverlay.applyPickRay = function (pickRay, hit, noHit) {
|
|||
//
|
||||
function HighlightedEntity(id, entityProperties) {
|
||||
this.id = id;
|
||||
//V8TODO: change to local entity
|
||||
this.overlay = Overlays.addOverlay('cube', {
|
||||
position: entityProperties.position,
|
||||
rotation: entityProperties.rotation,
|
||||
dimensions: entityProperties.dimensions,
|
||||
solid: false,
|
||||
color: {
|
||||
red: 0xF3,
|
||||
green: 0x91,
|
||||
blue: 0x29
|
||||
this.overlay = Entities.addEntity({
|
||||
"type": "Shape",
|
||||
"shape": "Cube",
|
||||
"position": entityProperties.position,
|
||||
"rotation": entityProperties.rotation,
|
||||
"dimensions": entityProperties.dimensions,
|
||||
"primitiveMode": "solid",
|
||||
"color": {
|
||||
"red": 0xF3,
|
||||
"green": 0x91,
|
||||
"blue": 0x29
|
||||
},
|
||||
ignoreRayIntersection: true,
|
||||
drawInFront: false // Arguable. For now, let's not distract with mysterious wires around the scene.
|
||||
});
|
||||
"ignorePickIntersection": true,
|
||||
"renderLayer": "world" // Arguable. For now, let's not distract with mysterious wires around the scene.
|
||||
}, "local");
|
||||
HighlightedEntity.overlays.push(this);
|
||||
}
|
||||
HighlightedEntity.overlays = [];
|
||||
HighlightedEntity.clearOverlays = function clearHighlightedEntities() {
|
||||
HighlightedEntity.overlays.forEach(function (highlighted) {
|
||||
Overlays.deleteOverlay(highlighted.overlay);
|
||||
Entities.deleteEntity(highlighted.overlay);
|
||||
});
|
||||
HighlightedEntity.overlays = [];
|
||||
};
|
||||
HighlightedEntity.updateOverlays = function updateHighlightedEntities() {
|
||||
HighlightedEntity.overlays.forEach(function (highlighted) {
|
||||
var properties = Entities.getEntityProperties(highlighted.id, ['position', 'rotation', 'dimensions']);
|
||||
Overlays.editOverlay(highlighted.overlay, {
|
||||
position: properties.position,
|
||||
rotation: properties.rotation,
|
||||
dimensions: properties.dimensions
|
||||
Entities.editEntity(highlighted.overlay, {
|
||||
"position": properties.position,
|
||||
"rotation": properties.rotation,
|
||||
"dimensions": properties.dimensions
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -434,12 +437,14 @@ function getConnectionData(specificUsername, domain) { // Update all the usernam
|
|||
//
|
||||
function addAvatarNode(id) {
|
||||
var selected = ExtendedOverlay.isSelected(id);
|
||||
return new ExtendedOverlay(id, "sphere", {
|
||||
drawInFront: true,
|
||||
solid: true,
|
||||
alpha: 0.8,
|
||||
color: color(selected, false, 0.0),
|
||||
ignoreRayIntersection: false
|
||||
return new ExtendedOverlay(id, {
|
||||
"type": "Shape",
|
||||
"shape": "Sphere",
|
||||
"renderLayer": "front",
|
||||
"primitiveMode": "solid",
|
||||
"alpha": 0.8,
|
||||
"color": color(selected, false, 0.0),
|
||||
"ignorePickIntersection": false
|
||||
}, selected, true);
|
||||
}
|
||||
// Each open/refresh will capture a stable set of avatarsOfInterest, within the specified filter.
|
||||
|
|
|
@ -1,4 +1,16 @@
|
|||
"use strict";
|
||||
//
|
||||
// redirectOverlays.js
|
||||
//
|
||||
// Created by Wayne Chen on September 25th, 2018
|
||||
// Copyright 2018 High Fidelity, Inc.
|
||||
// Copyright 2023 Overte e.V.
|
||||
//
|
||||
// Overlays
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
||||
(function() {
|
||||
|
||||
var ERROR_MESSAGE_MAP = [
|
||||
|
@ -38,126 +50,140 @@
|
|||
|
||||
var oopsDimensions = {x: 4.2, y: 0.8};
|
||||
|
||||
//V8TODO: change to local entity
|
||||
var redirectOopsText = Overlays.addOverlay("text3d", {
|
||||
name: "oopsText",
|
||||
position: {x: 0, y: 1.6763916015625, z: 1.45927095413208},
|
||||
rotation: {x: -4.57763671875e-05, y: 0.4957197904586792, z: -7.62939453125e-05, w: 0.8684672117233276},
|
||||
text: getOopsText(),
|
||||
textAlpha: 1,
|
||||
backgroundColor: {x: 0, y: 0, z:0},
|
||||
backgroundAlpha: 0,
|
||||
lineHeight: 0.10,
|
||||
leftMargin: 0.538373570564886,
|
||||
visible: false,
|
||||
emissive: true,
|
||||
ignoreRayIntersection: true,
|
||||
dimensions: oopsDimensions,
|
||||
grabbable: false,
|
||||
});
|
||||
var redirectOopsText = Entities.addEntity({
|
||||
"type": "Text",
|
||||
"name": "oopsText",
|
||||
"position": {"x": 0, "y": 1.6763916015625, "z": 1.45927095413208},
|
||||
"rotation": {"x": -4.57763671875e-05, "y": 0.4957197904586792, "z": -7.62939453125e-05, "w": 0.8684672117233276},
|
||||
"text": getOopsText(),
|
||||
"textAlpha": 1,
|
||||
"backgroundColor": {"x": 0, "y": 0, "z":0},
|
||||
"backgroundAlpha": 0,
|
||||
"lineHeight": 0.10,
|
||||
"leftMargin": 0.538373570564886,
|
||||
"visible": false,
|
||||
"unlit": true,
|
||||
"ignorePickIntersection": true,
|
||||
"dimensions": oopsDimensions,
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
}
|
||||
}, "local");
|
||||
|
||||
//V8TODO: change to local entity
|
||||
var tryAgainImageNeutral = Overlays.addOverlay("image3d", {
|
||||
name: "tryAgainImage",
|
||||
localPosition: {x: -0.6, y: -0.6, z: 0.0},
|
||||
url: Script.resourcesPath() + "images/interstitialPage/button.png",
|
||||
alpha: 1,
|
||||
visible: false,
|
||||
emissive: true,
|
||||
ignoreRayIntersection: false,
|
||||
grabbable: false,
|
||||
orientation: Overlays.getProperty(redirectOopsText, "orientation"),
|
||||
parentID: redirectOopsText
|
||||
});
|
||||
var tryAgainImageNeutral = Entities.addEntity({
|
||||
"type": "Image",
|
||||
"name": "tryAgainImage",
|
||||
"localPosition": {"x": -0.6, "y": -0.6, "z": 0.0},
|
||||
"imageURL": Script.resourcesPath() + "images/interstitialPage/button.png",
|
||||
"alpha": 1,
|
||||
"visible": false,
|
||||
"emissive": true,
|
||||
"ignorePickIntersection": false,
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
},
|
||||
"rotation": Entities.getEntityProperties(redirectOopsText, ["rotation"]).rotation,
|
||||
"parentID": redirectOopsText
|
||||
}, "local");
|
||||
|
||||
//V8TODO: change to local entity
|
||||
var tryAgainImageHover = Overlays.addOverlay("image3d", {
|
||||
name: "tryAgainImageHover",
|
||||
localPosition: {x: -0.6, y: -0.6, z: 0.0},
|
||||
url: Script.resourcesPath() + "images/interstitialPage/button_hover.png",
|
||||
alpha: 1,
|
||||
visible: false,
|
||||
emissive: true,
|
||||
ignoreRayIntersection: false,
|
||||
grabbable: false,
|
||||
orientation: Overlays.getProperty(redirectOopsText, "orientation"),
|
||||
parentID: redirectOopsText
|
||||
});
|
||||
var tryAgainImageHover = Entities.addEntity({
|
||||
"type": "Image",
|
||||
"name": "tryAgainImageHover",
|
||||
"localPosition": {"x": -0.6, "y": -0.6, "z": 0.0},
|
||||
"imageURL": Script.resourcesPath() + "images/interstitialPage/button_hover.png",
|
||||
"alpha": 1,
|
||||
"visible": false,
|
||||
"emissive": true,
|
||||
"ignorePickIntersection": false,
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
},
|
||||
"rotation": Entities.getEntityProperties(redirectOopsText, ["rotation"]).rotation,
|
||||
"parentID": redirectOopsText
|
||||
}, "local");
|
||||
|
||||
//V8TODO: change to local entity
|
||||
var tryAgainText = Overlays.addOverlay("text3d", {
|
||||
name: "tryAgainText",
|
||||
localPosition: {x: -0.6, y: -0.962, z: 0.0},
|
||||
text: "Try Again",
|
||||
textAlpha: 1,
|
||||
backgroundAlpha: 0.00393,
|
||||
lineHeight: 0.08,
|
||||
visible: false,
|
||||
emissive: true,
|
||||
ignoreRayIntersection: true,
|
||||
grabbable: false,
|
||||
orientation: Overlays.getProperty(redirectOopsText, "orientation"),
|
||||
parentID: redirectOopsText
|
||||
});
|
||||
var tryAgainText = Entities.addEntity({
|
||||
"type": "Text",
|
||||
"name": "tryAgainText",
|
||||
"localPosition": {"x": -0.6, "y": -0.962, "z": 0.0},
|
||||
"text": "Try Again",
|
||||
"textAlpha": 1,
|
||||
"backgroundAlpha": 0.00393,
|
||||
"lineHeight": 0.08,
|
||||
"visible": false,
|
||||
"unlit": true,
|
||||
"ignorePickIntersection": true,
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
},
|
||||
"rotation": Entities.getEntityProperties(redirectOopsText, ["rotation"]).rotation,
|
||||
"parentID": redirectOopsText
|
||||
}, "local");
|
||||
|
||||
//V8TODO: change to local entity
|
||||
var backImageNeutral = Overlays.addOverlay("image3d", {
|
||||
name: "backImage",
|
||||
localPosition: {x: 0.6, y: -0.6, z: 0.0},
|
||||
url: Script.resourcesPath() + "images/interstitialPage/button.png",
|
||||
alpha: 1,
|
||||
visible: false,
|
||||
emissive: true,
|
||||
ignoreRayIntersection: false,
|
||||
grabbable: false,
|
||||
orientation: Overlays.getProperty(redirectOopsText, "orientation"),
|
||||
parentID: redirectOopsText
|
||||
});
|
||||
var backImageNeutral = Entities.addEntity({
|
||||
"type": "Image",
|
||||
"name": "backImage",
|
||||
"localPosition": {"x": 0.6, "y": -0.6, "z": 0.0},
|
||||
"imageURL": Script.resourcesPath() + "images/interstitialPage/button.png",
|
||||
"alpha": 1,
|
||||
"visible": false,
|
||||
"emissive": true,
|
||||
"ignorePickIntersection": false,
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
},
|
||||
"rotation": Entities.getEntityProperties(redirectOopsText, ["rotation"]).rotation,
|
||||
"parentID": redirectOopsText
|
||||
}, "local");
|
||||
|
||||
//V8TODO: change to local entity
|
||||
var backImageHover = Overlays.addOverlay("image3d", {
|
||||
name: "backImageHover",
|
||||
localPosition: {x: 0.6, y: -0.6, z: 0.0},
|
||||
url: Script.resourcesPath() + "images/interstitialPage/button_hover.png",
|
||||
alpha: 1,
|
||||
visible: false,
|
||||
emissive: true,
|
||||
ignoreRayIntersection: false,
|
||||
grabbable: false,
|
||||
orientation: Overlays.getProperty(redirectOopsText, "orientation"),
|
||||
parentID: redirectOopsText
|
||||
});
|
||||
var backImageHover = Entities.addEntity({
|
||||
"type": "Image",
|
||||
"name": "backImageHover",
|
||||
"localPosition": {"x": 0.6, "y": -0.6, "z": 0.0},
|
||||
"imageURL": Script.resourcesPath() + "images/interstitialPage/button_hover.png",
|
||||
"alpha": 1,
|
||||
"visible": false,
|
||||
"emissive": true,
|
||||
"ignorePickIntersection": false,
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
},
|
||||
"rotation": Entities.getEntityProperties(redirectOopsText, ["rotation"]).rotation,
|
||||
"parentID": redirectOopsText
|
||||
}, "local");
|
||||
|
||||
//V8TODO: change to local entity
|
||||
var backText = Overlays.addOverlay("text3d", {
|
||||
name: "backText",
|
||||
localPosition: {x: 0.6, y: -0.962, z: 0.0},
|
||||
text: "Back",
|
||||
textAlpha: 1,
|
||||
backgroundAlpha: 0.00393,
|
||||
lineHeight: 0.08,
|
||||
visible: false,
|
||||
emissive: true,
|
||||
ignoreRayIntersection: true,
|
||||
grabbable: false,
|
||||
orientation: Overlays.getProperty(redirectOopsText, "orientation"),
|
||||
parentID: redirectOopsText
|
||||
});
|
||||
var backText = Entities.addEntity({
|
||||
"type": "Text",
|
||||
"name": "backText",
|
||||
"localPosition": {"x": 0.6, "y": -0.962, "z": 0.0},
|
||||
"text": "Back",
|
||||
"textAlpha": 1,
|
||||
"backgroundAlpha": 0.00393,
|
||||
"lineHeight": 0.08,
|
||||
"visible": false,
|
||||
"unlit": true,
|
||||
"ignorePickIntersection": true,
|
||||
"grab": {
|
||||
"grabbable": false
|
||||
},
|
||||
"rotation": Entities.getEntityProperties(redirectOopsText, ["rotation"]).rotation,
|
||||
"parentID": redirectOopsText
|
||||
}, "local");
|
||||
|
||||
function toggleOverlays(isInErrorState) {
|
||||
isErrorState = isInErrorState;
|
||||
if (!isInErrorState) {
|
||||
var properties = {
|
||||
visible: false
|
||||
"visible": false
|
||||
};
|
||||
|
||||
Overlays.editOverlay(redirectOopsText, properties);
|
||||
Overlays.editOverlay(tryAgainImageNeutral, properties);
|
||||
Overlays.editOverlay(tryAgainImageHover, properties);
|
||||
Overlays.editOverlay(backImageNeutral, properties);
|
||||
Overlays.editOverlay(backImageHover, properties);
|
||||
Overlays.editOverlay(tryAgainText, properties);
|
||||
Overlays.editOverlay(backText, properties);
|
||||
Entities.editEntity(redirectOopsText, properties);
|
||||
Entities.editEntity(tryAgainImageNeutral, properties);
|
||||
Entities.editEntity(tryAgainImageHover, properties);
|
||||
Entities.editEntity(backImageNeutral, properties);
|
||||
Entities.editEntity(backImageHover, properties);
|
||||
Entities.editEntity(tryAgainText, properties);
|
||||
Entities.editEntity(backText, properties);
|
||||
return;
|
||||
}
|
||||
var oopsText = getOopsText();
|
||||
|
@ -166,44 +192,44 @@
|
|||
// for catching init or if error state were to be different.
|
||||
isErrorState = overlaysVisible;
|
||||
var properties = {
|
||||
visible: overlaysVisible
|
||||
"visible": overlaysVisible
|
||||
};
|
||||
|
||||
var textWidth = Overlays.textSize(redirectOopsText, oopsText).width;
|
||||
var textWidth = Entities.textSize(redirectOopsText, oopsText).width;
|
||||
var textOverlayWidth = oopsDimensions.x;
|
||||
|
||||
var oopsTextProperties = {
|
||||
visible: overlaysVisible,
|
||||
text: oopsText,
|
||||
textAlpha: overlaysVisible,
|
||||
"visible": overlaysVisible,
|
||||
"text": oopsText,
|
||||
"textAlpha": overlaysVisible,
|
||||
// either visible or invisible. 0 doesn't work in Mac.
|
||||
backgroundAlpha: overlaysVisible * 0.00393,
|
||||
leftMargin: (textOverlayWidth - textWidth) / 2
|
||||
"backgroundAlpha": overlaysVisible * 0.00393,
|
||||
"leftMargin": (textOverlayWidth - textWidth) / 2
|
||||
};
|
||||
|
||||
var tryAgainTextWidth = Overlays.textSize(tryAgainText, "Try Again").width;
|
||||
var tryAgainImageWidth = Overlays.getProperty(tryAgainImageNeutral, "dimensions").x;
|
||||
var tryAgainTextWidth = Entities.textSize(tryAgainText, "Try Again").width;
|
||||
var tryAgainImageWidth = Entities.getEntityProperties(tryAgainImageNeutral, ["dimensions"]).dimensions.x;
|
||||
|
||||
var tryAgainTextProperties = {
|
||||
visible: overlaysVisible,
|
||||
leftMargin: (tryAgainImageWidth - tryAgainTextWidth) / 2
|
||||
"visible": overlaysVisible,
|
||||
"leftMargin": (tryAgainImageWidth - tryAgainTextWidth) / 2
|
||||
};
|
||||
|
||||
var backTextWidth = Overlays.textSize(backText, "Back").width;
|
||||
var backImageWidth = Overlays.getProperty(backImageNeutral, "dimensions").x;
|
||||
var backTextWidth = Entities.textSize(backText, "Back").width;
|
||||
var backImageWidth = Entities.getEntityProperties(backImageNeutral, ["dimensions"]).dimensions.x;
|
||||
|
||||
var backTextProperties = {
|
||||
visible: overlaysVisible,
|
||||
leftMargin: (backImageWidth - backTextWidth) / 2
|
||||
"visible": overlaysVisible,
|
||||
"leftMargin": (backImageWidth - backTextWidth) / 2
|
||||
};
|
||||
|
||||
Overlays.editOverlay(redirectOopsText, oopsTextProperties);
|
||||
Overlays.editOverlay(tryAgainImageNeutral, properties);
|
||||
Overlays.editOverlay(backImageNeutral, properties);
|
||||
Overlays.editOverlay(tryAgainImageHover, {visible: false});
|
||||
Overlays.editOverlay(backImageHover, {visible: false});
|
||||
Overlays.editOverlay(tryAgainText, tryAgainTextProperties);
|
||||
Overlays.editOverlay(backText, backTextProperties);
|
||||
Entities.editEntity(redirectOopsText, oopsTextProperties);
|
||||
Entities.editEntity(tryAgainImageNeutral, properties);
|
||||
Entities.editEntity(backImageNeutral, properties);
|
||||
Entities.editEntity(tryAgainImageHover, {"visible": false});
|
||||
Entities.editEntity(backImageHover, {"visible": false});
|
||||
Entities.editEntity(tryAgainText, tryAgainTextProperties);
|
||||
Entities.editEntity(backText, backTextProperties);
|
||||
|
||||
}
|
||||
|
||||
|
@ -222,13 +248,13 @@
|
|||
function cleanup() {
|
||||
Script.clearInterval(timer);
|
||||
timer = null;
|
||||
Overlays.deleteOverlay(redirectOopsText);
|
||||
Overlays.deleteOverlay(tryAgainImageNeutral);
|
||||
Overlays.deleteOverlay(backImageNeutral);
|
||||
Overlays.deleteOverlay(tryAgainImageHover);
|
||||
Overlays.deleteOverlay(backImageHover);
|
||||
Overlays.deleteOverlay(tryAgainText);
|
||||
Overlays.deleteOverlay(backText);
|
||||
Entities.deleteEntity(redirectOopsText);
|
||||
Entities.deleteEntity(tryAgainImageNeutral);
|
||||
Entities.deleteEntity(backImageNeutral);
|
||||
Entities.deleteEntity(tryAgainImageHover);
|
||||
Entities.deleteEntity(backImageHover);
|
||||
Entities.deleteEntity(tryAgainText);
|
||||
Entities.deleteEntity(backText);
|
||||
}
|
||||
|
||||
toggleOverlays(true);
|
||||
|
@ -240,12 +266,12 @@
|
|||
return;
|
||||
}
|
||||
if (overlayID === backImageNeutral && location.canGoBack()) {
|
||||
Overlays.editOverlay(backImageNeutral, {visible: false});
|
||||
Overlays.editOverlay(backImageHover, {visible: true});
|
||||
Entities.editEntity(backImageNeutral, {"visible": false});
|
||||
Entities.editEntity(backImageHover, {"visible": true});
|
||||
}
|
||||
if (overlayID === tryAgainImageNeutral) {
|
||||
Overlays.editOverlay(tryAgainImageNeutral, {visible: false});
|
||||
Overlays.editOverlay(tryAgainImageHover, {visible: true});
|
||||
Entities.editEntity(tryAgainImageNeutral, {"visible": false});
|
||||
Entities.editEntity(tryAgainImageHover, {"visible": true});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -255,12 +281,12 @@
|
|||
return;
|
||||
}
|
||||
if (overlayID === backImageHover) {
|
||||
Overlays.editOverlay(backImageHover, {visible: false});
|
||||
Overlays.editOverlay(backImageNeutral, {visible: true});
|
||||
Entities.editEntity(backImageHover, {"visible": false});
|
||||
Entities.editEntity(backImageNeutral, {"visible": true});
|
||||
}
|
||||
if (overlayID === tryAgainImageHover) {
|
||||
Overlays.editOverlay(tryAgainImageHover, {visible: false});
|
||||
Overlays.editOverlay(tryAgainImageNeutral, {visible: true});
|
||||
Entities.editEntity(tryAgainImageHover, {"visible": false});
|
||||
Entities.editEntity(tryAgainImageNeutral, {"visible": true});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
//
|
||||
// Created by Seth Alves 2016-9-29
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
// Copyright 2023 Overte e.V.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
@ -50,14 +51,14 @@
|
|||
if (!UIWebTablet) {
|
||||
return false;
|
||||
}
|
||||
if (Overlays.getProperty(HMD.tabletID, "type") !== "model") {
|
||||
if (Entities.getEntityProperties(HMD.tabletID, ["type"]).type !== "Model") {
|
||||
if (debugTablet) {
|
||||
print("TABLET is invalid due to frame: " + JSON.stringify(Overlays.getProperty(HMD.tabletID, "type")));
|
||||
print("TABLET is invalid due to frame: " + JSON.stringify(Entities.getEntityProperties(HMD.tabletID, ["type"]).type));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (Overlays.getProperty(HMD.homeButtonID, "type") !== "circle3d" ||
|
||||
Overlays.getProperty(HMD.tabletScreenID, "type") !== "web3d") {
|
||||
if (Entities.getEntityProperties(HMD.homeButtonID, ["type"]).type !== "Gizmo" ||
|
||||
Entities.getEntityProperties(HMD.tabletScreenID, ["type"]).type !== "Web") {
|
||||
if (debugTablet) {
|
||||
print("TABLET is invalid due to other");
|
||||
}
|
||||
|
@ -138,10 +139,10 @@
|
|||
}
|
||||
tabletProperties.visible = true;
|
||||
tabletProperties.ignorePickIntersection = false;
|
||||
Overlays.editOverlay(HMD.tabletID, tabletProperties);
|
||||
Overlays.editOverlay(HMD.homeButtonID, { visible: true, ignorePickIntersection: false });
|
||||
Overlays.editOverlay(HMD.homeButtonHighlightID, { visible: true, ignorePickIntersection: false });
|
||||
Overlays.editOverlay(HMD.tabletScreenID, { visible: true, ignorePickIntersection: false, maxFPS: 90 });
|
||||
Entities.editEntity(HMD.tabletID, tabletProperties);
|
||||
Entities.editEntity(HMD.homeButtonID, { "visible": true, "ignorePickIntersection": false });
|
||||
Entities.editEntity(HMD.homeButtonHighlightID, { "visible": true, "ignorePickIntersection": false });
|
||||
Entities.editEntity(HMD.tabletScreenID, { "visible": true, "ignorePickIntersection": false, "maxFPS": 90 });
|
||||
updateTabletWidthFromSettings(true);
|
||||
}
|
||||
gTablet.tabletShown = true;
|
||||
|
@ -158,10 +159,10 @@
|
|||
print("TABLET hide");
|
||||
}
|
||||
|
||||
Overlays.editOverlay(HMD.tabletID, { visible: false, ignorePickIntersection: true });
|
||||
Overlays.editOverlay(HMD.homeButtonID, { visible: false, ignorePickIntersection: true });
|
||||
Overlays.editOverlay(HMD.homeButtonHighlightID, { visible: false, ignorePickIntersection: true });
|
||||
Overlays.editOverlay(HMD.tabletScreenID, { visible: false, ignorePickIntersection: true, maxFPS: 1 });
|
||||
Entities.editEntity(HMD.tabletID, { "visible": false, "ignorePickIntersection": true });
|
||||
Entities.editEntity(HMD.homeButtonID, { "visible": false, "ignorePickIntersection": true });
|
||||
Entities.editEntity(HMD.homeButtonHighlightID, { "visible": false, "ignorePickIntersection": true });
|
||||
Entities.editEntity(HMD.tabletScreenID, { "visible": false, "ignorePickIntersection": true, "maxFPS": 1 });
|
||||
}
|
||||
|
||||
function closeTabletUI() {
|
||||
|
@ -249,21 +250,20 @@
|
|||
tabletShown = false;
|
||||
|
||||
// also cause the stylus model to be loaded
|
||||
//V8TODO: change to local entity
|
||||
var tmpStylusID = Overlays.addOverlay("model", {
|
||||
name: "stylus",
|
||||
url: Script.resourcesPath() + "meshes/tablet-stylus-fat.fbx",
|
||||
loadPriority: 10.0,
|
||||
position: Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, {x: 0, y: 0.1, z: -2})),
|
||||
dimensions: { x: 0.01, y: 0.01, z: 0.2 },
|
||||
solid: true,
|
||||
visible: true,
|
||||
ignoreRayIntersection: true,
|
||||
drawInFront: false,
|
||||
lifetime: 3
|
||||
});
|
||||
var tmpStylusID = Entities.addEntity({
|
||||
"type": "Model",
|
||||
"name": "stylus",
|
||||
"modelURL": Script.resourcesPath() + "meshes/tablet-stylus-fat.fbx",
|
||||
"position": Vec3.sum(MyAvatar.position, Vec3.multiplyQbyV(MyAvatar.orientation, {"x": 0, "y": 0.1, "z": -2})),
|
||||
"dimensions": { "x": 0.01, "y": 0.01, "z": 0.2 },
|
||||
"primitiveMode": "solid",
|
||||
"visible": true,
|
||||
"ignorePickIntersection": true,
|
||||
"renderLayer": "world",
|
||||
"lifetime": 3
|
||||
}, "local");
|
||||
Script.setTimeout(function() {
|
||||
Overlays.deleteOverlay(tmpStylusID);
|
||||
Entities.deleteEntity(tmpStylusID);
|
||||
}, 300);
|
||||
} else if (!tabletShown) {
|
||||
hideTabletUI();
|
||||
|
@ -331,7 +331,6 @@
|
|||
|
||||
var tabletID = HMD.tabletID;
|
||||
Entities.deleteEntity(tabletID);
|
||||
Overlays.deleteOverlay(tabletID);
|
||||
HMD.tabletID = null;
|
||||
HMD.homeButtonID = null;
|
||||
HMD.homeButtonHighlightID = null;
|
||||
|
|
Loading…
Reference in a new issue