Browse Source

Formatting

Gary Hsu 7 years ago
parent
commit
6a431aa8ab
2 changed files with 76 additions and 71 deletions
  1. 41 41
      src/babylon.assetContainer.ts
  2. 35 30
      src/babylon.scene.ts

+ 41 - 41
src/babylon.assetContainer.ts

@@ -22,7 +22,7 @@ module BABYLON {
         /**
          * ParticleSystems to keep.
          */
-        public particleSystems = new Array<ParticleSystem>();
+        public particleSystems = new Array<IParticleSystem>();
         /**
          * Animations to keep.
          */
@@ -135,115 +135,115 @@ module BABYLON {
          * Sounds populated in the container.
          */
         public sounds = new Array<Sound>();
-        
+
         /**
          * Instantiates an AssetContainer.
          * @param scene The scene the AssetContainer belongs to.
          */
-        constructor(scene:Scene){
+        constructor(scene: Scene) {
             this.scene = scene;
         }
-        
+
         /**
          * Adds all the assets from the container to the scene.
          */
-        public addAllToScene(){
-            this.cameras.forEach((o)=>{
+        public addAllToScene() {
+            this.cameras.forEach((o) => {
                 this.scene.addCamera(o);
             });
-            this.lights.forEach((o)=>{
+            this.lights.forEach((o) => {
                 this.scene.addLight(o);
             });
-            this.meshes.forEach((o)=>{
+            this.meshes.forEach((o) => {
                 this.scene.addMesh(o);
             });
-            this.skeletons.forEach((o)=>{
+            this.skeletons.forEach((o) => {
                 this.scene.addSkeleton(o);
             });
-            this.particleSystems.forEach((o)=>{
+            this.particleSystems.forEach((o) => {
                 this.scene.addParticleSystem(o);
             });
-            this.animations.forEach((o)=>{
+            this.animations.forEach((o) => {
                 this.scene.addAnimation(o);
             });
-            this.multiMaterials.forEach((o)=>{
+            this.multiMaterials.forEach((o) => {
                 this.scene.addMultiMaterial(o);
             });
-            this.materials.forEach((o)=>{
+            this.materials.forEach((o) => {
                 this.scene.addMaterial(o);
             });
-            this.morphTargetManagers.forEach((o)=>{
+            this.morphTargetManagers.forEach((o) => {
                 this.scene.addMorphTargetManager(o);
             });
-            this.geometries.forEach((o)=>{
+            this.geometries.forEach((o) => {
                 this.scene.addGeometry(o);
             });
-            this.transformNodes.forEach((o)=>{
+            this.transformNodes.forEach((o) => {
                 this.scene.addTransformNode(o);
             });
-            this.lensFlareSystems.forEach((o)=>{
+            this.lensFlareSystems.forEach((o) => {
                 this.scene.addLensFlareSystem(o);
             });
-            this.actionManagers.forEach((o)=>{
+            this.actionManagers.forEach((o) => {
                 this.scene.addActionManager(o);
             });
-            this.sounds.forEach((o)=>{
+            this.sounds.forEach((o) => {
                 o.play();
-                o.autoplay=true;
+                o.autoplay = true;
                 this.scene.mainSoundTrack.AddSound(o);
-            })
+            });
         }
 
         /**
          * Removes all the assets in the container from the scene
          */
-        public removeAllFromScene(){
-            this.cameras.forEach((o)=>{
+        public removeAllFromScene() {
+            this.cameras.forEach((o) => {
                 this.scene.removeCamera(o);
             });
-            this.lights.forEach((o)=>{
+            this.lights.forEach((o) => {
                 this.scene.removeLight(o);
             });
-            this.meshes.forEach((o)=>{
+            this.meshes.forEach((o) => {
                 this.scene.removeMesh(o);
             });
-            this.skeletons.forEach((o)=>{
+            this.skeletons.forEach((o) => {
                 this.scene.removeSkeleton(o);
             });
-            this.particleSystems.forEach((o)=>{
+            this.particleSystems.forEach((o) => {
                 this.scene.removeParticleSystem(o);
             });
-            this.animations.forEach((o)=>{
+            this.animations.forEach((o) => {
                 this.scene.removeAnimation(o);
             });
-            this.multiMaterials.forEach((o)=>{
+            this.multiMaterials.forEach((o) => {
                 this.scene.removeMultiMaterial(o);
             });
-            this.materials.forEach((o)=>{
+            this.materials.forEach((o) => {
                 this.scene.removeMaterial(o);
             });
-            this.morphTargetManagers.forEach((o)=>{
+            this.morphTargetManagers.forEach((o) => {
                 this.scene.removeMorphTargetManager(o);
             });
-            this.geometries.forEach((o)=>{
+            this.geometries.forEach((o) => {
                 this.scene.removeGeometry(o);
             });
-            this.transformNodes.forEach((o)=>{
+            this.transformNodes.forEach((o) => {
                 this.scene.removeTransformNode(o);
             });
-            this.lensFlareSystems.forEach((o)=>{
+            this.lensFlareSystems.forEach((o) => {
                 this.scene.removeLensFlareSystem(o);
             });
-            this.actionManagers.forEach((o)=>{
+            this.actionManagers.forEach((o) => {
                 this.scene.removeActionManager(o);
             });
-            this.sounds.forEach((o)=>{
+            this.sounds.forEach((o) => {
                 o.stop();
                 o.autoplay = false;
                 this.scene.mainSoundTrack.RemoveSound(o);
-            })
+            });
         }
-        
+
         private _moveAssets<T>(sourceAssets: T[], targetAssets: T[], keepAssets: T[]): void {
             for (let asset of sourceAssets) {
                 let move = true;
@@ -253,7 +253,7 @@ module BABYLON {
                         break;
                     }
                 }
-    
+
                 if (move) {
                     targetAssets.push(asset);
                 }
@@ -269,7 +269,7 @@ module BABYLON {
             if (keepAssets === undefined) {
                 keepAssets = new KeepAssets();
             }
-    
+
             this._moveAssets(this.scene.cameras, this.cameras, keepAssets.cameras);
             this._moveAssets(this.scene.meshes, this.meshes, keepAssets.meshes);
             this._moveAssets(this.scene.getGeometries(), this.geometries, keepAssets.geometries);
@@ -284,7 +284,7 @@ module BABYLON {
             this._moveAssets(this.scene.particleSystems, this.particleSystems, keepAssets.particleSystems);
             this._moveAssets(this.scene.mainSoundTrack.soundCollection, this.sounds, keepAssets.sounds);
             this._moveAssets(this.scene.transformNodes, this.transformNodes, keepAssets.transformNodes);
-    
+
             this.removeAllFromScene();
         }
     }

+ 35 - 30
src/babylon.scene.ts

@@ -2529,44 +2529,49 @@
                 this.particleSystems.splice(index, 1);
             }
             return index;
-        };
+        }
+
         public removeAnimation(toRemove: Animation): number {
             var index = this.animations.indexOf(toRemove);
             if (index !== -1) {
                 this.animations.splice(index, 1);
             }
             return index;
-        };
+        }
+
         public removeMultiMaterial(toRemove: MultiMaterial): number {
             var index = this.multiMaterials.indexOf(toRemove);
             if (index !== -1) {
                 this.multiMaterials.splice(index, 1);
             }
             return index;
-        };
+        }
+
         public removeMaterial(toRemove: Material): number {
             var index = this.materials.indexOf(toRemove);
             if (index !== -1) {
                 this.materials.splice(index, 1);
             }
             return index;
-        };
-        public removeLensFlareSystem(toRemove: LensFlareSystem) {
+        }
+
+        public removeLensFlareSystem(toRemove: LensFlareSystem): number {
             var index = this.lensFlareSystems.indexOf(toRemove);
             if (index !== -1) {
                 this.lensFlareSystems.splice(index, 1);
             }
             return index;
-        };
-        public removeActionManager(toRemove: ActionManager) {
+        }
+
+        public removeActionManager(toRemove: ActionManager): number {
             var index = this._actionManagers.indexOf(toRemove);
             if (index !== -1) {
                 this._actionManagers.splice(index, 1);
             }
             return index;
-        };
+        }
 
-        public addLight(newLight: Light) {
+        public addLight(newLight: Light): void {
             this.lights.push(newLight);
             this.sortLightsByPriority();
 
@@ -2587,53 +2592,53 @@
             }
         }
 
-        public addCamera(newCamera: Camera) {
+        public addCamera(newCamera: Camera): void {
             this.cameras.push(newCamera);
             this.onNewCameraAddedObservable.notifyObservers(newCamera);
         }
 
-        public addSkeleton(newSkeleton: Skeleton) {
-            this.skeletons.push(newSkeleton)
+        public addSkeleton(newSkeleton: Skeleton): void {
+            this.skeletons.push(newSkeleton);
         }
 
-        public addParticleSystem(newParticleSystem: IParticleSystem) {
-            this.particleSystems.push(newParticleSystem)
+        public addParticleSystem(newParticleSystem: IParticleSystem): void {
+            this.particleSystems.push(newParticleSystem);
         }
 
-        public addAnimation(newAnimation: Animation) {
-            this.animations.push(newAnimation)
+        public addAnimation(newAnimation: Animation): void {
+            this.animations.push(newAnimation);
         }
 
-        public addMultiMaterial(newMultiMaterial: MultiMaterial) {
-            this.multiMaterials.push(newMultiMaterial)
+        public addMultiMaterial(newMultiMaterial: MultiMaterial): void {
+            this.multiMaterials.push(newMultiMaterial);
         }
 
-        public addMaterial(newMaterial: Material) {
-            this.materials.push(newMaterial)
+        public addMaterial(newMaterial: Material): void {
+            this.materials.push(newMaterial);
         }
 
-        public addMorphTargetManager(newMorphTargetManager: MorphTargetManager) {
-            this.morphTargetManagers.push(newMorphTargetManager)
+        public addMorphTargetManager(newMorphTargetManager: MorphTargetManager): void {
+            this.morphTargetManagers.push(newMorphTargetManager);
         }
 
-        public addGeometry(newGeometrie: Geometry) {
-            this._geometries.push(newGeometrie)
+        public addGeometry(newGeometrie: Geometry): void {
+            this._geometries.push(newGeometrie);
         }
 
-        public addLensFlareSystem(newLensFlareSystem: LensFlareSystem) {
-            this.lensFlareSystems.push(newLensFlareSystem)
+        public addLensFlareSystem(newLensFlareSystem: LensFlareSystem): void {
+            this.lensFlareSystems.push(newLensFlareSystem);
         }
 
-        public addActionManager(newActionManager: ActionManager) {
-            this._actionManagers.push(newActionManager)
+        public addActionManager(newActionManager: ActionManager): void {
+            this._actionManagers.push(newActionManager);
         }
 
         /**
          * Switch active camera
          * @param {Camera} newCamera - new active camera
-		 * @param {boolean} attachControl - call attachControl for the new active camera (default: true)
+         * @param {boolean} attachControl - call attachControl for the new active camera (default: true)
          */
-        public switchActiveCamera(newCamera: Camera, attachControl = true) {
+        public switchActiveCamera(newCamera: Camera, attachControl = true): void {
             var canvas = this._engine.getRenderingCanvas();
 
             if (!canvas) {