make a version of computePick that works off of view frustum even when in HMD mode, updates to lobby

This commit is contained in:
ZappoMan 2014-11-22 21:25:43 -08:00
parent 310e31377d
commit efe202b7e8
3 changed files with 19 additions and 9 deletions

View file

@ -329,7 +329,9 @@ function handleLookAt(pickRay) {
} }
} }
formatedDescription += currentGoodLine; formatedDescription += currentGoodLine;
Overlays.editOverlay(descriptionText, { text: formatedDescription }); Overlays.editOverlay(descriptionText, { text: formatedDescription, visible: true });
} else {
Overlays.editOverlay(descriptionText, { text: "", visible: false });
} }
} }
} }
@ -348,8 +350,7 @@ function update(deltaTime) {
var nowDate = new Date(); var nowDate = new Date();
var now = nowDate.getTime(); var now = nowDate.getTime();
if (now - lastMouseMove > IDLE_HOVER_TIME) { if (now - lastMouseMove > IDLE_HOVER_TIME) {
var windowDimensions = Controller.getViewportDimensions(); var pickRay = Camera.computeViewPickRay(0.5, 0.5);
var pickRay = Camera.computePickRay(windowDimensions.x / 2, windowDimensions.y / 2);
handleLookAt(pickRay); handleLookAt(pickRay);
} }
@ -363,14 +364,16 @@ function update(deltaTime) {
} }
function mouseMoveEvent(event) { function mouseMoveEvent(event) {
if (panelWall) {
var nowDate = new Date(); var nowDate = new Date();
lastMouseMove = nowDate.getTime(); lastMouseMove = nowDate.getTime();
var pickRay = Camera.computePickRay(event.x, event.y); var pickRay = Camera.computePickRay(event.x, event.y);
handleLookAt(pickRay); handleLookAt(pickRay);
}
} }
Controller.mouseMoveEvent.connect(mouseMoveEvent);
Controller.actionStartEvent.connect(actionStartEvent); Controller.actionStartEvent.connect(actionStartEvent);
Controller.backStartEvent.connect(backStartEvent); Controller.backStartEvent.connect(backStartEvent);
Script.update.connect(update); Script.update.connect(update);
Script.scriptEnding.connect(maybeCleanupLobby); Script.scriptEnding.connect(maybeCleanupLobby);
Controller.mouseMoveEvent.connect(mouseMoveEvent);

View file

@ -108,6 +108,12 @@ PickRay Camera::computePickRay(float x, float y) {
return result; return result;
} }
PickRay Camera::computeViewPickRay(float xRatio, float yRatio) {
PickRay result;
Application::getInstance()->getViewFrustum()->computePickRay(xRatio, yRatio, result.origin, result.direction);
return result;
}
void Camera::setModeString(const QString& mode) { void Camera::setModeString(const QString& mode) {
CameraMode targetMode = stringToMode(mode); CameraMode targetMode = stringToMode(mode);

View file

@ -79,6 +79,7 @@ public slots:
glm::quat getOrientation() const { return getRotation(); } glm::quat getOrientation() const { return getRotation(); }
PickRay computePickRay(float x, float y); PickRay computePickRay(float x, float y);
PickRay computeViewPickRay(float xRatio, float yRatio);
signals: signals:
void modeUpdated(const QString& newMode); void modeUpdated(const QString& newMode);