Merge branch 'ambient' of https://github.com/samcake/hifi into ambient-bis

This commit is contained in:
samcake 2017-04-06 11:34:35 -07:00
commit 158084369a
10 changed files with 270 additions and 385 deletions

View file

@ -1,5 +1,5 @@
import QtQuick 2.5 import QtQuick 2.5
import QtQuick.Controls 1.2 import QtQuick.Controls 1.4
import QtWebChannel 1.0 import QtWebChannel 1.0
import QtWebEngine 1.2 import QtWebEngine 1.2
@ -7,7 +7,7 @@ import "controls"
import "styles" as HifiStyles import "styles" as HifiStyles
import "styles-uit" import "styles-uit"
import "windows" import "windows"
import HFWebEngineProfile 1.0 import HFTabletWebEngineProfile 1.0
Item { Item {
id: root id: root
@ -28,34 +28,10 @@ Item {
x: 0 x: 0
y: 0 y: 0
function goBack() {
webview.goBack();
}
function goForward() {
webview.goForward();
}
function gotoPage(url) {
webview.url = url;
}
function setProfile(profile) { function setProfile(profile) {
webview.profile = profile; webview.profile = profile;
} }
function reloadPage() {
webview.reloadAndBypassCache();
webview.setActiveFocusOnPress(true);
webview.setEnabled(true);
}
Item {
id:item
width: parent.width
implicitHeight: parent.height
QtObject { QtObject {
id: eventBridgeWrapper id: eventBridgeWrapper
WebChannel.id: "eventBridgeWrapper" WebChannel.id: "eventBridgeWrapper"
@ -70,9 +46,9 @@ Item {
width: parent.width width: parent.width
height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height height: keyboardEnabled && keyboardRaised ? parent.height - keyboard.height : parent.height
profile: HFWebEngineProfile { profile: HFTabletWebEngineProfile {
id: webviewProfile id: webviewTabletProfile
storageName: "qmlWebEngine" storageName: "qmlTabletWebEngine"
} }
property string userScriptUrl: "" property string userScriptUrl: ""
@ -113,7 +89,7 @@ Item {
console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message); console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message);
}); });
webview.profile.httpUserAgent = "Mozilla/5.0 Chrome (HighFidelityInterface"; webview.profile.httpUserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36";
web.address = url; web.address = url;
} }
@ -137,28 +113,17 @@ Item {
} }
} }
onNavigationRequested: {
if (request.navigationType == WebEngineNavigationRequest.LinkClickedNavigation) {
pagesModel.append({webUrl: request.url.toString()})
}
}
onNewViewRequested: { onNewViewRequested: {
var component = Qt.createComponent("./TabletBrowser.qml"); request.openIn(webView);
if (component.status != Component.Ready) {
if (component.status == Component.Error) {
console.log("Error: " + component.errorString());
}
return;
}
var newWindow = component.createObject();
newWindow.setProfile(webview.profile);
request.openIn(newWindow.webView);
newWindow.eventBridge = web.eventBridge;
stackRoot.push(newWindow);
newWindow.webView.forceActiveFocus();
} }
} }
} // item
Keys.onPressed: { Keys.onPressed: {
switch(event.key) { switch(event.key) {
case Qt.Key_L: case Qt.Key_L:
@ -171,4 +136,4 @@ Item {
} }
} }
} // dialog }

View file

@ -1,6 +1,6 @@
import QtQuick 2.5 import QtQuick 2.5
import QtQuick.Controls 1.4 import QtQuick.Controls 1.4
import QtWebEngine 1.1 import QtWebEngine 1.2
import QtWebChannel 1.0 import QtWebChannel 1.0
import "../controls-uit" as HiFiControls import "../controls-uit" as HiFiControls
import "../styles" as HifiStyles import "../styles" as HifiStyles
@ -14,17 +14,20 @@ Item {
height: parent.height height: parent.height
property var parentStackItem: null property var parentStackItem: null
property int headerHeight: 38 property int headerHeight: 38
property alias url: root.url property string url
property string address: url property string address: url //for compatibility
property alias scriptURL: root.userScriptUrl property string scriptURL
property alias eventBridge: eventBridgeWrapper.eventBridge property alias eventBridge: eventBridgeWrapper.eventBridge
property bool keyboardEnabled: HMD.active property bool keyboardEnabled: HMD.active
property bool keyboardRaised: false property bool keyboardRaised: false
property bool punctuationMode: false property bool punctuationMode: false
property bool isDesktop: false property bool isDesktop: false
property WebEngineView view: root property WebEngineView view: loader.currentView
property int currentPage: -1 // used as a model for repeater
property alias pagesModel: pagesModel
Row { Row {
id: buttons id: buttons
HifiConstants { id: hifi } HifiConstants { id: hifi }
@ -37,29 +40,29 @@ Item {
anchors.leftMargin: 8 anchors.leftMargin: 8
HiFiGlyphs { HiFiGlyphs {
id: back; id: back;
enabled: true; enabled: currentPage > 0
text: hifi.glyphs.backward text: hifi.glyphs.backward
color: enabled ? hifistyles.colors.text : hifistyles.colors.disabledText color: enabled ? hifistyles.colors.text : hifistyles.colors.disabledText
size: 48 size: 48
MouseArea { anchors.fill: parent; onClicked: stackRoot.goBack() } MouseArea { anchors.fill: parent; onClicked: goBack() }
} }
HiFiGlyphs { HiFiGlyphs {
id: forward; id: forward;
enabled: stackRoot.currentItem.canGoForward; enabled: currentPage < pagesModel.count - 1
text: hifi.glyphs.forward text: hifi.glyphs.forward
color: enabled ? hifistyles.colors.text : hifistyles.colors.disabledText color: enabled ? hifistyles.colors.text : hifistyles.colors.disabledText
size: 48 size: 48
MouseArea { anchors.fill: parent; onClicked: stackRoot.currentItem.goForward() } MouseArea { anchors.fill: parent; onClicked: goForward() }
} }
HiFiGlyphs { HiFiGlyphs {
id: reload; id: reload;
enabled: true; enabled: view != null;
text: webview.loading ? hifi.glyphs.close : hifi.glyphs.reload text: (view !== null && view.loading) ? hifi.glyphs.close : hifi.glyphs.reload
color: enabled ? hifistyles.colors.text : hifistyles.colors.disabledText color: enabled ? hifistyles.colors.text : hifistyles.colors.disabledText
size: 48 size: 48
MouseArea { anchors.fill: parent; onClicked: stackRoot.currentItem.reloadPage(); } MouseArea { anchors.fill: parent; onClicked: reloadPage(); }
} }
} }
@ -86,7 +89,7 @@ Item {
} }
//root.hidePermissionsBar(); //root.hidePermissionsBar();
web.keyboardRaised = false; web.keyboardRaised = false;
stackRoot.currentItem.gotoPage(text); gotoPage(text);
break; break;
@ -94,35 +97,43 @@ Item {
} }
} }
ListModel {
id: pagesModel
StackView { onCountChanged: {
id: stackRoot currentPage = count - 1
width: parent.width }
height: parent.height - web.headerHeight }
anchors.top: buttons.bottom
//property var goBack: currentItem.goBack();
property WebEngineView view: root
initialItem: root;
function goBack() { function goBack() {
if (depth > 1 ) { if (currentPage > 0) {
if (currentItem.canGoBack) { currentPage--;
currentItem.goBack();
} else {
stackRoot.pop();
currentItem.webView.focus = true;
currentItem.webView.forceActiveFocus();
web.address = currentItem.webView.url;
}
} else {
if (currentItem.canGoBack) {
currentItem.goBack();
} else if (parentStackItem) {
web.parentStackItem.pop();
} }
} }
function goForward() {
if (currentPage < pagesModel.count - 1) {
currentPage++;
}
}
function gotoPage(url) {
pagesModel.append({webUrl: url})
}
function reloadPage() {
view.reloadAndBypassCache()
view.setActiveFocusOnPress(true);
view.setEnabled(true);
}
onCurrentPageChanged: {
if (currentPage >= 0 && currentPage < pagesModel.count && loader.item !== null) {
loader.item.url = pagesModel.get(currentPage).webUrl
}
}
onUrlChanged: {
gotoPage(url)
} }
QtObject { QtObject {
@ -131,120 +142,33 @@ Item {
property var eventBridge; property var eventBridge;
} }
WebEngineView { Loader {
id: root id: loader
objectName: "webEngineView"
x: 0 property WebEngineView currentView: null
y: 0
width: parent.width width: parent.width
height: keyboardEnabled && keyboardRaised ? (parent.height - keyboard.height) : parent.height height: parent.height - web.headerHeight
profile: HFTabletWebEngineProfile { asynchronous: true
id: webviewTabletProfile anchors.top: buttons.bottom
storageName: "qmlTabletWebEngine" active: false
} source: "../TabletBrowser.qml"
onStatusChanged: {
property WebEngineView webView: root if (loader.status === Loader.Ready) {
function reloadPage() { currentView = item.webView
root.reload(); item.webView.userScriptUrl = web.scriptURL
} if (currentPage >= 0) {
//we got something to load already
function gotoPage(url) { item.url = pagesModel.get(currentPage).webUrl
root.url = url;
}
property string userScriptUrl: ""
// creates a global EventBridge object.
WebEngineScript {
id: createGlobalEventBridge
sourceCode: eventBridgeJavaScriptToInject
injectionPoint: WebEngineScript.DocumentCreation
worldId: WebEngineScript.MainWorld
}
// detects when to raise and lower virtual keyboard
WebEngineScript {
id: raiseAndLowerKeyboard
injectionPoint: WebEngineScript.Deferred
sourceUrl: resourceDirectoryUrl + "/html/raiseAndLowerKeyboard.js"
worldId: WebEngineScript.MainWorld
}
// User script.
WebEngineScript {
id: userScript
sourceUrl: root.userScriptUrl
injectionPoint: WebEngineScript.DocumentReady // DOM ready but page load may not be finished.
worldId: WebEngineScript.MainWorld
}
userScripts: [ createGlobalEventBridge, raiseAndLowerKeyboard, userScript ]
property string newUrl: ""
webChannel.registeredObjects: [eventBridgeWrapper]
Component.onCompleted: {
// Ensure the JS from the web-engine makes it to our logging
root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
console.log("Web Entity JS message: " + sourceID + " " + lineNumber + " " + message);
});
root.profile.httpUserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Mobile Safari/537.36"
}
onFeaturePermissionRequested: {
grantFeaturePermission(securityOrigin, feature, true);
}
onLoadingChanged: {
keyboardRaised = false;
punctuationMode = false;
keyboard.resetShiftMode(false);
// Required to support clicking on "hifi://" links
if (WebEngineView.LoadStartedStatus == loadRequest.status) {
var url = loadRequest.url.toString();
if (urlHandler.canHandleUrl(url)) {
if (urlHandler.handleUrl(url)) {
root.stop();
} }
} }
} }
} }
onNewViewRequested:{
var component = Qt.createComponent("../TabletBrowser.qml");
if (component.status != Component.Ready) {
if (component.status == Component.Error) {
console.log("Error: " + component.errorString());
}
return;
}
var newWindow = component.createObject();
newWindow.setProfile(root.profile);
request.openIn(newWindow.webView);
newWindow.eventBridge = web.eventBridge;
stackRoot.push(newWindow);
}
}
HiFiControls.Keyboard {
id: keyboard
raised: web.keyboardEnabled && web.keyboardRaised
numeric: web.punctuationMode
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
}
}
Component.onCompleted: { Component.onCompleted: {
web.isDesktop = (typeof desktop !== "undefined"); web.isDesktop = (typeof desktop !== "undefined");
address = url; address = url;
loader.active = true
} }
Keys.onPressed: { Keys.onPressed: {

View file

@ -158,6 +158,22 @@ namespace controller {
LEFT_HAND_PINKY2, LEFT_HAND_PINKY2,
LEFT_HAND_PINKY3, LEFT_HAND_PINKY3,
LEFT_HAND_PINKY4, LEFT_HAND_PINKY4,
TRACKED_OBJECT_00,
TRACKED_OBJECT_01,
TRACKED_OBJECT_02,
TRACKED_OBJECT_03,
TRACKED_OBJECT_04,
TRACKED_OBJECT_05,
TRACKED_OBJECT_06,
TRACKED_OBJECT_07,
TRACKED_OBJECT_08,
TRACKED_OBJECT_09,
TRACKED_OBJECT_10,
TRACKED_OBJECT_11,
TRACKED_OBJECT_12,
TRACKED_OBJECT_13,
TRACKED_OBJECT_14,
TRACKED_OBJECT_15,
NUM_STANDARD_POSES NUM_STANDARD_POSES
}; };

View file

@ -61,6 +61,16 @@ void UserActivityLoggerScriptingInterface::palOpened(float secondsOpened) {
}); });
} }
void UserActivityLoggerScriptingInterface::makeUserConnection(QString otherID, bool success, QString detailsString) {
QJsonObject payload;
payload["otherUser"] = otherID;
payload["success"] = success;
if (detailsString.length() > 0) {
payload["details"] = detailsString;
}
logAction("makeUserConnection", payload);
}
void UserActivityLoggerScriptingInterface::logAction(QString action, QJsonObject details) { void UserActivityLoggerScriptingInterface::logAction(QString action, QJsonObject details) {
QMetaObject::invokeMethod(&UserActivityLogger::getInstance(), "logAction", QMetaObject::invokeMethod(&UserActivityLogger::getInstance(), "logAction",
Q_ARG(QString, action), Q_ARG(QString, action),

View file

@ -29,6 +29,7 @@ public:
float tutorialElapsedTime, QString tutorialRunID = "", int tutorialVersion = 0, QString controllerType = ""); float tutorialElapsedTime, QString tutorialRunID = "", int tutorialVersion = 0, QString controllerType = "");
Q_INVOKABLE void palAction(QString action, QString target); Q_INVOKABLE void palAction(QString action, QString target);
Q_INVOKABLE void palOpened(float secondsOpen); Q_INVOKABLE void palOpened(float secondsOpen);
Q_INVOKABLE void makeUserConnection(QString otherUser, bool success, QString details="");
private: private:
void logAction(QString action, QJsonObject details = {}); void logAction(QString action, QJsonObject details = {});
}; };

View file

@ -63,59 +63,6 @@ bool ViveControllerManager::activate() {
enableOpenVrKeyboard(_container); enableOpenVrKeyboard(_container);
// OpenVR provides 3d mesh representations of the controllers
// Disabled controller rendering code
/*
auto renderModels = vr::VRRenderModels();
vr::RenderModel_t model;
if (!_system->LoadRenderModel(CONTROLLER_MODEL_STRING, &model)) {
qDebug() << QString("Unable to load render model %1\n").arg(CONTROLLER_MODEL_STRING);
} else {
model::Mesh* mesh = new model::Mesh();
model::MeshPointer meshPtr(mesh);
_modelGeometry.setMesh(meshPtr);
auto indexBuffer = new gpu::Buffer(3 * model.unTriangleCount * sizeof(uint16_t), (gpu::Byte*)model.rIndexData);
auto indexBufferPtr = gpu::BufferPointer(indexBuffer);
auto indexBufferView = new gpu::BufferView(indexBufferPtr, gpu::Element(gpu::SCALAR, gpu::UINT16, gpu::RAW));
mesh->setIndexBuffer(*indexBufferView);
auto vertexBuffer = new gpu::Buffer(model.unVertexCount * sizeof(vr::RenderModel_Vertex_t),
(gpu::Byte*)model.rVertexData);
auto vertexBufferPtr = gpu::BufferPointer(vertexBuffer);
auto vertexBufferView = new gpu::BufferView(vertexBufferPtr,
0,
vertexBufferPtr->getSize() - sizeof(float) * 3,
sizeof(vr::RenderModel_Vertex_t),
gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::RAW));
mesh->setVertexBuffer(*vertexBufferView);
mesh->addAttribute(gpu::Stream::NORMAL,
gpu::BufferView(vertexBufferPtr,
sizeof(float) * 3,
vertexBufferPtr->getSize() - sizeof(float) * 3,
sizeof(vr::RenderModel_Vertex_t),
gpu::Element(gpu::VEC3, gpu::FLOAT, gpu::RAW)));
//mesh->addAttribute(gpu::Stream::TEXCOORD,
// gpu::BufferView(vertexBufferPtr,
// 2 * sizeof(float) * 3,
// vertexBufferPtr->getSize() - sizeof(float) * 2,
// sizeof(vr::RenderModel_Vertex_t),
// gpu::Element(gpu::VEC2, gpu::FLOAT, gpu::RAW)));
gpu::Element formatGPU = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
gpu::Element formatMip = gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA);
_texture = gpu::TexturePointer(
gpu::Texture::create2D(formatGPU, model.diffuseTexture.unWidth, model.diffuseTexture.unHeight,
gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)));
_texture->assignStoredMip(0, formatMip, model.diffuseTexture.unWidth * model.diffuseTexture.unHeight * 4 * sizeof(uint8_t), model.diffuseTexture.rubTextureMapData);
_texture->autoGenerateMips(-1);
_modelLoaded = true;
_renderControllers = true;
}
*/
// register with UserInputMapper // register with UserInputMapper
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>(); auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
userInputMapper->registerDevice(_inputDevice); userInputMapper->registerDevice(_inputDevice);
@ -145,70 +92,6 @@ void ViveControllerManager::deactivate() {
_registeredWithInputMapper = false; _registeredWithInputMapper = false;
} }
void ViveControllerManager::updateRendering(RenderArgs* args, render::ScenePointer scene, render::Transaction transaction) {
PerformanceTimer perfTimer("ViveControllerManager::updateRendering");
/*
if (_modelLoaded) {
//auto controllerPayload = new render::Payload<ViveControllerManager>(this);
//auto controllerPayloadPointer = ViveControllerManager::PayloadPointer(controllerPayload);
//if (_leftHandRenderID == 0) {
// _leftHandRenderID = scene->allocateID();
// transaction.resetItem(_leftHandRenderID, controllerPayloadPointer);
//}
//transaction.updateItem(_leftHandRenderID, );
controller::Pose leftHand = _inputDevice->_poseStateMap[controller::StandardPoseChannel::LEFT_HAND];
controller::Pose rightHand = _inputDevice->_poseStateMap[controller::StandardPoseChannel::RIGHT_HAND];
gpu::doInBatch(args->_context, [=](gpu::Batch& batch) {
auto geometryCache = DependencyManager::get<GeometryCache>();
geometryCache->useSimpleDrawPipeline(batch);
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(batch, true);
auto mesh = _modelGeometry.getMesh();
batch.setInputFormat(mesh->getVertexFormat());
//batch._glBindTexture(GL_TEXTURE_2D, _uexture);
if (leftHand.isValid()) {
renderHand(leftHand, batch, 1);
}
if (rightHand.isValid()) {
renderHand(rightHand, batch, -1);
}
});
}
*/
}
void ViveControllerManager::renderHand(const controller::Pose& pose, gpu::Batch& batch, int sign) {
/*
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
Transform transform(userInputMapper->getSensorToWorldMat());
transform.postTranslate(pose.getTranslation() + pose.getRotation() * glm::vec3(0, 0, CONTROLLER_LENGTH_OFFSET));
glm::quat rotation = pose.getRotation() * glm::angleAxis(PI, glm::vec3(1.0f, 0.0f, 0.0f)) * glm::angleAxis(sign * PI_OVER_TWO, glm::vec3(0.0f, 0.0f, 1.0f));
transform.postRotate(rotation);
batch.setModelTransform(transform);
auto mesh = _modelGeometry.getMesh();
batch.setInputBuffer(gpu::Stream::POSITION, mesh->getVertexBuffer());
batch.setInputBuffer(gpu::Stream::NORMAL,
mesh->getVertexBuffer()._buffer,
sizeof(float) * 3,
mesh->getVertexBuffer()._stride);
//batch.setInputBuffer(gpu::Stream::TEXCOORD,
// mesh->getVertexBuffer()._buffer,
// 2 * 3 * sizeof(float),
// mesh->getVertexBuffer()._stride);
batch.setIndexBuffer(gpu::UINT16, mesh->getIndexBuffer()._buffer, 0);
batch.drawIndexed(gpu::TRIANGLES, mesh->getNumIndices(), 0);
*/
}
void ViveControllerManager::pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) { void ViveControllerManager::pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) {
if (!_system) { if (!_system) {
@ -257,6 +140,11 @@ void ViveControllerManager::InputDevice::update(float deltaTime, const controlle
handleHandController(deltaTime, leftHandDeviceIndex, inputCalibrationData, true); handleHandController(deltaTime, leftHandDeviceIndex, inputCalibrationData, true);
handleHandController(deltaTime, rightHandDeviceIndex, inputCalibrationData, false); handleHandController(deltaTime, rightHandDeviceIndex, inputCalibrationData, false);
// collect raw poses
for (int i = 0; i < vr::k_unMaxTrackedDeviceCount; i++) {
handleTrackedObject(i, inputCalibrationData);
}
// handle haptics // handle haptics
{ {
Locker locker(_lock); Locker locker(_lock);
@ -278,6 +166,30 @@ void ViveControllerManager::InputDevice::update(float deltaTime, const controlle
_trackedControllers = numTrackedControllers; _trackedControllers = numTrackedControllers;
} }
void ViveControllerManager::InputDevice::handleTrackedObject(uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData) {
uint32_t poseIndex = controller::TRACKED_OBJECT_00 + deviceIndex;
if (_system->IsTrackedDeviceConnected(deviceIndex) &&
_nextSimPoseData.vrPoses[deviceIndex].bPoseIsValid &&
poseIndex <= controller::TRACKED_OBJECT_15) {
// process pose
const mat4& mat = _nextSimPoseData.poses[deviceIndex];
const vec3 linearVelocity = _nextSimPoseData.linearVelocities[deviceIndex];
const vec3 angularVelocity = _nextSimPoseData.angularVelocities[deviceIndex];
controller::Pose pose(extractTranslation(mat), glmExtractRotation(mat), linearVelocity, angularVelocity);
// transform into avatar frame
glm::mat4 controllerToAvatar = glm::inverse(inputCalibrationData.avatarMat) * inputCalibrationData.sensorToWorldMat;
_poseStateMap[poseIndex] = pose.transform(controllerToAvatar);
} else {
controller::Pose invalidPose;
_poseStateMap[poseIndex] = invalidPose;
}
}
void ViveControllerManager::InputDevice::handleHandController(float deltaTime, uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData, bool isLeftHand) { void ViveControllerManager::InputDevice::handleHandController(float deltaTime, uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData, bool isLeftHand) {
if (_system->IsTrackedDeviceConnected(deviceIndex) && if (_system->IsTrackedDeviceConnected(deviceIndex) &&
@ -492,6 +404,24 @@ controller::Input::NamedVector ViveControllerManager::InputDevice::getAvailableI
makePair(LEFT_HAND, "LeftHand"), makePair(LEFT_HAND, "LeftHand"),
makePair(RIGHT_HAND, "RightHand"), makePair(RIGHT_HAND, "RightHand"),
// 16 tracked poses
makePair(TRACKED_OBJECT_00, "TrackedObject00"),
makePair(TRACKED_OBJECT_01, "TrackedObject01"),
makePair(TRACKED_OBJECT_02, "TrackedObject02"),
makePair(TRACKED_OBJECT_03, "TrackedObject03"),
makePair(TRACKED_OBJECT_04, "TrackedObject04"),
makePair(TRACKED_OBJECT_05, "TrackedObject05"),
makePair(TRACKED_OBJECT_06, "TrackedObject06"),
makePair(TRACKED_OBJECT_07, "TrackedObject07"),
makePair(TRACKED_OBJECT_08, "TrackedObject08"),
makePair(TRACKED_OBJECT_09, "TrackedObject09"),
makePair(TRACKED_OBJECT_10, "TrackedObject10"),
makePair(TRACKED_OBJECT_11, "TrackedObject11"),
makePair(TRACKED_OBJECT_12, "TrackedObject12"),
makePair(TRACKED_OBJECT_13, "TrackedObject13"),
makePair(TRACKED_OBJECT_14, "TrackedObject14"),
makePair(TRACKED_OBJECT_15, "TrackedObject15"),
// app button above trackpad. // app button above trackpad.
Input::NamedPair(Input(_deviceID, LEFT_APP_MENU, ChannelType::BUTTON), "LeftApplicationMenu"), Input::NamedPair(Input(_deviceID, LEFT_APP_MENU, ChannelType::BUTTON), "LeftApplicationMenu"),
Input::NamedPair(Input(_deviceID, RIGHT_APP_MENU, ChannelType::BUTTON), "RightApplicationMenu"), Input::NamedPair(Input(_deviceID, RIGHT_APP_MENU, ChannelType::BUTTON), "RightApplicationMenu"),

View file

@ -43,8 +43,6 @@ public:
void pluginFocusOutEvent() override { _inputDevice->focusOutEvent(); } void pluginFocusOutEvent() override { _inputDevice->focusOutEvent(); }
void pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) override; void pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) override;
void updateRendering(RenderArgs* args, render::ScenePointer scene, render::Transaction transaction);
void setRenderControllers(bool renderControllers) { _renderControllers = renderControllers; } void setRenderControllers(bool renderControllers) { _renderControllers = renderControllers; }
private: private:
@ -62,6 +60,7 @@ private:
void hapticsHelper(float deltaTime, bool leftHand); void hapticsHelper(float deltaTime, bool leftHand);
void handleHandController(float deltaTime, uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData, bool isLeftHand); void handleHandController(float deltaTime, uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData, bool isLeftHand);
void handleTrackedObject(uint32_t deviceIndex, const controller::InputCalibrationData& inputCalibrationData);
void handleButtonEvent(float deltaTime, uint32_t button, bool pressed, bool touched, bool isLeftHand); void handleButtonEvent(float deltaTime, uint32_t button, bool pressed, bool touched, bool isLeftHand);
void handleAxisEvent(float deltaTime, uint32_t axis, float x, float y, bool isLeftHand); void handleAxisEvent(float deltaTime, uint32_t axis, float x, float y, bool isLeftHand);
void handlePoseEvent(float deltaTime, const controller::InputCalibrationData& inputCalibrationData, const mat4& mat, void handlePoseEvent(float deltaTime, const controller::InputCalibrationData& inputCalibrationData, const mat4& mat,

View file

@ -0,0 +1,36 @@
var TRACKED_OBJECT_POSES = [
"TrackedObject00", "TrackedObject01", "TrackedObject02", "TrackedObject03",
"TrackedObject04", "TrackedObject05", "TrackedObject06", "TrackedObject07",
"TrackedObject08", "TrackedObject09", "TrackedObject10", "TrackedObject11",
"TrackedObject12", "TrackedObject13", "TrackedObject14", "TrackedObject15"
];
function init() {
Script.update.connect(update);
}
function shutdown() {
Script.update.disconnect(update);
TRACKED_OBJECT_POSES.forEach(function (key) {
DebugDraw.removeMyAvatarMarker(key);
});
}
var WHITE = {x: 1, y: 1, z: 1, w: 1};
function update(dt) {
if (Controller.Hardware.Vive) {
TRACKED_OBJECT_POSES.forEach(function (key) {
var pose = Controller.getPoseValue(Controller.Hardware.Vive[key]);
if (pose.valid) {
DebugDraw.addMyAvatarMarker(key, pose.rotation, pose.translation, WHITE);
} else {
DebugDraw.removeMyAvatarMarker(key);
}
});
}
}
init();

View file

@ -297,8 +297,9 @@ function Teleporter() {
} else if (teleportLocationType === TARGET.SURFACE) { } else if (teleportLocationType === TARGET.SURFACE) {
var offset = getAvatarFootOffset(); var offset = getAvatarFootOffset();
intersection.intersection.y += offset; intersection.intersection.y += offset;
MyAvatar.position = intersection.intersection; MyAvatar.goToLocation(intersection.intersection, false, {x: 0, y: 0, z: 0, w: 1}, false);
HMD.centerUI(); HMD.centerUI();
MyAvatar.centerBody();
} }
} }
}; };

View file

@ -543,12 +543,14 @@ function connectionRequestCompleted() { // Final result is in. Do effects.
// don't change state (so animation continues while gripped) // don't change state (so animation continues while gripped)
// but do send a notification, by calling the slot that emits the signal for it // but do send a notification, by calling the slot that emits the signal for it
Window.makeConnection(true, result.connection.new_connection ? "You and " + result.connection.username + " are now connected!" : result.connection.username); Window.makeConnection(true, result.connection.new_connection ? "You and " + result.connection.username + " are now connected!" : result.connection.username);
UserActivityLogger.makeUserConnection(connectingId, true, result.connection.new_connection ? "new connection" : "already connected");
return; return;
} // failed } // failed
endHandshake(); endHandshake();
debug("failing with result data", result); debug("failing with result data", result);
// IWBNI we also did some fail sound/visual effect. // IWBNI we also did some fail sound/visual effect.
Window.makeConnection(false, result.connection); Window.makeConnection(false, result.connection);
UserActivityLogger.makeUserConnection(connectingId, false, result.connection);
} }
var POLL_INTERVAL_MS = 200, POLL_LIMIT = 5; var POLL_INTERVAL_MS = 200, POLL_LIMIT = 5;
function handleConnectionResponseAndMaybeRepeat(error, response) { function handleConnectionResponseAndMaybeRepeat(error, response) {
@ -573,6 +575,7 @@ function handleConnectionResponseAndMaybeRepeat(error, response) {
} else if (error || (response.status !== 'success')) { } else if (error || (response.status !== 'success')) {
debug('server fail', error, response.status); debug('server fail', error, response.status);
result = error ? {status: 'error', connection: error} : response; result = error ? {status: 'error', connection: error} : response;
UserActivityLogger.makeUserConnection(connectingId, false, error || response);
connectionRequestCompleted(); connectionRequestCompleted();
} else { } else {
debug('server success', result); debug('server success', result);