mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:47:30 +02:00
move cellscience to production
This commit is contained in:
parent
0f8842f582
commit
8899ac71a1
11 changed files with 161 additions and 148 deletions
|
@ -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 = {
|
var spriteDimensions = {
|
||||||
x: 10,
|
x: 10,
|
||||||
y: 10,
|
y: 10,
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
z: -1
|
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;
|
var self = this;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
Script.include(utilsScript);
|
Script.include(utilsScript);
|
||||||
|
|
||||||
var self = this;
|
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.preload = function(entityId) {
|
||||||
this.entityId = entityId;
|
this.entityId = entityId;
|
||||||
|
|
|
@ -6,113 +6,114 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var baseURL = "https://hifi-content.s3.amazonaws.com/hifi-content/DomainContent/CellScience/";
|
var baseURL = "https://hifi-production.s3.amazonaws.com/hifi-production/DomainContent/CellScience/";
|
||||||
var self = this;
|
var self = this;
|
||||||
this.buttonImageURL = baseURL + "GUI/play_audio.svg?2";
|
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) {
|
this.addButton = function() {
|
||||||
//print(' should initialize' + entityId)
|
this.windowDimensions = Controller.getViewportDimensions();
|
||||||
var properties = Entities.getEntityProperties(entityId);
|
this.buttonWidth = 100;
|
||||||
if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) {
|
this.buttonHeight = 100;
|
||||||
self.initTimeout = Script.setTimeout(function() {
|
this.buttonPadding = 0;
|
||||||
// print(' no user data yet, try again in one second')
|
|
||||||
self.initialize(entityId);
|
|
||||||
}, 1000)
|
|
||||||
|
|
||||||
|
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 {
|
} else {
|
||||||
//print(' userdata before parse attempt' + properties.userData)
|
//print("not downloaded");
|
||||||
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.addButton = function() {
|
this.unload = function() {
|
||||||
this.windowDimensions = Controller.getViewportDimensions();
|
Overlays.deleteOverlay(self.button);
|
||||||
this.buttonWidth = 100;
|
Controller.mousePressEvent.disconnect(this.onClick);
|
||||||
this.buttonHeight = 100;
|
Script.update.disconnect(this.update);
|
||||||
this.buttonPadding = 0;
|
if (this.initTimeout !== null) {
|
||||||
|
Script.clearTimeout(this.initTimeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.buttonPositionX = (self.windowDimensions.x - self.buttonPadding) / 2 - self.buttonWidth;
|
Controller.mousePressEvent.connect(this.onClick);
|
||||||
this.buttonPositionY = (self.windowDimensions.y - self.buttonHeight) - (self.buttonHeight + self.buttonPadding);
|
Script.update.connect(this.update);
|
||||||
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("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);
|
|
||||||
|
|
||||||
});
|
|
|
@ -8,7 +8,7 @@
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
var self = this;
|
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;
|
var version = 3;
|
||||||
this.preload = function(entityId) {
|
this.preload = function(entityId) {
|
||||||
|
|
|
@ -22,9 +22,14 @@
|
||||||
this.initialize = function(entityID) {
|
this.initialize = function(entityID) {
|
||||||
// print(' should initialize')
|
// print(' should initialize')
|
||||||
var properties = Entities.getEntityProperties(entityID);
|
var properties = Entities.getEntityProperties(entityID);
|
||||||
if (properties.userData.length === 0 || properties.hasOwnProperty('userData') === false) {
|
if (properties.hasOwnProperty('userData') === false) {
|
||||||
self.initTimeout = Script.setTimeout(function() {
|
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);
|
self.initialize(entityID);
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} else {
|
} else {
|
||||||
|
@ -39,7 +44,7 @@
|
||||||
volume: 0.5
|
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);
|
// print(" portal destination is " + self.portalDestination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,13 +56,13 @@
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
print("Teleporting to (" + data.location.x + ", " + data.location.y + ", " + data.location.z + ")");
|
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')
|
//print('SHOULD LOOK AT TARGET')
|
||||||
var direction = Vec3.normalize(Vec3.subtract(entryPoint, target));
|
var direction = Vec3.normalize(Vec3.subtract(entryPoint, target));
|
||||||
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
|
var pitch = Quat.angleAxis(Math.asin(-direction.y) * 180.0 / Math.PI, {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var soundMap = [{
|
var soundMap = [{
|
||||||
name: 'Cells',
|
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: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 15850,
|
x: 15850,
|
||||||
|
@ -12,7 +12,7 @@ var soundMap = [{
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'Cell Layout',
|
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: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 15950,
|
x: 15950,
|
||||||
|
@ -24,7 +24,7 @@ var soundMap = [{
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'Ribsome',
|
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: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 15650,
|
x: 15650,
|
||||||
|
@ -36,7 +36,7 @@ var soundMap = [{
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'Hexokinase',
|
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: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 15750,
|
x: 15750,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,12 +9,8 @@ var numDynein = 2;
|
||||||
var numKinesin = 2;
|
var numKinesin = 2;
|
||||||
var percentOnMainMT = 100;
|
var percentOnMainMT = 100;
|
||||||
|
|
||||||
var baseLocation;
|
|
||||||
if (USE_LOCAL_HOST === true) {
|
baseLocation = "https://hifi-production.s3.amazonaws.com/DomainContent/CellScience/"
|
||||||
baseLocation = "http://localhost:8080/";
|
|
||||||
} else {
|
|
||||||
baseLocation = "https://hifi-content.s3.amazonaws.com/DomainContent/CellScience/"
|
|
||||||
}
|
|
||||||
|
|
||||||
var WORLD_OFFSET = {
|
var WORLD_OFFSET = {
|
||||||
x: 0,
|
x: 0,
|
||||||
|
|
|
@ -18,7 +18,6 @@ function offsetVectorToWorld(vector) {
|
||||||
|
|
||||||
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
||||||
|
|
||||||
print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector))
|
|
||||||
return newVector
|
return newVector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ function offsetVectorToWorld(vector) {
|
||||||
|
|
||||||
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
newVector = Vec3.sum(vector, WORLD_OFFSET);
|
||||||
|
|
||||||
print('JBP NEW VECTOR IS:: ' + JSON.stringify(newVector))
|
|
||||||
return newVector
|
return newVector
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue