Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
RaananW committed Jul 27, 2021
1 parent 7da1f39 commit 812b33d
Show file tree
Hide file tree
Showing 413 changed files with 3,745 additions and 3,918 deletions.
2 changes: 1 addition & 1 deletion Playground/src/custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ declare module "*.svg" {
export default content;
}

declare module "monaco-editor/esm/vs/language/typescript/languageFeatures" {
declare module "monaco-editor/esm/vs/language/typescript/languageFeatures" {
const SuggestAdapter: any;
export type SuggestAdapter = any;
}
2 changes: 1 addition & 1 deletion Playground/src/globalState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class GlobalState {
public onThemeChangedObservable = new Observable<void>();
public onFontSizeChangedObservable = new Observable<void>();
public onLanguageChangedObservable = new Observable<void>();
public onNavigateRequiredObservable = new Observable<{lineNumber: number, column: number}>();
public onNavigateRequiredObservable = new Observable<{ lineNumber: number, column: number }>();
public onExamplesDisplayChangedObservable = new Observable<void>();
public onQRCodeRequiredObservable = new Observable<boolean>();
public OnNewDropdownButtonClicked = new Observable<any>();
Expand Down
2 changes: 1 addition & 1 deletion Playground/src/tools/downloadManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class DownloadManager {
xhr.responseType = "arraybuffer";
}

xhr.onreadystatechange = function() {
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var text;
Expand Down
2 changes: 1 addition & 1 deletion Playground/src/tools/loadManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class LoadManager {
let prevHash = location.hash;
location.hash = id;

if(location.hash === prevHash){
if (location.hash === prevHash) {
this._loadPlayground(id);
}
});
Expand Down
14 changes: 7 additions & 7 deletions Playground/src/tools/saveManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class SaveManager {
});
}

private _saveSnippet() {
private _saveSnippet() {
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = () => {
if (xmlHttp.readyState === 4) {
Expand Down Expand Up @@ -47,13 +47,13 @@ export class SaveManager {
if (snippet.version && snippet.version !== "0") {
newUrl += "#" + snippet.version;
}
location.href = newUrl;
this.globalState.onRunRequiredObservable.notifyObservers();
location.href = newUrl;
this.globalState.onRunRequiredObservable.notifyObservers();
}
this.globalState.onSavedObservable.notifyObservers();

this.globalState.onSavedObservable.notifyObservers();
} else {
this.globalState.onErrorObservable.notifyObservers({message: "Unable to save your code. It may be too long."});
this.globalState.onErrorObservable.notifyObservers({ message: "Unable to save your code. It may be too long." });
}
}
};
Expand All @@ -70,6 +70,6 @@ export class SaveManager {
tags: this.globalState.currentSnippetTags
};

xmlHttp.send(JSON.stringify(dataToSend));
xmlHttp.send(JSON.stringify(dataToSend));
}
}
4 changes: 2 additions & 2 deletions Playground/src/tools/shortcutManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Utilities } from './utilities';

export class ShortcutManager {

public constructor(public globalState: GlobalState) {
public constructor(public globalState: GlobalState) {
this._register();
}

Expand All @@ -15,7 +15,7 @@ export class ShortcutManager {
this.globalState.onRunRequiredObservable.notifyObservers();
return;
}

// Ctrl+Shift+S to Download Zip
if (
(window.navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey) &&
Expand Down
6 changes: 3 additions & 3 deletions Playground/src/tools/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ export class Utilities {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.setAttribute('type', 'text/javascript');

script.innerHTML = `try {${code};}
catch(e) {
handleException(e);
}`;

head.appendChild(script);
}

Expand Down Expand Up @@ -57,7 +57,7 @@ export class Utilities {
return true;
};

public static SwitchLanguage(language: string, globalState: GlobalState, force?: boolean) {
public static SwitchLanguage(language: string, globalState: GlobalState, force?: boolean) {
if (force || window.confirm("Are you sure you want to switch the language (You will lose your current project if it was not saved before)?")) {
Utilities.StoreStringToStore("language", language);
globalState.language = language;
Expand Down
204 changes: 102 additions & 102 deletions Playground/templates.json
Original file line number Diff line number Diff line change
@@ -1,104 +1,104 @@
[
{
"label" : "Create a sphere",
"documentation" : "https://doc.babylonjs.com/how_to/set_shapes",
"insertText" : "var sphere = BABYLON.MeshBuilder.CreateSphere(\"${1:sphere}\", {diameter: ${2:1}}, scene);"
},
{
"label" : "Create a box",
"documentation" : "https://doc.babylonjs.com/how_to/set_shapes",
"insertText" : "var box = BABYLON.MeshBuilder.CreateBox(\"${1:box}\", {size: ${2:1}}, scene);"
},
{
"label" : "Load CPU Particle System from Snippet Server",
"documentation" : "https://doc.babylonjs.com/babylon101/particles#snippet-server",
"insertText" : "BABYLON.ParticleHelper.CreateFromSnippetAsync(\"${1:your_snippet_url_no_#}\", scene, false).then(system => {\n\n});"
},
{
"label" : "Load GPU Particle System from Snippet Server",
"documentation" : "https://doc.babylonjs.com/babylon101/particles#snippet-server",
"insertText" : "BABYLON.ParticleHelper.CreateFromSnippetAsync(\"${1:your_snippet_url_no_#}\", scene, true).then(system => {\n\n});"
},
{
"label" : "Create a cylinder",
"documentation" : "https://doc.babylonjs.com/how_to/set_shapes",
"insertText" : "var cylinder = BABYLON.MeshBuilder.CreateCylinder(\"${1:cylinder}\", {height: ${2:2}, diameter: ${3:1}}, scene);"
},
{
"label" : "Create a ground plane",
"documentation" : "https://doc.babylonjs.com/how_to/set_shapes",
"insertText" : "var ground = BABYLON.MeshBuilder.CreateGround(\"${1:ground}\", {width: ${2:6}, height: ${3:6}}, scene);"
},
{
"label" : "Create a point light",
"documentation" : "https://doc.babylonjs.com/babylon101/lights#the-point-light",
"insertText" : "var pointLight = new BABYLON.PointLight(\"${1:pointLight}\", new BABYLON.Vector3(${2:0},${3:5},${4:0}), scene);"
},
{
"label" : "Create a directional light",
"documentation" : "https://doc.babylonjs.com/babylon101/lights#the-directional-light",
"insertText" : "var dirLight = new BABYLON.DirectionalLight(\"${1:dirLight}\", new BABYLON.Vector3(${2:0.25},${3:-1},${4:-0.25}), scene);"
},
{
"label" : "Create a spot light",
"documentation" : "https://doc.babylonjs.com/babylon101/lights#the-spot-light",
"insertText" : "var spotLight = new BABYLON.SpotLight(\"${1:spotLight}\", new BABYLON.Vector3(${2:0}, ${3:30}, ${4:-10}), new BABYLON.Vector3(${5:0}, ${6:-1}, ${7:0}), ${8:Math.PI / 3}, ${9:2}, scene);"
},
{
"label" : "Create a hemispheric light",
"documentation" : "https://doc.babylonjs.com/babylon101/lights#the-hemispheric-light",
"insertText" : "var hemiLight = new BABYLON.HemisphericLight(\"${1:hemiLight}\", new BABYLON.Vector3(${2:0}, ${3:1}, ${4:0}), scene);"
},
{
"label" : "Load a Node Material from snippet w/callback",
"documentation" : "https://doc.babylonjs.com/how_to/node_material#loading-from-a-file-saved-from-the-node-material-editor",
"insertText" : "BABYLON.NodeMaterial.ParseFromSnippetAsync(\"${1:your_snippet_url_no_#}\", scene).then(nodeMaterial => {\n ${2:mesh_to_apply_node_material_to}.material = nodeMaterial;\n});"
},
{
"label" : "Load a fullscreen GUI from the snippet server",
"documentation" : "Coming Soon",
"insertText" : "let advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI(\"${1:name}\", true, scene);\nlet loadedGUI = advancedTexture.parseFromSnippetAsync(\"${2:your_snippet_url_no_#}\");"
},
{
"label" : "Show the Inspector",
"documentation" : "https://doc.babylonjs.com/features/playground_debuglayer",
"insertText" : "scene.debugLayer.show({\n embedMode:true\n});"
},
{
"label" : "Create an Arc Rotate Camera w/Degrees",
"documentation" : "https://doc.babylonjs.com/babylon101/cameras#arc-rotate-camera",
"insertText" : "var camera = new BABYLON.ArcRotateCamera(\"${1:camera}\", BABYLON.Tools.ToRadians(${2:90}), BABYLON.Tools.ToRadians(${3:65}), ${4:10}, ${5:BABYLON.Vector3.Zero()}, scene);"
},
{
"label" : "Create an Arc Rotate Camera w/Radians",
"documentation" : "https://doc.babylonjs.com/babylon101/cameras#arc-rotate-camera",
"insertText" : "var camera = new BABYLON.ArcRotateCamera(\"${1:camera}\", ${2:0}, ${3:Math.PI/2}, ${4:10}, ${5:BABYLON.Vector3.Zero()}, scene);"
},
{
"label": "Create a WebXR Camera",
"documentation": "https://doc.babylonjs.com/divingDeeper/webXR/introToWebXR",
"insertText": "scene.createDefaultXRExperienceAsync({}).then((defaultXRExperience) => {\n ${1}\n});"
},
{
"label" : "Import a Mesh w/callback",
"documentation" : "https://doc.babylonjs.com/resources/external_pg_assets",
"insertText" : "BABYLON.SceneLoader.ImportMesh(\"${1:meshName}\", \"${2:url to the mesh parent directory}\", \"${3:Mesh filename.fileextension}\", scene, function(newMeshes){\n\n});"
},
{
"label" : "Setup a shadow generator",
"documentation" : "https://doc.babylonjs.com/babylon101/shadows",
"insertText" : "var shadowGenerator = new BABYLON.ShadowGenerator(${1:size}, ${2:the_light_source});\nshadowGenerator.getShadowMap().renderList.push(${3:the_mesh_that_casts_a_shadow});\n${4:mesh_that_receives_the_shadow}.receiveShadows = true;"
},
{
"label" : "Export scene to GLB",
"documentation" : "https://doc.babylonjs.com/extensions/gltfexporter#exporting-a-scene-to-gltf",
"insertText" : "BABYLON.GLTF2Export.GLBAsync(scene, \"${1:fileName}\").then((glb) => {\n glb.downloadFiles();\n});",
"language" : "javascript"
},
{
"label" : "Export scene to GLTF",
"documentation" : "https://doc.babylonjs.com/extensions/gltfexporter#exporting-a-scene-to-gltf",
"insertText" : "BABYLON.GLTF2Export.GLTFAsync(scene, \"${1:fileName}\").then((gltf) => {\n gltf.downloadFiles();\n});",
"language" : "javascript"
}
{
"label": "Create a sphere",
"documentation": "https://doc.babylonjs.com/how_to/set_shapes",
"insertText": "var sphere = BABYLON.MeshBuilder.CreateSphere(\"${1:sphere}\", {diameter: ${2:1}}, scene);"
},
{
"label": "Create a box",
"documentation": "https://doc.babylonjs.com/how_to/set_shapes",
"insertText": "var box = BABYLON.MeshBuilder.CreateBox(\"${1:box}\", {size: ${2:1}}, scene);"
},
{
"label": "Load CPU Particle System from Snippet Server",
"documentation": "https://doc.babylonjs.com/babylon101/particles#snippet-server",
"insertText": "BABYLON.ParticleHelper.CreateFromSnippetAsync(\"${1:your_snippet_url_no_#}\", scene, false).then(system => {\n\n});"
},
{
"label": "Load GPU Particle System from Snippet Server",
"documentation": "https://doc.babylonjs.com/babylon101/particles#snippet-server",
"insertText": "BABYLON.ParticleHelper.CreateFromSnippetAsync(\"${1:your_snippet_url_no_#}\", scene, true).then(system => {\n\n});"
},
{
"label": "Create a cylinder",
"documentation": "https://doc.babylonjs.com/how_to/set_shapes",
"insertText": "var cylinder = BABYLON.MeshBuilder.CreateCylinder(\"${1:cylinder}\", {height: ${2:2}, diameter: ${3:1}}, scene);"
},
{
"label": "Create a ground plane",
"documentation": "https://doc.babylonjs.com/how_to/set_shapes",
"insertText": "var ground = BABYLON.MeshBuilder.CreateGround(\"${1:ground}\", {width: ${2:6}, height: ${3:6}}, scene);"
},
{
"label": "Create a point light",
"documentation": "https://doc.babylonjs.com/babylon101/lights#the-point-light",
"insertText": "var pointLight = new BABYLON.PointLight(\"${1:pointLight}\", new BABYLON.Vector3(${2:0},${3:5},${4:0}), scene);"
},
{
"label": "Create a directional light",
"documentation": "https://doc.babylonjs.com/babylon101/lights#the-directional-light",
"insertText": "var dirLight = new BABYLON.DirectionalLight(\"${1:dirLight}\", new BABYLON.Vector3(${2:0.25},${3:-1},${4:-0.25}), scene);"
},
{
"label": "Create a spot light",
"documentation": "https://doc.babylonjs.com/babylon101/lights#the-spot-light",
"insertText": "var spotLight = new BABYLON.SpotLight(\"${1:spotLight}\", new BABYLON.Vector3(${2:0}, ${3:30}, ${4:-10}), new BABYLON.Vector3(${5:0}, ${6:-1}, ${7:0}), ${8:Math.PI / 3}, ${9:2}, scene);"
},
{
"label": "Create a hemispheric light",
"documentation": "https://doc.babylonjs.com/babylon101/lights#the-hemispheric-light",
"insertText": "var hemiLight = new BABYLON.HemisphericLight(\"${1:hemiLight}\", new BABYLON.Vector3(${2:0}, ${3:1}, ${4:0}), scene);"
},
{
"label": "Load a Node Material from snippet w/callback",
"documentation": "https://doc.babylonjs.com/how_to/node_material#loading-from-a-file-saved-from-the-node-material-editor",
"insertText": "BABYLON.NodeMaterial.ParseFromSnippetAsync(\"${1:your_snippet_url_no_#}\", scene).then(nodeMaterial => {\n ${2:mesh_to_apply_node_material_to}.material = nodeMaterial;\n});"
},
{
"label": "Load a fullscreen GUI from the snippet server",
"documentation": "Coming Soon",
"insertText": "let advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI(\"${1:name}\", true, scene);\nlet loadedGUI = advancedTexture.parseFromSnippetAsync(\"${2:your_snippet_url_no_#}\");"
},
{
"label": "Show the Inspector",
"documentation": "https://doc.babylonjs.com/features/playground_debuglayer",
"insertText": "scene.debugLayer.show({\n embedMode:true\n});"
},
{
"label": "Create an Arc Rotate Camera w/Degrees",
"documentation": "https://doc.babylonjs.com/babylon101/cameras#arc-rotate-camera",
"insertText": "var camera = new BABYLON.ArcRotateCamera(\"${1:camera}\", BABYLON.Tools.ToRadians(${2:90}), BABYLON.Tools.ToRadians(${3:65}), ${4:10}, ${5:BABYLON.Vector3.Zero()}, scene);"
},
{
"label": "Create an Arc Rotate Camera w/Radians",
"documentation": "https://doc.babylonjs.com/babylon101/cameras#arc-rotate-camera",
"insertText": "var camera = new BABYLON.ArcRotateCamera(\"${1:camera}\", ${2:0}, ${3:Math.PI/2}, ${4:10}, ${5:BABYLON.Vector3.Zero()}, scene);"
},
{
"label": "Create a WebXR Camera",
"documentation": "https://doc.babylonjs.com/divingDeeper/webXR/introToWebXR",
"insertText": "scene.createDefaultXRExperienceAsync({}).then((defaultXRExperience) => {\n ${1}\n});"
},
{
"label": "Import a Mesh w/callback",
"documentation": "https://doc.babylonjs.com/resources/external_pg_assets",
"insertText": "BABYLON.SceneLoader.ImportMesh(\"${1:meshName}\", \"${2:url to the mesh parent directory}\", \"${3:Mesh filename.fileextension}\", scene, function(newMeshes){\n\n});"
},
{
"label": "Setup a shadow generator",
"documentation": "https://doc.babylonjs.com/babylon101/shadows",
"insertText": "var shadowGenerator = new BABYLON.ShadowGenerator(${1:size}, ${2:the_light_source});\nshadowGenerator.getShadowMap().renderList.push(${3:the_mesh_that_casts_a_shadow});\n${4:mesh_that_receives_the_shadow}.receiveShadows = true;"
},
{
"label": "Export scene to GLB",
"documentation": "https://doc.babylonjs.com/extensions/gltfexporter#exporting-a-scene-to-gltf",
"insertText": "BABYLON.GLTF2Export.GLBAsync(scene, \"${1:fileName}\").then((glb) => {\n glb.downloadFiles();\n});",
"language": "javascript"
},
{
"label": "Export scene to GLTF",
"documentation": "https://doc.babylonjs.com/extensions/gltfexporter#exporting-a-scene-to-gltf",
"insertText": "BABYLON.GLTF2Export.GLTFAsync(scene, \"${1:fileName}\").then((gltf) => {\n gltf.downloadFiles();\n});",
"language": "javascript"
}
]
26 changes: 7 additions & 19 deletions Playground/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,12 @@
"baseUrl": "./src/",
"rootDir": "./src/",
"paths": {
"babylonjs-gui/*": [
"../../dist/preview release/gui/babylon.gui.module.d.ts"
],
"babylonjs-gltf2interface": [
"../../dist/preview release/glTF2Interface/babylon.glTF2Interface.d.ts"
],
"babylonjs-loaders/*": [
"../../dist/preview release/loaders/babylonjs.loaders.module.d.ts"
],
"babylonjs-materials/*": [
"../../dist/preview release/materialsLibrary/babylonjs.materials.module.d.ts"
],
"babylonjs-serializers/*": [
"../../dist/preview release/serializers/babylonjs.serializers.module.d.ts"
],
"babylonjs/*": [
"../../dist/preview release/babylon.module.d.ts"
]
"babylonjs-gui/*": ["../../dist/preview release/gui/babylon.gui.module.d.ts"],
"babylonjs-gltf2interface": ["../../dist/preview release/glTF2Interface/babylon.glTF2Interface.d.ts"],
"babylonjs-loaders/*": ["../../dist/preview release/loaders/babylonjs.loaders.module.d.ts"],
"babylonjs-materials/*": ["../../dist/preview release/materialsLibrary/babylonjs.materials.module.d.ts"],
"babylonjs-serializers/*": ["../../dist/preview release/serializers/babylonjs.serializers.module.d.ts"],
"babylonjs/*": ["../../dist/preview release/babylon.module.d.ts"]
}
}
}
}
2 changes: 1 addition & 1 deletion Viewer/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
"engines": {
"node": "*"
}
}
}
2 changes: 1 addition & 1 deletion Viewer/dist/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"scene": {
"debug": false
}
}
}
2 changes: 1 addition & 1 deletion Viewer/dist/external/msft/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion Viewer/src/configuration/interfaces/groundConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface IGroundConfiguration {
size?: number;
receiveShadows?: boolean;
shadowLevel?: number;
/** @deprecated */ shadowOnly?: boolean;
/** @deprecated */ shadowOnly?: boolean;
mirror?: boolean | {
sizeRatio?: number;
blurKernel?: number;
Expand Down
2 changes: 1 addition & 1 deletion Viewer/src/configuration/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { RenderOnlyConfigurationLoader } from "./renderOnlyLoader";
import { getConfigurationType } from "./types";

export class ConfigurationLoader extends RenderOnlyConfigurationLoader {
protected getExtendedConfig(type:string|undefined){
protected getExtendedConfig(type: string | undefined) {
return getConfigurationType(type || "extended");
}
}
Loading

0 comments on commit 812b33d

Please sign in to comment.