sebastien 6 anos atrás
pai
commit
61d1366470

+ 10 - 6
src/Materials/Textures/internalTexture.ts

@@ -3,18 +3,22 @@ import { Nullable, int } from "types";
 import { SphericalPolynomial } from "Math/sphericalPolynomial";
 import { Engine, RenderTargetCreationOptions } from "Engine/engine";
 import { IInternalTextureTracker } from "Materials/Textures/internalTextureTracker";
-import { BaseTexture } from "Materials/Textures/baseTexture";
-import { Texture } from "Materials/Textures/texture";
-import { RawCubeTexture } from "Materials/Textures/rawCubeTexture";
-
 import { _TimeToken } from "Instrumentation";
 import { _DepthCullingState, _StencilState, _AlphaState } from "States";
+
+declare type BaseTexture = import("Materials/Textures/baseTexture").BaseTexture;
+
     /**
      * Class used to store data associated with WebGL texture data for the engine
      * This class should not be used directly
      */
     export class InternalTexture implements IInternalTextureTracker {
 
+        /** hidden */
+        public static _UpdateRGBDAsync = (internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number): Promise<void> => {
+            throw "environmentTextureTools needs to be imported before rebuilding RGBD textures.";
+        }
+
         /**
          * The source of the texture data is unknown
          */
@@ -350,7 +354,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
                     return;
                 case InternalTexture.DATASOURCE_DEPTHTEXTURE:
                     let depthTextureOptions = {
-                        bilinearFiltering: this.samplingMode !== Texture.BILINEAR_SAMPLINGMODE,
+                        bilinearFiltering: this.samplingMode !== Engine.TEXTURE_BILINEAR_SAMPLINGMODE,
                         comparisonFunction: this._comparisonFunction,
                         generateStencil: this._generateStencilBuffer,
                         isCube: this.isCube
@@ -377,7 +381,7 @@ import { _DepthCullingState, _StencilState, _AlphaState } from "States";
 
                 case InternalTexture.DATASOURCE_CUBERAW_RGBD:
                     proxy = this._engine.createRawCubeTexture(null, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
-                    RawCubeTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray!, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(() => {
+                    InternalTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray!, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(() => {
                         this.isReady = true;
                     });
                     proxy._swapAndDie(this);

+ 3 - 4
src/Materials/Textures/texture.ts

@@ -13,10 +13,6 @@ import { BaseTexture } from "Materials/Textures/baseTexture";
 // import { MirrorTexture } from "Materials/Textures/mirrorTexture";
 // import { CubeTexture } from "Materials/Textures/cubeTexture";
 
-SerializationHelper._TextureParser = (sourceProperty: any, scene: Scene, rootUrl: string): Nullable<BaseTexture> => {
-    return Texture.Parse(sourceProperty, scene, rootUrl);
-};
-
     /**
      * This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.
      * @see http://doc.babylonjs.com/babylon101/materials#texture
@@ -724,3 +720,6 @@ SerializationHelper._TextureParser = (sourceProperty: any, scene: Scene, rootUrl
             return new Texture(name, scene, noMipmap, invertY, samplingMode, onLoad, onError, buffer, deleteBuffer, format);
         }
     }
+
+    // References the dependencies.
+    SerializationHelper._TextureParser = Texture.Parse;

+ 3 - 4
src/Materials/colorCurves.ts

@@ -3,10 +3,6 @@ import { SerializationHelper } from "Tools";
 import { Color4 } from "Math";
 import { Effect } from "Materials";
 
-SerializationHelper._ColorCurvesParser = (sourceProperty: any): ColorCurves => {
-    return ColorCurves.Parse(sourceProperty);
-};
-
     /**
      * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT).
      * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
@@ -568,3 +564,6 @@ SerializationHelper._ColorCurvesParser = (sourceProperty: any): ColorCurves => {
             return SerializationHelper.Parse(() => new ColorCurves(), source, null, null);
         }
     }
+
+// References the dependencies.
+SerializationHelper._ColorCurvesParser = ColorCurves.Parse;

+ 3 - 4
src/Materials/fresnelParameters.ts

@@ -4,10 +4,6 @@ import { Engine } from "Engine/engine";
 import { Material } from "Materials/material";
 import { SerializationHelper } from "Tools/decorators";
 
-SerializationHelper._FresnelParametersParser = (sourceProperty: any) => {
-    return FresnelParameters.Parse(sourceProperty);
-};
-
     /**
      * This represents all the required information to add a fresnel effect on a material:
      * @see http://doc.babylonjs.com/how_to/how_to_use_fresnelparameters
@@ -94,3 +90,6 @@ SerializationHelper._FresnelParametersParser = (sourceProperty: any) => {
             return fresnelParameters;
         }
     }
+
+// References the dependencies.
+SerializationHelper._FresnelParametersParser = FresnelParameters.Parse;

+ 3 - 4
src/Materials/imageProcessingConfiguration.ts

@@ -8,10 +8,6 @@ import { Effect } from "Materials/effect";
 import { BaseTexture } from "Materials/Textures/baseTexture";
 import { ColorCurves } from "Materials/colorCurves";
 
-SerializationHelper._ImageProcessingConfigurationParser = (sourceProperty: any) => {
-    return ImageProcessingConfiguration.Parse(sourceProperty);
-};
-
     /**
      * Interface to follow in your material defines to integrate easily the
      * Image proccessing functions.
@@ -585,3 +581,6 @@ SerializationHelper._ImageProcessingConfigurationParser = (sourceProperty: any)
             return this._VIGNETTEMODE_OPAQUE;
         }
     }
+
+    // References the dependencies.
+    SerializationHelper._ImageProcessingConfigurationParser = ImageProcessingConfiguration.Parse;

+ 1 - 0
src/Morph/morphTarget.ts

@@ -7,6 +7,7 @@ import { AbstractMesh } from "Mesh/abstractMesh";
 import { VertexBuffer } from "Mesh/buffer";
 import { Animation } from "Animations/animation";
 import { AnimationPropertiesOverride } from "Animations/animationPropertiesOverride";
+import { serialize } from "Tools/decorators";
     /**
      * Defines a target to use with MorphTargetManager
      * @see http://doc.babylonjs.com/how_to/how_to_use_morphtargets

+ 16 - 1
src/Tools/environmentTextureTools.ts

@@ -5,7 +5,6 @@ import { Scalar } from "Math/math.scalar";
 import { SphericalPolynomial } from "Math/sphericalPolynomial";
 import { InternalTexture } from "Materials/Textures/internalTexture";
 import { BaseTexture } from "Materials/Textures/baseTexture";
-//import { Texture } from "Materials/Textures/texture";
 import { CubeTexture } from "Materials/Textures/cubeTexture";
 import { Engine } from "Engine/engine";
 import { Scene } from "scene";
@@ -606,4 +605,20 @@ import { PostProcess } from "PostProcess/postProcess";
             Vector3.FromArrayToRef(irradianceInfo.xy, 0, sp.xy);
             texture._sphericalPolynomial = sp;
         }
+
+        /** @hidden */
+        public static _UpdateRGBDAsync(internalTexture: InternalTexture, data: ArrayBufferView[][], sphericalPolynomial: Nullable<SphericalPolynomial>, lodScale: number, lodOffset: number): Promise<void> {
+            internalTexture._dataSource = InternalTexture.DATASOURCE_CUBERAW_RGBD;
+            internalTexture._bufferViewArrayArray = data;
+            internalTexture._lodGenerationScale = lodScale;
+            internalTexture._lodGenerationOffset = lodOffset;
+            internalTexture._sphericalPolynomial = sphericalPolynomial;
+
+            return EnvironmentTextureTools.UploadLevelsAsync(internalTexture, data).then(() => {
+                internalTexture.isReady = true;
+            });
+        }
     }
+
+    // References the dependencies.
+    InternalTexture._UpdateRGBDAsync = EnvironmentTextureTools._UpdateRGBDAsync;

+ 1 - 0
src/scene.ts

@@ -44,6 +44,7 @@ import { ISceneComponent, ISceneSerializableComponent, Stage, SimpleStageAction,
 import { Engine } from "Engine/engine";
 import { Ray } from "Culling/ray";
 import { Node } from "node";
+import { MorphTarget } from "Morph/morphTarget";
 
     /**
      * Define an interface for all classes that will hold resources