David Catuhe 8 年之前
父節點
當前提交
a8ef5428c3
共有 31 個文件被更改,包括 19642 次插入17905 次删除
  1. 4888 4880
      dist/preview release/babylon.d.ts
  2. 39 39
      dist/preview release/babylon.js
  3. 22 10
      dist/preview release/babylon.max.js
  4. 4888 4880
      dist/preview release/babylon.module.d.ts
  5. 40 40
      dist/preview release/babylon.worker.js
  6. 3869 3861
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  7. 31 31
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  8. 21 9
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  9. 3869 3861
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts
  10. 11 1
      dist/preview release/gui/babylon.gui.js
  11. 3 3
      dist/preview release/gui/babylon.gui.min.js
  12. 263 263
      dist/preview release/inspector/babylon.inspector.bundle.js
  13. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  14. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  15. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  16. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  17. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  18. 274 2
      dist/preview release/materialsLibrary/babylon.customMaterial.d.ts
  19. 1375 1
      dist/preview release/materialsLibrary/babylon.customMaterial.js
  20. 2 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  21. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  22. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  23. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  24. 8 0
      gui/src/advancedDynamicTexture.ts
  25. 5 1
      gui/src/controls/control.ts
  26. 6 1
      src/Materials/PBR/babylon.pbrBaseMaterial.ts
  27. 7 0
      src/Materials/PBR/babylon.pbrMaterial.ts
  28. 7 0
      src/Mesh/babylon.abstractMesh.ts
  29. 0 7
      src/Mesh/babylon.mesh.ts
  30. 1 1
      src/Shaders/pbr.fragment.fx
  31. 1 1
      src/Tools/babylon.sceneOptimizer.ts

File diff suppressed because it is too large
+ 4888 - 4880
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 39 - 39
dist/preview release/babylon.js


File diff suppressed because it is too large
+ 22 - 10
dist/preview release/babylon.max.js


File diff suppressed because it is too large
+ 4888 - 4880
dist/preview release/babylon.module.d.ts


File diff suppressed because it is too large
+ 40 - 40
dist/preview release/babylon.worker.js


File diff suppressed because it is too large
+ 3869 - 3861
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


File diff suppressed because it is too large
+ 31 - 31
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


File diff suppressed because it is too large
+ 21 - 9
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js


File diff suppressed because it is too large
+ 3869 - 3861
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 11 - 1
dist/preview release/gui/babylon.gui.js

@@ -192,6 +192,12 @@ var BABYLON;
                             continue;
                         }
                         var mesh = control._linkedMesh;
+                        if (mesh.isDisposed()) {
+                            BABYLON.Tools.SetImmediate(function () {
+                                control.linkWithMesh(null);
+                            });
+                            continue;
+                        }
                         var position = mesh.getBoundingInfo().boundingSphere.center;
                         var projectedPosition = BABYLON.Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);
                         if (projectedPosition.z < 0 || projectedPosition.z > 1) {
@@ -1069,8 +1075,12 @@ var BABYLON;
                     BABYLON.Tools.Error("Cannot link a control to a mesh if the control is not at root level");
                     return;
                 }
-                if (this._host._linkedControls.indexOf(this) !== -1) {
+                var index = this._host._linkedControls.indexOf(this);
+                if (index !== -1) {
                     this._linkedMesh = mesh;
+                    if (!mesh) {
+                        this._host._linkedControls.splice(index, 1);
+                    }
                     return;
                 }
                 this.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT;

File diff suppressed because it is too large
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


File diff suppressed because it is too large
+ 263 - 263
dist/preview release/inspector/babylon.inspector.bundle.js


File diff suppressed because it is too large
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


+ 274 - 2
dist/preview release/materialsLibrary/babylon.customMaterial.d.ts

@@ -1,5 +1,277 @@
 
 declare module BABYLON {
+    class StandardMaterialDefines_OldVer extends MaterialDefines implements IImageProcessingConfigurationDefines {
+        DIFFUSE: boolean;
+        AMBIENT: boolean;
+        OPACITY: boolean;
+        OPACITYRGB: boolean;
+        REFLECTION: boolean;
+        EMISSIVE: boolean;
+        SPECULAR: boolean;
+        BUMP: boolean;
+        PARALLAX: boolean;
+        PARALLAXOCCLUSION: boolean;
+        SPECULAROVERALPHA: boolean;
+        CLIPPLANE: boolean;
+        ALPHATEST: boolean;
+        ALPHAFROMDIFFUSE: boolean;
+        POINTSIZE: boolean;
+        FOG: boolean;
+        SPECULARTERM: boolean;
+        DIFFUSEFRESNEL: boolean;
+        OPACITYFRESNEL: boolean;
+        REFLECTIONFRESNEL: boolean;
+        REFRACTIONFRESNEL: boolean;
+        EMISSIVEFRESNEL: boolean;
+        FRESNEL: boolean;
+        NORMAL: boolean;
+        UV1: boolean;
+        UV2: boolean;
+        VERTEXCOLOR: boolean;
+        VERTEXALPHA: boolean;
+        NUM_BONE_INFLUENCERS: number;
+        BonesPerMesh: number;
+        INSTANCES: boolean;
+        GLOSSINESS: boolean;
+        ROUGHNESS: boolean;
+        EMISSIVEASILLUMINATION: boolean;
+        LINKEMISSIVEWITHDIFFUSE: boolean;
+        REFLECTIONFRESNELFROMSPECULAR: boolean;
+        LIGHTMAP: boolean;
+        USELIGHTMAPASSHADOWMAP: boolean;
+        REFLECTIONMAP_3D: boolean;
+        REFLECTIONMAP_SPHERICAL: boolean;
+        REFLECTIONMAP_PLANAR: boolean;
+        REFLECTIONMAP_CUBIC: boolean;
+        REFLECTIONMAP_PROJECTION: boolean;
+        REFLECTIONMAP_SKYBOX: boolean;
+        REFLECTIONMAP_EXPLICIT: boolean;
+        REFLECTIONMAP_EQUIRECTANGULAR: boolean;
+        REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
+        REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
+        INVERTCUBICMAP: boolean;
+        LOGARITHMICDEPTH: boolean;
+        REFRACTION: boolean;
+        REFRACTIONMAP_3D: boolean;
+        REFLECTIONOVERALPHA: boolean;
+        INVERTNORMALMAPX: boolean;
+        INVERTNORMALMAPY: boolean;
+        TWOSIDEDLIGHTING: boolean;
+        SHADOWFLOAT: boolean;
+        MORPHTARGETS: boolean;
+        MORPHTARGETS_NORMAL: boolean;
+        MORPHTARGETS_TANGENT: boolean;
+        NUM_MORPH_INFLUENCERS: number;
+        USERIGHTHANDEDSYSTEM: boolean;
+        IMAGEPROCESSING: boolean;
+        VIGNETTE: boolean;
+        VIGNETTEBLENDMODEMULTIPLY: boolean;
+        VIGNETTEBLENDMODEOPAQUE: boolean;
+        TONEMAPPING: boolean;
+        CONTRAST: boolean;
+        COLORCURVES: boolean;
+        COLORGRADING: boolean;
+        SAMPLER3DGREENDEPTH: boolean;
+        SAMPLER3DBGRMAP: boolean;
+        IMAGEPROCESSINGPOSTPROCESS: boolean;
+        EXPOSURE: boolean;
+        constructor();
+        setReflectionMode(modeToEnable: string): void;
+    }
+    class StandardMaterial_OldVer extends PushMaterial {
+        private _diffuseTexture;
+        diffuseTexture: BaseTexture;
+        private _ambientTexture;
+        ambientTexture: BaseTexture;
+        private _opacityTexture;
+        opacityTexture: BaseTexture;
+        private _reflectionTexture;
+        reflectionTexture: BaseTexture;
+        private _emissiveTexture;
+        emissiveTexture: BaseTexture;
+        private _specularTexture;
+        specularTexture: BaseTexture;
+        private _bumpTexture;
+        bumpTexture: BaseTexture;
+        private _lightmapTexture;
+        lightmapTexture: BaseTexture;
+        private _refractionTexture;
+        refractionTexture: BaseTexture;
+        ambientColor: Color3;
+        diffuseColor: Color3;
+        specularColor: Color3;
+        emissiveColor: Color3;
+        specularPower: number;
+        private _useAlphaFromDiffuseTexture;
+        useAlphaFromDiffuseTexture: boolean;
+        private _useEmissiveAsIllumination;
+        useEmissiveAsIllumination: boolean;
+        private _linkEmissiveWithDiffuse;
+        linkEmissiveWithDiffuse: boolean;
+        private _useSpecularOverAlpha;
+        useSpecularOverAlpha: boolean;
+        private _useReflectionOverAlpha;
+        useReflectionOverAlpha: boolean;
+        private _disableLighting;
+        disableLighting: boolean;
+        private _useParallax;
+        useParallax: boolean;
+        private _useParallaxOcclusion;
+        useParallaxOcclusion: boolean;
+        parallaxScaleBias: number;
+        private _roughness;
+        roughness: number;
+        indexOfRefraction: number;
+        invertRefractionY: boolean;
+        private _useLightmapAsShadowmap;
+        useLightmapAsShadowmap: boolean;
+        private _diffuseFresnelParameters;
+        diffuseFresnelParameters: FresnelParameters;
+        private _opacityFresnelParameters;
+        opacityFresnelParameters: FresnelParameters;
+        private _reflectionFresnelParameters;
+        reflectionFresnelParameters: FresnelParameters;
+        private _refractionFresnelParameters;
+        refractionFresnelParameters: FresnelParameters;
+        private _emissiveFresnelParameters;
+        emissiveFresnelParameters: FresnelParameters;
+        private _useReflectionFresnelFromSpecular;
+        useReflectionFresnelFromSpecular: boolean;
+        private _useGlossinessFromSpecularMapAlpha;
+        useGlossinessFromSpecularMapAlpha: boolean;
+        private _maxSimultaneousLights;
+        maxSimultaneousLights: number;
+        /**
+         * If sets to true, x component of normal map value will invert (x = 1.0 - x).
+         */
+        private _invertNormalMapX;
+        invertNormalMapX: boolean;
+        /**
+         * If sets to true, y component of normal map value will invert (y = 1.0 - y).
+         */
+        private _invertNormalMapY;
+        invertNormalMapY: boolean;
+        /**
+         * If sets to true and backfaceCulling is false, normals will be flipped on the backside.
+         */
+        private _twoSidedLighting;
+        twoSidedLighting: boolean;
+        /**
+         * Default configuration related to image processing available in the standard Material.
+         */
+        protected _imageProcessingConfiguration: ImageProcessingConfiguration;
+        /**
+         * Gets the image processing configuration used either in this material.
+         */
+        /**
+         * Sets the Default image processing configuration used either in the this material.
+         *
+         * If sets to null, the scene one is in use.
+         */
+        imageProcessingConfiguration: ImageProcessingConfiguration;
+        /**
+         * Keep track of the image processing observer to allow dispose and replace.
+         */
+        private _imageProcessingObserver;
+        /**
+         * Attaches a new image processing configuration to the Standard Material.
+         * @param configuration
+         */
+        protected _attachImageProcessingConfiguration(configuration: ImageProcessingConfiguration): void;
+        /**
+         * Gets wether the color curves effect is enabled.
+         */
+        /**
+         * Sets wether the color curves effect is enabled.
+         */
+        cameraColorCurvesEnabled: boolean;
+        /**
+         * Gets wether the color grading effect is enabled.
+         */
+        /**
+         * Gets wether the color grading effect is enabled.
+         */
+        cameraColorGradingEnabled: boolean;
+        /**
+         * Gets wether tonemapping is enabled or not.
+         */
+        /**
+         * Sets wether tonemapping is enabled or not
+         */
+        cameraToneMappingEnabled: boolean;
+        /**
+         * The camera exposure used on this material.
+         * This property is here and not in the camera to allow controlling exposure without full screen post process.
+         * This corresponds to a photographic exposure.
+         */
+        /**
+         * The camera exposure used on this material.
+         * This property is here and not in the camera to allow controlling exposure without full screen post process.
+         * This corresponds to a photographic exposure.
+         */
+        cameraExposure: number;
+        /**
+         * Gets The camera contrast used on this material.
+         */
+        /**
+         * Sets The camera contrast used on this material.
+         */
+        cameraContrast: number;
+        /**
+         * Gets the Color Grading 2D Lookup Texture.
+         */
+        /**
+         * Sets the Color Grading 2D Lookup Texture.
+         */
+        cameraColorGradingTexture: BaseTexture;
+        customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines_OldVer) => string;
+        protected _renderTargets: SmartArray<RenderTargetTexture>;
+        protected _worldViewProjectionMatrix: Matrix;
+        protected _globalAmbientColor: Color3;
+        protected _useLogarithmicDepth: boolean;
+        constructor(name: string, scene: Scene);
+        getClassName(): string;
+        useLogarithmicDepth: boolean;
+        needAlphaBlending(): boolean;
+        needAlphaTesting(): boolean;
+        protected _shouldUseAlphaFromDiffuseTexture(): boolean;
+        getAlphaTestTexture(): BaseTexture;
+        /**
+         * Child classes can use it to update shaders
+         */
+        isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
+        buildUniformLayout(): void;
+        unbind(): void;
+        bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
+        getAnimatables(): IAnimatable[];
+        getActiveTextures(): BaseTexture[];
+        dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void;
+        clone(name: string): StandardMaterial_OldVer;
+        serialize(): any;
+        static Parse(source: any, scene: Scene, rootUrl: string): StandardMaterial_OldVer;
+        static _DiffuseTextureEnabled: boolean;
+        static DiffuseTextureEnabled: boolean;
+        static _AmbientTextureEnabled: boolean;
+        static AmbientTextureEnabled: boolean;
+        static _OpacityTextureEnabled: boolean;
+        static OpacityTextureEnabled: boolean;
+        static _ReflectionTextureEnabled: boolean;
+        static ReflectionTextureEnabled: boolean;
+        static _EmissiveTextureEnabled: boolean;
+        static EmissiveTextureEnabled: boolean;
+        static _SpecularTextureEnabled: boolean;
+        static SpecularTextureEnabled: boolean;
+        static _BumpTextureEnabled: boolean;
+        static BumpTextureEnabled: boolean;
+        static _LightmapTextureEnabled: boolean;
+        static LightmapTextureEnabled: boolean;
+        static _RefractionTextureEnabled: boolean;
+        static RefractionTextureEnabled: boolean;
+        static _ColorGradingTextureEnabled: boolean;
+        static ColorGradingTextureEnabled: boolean;
+        static _FresnelEnabled: boolean;
+        static FresnelEnabled: boolean;
+    }
     class CustomShaderStructure {
         FragmentStore: string;
         VertexStore: string;
@@ -25,7 +297,7 @@ declare module BABYLON {
     class StandardShaderVersions {
         static Ver3_0: any;
     }
-    class CustomMaterial extends StandardMaterial {
+    class CustomMaterial extends StandardMaterial_OldVer {
         static ShaderIndexer: number;
         CustomParts: ShaderSpecialParts;
         ShaderVersion: CustomShaderStructure;
@@ -37,7 +309,7 @@ declare module BABYLON {
         _newSamplerInstances: Texture[];
         AttachAfterBind(mesh: Mesh, effect: Effect): void;
         ReviewUniform(name: string, arr: string[]): string[];
-        Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines): string;
+        Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines_OldVer): string;
         SelectVersion(ver: string): void;
         constructor(name: string, scene: Scene);
         AddUniform(name: string, kind: string, param: any): CustomMaterial;

File diff suppressed because it is too large
+ 1375 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.js


File diff suppressed because it is too large
+ 2 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


+ 8 - 0
gui/src/advancedDynamicTexture.ts

@@ -204,6 +204,14 @@ module BABYLON.GUI {
                     }
 
                     var mesh = control._linkedMesh;
+
+                    if (mesh.isDisposed()) {
+                        Tools.SetImmediate(()=>{
+                            control.linkWithMesh(null);
+                        });
+                        
+                        continue;
+                    }
                     
                     var position = mesh.getBoundingInfo().boundingSphere.center;
                     var projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);

+ 5 - 1
gui/src/controls/control.ts

@@ -441,8 +441,12 @@ module BABYLON.GUI {
                 return;
             }
 
-            if (this._host._linkedControls.indexOf(this) !== -1) {
+            var index = this._host._linkedControls.indexOf(this);
+            if (index !== -1) {
                 this._linkedMesh = mesh;
+                if (!mesh) {
+                    this._host._linkedControls.splice(index, 1);
+                }
                 return;
             }
 

+ 6 - 1
src/Materials/PBR/babylon.pbrBaseMaterial.ts

@@ -395,6 +395,11 @@
         protected _environmentBRDFTexture: BaseTexture = null;
 
         /**
+         * Force the shader to compute irradiance in the fragment shader in order to take bump in account.
+         */
+        protected _forceIrradianceInFragment = false;
+
+        /**
          * Default configuration related to image processing available in the PBR Material.
          */
         @serializeAsImageProcessingConfiguration()
@@ -624,7 +629,7 @@
                         if (reflectionTexture.coordinatesMode !== BABYLON.Texture.SKYBOX_MODE) {
                             if (reflectionTexture.sphericalPolynomial) {
                                 defines.USESPHERICALFROMREFLECTIONMAP = true;
-                                if (scene.getEngine().getCaps().maxVaryingVectors <= 8) {
+                                if (this._forceIrradianceInFragment || scene.getEngine().getCaps().maxVaryingVectors <= 8) {
                                     defines.USESPHERICALINFRAGMENT = true;
                                 }
                             }

+ 7 - 0
src/Materials/PBR/babylon.pbrMaterial.ts

@@ -332,6 +332,13 @@
         public disableLighting = false;
 
         /**
+         * Force the shader to compute irradiance in the fragment shader in order to take bump in account.
+         */
+        @serialize()
+        @expandToProperty("_markAllSubMeshesAsTexturesDirty")
+        public forceIrradianceInFragment = false;        
+
+        /**
          * Number of Simultaneous lights allowed on the material.
          */
         @serialize()

+ 7 - 0
src/Mesh/babylon.abstractMesh.ts

@@ -369,6 +369,13 @@
         }
 
         /**
+         * Boolean : true if the mesh has been disposed.  
+         */
+        public isDisposed(): boolean {
+            return this._isDisposed;
+        }
+
+        /**
          * Returns the string "AbstractMesh"
          */
         public getClassName(): string {

+ 0 - 7
src/Mesh/babylon.mesh.ts

@@ -529,13 +529,6 @@
             return super.isReady();
         }
 
-        /**
-         * Boolean : true if the mesh has been disposed.  
-         */
-        public isDisposed(): boolean {
-            return this._isDisposed;
-        }
-
         public get sideOrientation(): number {
             return this._sideOrientation;
         }

+ 1 - 1
src/Shaders/pbr.fragment.fx

@@ -563,7 +563,7 @@ void main(void) {
 		#if defined(NORMAL) && !defined(USESPHERICALINFRAGMENT)
 			environmentIrradiance = vEnvironmentIrradiance;
 		#else
-			vec3 irradianceVector = vec3(reflectionMatrix * vec4(vNormalW, 0)).xyz;
+			vec3 irradianceVector = vec3(reflectionMatrix * vec4(normalW, 0)).xyz;
 			#ifdef REFLECTIONMAP_OPPOSITEZ
 				irradianceVector.z *= -1.0;
 			#endif

+ 1 - 1
src/Tools/babylon.sceneOptimizer.ts

@@ -20,7 +20,7 @@
             for (var index = 0; index < scene.textures.length; index++) {
                 var texture = scene.textures[index];
 
-                if (!texture.canRescale) {
+                if (!texture.canRescale || (<any>texture).getContext) {
                     continue;
                 }