Merge branch 'master' of github.com:highfidelity/hifi into no-fly-zones

This commit is contained in:
Seth Alves 2016-05-02 10:28:53 -07:00
commit 5fd871d640
31 changed files with 827 additions and 227 deletions

View file

@ -15,7 +15,7 @@
viewBox="0 0 1440 200"
id="svg4136"
inkscape:version="0.91 r13725"
sodipodi:docname="address-bar.002.svg">
sodipodi:docname="address-bar.svg">
<metadata
id="metadata4144">
<rdf:RDF>
@ -39,16 +39,16 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1835"
inkscape:window-height="1057"
inkscape:window-width="1536"
inkscape:window-height="687"
id="namedview4140"
showgrid="false"
inkscape:zoom="0.61319416"
inkscape:cx="132.58366"
inkscape:cx="670.06567"
inkscape:cy="52.468468"
inkscape:window-x="77"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:window-x="105"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="svg4136" />
<rect
style="fill:#ededed;fill-opacity:1;stroke:none;stroke-linejoin:round;stroke-opacity:1"
@ -60,14 +60,14 @@
rx="16.025024"
ry="17.019567" />
<rect
style="fill:#dadada;fill-opacity:1;stroke:#cbcbcb;stroke-width:0.33821851;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
style="fill:#dadada;fill-opacity:1;stroke:#cbcbcb;stroke-width:0.35830048;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="rect4135"
width="292.86267"
height="139.66179"
x="150.32542"
y="30.169102"
rx="16.817432"
ry="20.612938" />
width="328.72031"
height="139.64169"
x="150.33546"
y="30.179144"
rx="18.876532"
ry="20.609974" />
<circle
style="fill:#b8b8b8;fill-opacity:1;stroke:none;stroke-opacity:1"
id="path4146"
@ -78,11 +78,4 @@
d="m 100,36.000005 c -22.1,0 -40,17.9 -40,39.999995 0,30 40,88 40,88 0,0 40,-58 40,-88 0,-22.099995 -17.9,-39.999995 -40,-39.999995 z m 0,22 c 9.9,0 18,8.099995 18,17.999995 0,9.9 -8.1,18 -18,18 -9.9,0 -18,-8.1 -18,-18 0,-9.9 8.1,-17.999995 18,-17.999995 z"
id="path4138"
inkscape:connector-curvature="0" />
<rect
style="fill:#bdbdbd;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
id="rect4136"
width="4"
height="100"
x="310.12924"
y="50" />
</svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
viewBox="0 0 320 280"
xml:space="preserve"
inkscape:version="0.91 r13725"
sodipodi:docname="home-button.svg"
width="320"
height="280"><metadata
id="metadata4143"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs4141" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1827"
inkscape:window-height="1057"
id="namedview4139"
showgrid="false"
inkscape:zoom="1.2263883"
inkscape:cx="135.72814"
inkscape:cy="175.61874"
inkscape:window-x="85"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1" /><polyline
points="261,116.2 420.4,261.1 361.7,261.1 361.7,394.5 160.4,394.5 160.4,261.1 101.8,261.1 261,116.2 "
id="polyline4137"
transform="translate(-101.1,-115.35)"
style="fill:#535353;fill-opacity:1" /></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -55,15 +55,35 @@ Window {
property int inputAreaHeight: 56.0 * root.scale // Height of the background's input area
property int inputAreaStep: (height - inputAreaHeight) / 2
Image {
id: homeButton
source: "../images/home-button.svg"
width: 29
height: 26
anchors {
left: parent.left
leftMargin: parent.height + 2 * hifi.layout.spacing
verticalCenter: parent.verticalCenter
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
addressBarDialog.loadHome()
}
}
}
Image {
id: backArrow
source: addressBarDialog.backEnabled ? "../images/left-arrow.svg" : "../images/left-arrow-disabled.svg"
width: 22
height: 26
anchors {
fill: parent
leftMargin: parent.height + hifi.layout.spacing + 6
rightMargin: parent.height + hifi.layout.spacing * 60
topMargin: parent.inputAreaStep + parent.inputAreaStep + hifi.layout.spacing
bottomMargin: parent.inputAreaStep + parent.inputAreaStep + hifi.layout.spacing
left: homeButton.right
leftMargin: 2 * hifi.layout.spacing
verticalCenter: parent.verticalCenter
}
MouseArea {
@ -78,12 +98,12 @@ Window {
Image {
id: forwardArrow
source: addressBarDialog.forwardEnabled ? "../images/right-arrow.svg" : "../images/right-arrow-disabled.svg"
width: 22
height: 26
anchors {
fill: parent
leftMargin: parent.height + hifi.layout.spacing * 9
rightMargin: parent.height + hifi.layout.spacing * 53
topMargin: parent.inputAreaStep + parent.inputAreaStep + hifi.layout.spacing
bottomMargin: parent.inputAreaStep + parent.inputAreaStep + hifi.layout.spacing
left: backArrow.right
leftMargin: 2 * hifi.layout.spacing
verticalCenter: parent.verticalCenter
}
MouseArea {
@ -101,7 +121,7 @@ Window {
focus: true
anchors {
fill: parent
leftMargin: parent.height + parent.height + hifi.layout.spacing * 5
leftMargin: parent.height + parent.height + hifi.layout.spacing * 7
rightMargin: hifi.layout.spacing * 2
topMargin: parent.inputAreaStep + hifi.layout.spacing
bottomMargin: parent.inputAreaStep + hifi.layout.spacing

View file

@ -1,8 +1,18 @@
//
// InfoView.qml
//
// Created by Bradley Austin Davis on 27 Apr 2015
// Copyright 2015 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
//
import QtQuick 2.5
import Hifi 1.0 as Hifi
import "controls"
import "windows" as Windows
import "controls-uit"
import "windows-uit" as Windows
Windows.Window {
id: root
@ -12,16 +22,16 @@ Windows.Window {
Hifi.InfoView {
id: infoView
// Fill the client area
anchors.fill: parent
width: pane.contentWidth
implicitHeight: pane.scrollHeight
WebView {
id: webview
objectName: "WebView"
anchors.fill: parent
url: infoView.url
}
}
}
Component.onCompleted: {
centerWindow(root);

View file

@ -1,11 +1,21 @@
import QtQuick 2.3
import QtQuick.Controls 1.2
//
// QmlWebWindow.qml
//
// Created by Bradley Austin Davis on 17 Dec 2015
// Copyright 2015 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
//
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtWebEngine 1.1
import QtWebChannel 1.0
import "windows" as Windows
import "controls" as Controls
import "styles"
import "windows-uit" as Windows
import "controls-uit" as Controls
import "styles-uit"
Windows.Window {
id: root
@ -29,11 +39,16 @@ Windows.Window {
// missing signal
signal sendToScript(var message);
Controls.WebView {
id: webview
url: "about:blank"
anchors.fill: parent
focus: true
webChannel.registeredObjects: [eventBridgeWrapper]
Item {
width: pane.contentWidth
implicitHeight: pane.scrollHeight
Controls.WebView {
id: webview
url: "about:blank"
anchors.fill: parent
focus: true
webChannel.registeredObjects: [eventBridgeWrapper]
}
}
} // dialog
}

View file

@ -15,6 +15,8 @@ WebEngineView {
id: root
property var newUrl;
profile.httpUserAgent: "Mozilla/5.0 Chrome (HighFidelityInterface)"
Component.onCompleted: {
console.log("Connecting JS messaging to Hifi Logging")
// Ensure the JS from the web-engine makes it to our logging

View file

@ -1,10 +1,20 @@
//
// AvatarBrowser.qml
//
// Created by Bradley Austin Davis on 30 Aug 2015
// Copyright 2015 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
//
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtWebEngine 1.1
import "../../windows" as Windows
import "../../controls" as Controls
import "../../styles"
import "../../windows-uit" as Windows
import "../../controls-uit" as Controls
import "../../styles-uit"
Windows.Window {
id: root
@ -14,20 +24,14 @@ Windows.Window {
modality: Qt.ApplicationModal
Item {
anchors.fill: parent
width: pane.contentWidth
implicitHeight: pane.scrollHeight
Controls.WebView {
id: webview
anchors { top: parent.top; left: parent.left; right: parent.right; bottom: closeButton.top; margins: 8 }
anchors.fill: parent
url: "https://metaverse.highfidelity.com/marketplace?category=avatars"
focus: true
}
Button {
id: closeButton
anchors { bottom: parent.bottom; right: parent.right; margins: 8 }
text: "Close"
onClicked: root.destroy();
}
}
}

View file

@ -29,6 +29,10 @@
#include "Bookmarks.h"
#include <QtQuick/QQuickWindow>
const QString Bookmarks::HOME_BOOKMARK = "Home";
Bookmarks::Bookmarks() {
_bookmarksFilename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + BOOKMARKS_FILENAME;
readFromFile();
@ -60,6 +64,10 @@ bool Bookmarks::contains(const QString& name) const {
return _bookmarks.contains(name);
}
QString Bookmarks::addressForBookmark(const QString& name) const {
return _bookmarks.value(name).toString();
}
void Bookmarks::readFromFile() {
QFile loadFile(_bookmarksFilename);
@ -95,6 +103,8 @@ void Bookmarks::setupMenus(Menu* menubar, MenuWrapper* menu) {
// Add menus/actions
auto bookmarkAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::BookmarkLocation);
QObject::connect(bookmarkAction, SIGNAL(triggered()), this, SLOT(bookmarkLocation()), Qt::QueuedConnection);
auto setHomeAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::SetHomeLocation);
QObject::connect(setHomeAction, SIGNAL(triggered()), this, SLOT(setHomeLocation()), Qt::QueuedConnection);
_bookmarksMenu = menu->addMenu(MenuOption::Bookmarks);
_deleteBookmarksAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::DeleteBookmark);
QObject::connect(_deleteBookmarksAction, SIGNAL(triggered()), this, SLOT(deleteBookmark()), Qt::QueuedConnection);
@ -146,6 +156,18 @@ void Bookmarks::bookmarkLocation() {
enableMenuItems(true);
}
void Bookmarks::setHomeLocation() {
Menu* menubar = Menu::getInstance();
QString bookmarkName = HOME_BOOKMARK;
auto addressManager = DependencyManager::get<AddressManager>();
QString bookmarkAddress = addressManager->currentAddress().toString();
addLocationToMenu(menubar, bookmarkName, bookmarkAddress);
insert(bookmarkName, bookmarkAddress); // Overwrites any item with the same bookmarkName.
enableMenuItems(true);
}
void Bookmarks::teleportToBookmark() {
QAction* action = qobject_cast<QAction*>(sender());
QString address = action->data().toString();

View file

@ -29,8 +29,13 @@ public:
void setupMenus(Menu* menubar, MenuWrapper* menu);
QString addressForBookmark(const QString& name) const;
static const QString HOME_BOOKMARK;
private slots:
void bookmarkLocation();
void setHomeLocation();
void teleportToBookmark();
void deleteBookmark();

View file

@ -170,6 +170,7 @@ namespace MenuOption {
const QString RunTimingTests = "Run Timing Tests";
const QString ScriptEditor = "Script Editor...";
const QString ScriptedMotorControl = "Enable Scripted Motor Control";
const QString SetHomeLocation = "Set Home Location";
const QString ShowDSConnectTable = "Show Domain Connection Timing";
const QString ShowBordersEntityNodes = "Show Entity Nodes";
const QString ShowRealtimeEntityStats = "Show Realtime Entity Stats";

View file

@ -85,12 +85,23 @@ Rig::CharacterControllerState convertCharacterControllerState(CharacterControlle
};
}
// Called within Model::simulate call, below.
void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
const FBXGeometry& geometry = getFBXGeometry();
Head* head = _owningAvatar->getHead();
// make sure lookAt is not too close to face (avoid crosseyes)
glm::vec3 lookAt = _owningAvatar->isMyAvatar() ? head->getLookAtPosition() : head->getCorrectedLookAtPosition();
glm::vec3 focusOffset = lookAt - _owningAvatar->getHead()->getEyePosition();
float focusDistance = glm::length(focusOffset);
const float MIN_LOOK_AT_FOCUS_DISTANCE = 1.0f;
if (focusDistance < MIN_LOOK_AT_FOCUS_DISTANCE && focusDistance > EPSILON) {
lookAt = _owningAvatar->getHead()->getEyePosition() + (MIN_LOOK_AT_FOCUS_DISTANCE / focusDistance) * focusOffset;
}
if (_owningAvatar->isMyAvatar()) {
MyAvatar* myAvatar = static_cast<MyAvatar*>(_owningAvatar);
@ -164,7 +175,7 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
Rig::EyeParameters eyeParams;
eyeParams.worldHeadOrientation = headParams.worldHeadOrientation;
eyeParams.eyeLookAt = head->getLookAtPosition();
eyeParams.eyeLookAt = lookAt;
eyeParams.eyeSaccade = head->getSaccade();
eyeParams.modelRotation = getRotation();
eyeParams.modelTranslation = getTranslation();
@ -196,8 +207,8 @@ void SkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) {
Rig::EyeParameters eyeParams;
eyeParams.worldHeadOrientation = head->getFinalOrientationInWorldFrame();
eyeParams.eyeLookAt = head->getCorrectedLookAtPosition();
eyeParams.eyeSaccade = glm::vec3();
eyeParams.eyeLookAt = lookAt;
eyeParams.eyeSaccade = glm::vec3(0.0f);
eyeParams.modelRotation = getRotation();
eyeParams.modelTranslation = getTranslation();
eyeParams.leftEyeJointIndex = geometry.leftEyeJointIndex;

View file

@ -10,6 +10,7 @@
//
#include "AddressBarDialog.h"
#include "Application.h"
#include <QMessageBox>
@ -50,6 +51,16 @@ void AddressBarDialog::loadAddress(const QString& address) {
}
}
void AddressBarDialog::loadHome() {
qDebug() << "Called LoadHome";
QString homeLocation = qApp->getBookmarks()->addressForBookmark(Bookmarks::HOME_BOOKMARK);
const QString DEFAULT_HOME_LOCATION = "localhost";
if (homeLocation == "") {
homeLocation = DEFAULT_HOME_LOCATION;
}
DependencyManager::get<AddressManager>()->handleLookupString(homeLocation);
}
void AddressBarDialog::loadBack() {
qDebug() << "Called LoadBack";
DependencyManager::get<AddressManager>()->goBack();

View file

@ -36,6 +36,7 @@ protected:
void hide();
Q_INVOKABLE void loadAddress(const QString& address);
Q_INVOKABLE void loadHome();
Q_INVOKABLE void loadBack();
Q_INVOKABLE void loadForward();

View file

@ -203,8 +203,6 @@ public:
// rig space
bool getModelRegistrationPoint(glm::vec3& modelRegistrationPointOut) const;
const glm::vec3& getEyesInRootFrame() const { return _eyesInRootFrame; }
// rig space
AnimPose getAbsoluteDefaultPose(int index) const;
@ -275,7 +273,6 @@ protected:
glm::vec3 _lastFront;
glm::vec3 _lastPosition;
glm::vec3 _lastVelocity;
glm::vec3 _eyesInRootFrame { Vectors::ZERO };
QUrl _animGraphURL;
std::shared_ptr<AnimNode> _animNode;

View file

@ -105,6 +105,9 @@ void render::renderStateSortShapes(const SceneContextPointer& sceneContext, cons
for (auto& pipelineKey : sortedPipelines) {
auto& bucket = sortedShapes[pipelineKey];
args->_pipeline = shapeContext->pickPipeline(args, pipelineKey);
if (!args->_pipeline) {
continue;
}
for (auto& item : bucket) {
item.render(args);
}

View file

@ -17,7 +17,7 @@ var toolIconUrl = Script.resolvePath("assets/images/tools/");
var DIRECTORY_WINDOW_URL = "https://metaverse.highfidelity.com/directory";
var directoryWindow = new OverlayWebWindow({
title: 'directory',
title: 'Directory',
source: "about:blank",
width: 900,
height: 700,

View file

@ -6,7 +6,7 @@
//
var spriteURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Sprites/nucleosomes_sprite.fbx";
var spriteURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Sprites/nucleosomes_sprite.fbx";
var spriteDimensions = {
x: 10,
y: 10,

View file

@ -13,7 +13,7 @@
z: -1
}
var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
var self = this;

View file

@ -0,0 +1,109 @@
// 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() {
var version = 12;
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
var button;
var _this;
function NavButton() {
_this = this;
}
NavButton.prototype = {
button: null,
buttonImageURL: baseURL + "GUI/GUI_Cells.png?" + version,
hasButton: false,
entryPoint: {
x: 13500,
y: 13500,
z: 13500
},
target: {
x: 13501,
y: 13501,
z: 13501
},
preload: function(entityId) {
print('CELL PRELOAD CeLLS 1 ')
this.entityId = entityId;
this.addButton();
Controller.mousePressEvent.connect(this.onClick);
print('CELL PRELOAD CeLLS 2 ')
},
addButton: function() {
if (this.hasButton === false) {
print('CELL ADDBuTTON CeLLS 1 ')
var windowDimensions = Controller.getViewportDimensions();
var buttonWidth = 150;
var buttonHeight = 50;
var buttonPadding = 10;
var offset = 0;
var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5);
var buttonPositionY = (windowDimensions.y - buttonHeight) - 50;
button = Overlays.addOverlay("image", {
x: buttonPositionX,
y: buttonPositionY,
width: buttonWidth,
height: buttonHeight,
imageURL: this.buttonImageURL,
visible: true,
alpha: 1.0
});
this.hasButton = true;
print('CELL ADDBuTTON CeLLS 2 button id is : ' +button)
} else {
print('CELL ADDBUTTON CeLLS FAIL - hasButton is' + this.hasButton)
}
},
onClick: function(event) {
//call to an internal function to get our scope back;
_this.handleClick(event);
},
handleClick: function(event) {
var clickedOverlay = Overlays.getOverlayAtPoint({
x: event.x,
y: event.y
});
if (clickedOverlay === button) {
this.lookAtTarget();
}
},
lookAtTarget: function() {
var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint));
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
x: 1,
y: 0,
z: 0
});
var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, {
x: 0,
y: 1,
z: 0
});
MyAvatar.goToLocation(this.target, true, yaw);
MyAvatar.headYaw = 0;
},
unload: function() {
this.hasButton = false;
Overlays.deleteOverlay(button);
Controller.mousePressEvent.disconnect(this.onClick);
}
}
return new NavButton();
});

View file

@ -0,0 +1,115 @@
// 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
//
// 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() {
var version = 12;
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
var button;
var _this;
function NavButton() {
_this = this;
}
NavButton.prototype = {
button: null,
buttonImageURL: baseURL + "GUI/GUI_Hexokinase.png?" + version,
hasButton: false,
entryPoint: {
x: 3000,
y: 3000,
z: 13500
},
target: {
x: 2755,
y: 3121,
z: 13501
},
preload: function(entityId) {
print('CELL PRELOAD HEXOKINASE 1')
this.entityId = entityId;
this.addButton();
Controller.mousePressEvent.connect(this.onClick);
print('CELL PRELOAD HEXOKINASE 2')
},
addButton: function() {
if (this.hasButton === false) {
print('CELL ADDBUTTON HEXOKINASE 1')
var windowDimensions = Controller.getViewportDimensions();
var buttonWidth = 150;
var buttonHeight = 50;
var buttonPadding = 10;
var offset = 3;
var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5);
var buttonPositionY = (windowDimensions.y - buttonHeight) - 50;
button = Overlays.addOverlay("image", {
x: buttonPositionX,
y: buttonPositionY,
width: buttonWidth,
height: buttonHeight,
imageURL: this.buttonImageURL,
visible: true,
alpha: 1.0
});
this.hasButton = true;
print('CELL ADDBUTTON HEXOKINASE 2 button id is : ' +button)
} else {
print('CELL ADDBUTTON HEXOKINASE FAIL hasButton is' + this.hasButton)
}
},
onClick: function(event) {
//call to an internal function to get our scope back;
_this.handleClick(event);
},
handleClick: function(event) {
var clickedOverlay = Overlays.getOverlayAtPoint({
x: event.x,
y: event.y
});
if (clickedOverlay === button) {
this.lookAtTarget();
}
},
lookAtTarget: function() {
var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint));
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
x: 1,
y: 0,
z: 0
});
var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, {
x: 0,
y: 1,
z: 0
});
MyAvatar.goToLocation(this.target, true, yaw);
MyAvatar.headYaw = 0;
},
unload: function() {
this.hasButton = false;
Overlays.deleteOverlay(button);
Controller.mousePressEvent.disconnect(this.onClick);
}
}
return new NavButton();
});

View file

@ -0,0 +1,109 @@
// 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() {
var version = 12;
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
var button;
var _this;
function NavButton() {
_this = this;
}
NavButton.prototype = {
button: null,
buttonImageURL: baseURL + "GUI/GUI_CellLayout.png?" + version,
hasButton: false,
entryPoint: {
x: 3000,
y: 13500,
z: 3000
},
target: {
x: 3276.6,
y: 13703.3,
z: 4405.6
},
preload: function(entityId) {
print('CeLL PRELOAD INSIDECELL 1')
this.entityId = entityId;
this.addButton();
Controller.mousePressEvent.connect(this.onClick);
print('CeLL PRELOAD INSIDECELL 2')
},
addButton: function() {
if (this.hasButton === false) {
print('CELL ADDBUTTON INSIDECELL 1')
var windowDimensions = Controller.getViewportDimensions();
var buttonWidth = 150;
var buttonHeight = 50;
var buttonPadding = 10;
var offset = 1;
var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5);
var buttonPositionY = (windowDimensions.y - buttonHeight) - 50;
button = Overlays.addOverlay("image", {
x: buttonPositionX,
y: buttonPositionY,
width: buttonWidth,
height: buttonHeight,
imageURL: this.buttonImageURL,
visible: true,
alpha: 1.0
});
this.hasButton = true;
print('CELL ADDBUTTON INSIDECELL 2 button id is : ' +button)
} else {
print('CELL ADDBUTTON INSIDECELL FAIL - hasButton is' + this.hasButton)
}
},
onClick: function(event) {
//call to an internal function to get our scope back;
_this.handleClick(event);
},
handleClick: function(event) {
var clickedOverlay = Overlays.getOverlayAtPoint({
x: event.x,
y: event.y
});
if (clickedOverlay === button) {
this.lookAtTarget();
}
},
lookAtTarget: function() {
var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint));
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
x: 1,
y: 0,
z: 0
});
var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, {
x: 0,
y: 1,
z: 0
});
MyAvatar.goToLocation(this.target, true, yaw);
MyAvatar.headYaw = 0;
},
unload: function() {
this.hasButton = false;
Overlays.deleteOverlay(button);
Controller.mousePressEvent.disconnect(this.onClick);
}
}
return new NavButton();
});

View file

@ -0,0 +1,108 @@
// 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() {
var version = 12;
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
var button;
var _this;
function NavButton() {
_this = this;
}
NavButton.prototype = {
button: null,
buttonImageURL: baseURL + "GUI/GUI_Ribosome.png?" + version,
hasButton: false,
entryPoint: {
x: 13500,
y: 3000,
z: 3000
},
target: {
x: 3276.6,
y: 13703.3,
z: 4405.6
},
preload: function(entityId) {
print('CELL PRELOAD RIBOSOME 1')
this.entityId = entityId;
this.addButton();
Controller.mousePressEvent.connect(this.onClick);
print('CELL PRELOAD RIBOSOME 2')
},
addButton: function() {
if (this.hasButton === false) {
print('CELL ADBUTTON RIBOSOME 1')
var windowDimensions = Controller.getViewportDimensions();
var buttonWidth = 150;
var buttonHeight = 50;
var buttonPadding = 10;
var offset = 2;
var buttonPositionX = (offset + 1) * (buttonWidth + buttonPadding) + (windowDimensions.x / 2) - (buttonWidth * 3 + buttonPadding * 2.5);
var buttonPositionY = (windowDimensions.y - buttonHeight) - 50;
button = Overlays.addOverlay("image", {
x: buttonPositionX,
y: buttonPositionY,
width: buttonWidth,
height: buttonHeight,
imageURL: this.buttonImageURL,
visible: true,
alpha: 1.0
});
this.hasButton = true;
print('CELL ADDBUTTON RIBOSOME 2 button id is : ' +button)
} else {
print('CELL ADDBUTTON RIBOSOME FAIL - hasButton is' + this.hasButton)
}
},
onClick: function(event) {
//call to an internal function to get our scope back;
_this.handleClick(event);
},
handleClick: function(event) {
var clickedOverlay = Overlays.getOverlayAtPoint({
x: event.x,
y: event.y
});
if (clickedOverlay === button) {
this.lookAtTarget();
}
},
lookAtTarget: function() {
var direction = Vec3.normalize(Vec3.subtract(this.target, this.entryPoint));
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
x: 1,
y: 0,
z: 0
});
var yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * 180.0 / Math.PI, {
x: 0,
y: 1,
z: 0
});
MyAvatar.goToLocation(this.target, true, yaw);
MyAvatar.headYaw = 0;
},
unload: function() {
this.hasButton = false;
Overlays.deleteOverlay(button);
Controller.mousePressEvent.disconnect(this.onClick);
}
}
return new NavButton();
});

View file

@ -14,7 +14,7 @@
Script.include(utilsScript);
var self = this;
var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
this.preload = function(entityId) {
this.entityId = entityId;

View file

@ -6,113 +6,114 @@
//
(function() {
var baseURL = "https://hifi-content.s3.amazonaws.com/hifi-content/DomainContent/CellScience/";
var self = this;
this.buttonImageURL = baseURL + "GUI/play_audio.svg?2";
var baseURL = "https://hifi-production.s3.amazonaws.com/hifi-production/DomainContent/CellScience/";
var self = this;
this.buttonImageURL = baseURL + "GUI/play_audio.svg?2";
this.preload = function(entityId) {
this.entityId = entityId;
this.initialize(entityId)
this.initTimeout = null;
}
this.initialize = function(entityId) {
//print(' should initialize' + entityId)
var properties = Entities.getEntityProperties(entityId);
if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) {
self.initTimeout = Script.setTimeout(function() {
// print(' no user data yet, try again in one second')
self.initialize(entityId);
}, 1000)
} else {
//print(' userdata before parse attempt' + properties.userData)
self.userData = null;
try {
self.userData = JSON.parse(properties.userData);
} catch (err) {
// print(' error parsing json');
// print(' properties are:' + properties.userData);
return;
}
self.addButton();
self.buttonShowing = false;
self.showDistance = self.userData.showDistance;
self.soundURL = baseURL + "Audio/" + self.userData.soundName + ".wav";
// print("distance = " + self.userData.showDistance + ", sound = " + self.soundURL);
self.soundOptions = {
stereo: true,
loop: false,
localOnly: true,
volume: 1
};
self.sound = SoundCache.getSound(this.soundURL);
this.preload = function(entityId) {
this.entityId = entityId;
this.initialize(entityId)
this.initTimeout = null;
}
}
this.initialize = function(entityId) {
//print(' should initialize' + entityId)
var properties = Entities.getEntityProperties(entityId);
if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) {
self.initTimeout = Script.setTimeout(function() {
// print(' no user data yet, try again in one second')
self.initialize(entityId);
}, 1000)
this.addButton = function() {
this.windowDimensions = Controller.getViewportDimensions();
this.buttonWidth = 100;
this.buttonHeight = 100;
this.buttonPadding = 0;
this.buttonPositionX = (self.windowDimensions.x - self.buttonPadding) / 2 - self.buttonWidth;
this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - (self.buttonHeight + self.buttonPadding);
this.button = Overlays.addOverlay("image", {
x: self.buttonPositionX,
y: self.buttonPositionY,
width: self.buttonWidth,
height: self.buttonHeight,
imageURL: self.buttonImageURL,
visible: false,
alpha: 1.0
});
}
this.update = function(deltaTime) {
self.distance = Vec3.distance(MyAvatar.position, Entities.getEntityProperties(self.entityId).position);
//print(self.distance);
if (!self.buttonShowing && self.distance < self.userData.showDistance) {
self.buttonShowing = true;
Overlays.editOverlay(self.button, {
visible: true
});
} else if (self.buttonShowing && self.distance > self.userData.showDistance) {
self.buttonShowing = false;
Overlays.editOverlay(self.button, {
visible: false
});
}
}
this.onClick = function(event) {
var clickedOverlay = Overlays.getOverlayAtPoint({
x: event.x,
y: event.y
});
if (clickedOverlay === self.button) {
//print("button was clicked");
if (self.sound.downloaded) {
//print("play sound");
Audio.playSound(self.sound, self.soundOptions);
} else {
//print(' userdata before parse attempt' + properties.userData)
self.userData = null;
try {
self.userData = JSON.parse(properties.userData);
} catch (err) {
// print(' error parsing json');
// print(' properties are:' + properties.userData);
return;
}
self.addButton();
self.buttonShowing = false;
self.showDistance = self.userData.showDistance;
self.soundURL = baseURL + "Audio/" + self.userData.soundName + ".wav";
// print("distance = " + self.userData.showDistance + ", sound = " + self.soundURL);
self.soundOptions = {
stereo: true,
loop: false,
localOnly: true,
volume: 1
};
self.sound = SoundCache.getSound(this.soundURL);
//print("not downloaded");
}
}
}
this.addButton = function() {
this.windowDimensions = Controller.getViewportDimensions();
this.buttonWidth = 100;
this.buttonHeight = 100;
this.buttonPadding = 0;
this.unload = function() {
Overlays.deleteOverlay(self.button);
Controller.mousePressEvent.disconnect(this.onClick);
Script.update.disconnect(this.update);
if (this.initTimeout !== null) {
Script.clearTimeout(this.initTimeout);
}
}
this.buttonPositionX = (self.windowDimensions.x - self.buttonPadding) / 2 - self.buttonWidth;
this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - (self.buttonHeight + self.buttonPadding);
this.button = Overlays.addOverlay("image", {
x: self.buttonPositionX,
y: self.buttonPositionY,
width: self.buttonWidth,
height: self.buttonHeight,
imageURL: self.buttonImageURL,
visible: false,
alpha: 1.0
});
}
Controller.mousePressEvent.connect(this.onClick);
Script.update.connect(this.update);
this.update = function(deltaTime) {
self.distance = Vec3.distance(MyAvatar.position, Entities.getEntityProperties(self.entityId).position);
//print(self.distance);
if (!self.buttonShowing && self.distance < self.userData.showDistance) {
self.buttonShowing = true;
Overlays.editOverlay(self.button, {
visible: true
});
} else if (self.buttonShowing && self.distance > self.userData.showDistance) {
self.buttonShowing = false;
Overlays.editOverlay(self.button, {
visible: false
});
}
}
this.onClick = function(event) {
var clickedOverlay = Overlays.getOverlayAtPoint({
x: event.x,
y: event.y
});
if (clickedOverlay === self.button) {
//print("button was clicked");
if (self.sound.downloaded) {
//print("play sound");
Audio.playSound(self.sound, self.soundOptions);
} else {
//print("not downloaded");
}
}
}
this.unload = function() {
Overlays.deleteOverlay(self.button);
Controller.mousePressEvent.disconnect(this.onClick);
Script.update.disconnect(this.update);
if (this.initTimeout !== null) {
Script.clearTimeout(this.initTimeout);
}
}
Controller.mousePressEvent.connect(this.onClick);
Script.update.connect(this.update);
});
});

View file

@ -8,7 +8,7 @@
(function() {
var self = this;
var baseURL = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/";
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
var version = 3;
this.preload = function(entityId) {

View file

@ -22,9 +22,14 @@
this.initialize = function(entityID) {
// print(' should initialize')
var properties = Entities.getEntityProperties(entityID);
if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) {
if (properties.hasOwnProperty('userData') === false) {
self.initTimeout = Script.setTimeout(function() {
// print(' no user data yet, try again in one second')
// print(' no user data yet, try again in one second')
self.initialize(entityID);
}, 1000)
} else if (properties.userData.length === 0) {
self.initTimeout = Script.setTimeout(function() {
// print(' no user data yet, try again in one second')
self.initialize(entityID);
}, 1000)
} else {
@ -39,7 +44,7 @@
volume: 0.5
};
self.teleportSound = SoundCache.getSound("https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/whoosh.wav");
self.teleportSound = SoundCache.getSound("https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/whoosh.wav");
// print(" portal destination is " + self.portalDestination);
}
}
@ -51,13 +56,13 @@
if (data != null) {
print("Teleporting to (" + data.location.x + ", " + data.location.y + ", " + data.location.z + ")");
MyAvatar.position = data.location;
MyAvatar.position = data.location;
}
}
this.lookAtTarget = function(entryPoint,target) {
this.lookAtTarget = function(entryPoint, target) {
//print('SHOULD LOOK AT TARGET')
var direction = Vec3.normalize(Vec3.subtract(entryPoint, target));
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {

View file

@ -1,6 +1,6 @@
var soundMap = [{
name: 'Cells',
url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/Cells.wav",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/Cells.wav",
audioOptions: {
position: {
x: 15850,
@ -12,7 +12,7 @@ var soundMap = [{
}
}, {
name: 'Cell Layout',
url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/CellLayout.wav",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/CellLayout.wav",
audioOptions: {
position: {
x: 15950,
@ -24,7 +24,7 @@ var soundMap = [{
}
}, {
name: 'Ribsome',
url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/Ribosome.wav",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/Ribosome.wav",
audioOptions: {
position: {
x: 15650,
@ -36,7 +36,7 @@ var soundMap = [{
}
}, {
name: 'Hexokinase',
url: "http://hifi-content.s3.amazonaws.com/DomainContent/CellScience/Audio/Hexokinase.wav",
url: "http://hifi-production.s3.amazonaws.com/DomainContent/CellScience/Audio/Hexokinase.wav",
audioOptions: {
position: {
x: 15750,

View file

@ -9,12 +9,8 @@ var numDynein = 2;
var numKinesin = 2;
var percentOnMainMT = 100;
var baseLocation;
if (USE_LOCAL_HOST === true) {
baseLocation = "http://localhost:8080/";
} else {
baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"
}
baseLocation = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"
var WORLD_OFFSET = {
x: 0,

View file

@ -18,7 +18,6 @@ function offsetVectorToWorld(vector) {
newVector = Vec3.sum(vector, WORLD_OFFSET);
print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector))
return newVector
}

View file

@ -17,7 +17,6 @@ function offsetVectorToWorld(vector) {
newVector = Vec3.sum(vector, WORLD_OFFSET);
print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector))
return newVector
}