Script updates and fixes to highfidelity-public

Script updates and fixes to highfidelity-public
This commit is contained in:
Chris Collins 2015-01-06 17:04:42 -08:00
parent c3d151a646
commit 0a1a64b7e6
12 changed files with 126 additions and 53 deletions

View file

@ -77,7 +77,6 @@ var modelURLs = [
HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Alder.fbx", HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Alder.fbx",
HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Bush1.fbx", HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Bush1.fbx",
HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Bush6.fbx", HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Bush6.fbx",
HIFI_PUBLIC_BUCKET + "meshes/newInvader16x16-large-purple.svo",
HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed.fbx", HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed.fbx",
HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed2.fbx", HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed2.fbx",
HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed4.fbx", HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed4.fbx",
@ -192,8 +191,7 @@ var toolBar = (function () {
}); });
newTextButton = toolBar.addTool({ newTextButton = toolBar.addTool({
//imageURL: toolIconUrl + "add-text.svg", imageURL: toolIconUrl + "add-text.svg",
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/tools/add-text.svg", // temporarily
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT }, subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, width: toolWidth,
height: toolHeight, height: toolHeight,

View file

@ -56,7 +56,6 @@ var modelURLs = [
HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Alder.fbx", HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Alder.fbx",
HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Bush1.fbx", HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Bush1.fbx",
HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Bush6.fbx", HIFI_PUBLIC_BUCKET + "models/entities/2-Terrain:%20Bush6.fbx",
HIFI_PUBLIC_BUCKET + "meshes/newInvader16x16-large-purple.svo",
HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed.fbx", HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed.fbx",
HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed2.fbx", HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed2.fbx",
HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed4.fbx", HIFI_PUBLIC_BUCKET + "models/entities/3-Buildings-1-Rustic-Shed4.fbx",
@ -1215,8 +1214,7 @@ var toolBar = (function () {
}); });
newTextButton = toolBar.addTool({ newTextButton = toolBar.addTool({
//imageURL: toolIconUrl + "add-text.svg", imageURL: toolIconUrl + "add-text.svg",
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/tools/add-text.svg", // temporarily
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT }, subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
width: toolWidth, width: toolWidth,
height: toolHeight, height: toolHeight,

View file

@ -58,7 +58,7 @@ var button1 = Overlays.addOverlay("image", { // green button
width: 40, width: 40,
height: 35, height: 35,
subImage: { x: 0, y: 0, width: 39, height: 35 }, subImage: { x: 0, y: 0, width: 39, height: 35 },
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png", imageURL: "https://public.highfidelity.io/images/thumb.png",
color: readyColor, color: readyColor,
visible: true visible: true
}); });
@ -69,7 +69,7 @@ var button2 = Overlays.addOverlay("image", { // red button
width: 40, width: 40,
height: 35, height: 35,
subImage: { x: 0, y: 0, width: 39, height: 35 }, subImage: { x: 0, y: 0, width: 39, height: 35 },
imageURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/thumb.png", imageURL: "https://public.highfidelity.io/images/thumb.png",
color: { red: 250, green: 2, blue: 2}, color: { red: 250, green: 2, blue: 2},
visible: true, visible: true,
}); });

View file

@ -590,7 +590,7 @@ SelectionDisplay = (function () {
}); });
var yawHandle = Overlays.addOverlay("billboard", { var yawHandle = Overlays.addOverlay("billboard", {
url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png", url: "https://public.highfidelity.io/images/rotate-arrow-west-north.png",
position: { x:0, y: 0, z: 0}, position: { x:0, y: 0, z: 0},
color: rotateHandleColor, color: rotateHandleColor,
alpha: rotateHandleAlpha, alpha: rotateHandleAlpha,
@ -603,7 +603,7 @@ SelectionDisplay = (function () {
var pitchHandle = Overlays.addOverlay("billboard", { var pitchHandle = Overlays.addOverlay("billboard", {
url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png", url: "https://public.highfidelity.io/images/rotate-arrow-west-north.png",
position: { x:0, y: 0, z: 0}, position: { x:0, y: 0, z: 0},
color: rotateHandleColor, color: rotateHandleColor,
alpha: rotateHandleAlpha, alpha: rotateHandleAlpha,
@ -616,7 +616,7 @@ SelectionDisplay = (function () {
var rollHandle = Overlays.addOverlay("billboard", { var rollHandle = Overlays.addOverlay("billboard", {
url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png", url: "https://public.highfidelity.io/images/rotate-arrow-west-north.png",
position: { x:0, y: 0, z: 0}, position: { x:0, y: 0, z: 0},
color: rotateHandleColor, color: rotateHandleColor,
alpha: rotateHandleAlpha, alpha: rotateHandleAlpha,
@ -835,8 +835,8 @@ SelectionDisplay = (function () {
rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: far }; rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: far };
Overlays.editOverlay(pitchHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-south.png" }); Overlays.editOverlay(pitchHandle, { url: "https://public.highfidelity.io/images/rotate-arrow-west-south.png" });
Overlays.editOverlay(rollHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-south.png" }); Overlays.editOverlay(rollHandle, { url: "https://public.highfidelity.io/images/rotate-arrow-west-south.png" });
} else { } else {
@ -867,8 +867,8 @@ SelectionDisplay = (function () {
pitchCenter = { x: right, y: boundsCenter.y, z: boundsCenter.z }; pitchCenter = { x: right, y: boundsCenter.y, z: boundsCenter.z };
rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: near}; rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: near};
Overlays.editOverlay(pitchHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" }); Overlays.editOverlay(pitchHandle, { url: "https://public.highfidelity.io/images/rotate-arrow-west-north.png" });
Overlays.editOverlay(rollHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" }); Overlays.editOverlay(rollHandle, { url: "https://public.highfidelity.io/images/rotate-arrow-west-north.png" });
} }
} else { } else {
@ -899,8 +899,8 @@ SelectionDisplay = (function () {
pitchCenter = { x: left, y: boundsCenter.y, z: boundsCenter.z }; pitchCenter = { x: left, y: boundsCenter.y, z: boundsCenter.z };
rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: far}; rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: far};
Overlays.editOverlay(pitchHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" }); Overlays.editOverlay(pitchHandle, { url: "https://public.highfidelity.io/images/rotate-arrow-west-north.png" });
Overlays.editOverlay(rollHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" }); Overlays.editOverlay(rollHandle, { url: "https://public.highfidelity.io/images/rotate-arrow-west-north.png" });
} else { } else {
@ -928,8 +928,8 @@ SelectionDisplay = (function () {
rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: near }; rollCenter = { x: boundsCenter.x, y: boundsCenter.y, z: near };
pitchCenter = { x: left, y: boundsCenter.y, z: boundsCenter.z}; pitchCenter = { x: left, y: boundsCenter.y, z: boundsCenter.z};
Overlays.editOverlay(pitchHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" }); Overlays.editOverlay(pitchHandle, { url: "https://public.highfidelity.io/images/rotate-arrow-west-north.png" });
Overlays.editOverlay(rollHandle, { url: "https://s3-us-west-1.amazonaws.com/highfidelity-public/images/rotate-arrow-west-north.png" }); Overlays.editOverlay(rollHandle, { url: "https://public.highfidelity.io/images/rotate-arrow-west-north.png" });
} }
} }

View file

@ -0,0 +1,104 @@
//
// Unittest.js
// examples
//
// Created by Ryan Huffman on 5/4/14
// Copyright 2014 High Fidelity, Inc.
//
// This provides very basic unit testing functionality.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
test = function(name, func) {
print("Running test: " + name);
var unitTest = new UnitTest(name, func);
try {
unitTest.run();
print(" Success: " + unitTest.numAssertions + " assertions passed");
} catch (error) {
print(" Failure: " + error.name + " " + error.message);
}
};
AssertionException = function(expected, actual, message) {
print("Creating exception");
this.message = message + "\n: " + actual + " != " + expected;
this.name = 'AssertionException';
};
UnthrownException = function(message) {
print("Creating exception");
this.message = message + "\n";
this.name = 'UnthrownException';
};
UnitTest = function(name, func) {
this.numAssertions = 0;
this.func = func;
};
UnitTest.prototype.run = function() {
this.func();
};
UnitTest.prototype.assertNotEquals = function(expected, actual, message) {
this.numAssertions++;
if (expected == actual) {
throw new AssertionException(expected, actual, message);
}
};
UnitTest.prototype.assertEquals = function(expected, actual, message) {
this.numAssertions++;
if (expected != actual) {
throw new AssertionException(expected, actual, message);
}
};
UnitTest.prototype.assertContains = function (expected, actual, message) {
this.numAssertions++;
if (actual.indexOf(expected) == -1) {
throw new AssertionException(expected, actual, message);
}
};
UnitTest.prototype.assertHasProperty = function(property, actual, message) {
this.numAssertions++;
if (actual[property] === undefined) {
throw new AssertionException(property, actual, message);
}
};
UnitTest.prototype.assertNull = function(value, message) {
this.numAssertions++;
if (value !== null) {
throw new AssertionException(value, null, message);
}
}
UnitTest.prototype.arrayEqual = function(array1, array2, message) {
this.numAssertions++;
if (array1.length !== array2.length) {
throw new AssertionException(array1.length , array2.length , message);
}
for (var i = 0; i < array1.length; ++i) {
if (array1[i] !== array2[i]) {
throw new AssertionException(array1[i], array2[i], i + " " + message);
}
}
}
UnitTest.prototype.raises = function(func, message) {
this.numAssertions++;
try {
func();
} catch (error) {
return;
}
throw new UnthrownException(message);
}

View file

@ -1,27 +0,0 @@
//
// playSound.js
// examples
//
// Copyright 2014 High Fidelity, Inc.
// Plays a sample audio file at the avatar's current location
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
Script.include("libraries/globals.js");
// First, load a sample sound from a URL
var bird = SoundCache.getSound(HIFI_PUBLIC_BUCKET + "sounds/Animals/bushtit_1.raw");
function maybePlaySound(deltaTime) {
if (Math.random() < 0.01) {
// Set the location and other info for the sound to play
Audio.playSound(bird, {
position: MyAvatar.position,
volume: 0.5
});
}
}
// Connect a call back that happens every frame
Script.update.connect(maybePlaySound);

View file

@ -11,7 +11,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
Script.include("Test.js"); Script.include("../../libraries/unitTest.js");
test("Test default request values", function(finished) { test("Test default request values", function(finished) {
var req = new XMLHttpRequest(); var req = new XMLHttpRequest();

View file

@ -11,7 +11,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
Script.include("libraries/globals.js"); Script.include("../../libraries/globals.js");
var sound = SoundCache.getSound(HIFI_PUBLIC_BUCKET + "sounds/220Sine.wav"); var sound = SoundCache.getSound(HIFI_PUBLIC_BUCKET + "sounds/220Sine.wav");

View file

@ -11,7 +11,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
Script.include("libraries/globals.js"); Script.include("../../libraries/globals.js");
// A few sample files you may want to try: // A few sample files you may want to try:

View file

@ -9,9 +9,9 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
Script.include("libraries/globals.js"); Script.include("../../libraries/globals.js");
var soundClip = SoundCache.getSound(HIFI_PUBLIC_BUCKET + "sounds/Voxels/voxel create 3.raw"); var soundClip = SoundCache.getSound(HIFI_PUBLIC_BUCKET + "sounds/Guitars/Guitar+-+Nylon+A.raw");
var currentTime = 1.570079; // pi/2 var currentTime = 1.570079; // pi/2
var deltaTime = 0.05; var deltaTime = 0.05;
@ -38,6 +38,6 @@ function playSound() {
}); });
} }
Script.setInterval(playSound, 250); Script.setInterval(playSound, 850);

View file

@ -3,7 +3,7 @@ Instructions for adding the RtMidi library to Interface
Stephen Birarda, June 30, 2014 Stephen Birarda, June 30, 2014
1. Download the RtMidi tarball from High Fidelity S3. 1. Download the RtMidi tarball from High Fidelity S3.
http://highfidelity-public.s3.amazonaws.com/dependencies/rtmidi-2.1.0.tar.gz http://public.highfidelity.io/dependencies/rtmidi-2.1.0.tar.gz
2. Copy RtMidi.h to externals/rtmidi/include. 2. Copy RtMidi.h to externals/rtmidi/include.