mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 12:02:48 +02:00
switch to 3d text for description
This commit is contained in:
parent
5ea6973fe7
commit
437af06245
1 changed files with 29 additions and 17 deletions
|
@ -16,11 +16,12 @@ var orbShell = false;
|
||||||
var reticle = false;
|
var reticle = false;
|
||||||
var descriptionText = false;
|
var descriptionText = false;
|
||||||
|
|
||||||
// used for formating the description text
|
// used for formating the description text, in meters
|
||||||
var textWidth = 400;
|
var textWidth = 4;
|
||||||
var textHeight = 100;
|
var textHeight = 1;
|
||||||
var textBottomMargin = 20;
|
var numberOfLines = 4;
|
||||||
var textFontHeight = 20;
|
var textMargin = 0.0625;
|
||||||
|
var lineHeight = (textHeight - (2 * textMargin)) / numberOfLines;
|
||||||
|
|
||||||
var lastMouseMove = 0;
|
var lastMouseMove = 0;
|
||||||
var IDLE_HOVER_TIME = 2000; // if you haven't moved the mouse in 2 seconds, and in HMD mode, then we use reticle for hover
|
var IDLE_HOVER_TIME = 2000; // if you haven't moved the mouse in 2 seconds, and in HMD mode, then we use reticle for hover
|
||||||
|
@ -63,6 +64,14 @@ function reticlePosition() {
|
||||||
return Vec3.sum(Camera.position, Vec3.multiply(Quat.getFront(Camera.orientation), RETICLE_DISTANCE));
|
return Vec3.sum(Camera.position, Vec3.multiply(Quat.getFront(Camera.orientation), RETICLE_DISTANCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function textOverlayPosition() {
|
||||||
|
var TEXT_DISTANCE_OUT = 5;
|
||||||
|
var TEXT_DISTANCE_DOWN = -1;
|
||||||
|
return Vec3.sum(Vec3.sum(Camera.position, Vec3.multiply(Quat.getFront(Camera.orientation), TEXT_DISTANCE_OUT)),
|
||||||
|
Vec3.multiply(Quat.getUp(Camera.orientation), TEXT_DISTANCE_DOWN));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var MAX_NUM_PANELS = 21;
|
var MAX_NUM_PANELS = 21;
|
||||||
var DRONE_VOLUME = 0.3;
|
var DRONE_VOLUME = 0.3;
|
||||||
|
|
||||||
|
@ -91,27 +100,29 @@ function drawLobby() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var windowDimensions = Controller.getViewportDimensions();
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
|
|
||||||
var descriptionTextProps = {
|
var descriptionTextProps = {
|
||||||
x: (windowDimensions.x - textWidth) / 2,
|
position: textOverlayPosition(),
|
||||||
y: windowDimensions.y - textHeight - textBottomMargin,
|
dimensions: { x: textWidth, y: textHeight },
|
||||||
width: textWidth,
|
backgroundColor: { red: 0, green: 0, blue: 0},
|
||||||
height: textHeight,
|
|
||||||
backgroundColor: { red: 100, green: 100, blue: 100},
|
|
||||||
color: { red: 255, green: 255, blue: 255},
|
color: { red: 255, green: 255, blue: 255},
|
||||||
topMargin: 4,
|
topMargin: textMargin,
|
||||||
leftMargin: 4,
|
leftMargin: textMargin,
|
||||||
|
bottomMargin: textMargin,
|
||||||
|
rightMargin: textMargin,
|
||||||
text: "",
|
text: "",
|
||||||
font: { size: textFontHeight },
|
lineHeight: lineHeight,
|
||||||
alpha: 0.9,
|
alpha: 0.9,
|
||||||
visible: false // starts out hidden
|
ignoreRayIntersection: true,
|
||||||
|
visible: false,
|
||||||
|
isFacingAvatar: true
|
||||||
};
|
};
|
||||||
|
|
||||||
avatarStickPosition = MyAvatar.position;
|
avatarStickPosition = MyAvatar.position;
|
||||||
|
|
||||||
panelWall = Overlays.addOverlay("model", panelWallProps);
|
panelWall = Overlays.addOverlay("model", panelWallProps);
|
||||||
orbShell = Overlays.addOverlay("model", orbShellProps);
|
orbShell = Overlays.addOverlay("model", orbShellProps);
|
||||||
descriptionText = Overlays.addOverlay("text", descriptionTextProps);
|
descriptionText = Overlays.addOverlay("text3d", descriptionTextProps);
|
||||||
|
|
||||||
inOculusMode = Menu.isOptionChecked("Enable VR Mode");
|
inOculusMode = Menu.isOptionChecked("Enable VR Mode");
|
||||||
|
|
||||||
|
@ -358,9 +369,10 @@ function update(deltaTime) {
|
||||||
var pickRay = Camera.computeViewPickRay(0.5, 0.5);
|
var pickRay = Camera.computeViewPickRay(0.5, 0.5);
|
||||||
handleLookAt(pickRay);
|
handleLookAt(pickRay);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Overlays.editOverlay(descriptionText, { position: textOverlayPosition() });
|
||||||
|
|
||||||
// if the reticle is up then we may need to play the next muzak
|
// if the reticle is up then we may need to play the next muzak
|
||||||
if (!Audio.isInjectorPlaying(currentMuzakInjector)) {
|
if (!Audio.isInjectorPlaying(currentMuzakInjector)) {
|
||||||
playNextMuzak();
|
playNextMuzak();
|
||||||
|
|
Loading…
Reference in a new issue