Browse Source

Migrate reflection probe to component

sebastien 7 years ago
parent
commit
57375a742b
2 changed files with 12 additions and 5 deletions
  1. 12 0
      src/Probes/babylon.reflectionProbe.ts
  2. 0 5
      src/babylon.scene.ts

+ 12 - 0
src/Probes/babylon.reflectionProbe.ts

@@ -1,4 +1,12 @@
 module BABYLON {
+    export interface Scene {
+        /**
+         * The list of reflection probes added to the scene
+         * @see http://doc.babylonjs.com/how_to/how_to_use_reflection_probes
+         */
+        reflectionProbes: Array<ReflectionProbe>;
+    }
+
     /** 
      * Class used to generate realtime reflection / refraction cube textures
      * @see http://doc.babylonjs.com/how_to/how_to_use_reflection_probes
@@ -31,6 +39,10 @@
             size: number, scene: Scene, generateMipMaps = true, useFloat = false) {
             this._scene = scene;
 
+            // Create the scene field if not exist.
+            if (!this._scene.reflectionProbes) {
+                this._scene.reflectionProbes = new Array<ReflectionProbe>();
+            }
             this._scene.reflectionProbes.push(this);
 
             this._renderTargetTexture = new RenderTargetTexture(name, size, scene, generateMipMaps, true, useFloat ? Engine.TEXTURETYPE_FLOAT : Engine.TEXTURETYPE_UNSIGNED_INT, true);

+ 0 - 5
src/babylon.scene.ts

@@ -862,11 +862,6 @@
         * Gets or sets a boolean indicating if probes are enabled on this scene
         */
         public probesEnabled = true;
-        /**
-         * The list of reflection probes added to the scene
-         * @see http://doc.babylonjs.com/how_to/how_to_use_reflection_probes
-         */
-        public reflectionProbes = new Array<ReflectionProbe>();
 
         // Database
         /**