cell stuff

This commit is contained in:
James B. Pollack 2016-04-26 12:29:43 -07:00
parent 61ff4d0f60
commit e24c6f1b17
5 changed files with 311 additions and 321 deletions

View file

@ -8,103 +8,96 @@
(function() {
var version = 12;
var added = false;
var self = this;
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
var button;
var _this;
this.preload = function(entityId) {
this.entityId = entityId;
self.buttonImageURL = baseURL + "GUI/GUI_Cells.png?" + version;
// print(' BUTTON IMAGE URL:' + self.buttonImageURL)
if (self.button === undefined) {
// print(' NO BUTTON ADDING ONE!!')
self.button = true;
self.addButton();
} else {
//print(' SELF ALREADY HAS A BUTTON!!')
}
function NavButton() {
_this = this;
}
this.addButton = function() {
this.windowDimensions = Controller.getViewportDimensions();
this.buttonWidth = 150;
this.buttonHeight = 50;
this.buttonPadding = 10;
this.offset = 0;
this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5);
this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50;
this.button = Overlays.addOverlay("image", {
x: self.buttonPositionX,
y: self.buttonPositionY,
width: self.buttonWidth,
height: self.buttonHeight,
imageURL: self.buttonImageURL,
visible: true,
alpha: 1.0
});
}
this.onClick = function(event) {
var clickedOverlay = Overlays.getOverlayAtPoint({
x: event.x,
y: event.y
});
if (clickedOverlay == self.button) {
self.lookAtTarget();
}
}
this.lookAtTarget = function() {
// entryPoint: scene.entryPoint,
// target: scene.location,
var entryPoint = {
NavButton.prototype = {
button: null,
buttonImageURL: baseURL + "GUI/GUI_Cells.png?" + version,
hasButton: false,
entryPoint: {
x: 13500,
y: 13500,
z: 13500
};
var target = {
},
target: {
x: 13501,
y: 13501,
z: 13501
},
preload: function(entityId) {
this.entityId = entityId;
this.addButton();
Controller.mousePressEvent.connect(this.onClick);
},
addButton: function() {
if (this.hasButton === false) {
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;
}
},
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);
}
var direction = Vec3.normalize(Vec3.subtract(target, 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(target, true, yaw);
MyAvatar.headYaw = 0;
}
this.unload = function() {
Overlays.deleteOverlay(self.button);
Controller.mousePressEvent.disconnect(this.onClick);
}
return new NavButton();
Controller.mousePressEvent.connect(this.onClick);
});

View file

@ -4,102 +4,106 @@
// 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 added = false;
var self = this;
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
var button;
var _this;
this.preload = function(entityId) {
this.entityId = entityId;
self.buttonImageURL = baseURL + "GUI/GUI_Hexokinase.png?" + version;
// print(' BUTTON IMAGE URL:' + self.buttonImageURL)
if (self.button === undefined) {
// print(' NO BUTTON ADDING ONE!!')
self.button = true;
self.addButton();
} else {
//print(' SELF ALREADY HAS A BUTTON!!')
}
function NavButton() {
_this = this;
}
this.addButton = function() {
this.windowDimensions = Controller.getViewportDimensions();
this.buttonWidth = 150;
this.buttonHeight = 50;
this.buttonPadding = 10;
this.offset = 2;
this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5);
this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50;
this.button = Overlays.addOverlay("image", {
x: self.buttonPositionX,
y: self.buttonPositionY,
width: self.buttonWidth,
height: self.buttonHeight,
imageURL: self.buttonImageURL,
visible: true,
alpha: 1.0
});
}
this.onClick = function(event) {
var clickedOverlay = Overlays.getOverlayAtPoint({
x: event.x,
y: event.y
});
if (clickedOverlay == self.button) {
self.lookAtTarget();
}
}
this.lookAtTarget = function() {
var entryPoint = {
NavButton.prototype = {
button: null,
buttonImageURL: baseURL + "GUI/GUI_Hexokinase.png?" + version,
hasButton: false,
entryPoint: {
x: 3000,
y: 3000,
z: 13500
}
var target = {
},
target: {
x: 2755,
y: 3121,
z: 13501
},
preload: function(entityId) {
this.entityId = entityId;
this.addButton();
Controller.mousePressEvent.connect(this.onClick);
},
addButton: function() {
if (this.hasButton === false) {
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;
}
},
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);
}
var direction = Vec3.normalize(Vec3.subtract(target, 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(target, true, yaw);
MyAvatar.headYaw = 0;
}
this.unload = function() {
Overlays.deleteOverlay(self.button);
Controller.mousePressEvent.disconnect(this.onClick);
}
return new NavButton();
Controller.mousePressEvent.connect(this.onClick);
});

View file

@ -8,99 +8,96 @@
(function() {
var version = 12;
var added = false;
var self = this;
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
var button;
var _this;
this.preload = function(entityId) {
this.entityId = entityId;
self.buttonImageURL = baseURL + "GUI/GUI_CellLayout.png?" + version;
// print(' BUTTON IMAGE URL:' + self.buttonImageURL)
if (self.button === undefined) {
// print(' NO BUTTON ADDING ONE!!')
self.button = true;
self.addButton();
} else {
//print(' SELF ALREADY HAS A BUTTON!!')
}
function NavButton() {
_this = this;
}
this.addButton = function() {
this.windowDimensions = Controller.getViewportDimensions();
this.buttonWidth = 150;
this.buttonHeight = 50;
this.buttonPadding = 10;
this.offset = 1;
this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5);
this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50;
this.button = Overlays.addOverlay("image", {
x: self.buttonPositionX,
y: self.buttonPositionY,
width: self.buttonWidth,
height: self.buttonHeight,
imageURL: self.buttonImageURL,
visible: true,
alpha: 1.0
});
}
this.onClick = function(event) {
var clickedOverlay = Overlays.getOverlayAtPoint({
x: event.x,
y: event.y
});
if (clickedOverlay == self.button) {
self.lookAtTarget();
}
}
this.lookAtTarget = function() {
var entryPoint = {
NavButton.prototype = {
button: null,
buttonImageURL: baseURL + "GUI/GUI_CellLayout.png?" + version,
hasButton: false,
entryPoint: {
x: 3000,
y: 13500,
z: 3000
};
var target = {
},
target: {
x: 3276.6,
y: 13703.3,
z: 4405.6
},
preload: function(entityId) {
this.entityId = entityId;
this.addButton();
Controller.mousePressEvent.connect(this.onClick);
},
addButton: function() {
if (this.hasButton === false) {
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;
}
},
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);
}
var direction = Vec3.normalize(Vec3.subtract(target, 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(target, true, yaw);
MyAvatar.headYaw = 0;
}
this.unload = function() {
Overlays.deleteOverlay(self.button);
Controller.mousePressEvent.disconnect(this.onClick);
}
return new NavButton();
Controller.mousePressEvent.connect(this.onClick);
});

View file

@ -4,103 +4,99 @@
// 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 added = false;
var self = this;
var baseURL = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/";
var button;
var _this;
this.preload = function(entityId) {
this.entityId = entityId;
self.buttonImageURL = baseURL + "GUI/GUI_Ribosome.png?" + version;
// print(' BUTTON IMAGE URL:' + self.buttonImageURL)
if (self.button === undefined) {
// print(' NO BUTTON ADDING ONE!!')
self.button = true;
self.addButton();
} else {
//print(' SELF ALREADY HAS A BUTTON!!')
}
function NavButton() {
_this = this;
}
this.addButton = function() {
this.windowDimensions = Controller.getViewportDimensions();
this.buttonWidth = 150;
this.buttonHeight = 50;
this.buttonPadding = 10;
this.offset = 3;
this.buttonPositionX = (this.offset + 1) * (this.buttonWidth + this.buttonPadding) + (self.windowDimensions.x / 2) - (this.buttonWidth * 3 + this.buttonPadding * 2.5);
this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - 50;
this.button = Overlays.addOverlay("image", {
x: self.buttonPositionX,
y: self.buttonPositionY,
width: self.buttonWidth,
height: self.buttonHeight,
imageURL: self.buttonImageURL,
visible: true,
alpha: 1.0
});
}
this.onClick = function(event) {
var clickedOverlay = Overlays.getOverlayAtPoint({
x: event.x,
y: event.y
});
if (clickedOverlay == self.button) {
self.lookAtTarget();
}
}
this.lookAtTarget = function() {
var entryPoint = {
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) {
this.entityId = entityId;
this.addButton();
Controller.mousePressEvent.connect(this.onClick);
},
addButton: function() {
if (this.hasButton === false) {
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;
}
},
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
});
var target = {
x: 2755,
y: 3121,
z: 13501
};
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
});
var direction = Vec3.normalize(Vec3.subtract(entryPoint, target));
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(entryPoint, true, yaw);
MyAvatar.headYaw = 0;
MyAvatar.goToLocation(this.target, true, yaw);
MyAvatar.headYaw = 0;
},
unload: function() {
this.hasButton = false;
Overlays.deleteOverlay(button);
Controller.mousePressEvent.disconnect(this.onClick);
}
}
this.unload = function() {
Overlays.deleteOverlay(self.button);
Controller.mousePressEvent.disconnect(this.onClick);
}
return new NavButton();
Controller.mousePressEvent.connect(this.onClick);
});

View file

@ -5,7 +5,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var version = 1215;
var version = 1216;
var WORLD_OFFSET = {
x: 0,