Browse Source

Review PR Comments

Sebastien Vandenberghe 7 years ago
parent
commit
69a434d025

+ 1 - 0
Tools/Gulp/config.json

@@ -166,6 +166,7 @@
                 "../../src/Rendering/babylon.renderingManager.js",
                 "../../src/Rendering/babylon.renderingManager.js",
                 "../../src/Rendering/babylon.renderingGroup.js",
                 "../../src/Rendering/babylon.renderingGroup.js",
                 "../../src/babylon.sceneComponent.js",
                 "../../src/babylon.sceneComponent.js",
+                "../../src/babylon.abstractScene.js",
                 "../../src/babylon.scene.js",
                 "../../src/babylon.scene.js",
                 "../../src/babylon.assetContainer.js",
                 "../../src/babylon.assetContainer.js",
                 "../../src/Mesh/babylon.buffer.js",
                 "../../src/Mesh/babylon.buffer.js",

+ 2 - 2
src/Layer/babylon.effectLayerSceneComponent.ts

@@ -31,7 +31,7 @@
         addEffectLayer(newEffectLayer: EffectLayer): void;
         addEffectLayer(newEffectLayer: EffectLayer): void;
     }
     }
 
 
-    Scene.prototype.removeEffectLayer = function(toRemove: EffectLayer): number {
+    AbstractScene.prototype.removeEffectLayer = function(toRemove: EffectLayer): number {
         var index = this.effectLayers.indexOf(toRemove);
         var index = this.effectLayers.indexOf(toRemove);
         if (index !== -1) {
         if (index !== -1) {
             this.effectLayers.splice(index, 1);
             this.effectLayers.splice(index, 1);
@@ -40,7 +40,7 @@
         return index;
         return index;
     }
     }
 
 
-    Scene.prototype.addEffectLayer = function(newEffectLayer: EffectLayer): void {
+    AbstractScene.prototype.addEffectLayer = function(newEffectLayer: EffectLayer): void {
         this.effectLayers.push(newEffectLayer);
         this.effectLayers.push(newEffectLayer);
     }
     }
 
 

+ 2 - 2
src/Layer/babylon.glowLayer.ts

@@ -1,6 +1,6 @@
 module BABYLON {
 module BABYLON {
 
 
-    export interface Scene {
+    export interface AbstractScene {
         /**
         /**
          * Return a the first highlight layer of the scene with a given name.
          * Return a the first highlight layer of the scene with a given name.
          * @param name The name of the highlight layer to look for.
          * @param name The name of the highlight layer to look for.
@@ -9,7 +9,7 @@
         getGlowLayerByName(name: string): Nullable<GlowLayer>;
         getGlowLayerByName(name: string): Nullable<GlowLayer>;
     }
     }
 
 
-    Scene.prototype.getGlowLayerByName = function(name: string): Nullable<GlowLayer> {
+    AbstractScene.prototype.getGlowLayerByName = function(name: string): Nullable<GlowLayer> {
         for (var index = 0; index < this.effectLayers.length; index++) {
         for (var index = 0; index < this.effectLayers.length; index++) {
             if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === GlowLayer.EffectName) {
             if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === GlowLayer.EffectName) {
                 return (<any>this.effectLayers[index]) as GlowLayer;
                 return (<any>this.effectLayers[index]) as GlowLayer;

+ 2 - 2
src/Layer/babylon.highlightLayer.ts

@@ -1,5 +1,5 @@
 module BABYLON {
 module BABYLON {
-    export interface Scene {
+    export interface AbstractScene {
         /**
         /**
          * Return a the first highlight layer of the scene with a given name.
          * Return a the first highlight layer of the scene with a given name.
          * @param name The name of the highlight layer to look for.
          * @param name The name of the highlight layer to look for.
@@ -8,7 +8,7 @@
         getHighlightLayerByName(name: string): Nullable<HighlightLayer>;
         getHighlightLayerByName(name: string): Nullable<HighlightLayer>;
     }
     }
 
 
-    Scene.prototype.getHighlightLayerByName = function(name: string): Nullable<HighlightLayer> {
+    AbstractScene.prototype.getHighlightLayerByName = function(name: string): Nullable<HighlightLayer> {
         for (var index = 0; index < this.effectLayers.length; index++) {
         for (var index = 0; index < this.effectLayers.length; index++) {
             if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === HighlightLayer.EffectName) {
             if (this.effectLayers[index].name === name && this.effectLayers[index].getEffectName() === HighlightLayer.EffectName) {
                 return (<any>this.effectLayers[index]) as HighlightLayer;
                 return (<any>this.effectLayers[index]) as HighlightLayer;

+ 125 - 0
src/babylon.abstractScene.ts

@@ -0,0 +1,125 @@
+module BABYLON {
+    /**
+     * Defines how the parser contract is defined.
+     */
+    export type BabylonFileParser = (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => void;
+
+    /**
+     * Base class of the scene acting as a container for the different elements composing a scene.
+     * This class is dynamically extended by the different components of the scene increasing 
+     * flexibility and reducing coupling.
+     */
+    export abstract class AbstractScene {
+        /**
+         * Stores the list of available parsers in the application.
+         */
+        private static _BabylonFileParsers: { [key: string]: BabylonFileParser } = { };
+
+        /**
+         * Adds a parser in the list of availables ones.
+         * @param name Defines the name of the parser
+         * @param parser Defines the parser to add
+         */
+        public static AddParser(name: string, parser: BabylonFileParser): void {
+            this._BabylonFileParsers[name] = parser;
+        }
+
+        /**
+         * Parser json data and populate both a scene and its associated container object
+         * @param jsonData Defines the data to parse
+         * @param scene Defines the scene to parse the data for
+         * @param container Defines the container attached to the parsing sequence
+         * @param rootUrl Defines the root url of the data
+         */
+        public static Parse(jsonData: any, scene: Scene, container: AssetContainer, rootUrl: string): void {
+            for (let parserName in this._BabylonFileParsers) {
+                if (this._BabylonFileParsers.hasOwnProperty(parserName)) {
+                    this._BabylonFileParsers[parserName](jsonData, scene, container, rootUrl);
+                }
+            }
+        }
+
+        /** All of the cameras added to this scene
+         * @see http://doc.babylonjs.com/babylon101/cameras
+         */
+        public cameras = new Array<Camera>();
+
+        /**
+        * All of the lights added to this scene
+        * @see http://doc.babylonjs.com/babylon101/lights
+        */
+        public lights = new Array<Light>();
+
+        /**
+        * All of the (abstract) meshes added to this scene
+        */
+        public meshes = new Array<AbstractMesh>();
+
+        /**
+         * The list of skeletons added to the scene
+         * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons
+         */
+        public skeletons = new Array<Skeleton>();
+
+        /**
+        * All of the particle systems added to this scene
+        * @see http://doc.babylonjs.com/babylon101/particles
+        */
+        public particleSystems = new Array<IParticleSystem>();
+
+        /**
+         * Gets a list of Animations associated with the scene
+         */        
+        public animations: Animation[] = [];
+
+        /**
+        * All of the animation groups added to this scene
+        * @see http://doc.babylonjs.com/how_to/group
+        */
+        public animationGroups = new Array<AnimationGroup>();
+
+        /**
+        * All of the multi-materials added to this scene
+        * @see http://doc.babylonjs.com/how_to/multi_materials
+        */
+        public multiMaterials = new Array<MultiMaterial>();
+
+        /**
+        * All of the materials added to this scene
+        * @see http://doc.babylonjs.com/babylon101/materials
+        */
+        public materials = new Array<Material>();
+
+        /**
+         * The list of morph target managers added to the scene
+         * @see http://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh
+         */
+        public morphTargetManagers = new Array<MorphTargetManager>();
+        
+        /**
+         * The list of geometries used in the scene.
+         */
+        public geometries = new Array<Geometry>();
+
+        /**
+        * All of the tranform nodes added to this scene
+        * @see http://doc.babylonjs.com/how_to/transformnode
+        */
+        public transformNodes = new Array<TransformNode>();
+
+        /**
+         * ActionManagers available on the scene.
+         */
+        public actionManagers = new Array<ActionManager>();
+
+        /**
+         * Sounds to keep.
+         */
+        public sounds = new Array<Sound>();
+
+        /**
+         * Textures to keep.
+         */
+        public textures = new Array<BaseTexture>();
+    }
+}

+ 0 - 124
src/babylon.scene.ts

@@ -109,130 +109,6 @@
     }
     }
 
 
     /**
     /**
-     * Defines how the parser contract is defined.
-     */
-    export type BabylonFileParser = (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => void;
-
-    /**
-     * Base class of the scene acting as a container for the different elements composing a scene.
-     * This class is dynamically extended by the different components of the scene increasing 
-     * flexibility and reducing coupling.
-     */
-    export abstract class AbstractScene {
-        /**
-         * Stores the list of available parsers in the application.
-         */
-        private static _BabylonFileParsers: { [key: string]: BabylonFileParser } = { };
-
-        /**
-         * Adds a parser in the list of availables ones.
-         * @param name Defines the name of the parser
-         * @param parser Defines the parser to add
-         */
-        public static AddParser(name: string, parser: BabylonFileParser): void {
-            this._BabylonFileParsers[name] = parser;
-        }
-
-        /**
-         * Parser json data and populate both a scene and its associated container object
-         * @param jsonData Defines the data to parse
-         * @param scene Defines the scene to parse the data for
-         * @param container Defines the container attached to the parsing sequence
-         * @param rootUrl Defines the root url of the data
-         */
-        public static Parse(jsonData: any, scene: Scene, container: AssetContainer, rootUrl: string): void {
-            for (let parserName in this._BabylonFileParsers) {
-                if (this._BabylonFileParsers.hasOwnProperty(parserName)) {
-                    this._BabylonFileParsers[parserName](jsonData, scene, container, rootUrl);
-                }
-            }
-        }
-
-        /** All of the cameras added to this scene
-         * @see http://doc.babylonjs.com/babylon101/cameras
-         */
-        public cameras = new Array<Camera>();
-
-        /**
-        * All of the lights added to this scene
-        * @see http://doc.babylonjs.com/babylon101/lights
-        */
-        public lights = new Array<Light>();
-
-        /**
-        * All of the (abstract) meshes added to this scene
-        */
-        public meshes = new Array<AbstractMesh>();
-
-        /**
-         * The list of skeletons added to the scene
-         * @see http://doc.babylonjs.com/how_to/how_to_use_bones_and_skeletons
-         */
-        public skeletons = new Array<Skeleton>();
-
-        /**
-        * All of the particle systems added to this scene
-        * @see http://doc.babylonjs.com/babylon101/particles
-        */
-        public particleSystems = new Array<IParticleSystem>();
-
-        /**
-         * Gets a list of Animations associated with the scene
-         */        
-        public animations: Animation[] = [];
-
-        /**
-        * All of the animation groups added to this scene
-        * @see http://doc.babylonjs.com/how_to/group
-        */
-        public animationGroups = new Array<AnimationGroup>();
-
-        /**
-        * All of the multi-materials added to this scene
-        * @see http://doc.babylonjs.com/how_to/multi_materials
-        */
-        public multiMaterials = new Array<MultiMaterial>();
-
-        /**
-        * All of the materials added to this scene
-        * @see http://doc.babylonjs.com/babylon101/materials
-        */
-        public materials = new Array<Material>();
-
-        /**
-         * The list of morph target managers added to the scene
-         * @see http://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh
-         */
-        public morphTargetManagers = new Array<MorphTargetManager>();
-        
-        /**
-         * The list of geometries used in the scene.
-         */
-        public geometries = new Array<Geometry>();
-
-        /**
-        * All of the tranform nodes added to this scene
-        * @see http://doc.babylonjs.com/how_to/transformnode
-        */
-        public transformNodes = new Array<TransformNode>();
-
-        /**
-         * ActionManagers available on the scene.
-         */
-        public actionManagers = new Array<ActionManager>();
-
-        /**
-         * Sounds to keep.
-         */
-        public sounds = new Array<Sound>();
-
-        /**
-         * Textures to keep.
-         */
-        public textures = new Array<BaseTexture>();
-    }
-
-    /**
      * Represents a scene to be rendered by the engine.
      * Represents a scene to be rendered by the engine.
      * @see http://doc.babylonjs.com/features/scene
      * @see http://doc.babylonjs.com/features/scene
      */
      */