Update some archived scripts.

This commit is contained in:
Kalila L 2020-09-20 23:37:55 -04:00
parent a95c457499
commit aeae078b67
20 changed files with 46 additions and 96 deletions

View file

@ -9,9 +9,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
// Set the following variables to the right value
var NUM_AC = 3; // This is the number of AC. Their ID need to be unique and between 0 (included) and NUM_AC (excluded)
var NAMES = new Array("Craig", "Clement", "Jeff"); // ACs names ordered by IDs (Default name is "ACx", x = ID + 1))
@ -36,7 +33,7 @@ var LOAD = 6;
var windowDimensions = Controller.getViewportDimensions();
var TOOL_ICON_URL = VIRCADIA_PUBLIC_CDN + "images/tools/";
var TOOL_ICON_URL = ExternalResource.getUrl(ExternalResource.Assets, "images/tools/");
var ALPHA_ON = 1.0;
var ALPHA_OFF = 0.7;
var COLOR_TOOL_BAR = { red: 0, green: 0, blue: 0 };

View file

@ -20,9 +20,7 @@
//
//For procedural walk animation
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
Script.include(VIRCADIA_PUBLIC_CDN + "scripts/acScripts/proceduralAnimationAPI.js");
Script.include(ExternalResource.getUrl(ExternalResource.Assets, "scripts/acScripts/proceduralAnimationAPI.js");
var procAnimAPI = new ProcAnimAPI();
@ -122,9 +120,9 @@ var newBodyFilePrefix = "bot" + botNumber;
// set the face model fst using the bot number
// there is no need to change the body model - we're using the default
Avatar.faceModelURL = VIRCADIA_PUBLIC_CDN + "meshes/" + newFaceFilePrefix + ".fst";
Avatar.skeletonModelURL = VIRCADIA_PUBLIC_CDN + "meshes/" + newBodyFilePrefix + "_a.fst";
Avatar.billboardURL = VIRCADIA_PUBLIC_CDN + "meshes/billboards/bot" + botNumber + ".png";
Avatar.faceModelURL = ExternalResource.getUrl(ExternalResource.Assets, "meshes/" + newFaceFilePrefix + ".fst");
Avatar.skeletonModelURL = ExternalResource.getUrl(ExternalResource.Assets, "meshes/" + newBodyFilePrefix + "_a.fst");
Avatar.billboardURL = ExternalResource.getUrl(ExternalResource.Assets, "meshes/billboards/bot" + botNumber + ".png");
Agent.isAvatar = true;
Agent.isListeningToAudioStream = true;
@ -147,9 +145,9 @@ function loadSounds() {
var footstep_filenames = ["FootstepW2Left-12db.wav", "FootstepW2Right-12db.wav", "FootstepW3Left-12db.wav", "FootstepW3Right-12db.wav",
"FootstepW5Left-12db.wav", "FootstepW5Right-12db.wav"];
var SOUND_BASE_URL = VIRCADIA_PUBLIC_CDN + "sounds/Cocktail+Party+Snippets/Raws/";
var SOUND_BASE_URL = ExternalResource.getUrl(ExternalResource.Assets, "sounds/Cocktail+Party+Snippets/Raws/");
var FOOTSTEP_BASE_URL = VIRCADIA_PUBLIC_CDN + "sounds/Footsteps/";
var FOOTSTEP_BASE_URL = ExternalResource.getUrl(ExternalResource.Assets, "sounds/Footsteps/");
for (var i = 0; i < sound_filenames.length; i++) {
sounds.push(SoundCache.getSound(SOUND_BASE_URL + sound_filenames[i]));

View file

@ -12,9 +12,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
VIRCADIA_PUBLIC_CDN = networkingConstants.CONTENT_CDN_URL;
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}
@ -45,9 +42,9 @@ newBodyFilePrefix = "bot" + botNumber;
// set the face model fst using the bot number
// there is no need to change the body model - we're using the default
Avatar.faceModelURL = VIRCADIA_PUBLIC_CDN + "meshes/" + newFaceFilePrefix + ".fst";
Avatar.skeletonModelURL = VIRCADIA_PUBLIC_CDN + "meshes/" + newBodyFilePrefix + ".fst";
Avatar.billboardURL = VIRCADIA_PUBLIC_CDN + "meshes/billboards/bot" + botNumber + ".png";
Avatar.faceModelURL = ExternalResource.getUrl(ExternalResource.Assets, "meshes/" + newFaceFilePrefix + ".fst");
Avatar.skeletonModelURL = ExternalResource.getUrl(ExternalResource.Assets, "meshes/" + newBodyFilePrefix + ".fst");
Avatar.billboardURL = ExternalResource.getUrl(ExternalResource.Assets, "meshes/billboards/bot" + botNumber + ".png");
Agent.isAvatar = true;
Agent.isListeningToAudioStream = true;

View file

@ -10,16 +10,13 @@
//
Script.include("./AgentPoolController.js");
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
var masterController = new MasterController();
var input_text = null;
// Script. DO NOT MODIFY BEYOND THIS LINE.
//Script.include("../libraries/toolBars.js");
Script.include(VIRCADIA_PUBLIC_CDN + "scripts/libraries/toolBars.js");
Script.include(ExternalResource.getUrl(ExternalResource.Assets, "scripts/libraries/toolBars.js"));
// We want small icons
Tool.IMAGE_HEIGHT /= 2;
Tool.IMAGE_WIDTH /= 2;
@ -30,7 +27,7 @@ var STOP = 3;
var LOAD = 6;
var windowDimensions = Controller.getViewportDimensions();
var TOOL_ICON_URL = VIRCADIA_PUBLIC_CDN + "images/tools/";
var TOOL_ICON_URL = ExternalResource.getUrl(ExternalResource.Assets, "images/tools/");
var ALPHA_ON = 1.0;
var ALPHA_OFF = 0.7;
var COLOR_TOOL_BAR = { red: 0, green: 0, blue: 0 };

View file

@ -10,10 +10,6 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
// The "Swatches" example of this script will create 9 different image overlays, that use the color feature to
// display different colors as color swatches. The overlays can be clicked on, to change the "selectedSwatch" variable
// and update the image used for the overlay so that it appears to have a selected indicator.
@ -53,7 +49,7 @@ for (s = 0; s < numberOfSwatches; s++) {
width: 31,
height: 54,
subImage: { x: imageFromX, y: imageFromY, width: 30, height: 54 },
imageURL: VIRCADIA_PUBLIC_CDN + "images/testing-swatches.svg",
imageURL: ExternalResource.getUrl(ExternalResource.Assets, "images/testing-swatches.svg"),
color: swatchColors[s],
alpha: 1
});
@ -81,7 +77,7 @@ var toolA = Overlays.addOverlay("image", {
width: 62,
height: 40,
subImage: { x: 0, y: 0, width: 62, height: 40 },
imageURL: VIRCADIA_PUBLIC_CDN + "images/hifi-interface-tools.svg",
imageURL: ExternalResource.getUrl(ExternalResource.Assets, "images/hifi-interface-tools.svg"),
color: { red: 255, green: 255, blue: 255},
visible: false
});
@ -91,7 +87,7 @@ var toolA = Overlays.addOverlay("image", {
var slider = Overlays.addOverlay("image", {
// alternate form of expressing bounds
bounds: { x: 100, y: 300, width: 158, height: 35},
imageURL: VIRCADIA_PUBLIC_CDN + "images/slider.png",
imageURL: ExternalResource.getUrl(ExternalResource.Assets, "images/slider.png"),
color: { red: 255, green: 255, blue: 255},
alpha: 1
});
@ -105,7 +101,7 @@ var thumb = Overlays.addOverlay("image", {
y: 309,
width: 18,
height: 17,
imageURL: VIRCADIA_PUBLIC_CDN + "images/thumb.png",
imageURL: ExternalResource.getUrl(ExternalResource.Assets, "images/thumb.png"),
color: { red: 255, green: 255, blue: 255},
alpha: 1
});
@ -201,8 +197,8 @@ print("Cube overlay color =\n"
// This model overlay example causes intermittent crashes in NetworkGeometry::setTextureWithNameToURL()
//var modelOverlayProperties = {
// textures: {
// filename1: VIRCADIA_PUBLIC_CDN + "images/testing-swatches.svg",
// filename2: VIRCADIA_PUBLIC_CDN + "images/hifi-interface-tools.svg"
// filename1: ExternalResource.getUrl(ExternalResource.Assets, "images/testing-swatches.svg",)
// filename2: ExternalResource.getUrl(ExternalResource.Assets, "images/hifi-interface-tools.svg")
// }
//}
//var modelOverlay = Overlays.addOverlay("model", modelOverlayProperties);

View file

@ -1,6 +1,4 @@
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
var fireSound = SoundCache.getSound(VIRCADIA_PUBLIC_CDN + "sounds/Guns/GUN-SHOT2.raw");
var fireSound = SoundCache.getSound(ExternalResource.getUrl(ExternalResource.Assets, "sounds/Guns/GUN-SHOT2.raw"));
var audioOptions = {
volume: 0.9,
position: Vec3.sum(Camera.getPosition(), Quat.getFront(Camera.getOrientation()))

View file

@ -13,9 +13,7 @@
(function () {
var ball = null;
var var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
var collisionSoundURL = VIRCADIA_PUBLIC_CDN + "sounds/Collisions-ballhitsandcatches/billiards/collision1.wav";
var collisionSoundURL = ExternalResource.getUrl(ExternalResource.Assets, "sounds/Collisions-ballhitsandcatches/billiards/collision1.wav");
var triggerState = false;
var BALL_GRAVITY = -9.8;
var BALL_START_VELOCITY = 0.1;

View file

@ -9,12 +9,9 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
var grenadeURL = VIRCADIA_PUBLIC_CDN + "models/props/grenade/grenade.fbx";
var fuseSoundURL = VIRCADIA_PUBLIC_CDN + "sounds/burningFuse.wav";
var boomSoundURL = VIRCADIA_PUBLIC_CDN + "sounds/explosion.wav";
var grenadeURL = ExternalResource.getUrl(ExternalResource.Assets, "models/props/grenade/grenade.fbx");
var fuseSoundURL = ExternalResource.getUrl(ExternalResource.Assets, "sounds/burningFuse.wav");
var boomSoundURL = ExternalResource.getUrl(ExternalResource.Assets, "sounds/explosion.wav");
var AudioRotationOffset = Quat.fromPitchYawRollDegrees(0, -90, 0);
var audioOptions = {

View file

@ -6,9 +6,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
STICK_URL = VIRCADIA_PUBLIC_CDN + "models/props/geo_stick.fbx";
STICK_URL = ExternalResource.getUrl(ExternalResource.Assets, "models/props/geo_stick.fbx");
ZERO_VECTOR = { x: 0, y: 0, z: 0 };

View file

@ -22,8 +22,8 @@ KBD_UPPERCASE_HOVER = 2;
KBD_LOWERCASE_HOVER = 3;
KBD_BACKGROUND = 4;
KEYBOARD_URL = VIRCADIA_PUBLIC_CDN + "images/keyboard.svg";
CURSOR_URL = VIRCADIA_PUBLIC_CDN + "images/cursor.svg";
KEYBOARD_URL = ExternalResource.getUrl(ExternalResource.Assets, "images/keyboard.svg");
CURSOR_URL = ExternalResource.getUrl(ExternalResource.Assets, "images/cursor.svg");
RETURN_CHARCODE = 0x01000004;
ENTER_CHARCODE = 0x01000005;

View file

@ -11,8 +11,6 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
LineRider = function() {
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
var screenSize = Controller.getViewportDimensions();
var BUTTON_SIZE = 32;
@ -35,7 +33,7 @@ var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
y: screenSize.y - (BUTTON_SIZE + PADDING),
width: BUTTON_SIZE,
height: BUTTON_SIZE,
imageURL: VIRCADIA_PUBLIC_CDN + "images/coaster.png?v2",
imageURL: ExternalResource.getUrl(ExternalResource.Assets, "images/coaster.png?v2"),
color: this.buttonOffColor,
alpha: 1
});

View file

@ -9,9 +9,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
var panelWall = false;
var orbShell = false;
var descriptionText = false;
@ -46,16 +43,16 @@ var panelsCenterShift = Vec3.subtract(panelsCenter, orbCenter);
var ORB_SHIFT = { x: 0, y: -1.4, z: -0.8};
var LOBBY_PANEL_WALL_URL = VIRCADIA_PUBLIC_CDN + "models/sets/Lobby/PanelWallForInterface.fbx";
var LOBBY_BLANK_PANEL_TEXTURE_URL = VIRCADIA_PUBLIC_CDN + "models/sets/Lobby/Texture.jpg";
var LOBBY_SHELL_URL = VIRCADIA_PUBLIC_CDN + "models/sets/Lobby/LobbyShellForInterface.fbx";
var LOBBY_PANEL_WALL_URL = ExternalResource.getUrl(ExternalResource.Assets, "models/sets/Lobby/PanelWallForInterface.fbx");
var LOBBY_BLANK_PANEL_TEXTURE_URL = ExternalResource.getUrl(ExternalResource.Assets, "models/sets/Lobby/Texture.jpg");
var LOBBY_SHELL_URL = ExternalResource.getUrl(ExternalResource.Assets, "models/sets/Lobby/LobbyShellForInterface.fbx");
var droneSound = SoundCache.getSound(VIRCADIA_PUBLIC_CDN + "sounds/Lobby/drone.stereo.raw")
var droneSound = SoundCache.getSound(ExternalResource.getUrl(ExternalResource.Assets, "sounds/Lobby/drone.stereo.raw"));
var currentDrone = null;
var latinSound = SoundCache.getSound(VIRCADIA_PUBLIC_CDN + "sounds/Lobby/latin.stereo.raw")
var latinSound = SoundCache.getSound(ExternalResource.getUrl(ExternalResource.Assets, "sounds/Lobby/latin.stereo.raw"));
var latinInjector = null;
var elevatorSound = SoundCache.getSound(VIRCADIA_PUBLIC_CDN + "sounds/Lobby/elevator.stereo.raw")
var elevatorSound = SoundCache.getSound(ExternalResource.getUrl(ExternalResource.Assets, "sounds/Lobby/elevator.stereo.raw"));
var elevatorInjector = null;
var currentMuzakInjector = null;
var currentSound = null;

View file

@ -29,9 +29,6 @@ var buttonOnColor = {
blue: 100
};
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
var userCanPoint = false;
Script.include(["libraries/toolBars.js"]);
var toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.pointer.toolbar", function (screenSize) {
@ -40,14 +37,12 @@ var toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.pointer.toolba
var pointerButton = toolBar.addOverlay("image", {
width: BUTTON_SIZE,
height: BUTTON_SIZE,
imageURL: VIRCADIA_PUBLIC_CDN + "images/laser.png",
imageURL: ExternalResource.getUrl(ExternalResource.Assets, "images/laser.png"),
color: buttonOffColor,
alpha: 1
});
function nearLinePoint(targetPosition) {
var handPosition = MyAvatar.getRightPalmPosition();
var along = Vec3.subtract(targetPosition, handPosition);

View file

@ -9,10 +9,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* globals VIRCADIA_PUBLIC_CDN:true, Tool, ToolBar */
/* globals Tool, ToolBar */
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
Script.include("/~/system/libraries/toolBars.js");
var recordingFile = "recording.hfr";
@ -26,7 +24,7 @@ function setDefaultPlayerOptions() {
}
var windowDimensions = Controller.getViewportDimensions();
var TOOL_ICON_URL = VIRCADIA_PUBLIC_CDN + "images/tools/";
var TOOL_ICON_URL = ExternalResource.getUrl(ExternalResource.Assets, + "images/tools/");
var ALPHA_ON = 1.0;
var ALPHA_OFF = 0.7;
var COLOR_ON = { red: 128, green: 0, blue: 0 };

View file

@ -11,10 +11,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
var sound = SoundCache.getSound(VIRCADIA_PUBLIC_CDN + "sounds/220Sine.wav");
var sound = SoundCache.getSound(ExternalResource.getUrl(ExternalResource.Assets, "sounds/220Sine.wav"));
var soundPlaying = false;

View file

@ -9,9 +9,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
Script.include("../../libraries/globals.js");
var testAnimation = VIRCADIA_PUBLIC_CDN + "ozan/animations/forStephen/sniperJump.fbx";
var testAnimation = ExternalResource.getUrl(ExternalResource.Assets, "ozan/animations/forStephen/sniperJump.fbx");
var FRAME_RATE = 24.0; // frames per second
var isAnimating = false;

View file

@ -11,14 +11,12 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
// A few sample files you may want to try:
var sound = SoundCache.getSound(VIRCADIA_PUBLIC_CDN + "sounds/Guitars/Guitar+-+Nylon+A.raw");
//var sound = SoundCache.getSound(VIRCADIA_PUBLIC_CDN + "sounds/220Sine.wav");
//var sound = SoundCache.getSound(VIRCADIA_PUBLIC_CDN + "sounds/Cocktail+Party+Snippets/Bandcamp.wav");
var sound = SoundCache.getSound(ExternalResource.getUrl(ExternalResource.Assets, "sounds/Guitars/Guitar+-+Nylon+A.raw"));
//var sound = SoundCache.getSound(ExternalResource.getUrl(ExternalResource.Assets, "sounds/220Sine.wav"));
//var sound = SoundCache.getSound(ExternalResource.getUrl(ExternalResource.Assets, "sounds/Cocktail+Party+Snippets/Bandcamp.wav"));
var soundPlaying = false;
var options = {

View file

@ -9,10 +9,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
var soundClip = SoundCache.getSound(VIRCADIA_PUBLIC_CDN + "sounds/Cocktail%20Party%20Snippets/Walken1.wav");
var soundClip = SoundCache.getSound(ExternalResource.getUrl(ExternalResource.Assets, "sounds/Cocktail%20Party%20Snippets/Walken1.wav"));
function playSound() {
Audio.playSound(soundClip, {

View file

@ -10,9 +10,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
var networkingConstants = Script.require("/~/system/libraries/networkingConstants.js");
var VIRCADIA_PUBLIC_CDN = networkingConstants.PUBLIC_BUCKET_CDN_URL;
var SLIDER_RANGE_INCREMENT_SCALE = 1 / 1000;
var THUMB_COLOR = {
red: 150,
@ -785,7 +782,7 @@ var CHECK_MARK_COLOR = {
green: 255,
blue: 255
},
imageURL: VIRCADIA_PUBLIC_CDN + 'images/tools/expand-ui.svg',
imageURL: ExternalResource.getUrl(ExternalResource.Assets, 'images/tools/expand-ui.svg'),
x: x,
y: y,
width: rawHeight,
@ -1148,13 +1145,13 @@ var CHECK_MARK_COLOR = {
if (!item.isCollapsed && item.isCollapsable && clickedOverlay == item.thumb) {
Overlays.editOverlay(item.thumb, {
imageURL: VIRCADIA_PUBLIC_CDN + 'images/tools/expand-right.svg'
imageURL: ExternalResource.getUrl(ExternalResource.Assets, 'images/tools/expand-right.svg')
});
this.collapse(clickedOverlay);
item.isCollapsed = true;
} else if (item.isCollapsed && item.isCollapsable && clickedOverlay == item.thumb) {
Overlays.editOverlay(item.thumb, {
imageURL: VIRCADIA_PUBLIC_CDN + 'images/tools/expand-ui.svg'
imageURL: ExternalResource.getUrl(ExternalResource.Assets, 'images/tools/expand-ui.svg')
});
this.expand(clickedOverlay);
item.isCollapsed = false;

View file

@ -14,8 +14,7 @@
//
// animations, reach poses, reach pose parameters, transitions, transition parameters, sounds, image/s and reference files
const VIRCADIA_PUBLIC_CDN = "https://hifi-public.s3.amazonaws.com/";
var pathToAssets = VIRCADIA_PUBLIC_CDN + "procedural-animator/assets/";
var pathToAssets = ExternalResource.getUrl(ExternalResource.Assets, "procedural-animator/assets/");
Script.include([
"./libraries/walkConstants.js",