From d8069b6dbff90a205974fbacb5bfe8ec449ba082 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Mon, 1 Feb 2016 11:28:51 -0800 Subject: [PATCH] Whitespace and jslinting. --- examples/entityScripts/simpleKeepAway.js | 4 +- .../tests/performance/renderableMatrix.js | 60 +++++++++---------- examples/tests/performance/simpleKeepAway.js | 32 +++++----- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/examples/entityScripts/simpleKeepAway.js b/examples/entityScripts/simpleKeepAway.js index 8550477dbb..87beaa8794 100644 --- a/examples/entityScripts/simpleKeepAway.js +++ b/examples/entityScripts/simpleKeepAway.js @@ -14,7 +14,7 @@ var vector = Vec3.subtract(ball, me); if (Vec3.length(vector) < distanceAllowance) { - Entities.editEntity(entityID, {velocity: Vec3.multiply(distanceScale, Vec3.normalize(vector))}); + Entities.editEntity(entityID, {velocity: Vec3.multiply(distanceScale, Vec3.normalize(vector))}); } } @@ -25,7 +25,7 @@ if (userData) { distanceRate = userData.distanceRate || distanceRate; distanceAllowance = userData.distanceAllowance || distanceAllowance; - distanceScale = userData.distanceScale || distanceScale; + distanceScale = userData.distanceScale || distanceScale; } // run all the time by everyone: diff --git a/examples/tests/performance/renderableMatrix.js b/examples/tests/performance/renderableMatrix.js index f5eb33554a..bde420129d 100644 --- a/examples/tests/performance/renderableMatrix.js +++ b/examples/tests/performance/renderableMatrix.js @@ -19,37 +19,37 @@ var ROWS_X = 17; var ROWS_Y = 10; var ROWS_Z = 10; // Entities will be populated from this list set by the script writer for different tests. -var TYPES_TO_USE = [ 'Box', 'Sphere']; +var TYPES_TO_USE = ['Box', 'Sphere']; switch ('primitives') { // Quickly override the above by putting here one of the following case strings. -case 'particles': - TYPES_TO_USE = ['ParticleEffect']; - ROWS_X = ROWS_Z = 6; - break; -case 'lights': - TYPES_TO_USE = ['Light']; - ROWS_X = ROWS_Y = ROWS_Z = 5; - break; -case 'blocks': // 376 triangles/entity - TYPES_TO_USE = ["http://s3.amazonaws.com/hifi-public/marketplace/hificontent/Games/blocks/block.fbx"]; - ROWS_X = ROWS_Y = ROWS_Z = 10; - break; -case 'ramp': // 1,002 triangles/entity - TYPES_TO_USE = ["http://headache.hungry.com/~seth/hifi/curved-ramp.obj"]; - ROWS_X = ROWS_Y = 10; - ROWS_Z = 9; - break; -case 'trees': // 12k triangles/entity - TYPES_TO_USE = ["https://hifi-content.s3.amazonaws.com/ozan/dev/sets/lowpoly_island/CypressTreeGroup.fbx"]; - ROWS_X = ROWS_Z = 6; - ROWS_Y = 1; - break; -case 'web': - TYPES_TO_USE = ['Web']; - ROWS_X = ROWS_Z = 5; - ROWS_Y = 3; - break; -default: - // Just using values from above. + case 'particles': + TYPES_TO_USE = ['ParticleEffect']; + ROWS_X = ROWS_Z = 6; + break; + case 'lights': + TYPES_TO_USE = ['Light']; + ROWS_X = ROWS_Y = ROWS_Z = 5; + break; + case 'blocks': // 376 triangles/entity + TYPES_TO_USE = ["http://s3.amazonaws.com/hifi-public/marketplace/hificontent/Games/blocks/block.fbx"]; + ROWS_X = ROWS_Y = ROWS_Z = 10; + break; + case 'ramp': // 1,002 triangles/entity + TYPES_TO_USE = ["http://headache.hungry.com/~seth/hifi/curved-ramp.obj"]; + ROWS_X = ROWS_Y = 10; + ROWS_Z = 9; + break; + case 'trees': // 12k triangles/entity + TYPES_TO_USE = ["https://hifi-content.s3.amazonaws.com/ozan/dev/sets/lowpoly_island/CypressTreeGroup.fbx"]; + ROWS_X = ROWS_Z = 6; + ROWS_Y = 1; + break; + case 'web': + TYPES_TO_USE = ['Web']; + ROWS_X = ROWS_Z = 5; + ROWS_Y = 3; + break; + default: + // Just using values from above. } // Matrix will be axis-aligned, approximately all in this field of view. // As special case, if zero, grid is centered above your head. diff --git a/examples/tests/performance/simpleKeepAway.js b/examples/tests/performance/simpleKeepAway.js index d9b43ffbbd..05c0dd8159 100644 --- a/examples/tests/performance/simpleKeepAway.js +++ b/examples/tests/performance/simpleKeepAway.js @@ -17,7 +17,7 @@ var Vec3, Quat, MyAvatar, Entities, Camera, Script, print; // a moment -- that's why they are in a sparse grid. var USE_FLAT_FLOOR = true; // Give 'em a flat place to settle on. -var ROWS_X = 30; +var ROWS_X = 30; var ROWS_Z = 30; var SEPARATION = 1; // meters var LIFETIME = 60; // seconds @@ -61,13 +61,13 @@ var parameters = JSON.stringify({ var startTime = new Date(); if (USE_FLAT_FLOOR) { Entities.addEntity({ - type: 'Box', - name: 'keepAwayFloor', - lifetime: LIFETIME, - collisionsWillMove: false, - color: {red: 255, green: 0, blue: 0}, - position: Vec3.sum(origin, {x: xDim / 2, y: -1 - HOW_FAR_UP, z: zDim / 2}), - dimensions: {x: xDim + SEPARATION, y: 0.2, z: zDim + SEPARATION} + type: 'Box', + name: 'keepAwayFloor', + lifetime: LIFETIME, + collisionsWillMove: false, + color: {red: 255, green: 0, blue: 0}, + position: Vec3.sum(origin, {x: xDim / 2, y: -1 - HOW_FAR_UP, z: zDim / 2}), + dimensions: {x: xDim + SEPARATION, y: 0.2, z: zDim + SEPARATION} }); } Script.setInterval(function () { @@ -75,17 +75,17 @@ Script.setInterval(function () { return; } - var i, numToCreate = Math.min(RATE_PER_SECOND * (SCRIPT_INTERVAL / 1000.0), totalToCreate - totalCreated); + var i, properties, numToCreate = Math.min(RATE_PER_SECOND * (SCRIPT_INTERVAL / 1000.0), totalToCreate - totalCreated); for (i = 0; i < numToCreate; i++) { properties = { userData: parameters, type: TYPE, name: "keepAway-" + totalCreated, - position: { - x: origin.x + SIZE + (x * SEPARATION), - y: origin.y, - z: origin.z + SIZE + (z * SEPARATION) - }, + position: { + x: origin.x + SIZE + (x * SEPARATION), + y: origin.y, + z: origin.z + SIZE + (z * SEPARATION) + }, dimensions: {x: SIZE, y: SIZE, z: SIZE}, color: {red: Math.random() * 255, green: Math.random() * 255, blue: Math.random() * 255}, velocity: VELOCITY, @@ -94,7 +94,7 @@ Script.setInterval(function () { gravity: GRAVITY, collisionsWillMove: true, lifetime: LIFETIME, - script: Script.resolvePath("../../entityScripts/simpleKeepAway.js") + script: Script.resolvePath("../../entityScripts/simpleKeepAway.js") }; Entities.addEntity(properties); totalCreated++; @@ -102,7 +102,7 @@ Script.setInterval(function () { x++; if (x === ROWS_X) { x = 0; - z++; + z++; print("Created: " + totalCreated); } if (z === ROWS_Z) {