浏览代码

Merge branch 'master' into node-material

David Catuhe 6 年之前
父节点
当前提交
a7ded67a64
共有 89 个文件被更改,包括 4392 次插入1796 次删除
  1. 520 262
      Playground/babylon.d.txt
  2. 二进制
      Playground/textures/BJS-logo_v3-astc.ktx
  3. 二进制
      Playground/textures/BJS-logo_v3-dxt.ktx
  4. 二进制
      Playground/textures/BJS-logo_v3-etc2.ktx
  5. 二进制
      Playground/textures/BJS-logo_v3-pvrtc.ktx
  6. 二进制
      Playground/textures/checkerBJS-astc.ktx
  7. 二进制
      Playground/textures/checkerBJS-dxt.ktx
  8. 二进制
      Playground/textures/checkerBJS-etc2.ktx
  9. 二进制
      Playground/textures/checkerBJS-pvrtc.ktx
  10. 二进制
      Playground/textures/cubemapDebug/_nx-astc.ktx
  11. 二进制
      Playground/textures/cubemapDebug/_nx-dxt.ktx
  12. 二进制
      Playground/textures/cubemapDebug/_nx-etc1.ktx
  13. 二进制
      Playground/textures/cubemapDebug/_nx-etc2.ktx
  14. 二进制
      Playground/textures/cubemapDebug/_nx-pvrtc.ktx
  15. 二进制
      Playground/textures/cubemapDebug/_nx.jpg
  16. 二进制
      Playground/textures/cubemapDebug/_ny-astc.ktx
  17. 二进制
      Playground/textures/cubemapDebug/_ny-dxt.ktx
  18. 二进制
      Playground/textures/cubemapDebug/_ny-etc1.ktx
  19. 二进制
      Playground/textures/cubemapDebug/_ny-etc2.ktx
  20. 二进制
      Playground/textures/cubemapDebug/_ny-pvrtc.ktx
  21. 二进制
      Playground/textures/cubemapDebug/_ny.jpg
  22. 二进制
      Playground/textures/cubemapDebug/_nz-astc.ktx
  23. 二进制
      Playground/textures/cubemapDebug/_nz-dxt.ktx
  24. 二进制
      Playground/textures/cubemapDebug/_nz-etc1.ktx
  25. 二进制
      Playground/textures/cubemapDebug/_nz-etc2.ktx
  26. 二进制
      Playground/textures/cubemapDebug/_nz-pvrtc.ktx
  27. 二进制
      Playground/textures/cubemapDebug/_nz.jpg
  28. 二进制
      Playground/textures/cubemapDebug/_px-astc.ktx
  29. 二进制
      Playground/textures/cubemapDebug/_px-dxt.ktx
  30. 二进制
      Playground/textures/cubemapDebug/_px-etc1.ktx
  31. 二进制
      Playground/textures/cubemapDebug/_px-etc2.ktx
  32. 二进制
      Playground/textures/cubemapDebug/_px-pvrtc.ktx
  33. 二进制
      Playground/textures/cubemapDebug/_px.jpg
  34. 二进制
      Playground/textures/cubemapDebug/_py-astc.ktx
  35. 二进制
      Playground/textures/cubemapDebug/_py-dxt.ktx
  36. 二进制
      Playground/textures/cubemapDebug/_py-etc1.ktx
  37. 二进制
      Playground/textures/cubemapDebug/_py-etc2.ktx
  38. 二进制
      Playground/textures/cubemapDebug/_py-pvrtc.ktx
  39. 二进制
      Playground/textures/cubemapDebug/_py.jpg
  40. 二进制
      Playground/textures/cubemapDebug/_pz-astc.ktx
  41. 二进制
      Playground/textures/cubemapDebug/_pz-dxt.ktx
  42. 二进制
      Playground/textures/cubemapDebug/_pz-etc1.ktx
  43. 二进制
      Playground/textures/cubemapDebug/_pz-etc2.ktx
  44. 二进制
      Playground/textures/cubemapDebug/_pz-pvrtc.ktx
  45. 二进制
      Playground/textures/cubemapDebug/_pz.jpg
  46. 474 262
      dist/preview release/babylon.d.ts
  47. 1 1
      dist/preview release/babylon.js
  48. 391 95
      dist/preview release/babylon.max.js
  49. 1 1
      dist/preview release/babylon.max.js.map
  50. 973 542
      dist/preview release/babylon.module.d.ts
  51. 1 1
      dist/preview release/materialsLibrary/babylon.cellMaterial.min.js
  52. 230 6
      dist/preview release/materialsLibrary/babylon.customMaterial.js
  53. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.js.map
  54. 2 2
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  55. 1 1
      dist/preview release/materialsLibrary/babylon.fireMaterial.min.js
  56. 1 1
      dist/preview release/materialsLibrary/babylon.furMaterial.min.js
  57. 1 1
      dist/preview release/materialsLibrary/babylon.gradientMaterial.min.js
  58. 1 1
      dist/preview release/materialsLibrary/babylon.gridMaterial.min.js
  59. 1 1
      dist/preview release/materialsLibrary/babylon.lavaMaterial.min.js
  60. 1 1
      dist/preview release/materialsLibrary/babylon.mixMaterial.min.js
  61. 1 1
      dist/preview release/materialsLibrary/babylon.normalMaterial.min.js
  62. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  63. 1 1
      dist/preview release/materialsLibrary/babylon.simpleMaterial.min.js
  64. 1 1
      dist/preview release/materialsLibrary/babylon.skyMaterial.min.js
  65. 1 1
      dist/preview release/materialsLibrary/babylon.terrainMaterial.min.js
  66. 1 1
      dist/preview release/materialsLibrary/babylon.triPlanarMaterial.min.js
  67. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  68. 56 0
      dist/preview release/materialsLibrary/babylonjs.materials.d.ts
  69. 235 7
      dist/preview release/materialsLibrary/babylonjs.materials.js
  70. 1 1
      dist/preview release/materialsLibrary/babylonjs.materials.js.map
  71. 2 2
      dist/preview release/materialsLibrary/babylonjs.materials.min.js
  72. 119 0
      dist/preview release/materialsLibrary/babylonjs.materials.module.d.ts
  73. 1 1
      dist/preview release/packagesSizeBaseLine.json
  74. 973 542
      dist/preview release/viewer/babylon.module.d.ts
  75. 19 5
      dist/preview release/viewer/babylon.viewer.d.ts
  76. 23 19
      dist/preview release/viewer/babylon.viewer.js
  77. 1 1
      dist/preview release/viewer/babylon.viewer.max.js
  78. 22 5
      dist/preview release/viewer/babylon.viewer.module.d.ts
  79. 2 1
      dist/preview release/what's new.md
  80. 22 1
      src/Cameras/Inputs/freeCameraDeviceOrientationInput.ts
  81. 7 0
      src/Cameras/deviceOrientationCamera.ts
  82. 25 1
      src/Cameras/freeCameraInputsManager.ts
  83. 6 4
      src/Engines/engine.ts
  84. 193 15
      src/Gizmos/lightGizmo.ts
  85. 14 0
      src/Meshes/Builders/groundBuilder.ts
  86. 46 0
      src/Meshes/Builders/hemisphereBuilder.ts
  87. 1 0
      src/Meshes/Builders/index.ts
  88. 12 0
      src/Meshes/mesh.ts
  89. 5 5
      src/scene.ts

+ 520 - 262
Playground/babylon.d.txt

@@ -12017,6 +12017,12 @@ declare module BABYLON {
      */
     export class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
         /**
+         * @hidden
+         */
keyboardInput: Nullable<FreeCameraKeyboardMoveInput>;
+        /**
+         * @hidden
+         */
mouseInput: Nullable<FreeCameraMouseInput>;
+        /**
          * Instantiates a new FreeCameraInputsManager.
          * @param camera Defines the camera the inputs belong to
          */
@@ -12033,6 +12039,11 @@ declare module BABYLON {
          */
         addMouse(touchEnabled?: boolean): FreeCameraInputsManager;
         /**
+         * Removes the mouse input support from the manager
+         * @returns the current input manager
+         */
+        removeMouse(): FreeCameraInputsManager;
+        /**
          * Add touch input support to the input manager.
          * @returns the current input manager
          */
@@ -20889,6 +20900,15 @@ declare module BABYLON {
           */
         static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
         /**
+          * Creates a hemisphere mesh. Please consider using the same method from the MeshBuilder class instead
+          * @param name defines the name of the mesh to create
+          * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)
+          * @param diameter sets the diameter size (float) of the sphere (default 1)
+          * @param scene defines the hosting scene
+          * @returns a new Mesh
+          */
+        static CreateHemisphere(name: string, segments: number, diameter: number, scene?: Scene): Mesh;
+        /**
          * Creates a cylinder or a cone mesh. Please consider using the same method from the MeshBuilder class instead
          * @param name defines the name of the mesh to create
          * @param height sets the height size (float) of the cylinder/cone (float, default 2)
@@ -36265,6 +36285,9 @@ declare module BABYLON {
 declare module BABYLON {
         interface FreeCameraInputsManager {
             /**
+             * @hidden
+             */
deviceOrientationInput: Nullable<FreeCameraDeviceOrientationInput>;
+            /**
              * Add orientation input support to the input manager.
              * @returns the current input manager
              */
@@ -36284,6 +36307,9 @@ declare module BABYLON {
         private _beta;
         private _gamma;
         /**
+         * @hidden
+         */
onDeviceOrientationChangedObservable: Observable<void>;
+        /**
          * Instantiates a new input
          * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
          */
@@ -41798,10 +41824,286 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * A directional light is defined by a direction (what a surprise!).
+     * The light is emitted from everywhere in the specified direction, and has an infinite range.
+     * An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object.
+     * Documentation: https://doc.babylonjs.com/babylon101/lights
+     */
+    export class DirectionalLight extends ShadowLight {
+        private _shadowFrustumSize;
+        /**
+         * Fix frustum size for the shadow generation. This is disabled if the value is 0.
+         */
+        /**
+        * Specifies a fix frustum size for the shadow generation.
+        */
+        shadowFrustumSize: number;
+        private _shadowOrthoScale;
+        /**
+         * Gets the shadow projection scale against the optimal computed one.
+         * 0.1 by default which means that the projection window is increase by 10% from the optimal size.
+         * This does not impact in fixed frustum size (shadowFrustumSize being set)
+         */
+        /**
+        * Sets the shadow projection scale against the optimal computed one.
+        * 0.1 by default which means that the projection window is increase by 10% from the optimal size.
+        * This does not impact in fixed frustum size (shadowFrustumSize being set)
+        */
+        shadowOrthoScale: number;
+        /**
+         * Automatically compute the projection matrix to best fit (including all the casters)
+         * on each frame.
+         */
+        autoUpdateExtends: boolean;
+        private _orthoLeft;
+        private _orthoRight;
+        private _orthoTop;
+        private _orthoBottom;
+        /**
+         * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).
+         * The directional light is emitted from everywhere in the given direction.
+         * It can cast shadows.
+         * Documentation : https://doc.babylonjs.com/babylon101/lights
+         * @param name The friendly name of the light
+         * @param direction The direction of the light
+         * @param scene The scene the light belongs to
+         */
+        constructor(name: string, direction: Vector3, scene: Scene);
+        /**
+         * Returns the string "DirectionalLight".
+         * @return The class name
+         */
+        getClassName(): string;
+        /**
+         * Returns the integer 1.
+         * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x
+         */
+        getTypeID(): number;
+        /**
+         * Sets the passed matrix "matrix" as projection matrix for the shadows cast by the light according to the passed view matrix.
+         * Returns the DirectionalLight Shadow projection matrix.
+         */
+        protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
+        /**
+         * Sets the passed matrix "matrix" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.
+         * Returns the DirectionalLight Shadow projection matrix.
+         */
+        protected _setDefaultFixedFrustumShadowProjectionMatrix(matrix: Matrix): void;
+        /**
+         * Sets the passed matrix "matrix" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.
+         * Returns the DirectionalLight Shadow projection matrix.
+         */
+        protected _setDefaultAutoExtendShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
+        protected _buildUniformLayout(): void;
+        /**
+         * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.
+         * @param effect The effect to update
+         * @param lightIndex The index of the light in the effect to update
+         * @returns The directional light
+         */
+        transferToEffect(effect: Effect, lightIndex: string): DirectionalLight;
+        /**
+         * Gets the minZ used for shadow according to both the scene and the light.
+         *
+         * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
+         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
+         * @param activeCamera The camera we are returning the min for
+         * @returns the depth min z
+         */
+        getDepthMinZ(activeCamera: Camera): number;
+        /**
+         * Gets the maxZ used for shadow according to both the scene and the light.
+         *
+         * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
+         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
+         * @param activeCamera The camera we are returning the max for
+         * @returns the depth max z
+         */
+        getDepthMaxZ(activeCamera: Camera): number;
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        prepareLightSpecificDefines(defines: any, lightIndex: number): void;
+    }
+}
+declare module BABYLON {
+    /**
+     * Class containing static functions to help procedurally build meshes
+     */
+    export class HemisphereBuilder {
+        /**
+         * Creates a hemisphere mesh
+         * @param name defines the name of the mesh
+         * @param options defines the options used to create the mesh
+         * @param scene defines the hosting scene
+         * @returns the hemisphere mesh
+         */
+        static CreateHemisphere(name: string, options: {
+            segments?: number;
+            diameter?: number;
+            sideOrientation?: number;
+        }, scene: any): Mesh;
+    }
+}
+declare module BABYLON {
+    /**
+     * A spot light is defined by a position, a direction, an angle, and an exponent.
+     * These values define a cone of light starting from the position, emitting toward the direction.
+     * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,
+     * and the exponent defines the speed of the decay of the light with distance (reach).
+     * Documentation: https://doc.babylonjs.com/babylon101/lights
+     */
+    export class SpotLight extends ShadowLight {
+        private _angle;
+        private _innerAngle;
+        private _cosHalfAngle;
+        private _lightAngleScale;
+        private _lightAngleOffset;
+        /**
+         * Gets the cone angle of the spot light in Radians.
+         */
+        /**
+        * Sets the cone angle of the spot light in Radians.
+        */
+        angle: number;
+        /**
+         * Only used in gltf falloff mode, this defines the angle where
+         * the directional falloff will start before cutting at angle which could be seen
+         * as outer angle.
+         */
+        /**
+        * Only used in gltf falloff mode, this defines the angle where
+        * the directional falloff will start before cutting at angle which could be seen
+        * as outer angle.
+        */
+        innerAngle: number;
+        private _shadowAngleScale;
+        /**
+         * Allows scaling the angle of the light for shadow generation only.
+         */
+        /**
+        * Allows scaling the angle of the light for shadow generation only.
+        */
+        shadowAngleScale: number;
+        /**
+         * The light decay speed with the distance from the emission spot.
+         */
+        exponent: number;
+        private _projectionTextureMatrix;
+        /**
+        * Allows reading the projecton texture
+        */
+        readonly projectionTextureMatrix: Matrix;
+        protected _projectionTextureLightNear: number;
+        /**
+         * Gets the near clip of the Spotlight for texture projection.
+         */
+        /**
+        * Sets the near clip of the Spotlight for texture projection.
+        */
+        projectionTextureLightNear: number;
+        protected _projectionTextureLightFar: number;
+        /**
+         * Gets the far clip of the Spotlight for texture projection.
+         */
+        /**
+        * Sets the far clip of the Spotlight for texture projection.
+        */
+        projectionTextureLightFar: number;
+        protected _projectionTextureUpDirection: Vector3;
+        /**
+         * Gets the Up vector of the Spotlight for texture projection.
+         */
+        /**
+        * Sets the Up vector of the Spotlight for texture projection.
+        */
+        projectionTextureUpDirection: Vector3;
+        private _projectionTexture;
+        /**
+         * Gets the projection texture of the light.
+        */
+        /**
+        * Sets the projection texture of the light.
+        */
+        projectionTexture: Nullable<BaseTexture>;
+        private _projectionTextureViewLightDirty;
+        private _projectionTextureProjectionLightDirty;
+        private _projectionTextureDirty;
+        private _projectionTextureViewTargetVector;
+        private _projectionTextureViewLightMatrix;
+        private _projectionTextureProjectionLightMatrix;
+        private _projectionTextureScalingMatrix;
+        /**
+         * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.
+         * It can cast shadows.
+         * Documentation : https://doc.babylonjs.com/babylon101/lights
+         * @param name The light friendly name
+         * @param position The position of the spot light in the scene
+         * @param direction The direction of the light in the scene
+         * @param angle The cone angle of the light in Radians
+         * @param exponent The light decay speed with the distance from the emission spot
+         * @param scene The scene the lights belongs to
+         */
+        constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
+        /**
+         * Returns the string "SpotLight".
+         * @returns the class name
+         */
+        getClassName(): string;
+        /**
+         * Returns the integer 2.
+         * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x
+         */
+        getTypeID(): number;
+        /**
+         * Overrides the direction setter to recompute the projection texture view light Matrix.
+         */
+        protected _setDirection(value: Vector3): void;
+        /**
+         * Overrides the position setter to recompute the projection texture view light Matrix.
+         */
+        protected _setPosition(value: Vector3): void;
+        /**
+         * Sets the passed matrix "matrix" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.
+         * Returns the SpotLight.
+         */
+        protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
+        protected _computeProjectionTextureViewLightMatrix(): void;
+        protected _computeProjectionTextureProjectionLightMatrix(): void;
+        /**
+         * Main function for light texture projection matrix computing.
+         */
+        protected _computeProjectionTextureMatrix(): void;
+        protected _buildUniformLayout(): void;
+        private _computeAngleValues;
+        /**
+         * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.
+         * @param effect The effect to update
+         * @param lightIndex The index of the light in the effect to update
+         * @returns The spot light
+         */
+        transferToEffect(effect: Effect, lightIndex: string): SpotLight;
+        /**
+         * Disposes the light and the associated resources.
+         */
+        dispose(): void;
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        prepareLightSpecificDefines(defines: any, lightIndex: number): void;
+    }
+}
+declare module BABYLON {
+    /**
      * Gizmo that enables viewing a light
      */
     export class LightGizmo extends Gizmo {
-        private _box;
+        private _lightMesh;
+        private _material;
         /**
          * Creates a LightGizmo
          * @param gizmoLayer The utility layer the gizmo will be added to
@@ -41817,6 +42119,15 @@ declare module BABYLON {
          * Updates the gizmo to match the attached mesh's position/rotation
          */
         protected _update(): void;
+        private static _Scale;
+        /**
+         * Creates the lines for a light mesh
+         */
+        private static _createLightLines;
+        private static _CreateHemisphericLightMesh;
+        private static _CreatePointLightMesh;
+        private static _CreateSpotLightMesh;
+        private static _CreateDirectionalLightMesh;
     }
 }
 declare module BABYLON {
@@ -43180,6 +43491,160 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * Manages the defines for the PBR Material.
+     * @hidden
+     */
+    export class PBRMaterialDefines extends MaterialDefines implements IImageProcessingConfigurationDefines, IMaterialClearCoatDefines, IMaterialAnisotropicDefines, IMaterialBRDFDefines, IMaterialSheenDefines {
+        PBR: boolean;
+        MAINUV1: boolean;
+        MAINUV2: boolean;
+        UV1: boolean;
+        UV2: boolean;
+        ALBEDO: boolean;
+        ALBEDODIRECTUV: number;
+        VERTEXCOLOR: boolean;
+        AMBIENT: boolean;
+        AMBIENTDIRECTUV: number;
+        AMBIENTINGRAYSCALE: boolean;
+        OPACITY: boolean;
+        VERTEXALPHA: boolean;
+        OPACITYDIRECTUV: number;
+        OPACITYRGB: boolean;
+        ALPHATEST: boolean;
+        DEPTHPREPASS: boolean;
+        ALPHABLEND: boolean;
+        ALPHAFROMALBEDO: boolean;
+        ALPHATESTVALUE: string;
+        SPECULAROVERALPHA: boolean;
+        RADIANCEOVERALPHA: boolean;
+        ALPHAFRESNEL: boolean;
+        LINEARALPHAFRESNEL: boolean;
+        PREMULTIPLYALPHA: boolean;
+        EMISSIVE: boolean;
+        EMISSIVEDIRECTUV: number;
+        REFLECTIVITY: boolean;
+        REFLECTIVITYDIRECTUV: number;
+        SPECULARTERM: boolean;
+        MICROSURFACEFROMREFLECTIVITYMAP: boolean;
+        MICROSURFACEAUTOMATIC: boolean;
+        LODBASEDMICROSFURACE: boolean;
+        MICROSURFACEMAP: boolean;
+        MICROSURFACEMAPDIRECTUV: number;
+        METALLICWORKFLOW: boolean;
+        ROUGHNESSSTOREINMETALMAPALPHA: boolean;
+        ROUGHNESSSTOREINMETALMAPGREEN: boolean;
+        METALLNESSSTOREINMETALMAPBLUE: boolean;
+        AOSTOREINMETALMAPRED: boolean;
+        ENVIRONMENTBRDF: boolean;
+        ENVIRONMENTBRDF_RGBD: boolean;
+        NORMAL: boolean;
+        TANGENT: boolean;
+        BUMP: boolean;
+        BUMPDIRECTUV: number;
+        OBJECTSPACE_NORMALMAP: boolean;
+        PARALLAX: boolean;
+        PARALLAXOCCLUSION: boolean;
+        NORMALXYSCALE: boolean;
+        LIGHTMAP: boolean;
+        LIGHTMAPDIRECTUV: number;
+        USELIGHTMAPASSHADOWMAP: boolean;
+        GAMMALIGHTMAP: boolean;
+        REFLECTION: boolean;
+        REFLECTIONMAP_3D: boolean;
+        REFLECTIONMAP_SPHERICAL: boolean;
+        REFLECTIONMAP_PLANAR: boolean;
+        REFLECTIONMAP_CUBIC: boolean;
+        USE_LOCAL_REFLECTIONMAP_CUBIC: boolean;
+        REFLECTIONMAP_PROJECTION: boolean;
+        REFLECTIONMAP_SKYBOX: boolean;
+        REFLECTIONMAP_SKYBOX_TRANSFORMED: boolean;
+        REFLECTIONMAP_EXPLICIT: boolean;
+        REFLECTIONMAP_EQUIRECTANGULAR: boolean;
+        REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
+        REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
+        INVERTCUBICMAP: boolean;
+        USESPHERICALFROMREFLECTIONMAP: boolean;
+        USESPHERICALINVERTEX: boolean;
+        REFLECTIONMAP_OPPOSITEZ: boolean;
+        LODINREFLECTIONALPHA: boolean;
+        GAMMAREFLECTION: boolean;
+        RGBDREFLECTION: boolean;
+        RADIANCEOCCLUSION: boolean;
+        HORIZONOCCLUSION: boolean;
+        REFRACTION: boolean;
+        REFRACTIONMAP_3D: boolean;
+        REFRACTIONMAP_OPPOSITEZ: boolean;
+        LODINREFRACTIONALPHA: boolean;
+        GAMMAREFRACTION: boolean;
+        RGBDREFRACTION: boolean;
+        LINKREFRACTIONTOTRANSPARENCY: boolean;
+        INSTANCES: boolean;
+        NUM_BONE_INFLUENCERS: number;
+        BonesPerMesh: number;
+        BONETEXTURE: boolean;
+        NONUNIFORMSCALING: boolean;
+        MORPHTARGETS: boolean;
+        MORPHTARGETS_NORMAL: boolean;
+        MORPHTARGETS_TANGENT: boolean;
+        NUM_MORPH_INFLUENCERS: number;
+        IMAGEPROCESSING: boolean;
+        VIGNETTE: boolean;
+        VIGNETTEBLENDMODEMULTIPLY: boolean;
+        VIGNETTEBLENDMODEOPAQUE: boolean;
+        TONEMAPPING: boolean;
+        TONEMAPPING_ACES: boolean;
+        CONTRAST: boolean;
+        COLORCURVES: boolean;
+        COLORGRADING: boolean;
+        COLORGRADING3D: boolean;
+        SAMPLER3DGREENDEPTH: boolean;
+        SAMPLER3DBGRMAP: boolean;
+        IMAGEPROCESSINGPOSTPROCESS: boolean;
+        EXPOSURE: boolean;
+        MULTIVIEW: boolean;
+        USEPHYSICALLIGHTFALLOFF: boolean;
+        USEGLTFLIGHTFALLOFF: boolean;
+        TWOSIDEDLIGHTING: boolean;
+        SHADOWFLOAT: boolean;
+        CLIPPLANE: boolean;
+        CLIPPLANE2: boolean;
+        CLIPPLANE3: boolean;
+        CLIPPLANE4: boolean;
+        POINTSIZE: boolean;
+        FOG: boolean;
+        LOGARITHMICDEPTH: boolean;
+        FORCENORMALFORWARD: boolean;
+        SPECULARAA: boolean;
+        CLEARCOAT: boolean;
+        CLEARCOAT_DEFAULTIOR: boolean;
+        CLEARCOAT_TEXTURE: boolean;
+        CLEARCOAT_TEXTUREDIRECTUV: number;
+        CLEARCOAT_BUMP: boolean;
+        CLEARCOAT_BUMPDIRECTUV: number;
+        CLEARCOAT_TINT: boolean;
+        CLEARCOAT_TINT_TEXTURE: boolean;
+        CLEARCOAT_TINT_TEXTUREDIRECTUV: number;
+        ANISOTROPIC: boolean;
+        ANISOTROPIC_TEXTURE: boolean;
+        ANISOTROPIC_TEXTUREDIRECTUV: number;
+        BRDF_V_HEIGHT_CORRELATED: boolean;
+        MS_BRDF_ENERGY_CONSERVATION: boolean;
+        SHEEN: boolean;
+        SHEEN_TEXTURE: boolean;
+        SHEEN_TEXTUREDIRECTUV: number;
+        SHEEN_LINKWITHALBEDO: boolean;
+        UNLIT: boolean;
+        DEBUGMODE: number;
+        /**
+         * Initializes the PBR Material defines.
+         */
+        constructor();
+        /**
+         * Resets the PBR Material defines.
+         */
+        reset(): void;
+    }
+    /**
      * The Physically based material base class of BJS.
      *
      * This offers the main features of a standard PBR material.
@@ -43563,6 +44028,10 @@ declare module BABYLON {
          */
         readonly sheen: PBRSheenConfiguration;
         /**
+         * Custom callback helping to override the default shader used in the material.
+         */
+        customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: PBRMaterialDefines) => string;
+        /**
          * Instantiates a new PBRMaterial instance.
          *
          * @param name The material name
@@ -43578,11 +44047,6 @@ declare module BABYLON {
          */
         getClassName(): string;
         /**
-         * Gets the name of the material shader.
-         * @returns - string that specifies the shader program of the material.
-         */
-        getShaderName(): string;
-        /**
          * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.
          */
         /**
@@ -46064,112 +46528,6 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
-     * A directional light is defined by a direction (what a surprise!).
-     * The light is emitted from everywhere in the specified direction, and has an infinite range.
-     * An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object.
-     * Documentation: https://doc.babylonjs.com/babylon101/lights
-     */
-    export class DirectionalLight extends ShadowLight {
-        private _shadowFrustumSize;
-        /**
-         * Fix frustum size for the shadow generation. This is disabled if the value is 0.
-         */
-        /**
-        * Specifies a fix frustum size for the shadow generation.
-        */
-        shadowFrustumSize: number;
-        private _shadowOrthoScale;
-        /**
-         * Gets the shadow projection scale against the optimal computed one.
-         * 0.1 by default which means that the projection window is increase by 10% from the optimal size.
-         * This does not impact in fixed frustum size (shadowFrustumSize being set)
-         */
-        /**
-        * Sets the shadow projection scale against the optimal computed one.
-        * 0.1 by default which means that the projection window is increase by 10% from the optimal size.
-        * This does not impact in fixed frustum size (shadowFrustumSize being set)
-        */
-        shadowOrthoScale: number;
-        /**
-         * Automatically compute the projection matrix to best fit (including all the casters)
-         * on each frame.
-         */
-        autoUpdateExtends: boolean;
-        private _orthoLeft;
-        private _orthoRight;
-        private _orthoTop;
-        private _orthoBottom;
-        /**
-         * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).
-         * The directional light is emitted from everywhere in the given direction.
-         * It can cast shadows.
-         * Documentation : https://doc.babylonjs.com/babylon101/lights
-         * @param name The friendly name of the light
-         * @param direction The direction of the light
-         * @param scene The scene the light belongs to
-         */
-        constructor(name: string, direction: Vector3, scene: Scene);
-        /**
-         * Returns the string "DirectionalLight".
-         * @return The class name
-         */
-        getClassName(): string;
-        /**
-         * Returns the integer 1.
-         * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x
-         */
-        getTypeID(): number;
-        /**
-         * Sets the passed matrix "matrix" as projection matrix for the shadows cast by the light according to the passed view matrix.
-         * Returns the DirectionalLight Shadow projection matrix.
-         */
-        protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
-        /**
-         * Sets the passed matrix "matrix" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.
-         * Returns the DirectionalLight Shadow projection matrix.
-         */
-        protected _setDefaultFixedFrustumShadowProjectionMatrix(matrix: Matrix): void;
-        /**
-         * Sets the passed matrix "matrix" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.
-         * Returns the DirectionalLight Shadow projection matrix.
-         */
-        protected _setDefaultAutoExtendShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
-        protected _buildUniformLayout(): void;
-        /**
-         * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.
-         * @param effect The effect to update
-         * @param lightIndex The index of the light in the effect to update
-         * @returns The directional light
-         */
-        transferToEffect(effect: Effect, lightIndex: string): DirectionalLight;
-        /**
-         * Gets the minZ used for shadow according to both the scene and the light.
-         *
-         * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
-         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
-         * @param activeCamera The camera we are returning the min for
-         * @returns the depth min z
-         */
-        getDepthMinZ(activeCamera: Camera): number;
-        /**
-         * Gets the maxZ used for shadow according to both the scene and the light.
-         *
-         * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
-         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
-         * @param activeCamera The camera we are returning the max for
-         * @returns the depth max z
-         */
-        getDepthMaxZ(activeCamera: Camera): number;
-        /**
-         * Prepares the list of defines specific to the light type.
-         * @param defines the list of defines
-         * @param lightIndex defines the index of the light for the effect
-         */
-        prepareLightSpecificDefines(defines: any, lightIndex: number): void;
-    }
-}
-declare module BABYLON {
-    /**
      * A point light is a light defined by an unique point in world space.
      * The light is emitted in every direction from this point.
      * A good example of a point light is a standard light bulb.
@@ -46259,156 +46617,6 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
-     * A spot light is defined by a position, a direction, an angle, and an exponent.
-     * These values define a cone of light starting from the position, emitting toward the direction.
-     * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,
-     * and the exponent defines the speed of the decay of the light with distance (reach).
-     * Documentation: https://doc.babylonjs.com/babylon101/lights
-     */
-    export class SpotLight extends ShadowLight {
-        private _angle;
-        private _innerAngle;
-        private _cosHalfAngle;
-        private _lightAngleScale;
-        private _lightAngleOffset;
-        /**
-         * Gets the cone angle of the spot light in Radians.
-         */
-        /**
-        * Sets the cone angle of the spot light in Radians.
-        */
-        angle: number;
-        /**
-         * Only used in gltf falloff mode, this defines the angle where
-         * the directional falloff will start before cutting at angle which could be seen
-         * as outer angle.
-         */
-        /**
-        * Only used in gltf falloff mode, this defines the angle where
-        * the directional falloff will start before cutting at angle which could be seen
-        * as outer angle.
-        */
-        innerAngle: number;
-        private _shadowAngleScale;
-        /**
-         * Allows scaling the angle of the light for shadow generation only.
-         */
-        /**
-        * Allows scaling the angle of the light for shadow generation only.
-        */
-        shadowAngleScale: number;
-        /**
-         * The light decay speed with the distance from the emission spot.
-         */
-        exponent: number;
-        private _projectionTextureMatrix;
-        /**
-        * Allows reading the projecton texture
-        */
-        readonly projectionTextureMatrix: Matrix;
-        protected _projectionTextureLightNear: number;
-        /**
-         * Gets the near clip of the Spotlight for texture projection.
-         */
-        /**
-        * Sets the near clip of the Spotlight for texture projection.
-        */
-        projectionTextureLightNear: number;
-        protected _projectionTextureLightFar: number;
-        /**
-         * Gets the far clip of the Spotlight for texture projection.
-         */
-        /**
-        * Sets the far clip of the Spotlight for texture projection.
-        */
-        projectionTextureLightFar: number;
-        protected _projectionTextureUpDirection: Vector3;
-        /**
-         * Gets the Up vector of the Spotlight for texture projection.
-         */
-        /**
-        * Sets the Up vector of the Spotlight for texture projection.
-        */
-        projectionTextureUpDirection: Vector3;
-        private _projectionTexture;
-        /**
-         * Gets the projection texture of the light.
-        */
-        /**
-        * Sets the projection texture of the light.
-        */
-        projectionTexture: Nullable<BaseTexture>;
-        private _projectionTextureViewLightDirty;
-        private _projectionTextureProjectionLightDirty;
-        private _projectionTextureDirty;
-        private _projectionTextureViewTargetVector;
-        private _projectionTextureViewLightMatrix;
-        private _projectionTextureProjectionLightMatrix;
-        private _projectionTextureScalingMatrix;
-        /**
-         * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.
-         * It can cast shadows.
-         * Documentation : https://doc.babylonjs.com/babylon101/lights
-         * @param name The light friendly name
-         * @param position The position of the spot light in the scene
-         * @param direction The direction of the light in the scene
-         * @param angle The cone angle of the light in Radians
-         * @param exponent The light decay speed with the distance from the emission spot
-         * @param scene The scene the lights belongs to
-         */
-        constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
-        /**
-         * Returns the string "SpotLight".
-         * @returns the class name
-         */
-        getClassName(): string;
-        /**
-         * Returns the integer 2.
-         * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x
-         */
-        getTypeID(): number;
-        /**
-         * Overrides the direction setter to recompute the projection texture view light Matrix.
-         */
-        protected _setDirection(value: Vector3): void;
-        /**
-         * Overrides the position setter to recompute the projection texture view light Matrix.
-         */
-        protected _setPosition(value: Vector3): void;
-        /**
-         * Sets the passed matrix "matrix" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.
-         * Returns the SpotLight.
-         */
-        protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
-        protected _computeProjectionTextureViewLightMatrix(): void;
-        protected _computeProjectionTextureProjectionLightMatrix(): void;
-        /**
-         * Main function for light texture projection matrix computing.
-         */
-        protected _computeProjectionTextureMatrix(): void;
-        protected _buildUniformLayout(): void;
-        private _computeAngleValues;
-        /**
-         * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.
-         * @param effect The effect to update
-         * @param lightIndex The index of the light in the effect to update
-         * @returns The spot light
-         */
-        transferToEffect(effect: Effect, lightIndex: string): SpotLight;
-        /**
-         * Disposes the light and the associated resources.
-         */
-        dispose(): void;
-        /**
-         * Prepares the list of defines specific to the light type.
-         * @param defines the list of defines
-         * @param lightIndex defines the index of the light for the effect
-         */
-        prepareLightSpecificDefines(defines: any, lightIndex: number): void;
-    }
-}
-declare module BABYLON {
-    /**
      * Header information of HDR texture files.
      */
     export interface HDRInfo {
@@ -62669,6 +62877,8 @@ declare module BABYLON {
         Fragment_Definitions: string;
         Fragment_MainBegin: string;
         Fragment_Custom_Diffuse: string;
+        Fragment_Before_Lights: string;
+        Fragment_Before_Fog: string;
         Fragment_Custom_Alpha: string;
         Fragment_Before_FragColor: string;
         Vertex_Begin: string;
@@ -62676,6 +62886,7 @@ declare module BABYLON {
         Vertex_MainBegin: string;
         Vertex_Before_PositionUpdated: string;
         Vertex_Before_NormalUpdated: string;
+        Vertex_MainEnd: string;
     }
     export class CustomMaterial extends BABYLON.StandardMaterial {
         static ShaderIndexer: number;
@@ -62692,12 +62903,59 @@ declare module BABYLON {
         Fragment_MainBegin(shaderPart: string): CustomMaterial;
         Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
         Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
+        Fragment_Before_Lights(shaderPart: string): CustomMaterial;
+        Fragment_Before_Fog(shaderPart: string): CustomMaterial;
         Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
         Vertex_Begin(shaderPart: string): CustomMaterial;
         Vertex_Definitions(shaderPart: string): CustomMaterial;
         Vertex_MainBegin(shaderPart: string): CustomMaterial;
         Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
         Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
+        Vertex_MainEnd(shaderPart: string): CustomMaterial;
+    }
+}
+declare module BABYLON {
+    export class ShaderAlebdoParts {
+        constructor();
+        Fragment_Begin: string;
+        Fragment_Definitions: string;
+        Fragment_MainBegin: string;
+        Fragment_Custom_Albedo: string;
+        Fragment_Before_Lights: string;
+        Fragment_Before_Fog: string;
+        Fragment_Custom_Alpha: string;
+        Fragment_Before_FragColor: string;
+        Vertex_Begin: string;
+        Vertex_Definitions: string;
+        Vertex_MainBegin: string;
+        Vertex_Before_PositionUpdated: string;
+        Vertex_Before_NormalUpdated: string;
+        Vertex_MainEnd: string;
+    }
+    export class PBRCustomMaterial extends BABYLON.PBRMaterial {
+        static ShaderIndexer: number;
+        CustomParts: ShaderAlebdoParts;
isCreatedShader: boolean;
createdShaderName: string;
customUniform: string[];
newUniforms: string[];
newUniformInstances: any[];
newSamplerInstances: BABYLON.Texture[];
+        FragmentShader: string;
+        VertexShader: string;
+        AttachAfterBind(mesh: BABYLON.Mesh, effect: BABYLON.Effect): void;
+        ReviewUniform(name: string, arr: string[]): string[];
+        Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: BABYLON.PBRMaterialDefines): string;
+        constructor(name: string, scene: BABYLON.Scene);
+        AddUniform(name: string, kind: string, param: any): PBRCustomMaterial;
+        Fragment_Begin(shaderPart: string): PBRCustomMaterial;
+        Fragment_Definitions(shaderPart: string): PBRCustomMaterial;
+        Fragment_MainBegin(shaderPart: string): PBRCustomMaterial;
+        Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial;
+        Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial;
+        Vertex_Begin(shaderPart: string): PBRCustomMaterial;
+        Vertex_Definitions(shaderPart: string): PBRCustomMaterial;
+        Vertex_MainBegin(shaderPart: string): PBRCustomMaterial;
+        Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial;
+        Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial;
+        Vertex_MainEnd(shaderPart: string): PBRCustomMaterial;
     }
 }
 declare module BABYLON {

二进制
Playground/textures/BJS-logo_v3-astc.ktx


二进制
Playground/textures/BJS-logo_v3-dxt.ktx


二进制
Playground/textures/BJS-logo_v3-etc2.ktx


二进制
Playground/textures/BJS-logo_v3-pvrtc.ktx


二进制
Playground/textures/checkerBJS-astc.ktx


二进制
Playground/textures/checkerBJS-dxt.ktx


二进制
Playground/textures/checkerBJS-etc2.ktx


二进制
Playground/textures/checkerBJS-pvrtc.ktx


二进制
Playground/textures/cubemapDebug/_nx-astc.ktx


二进制
Playground/textures/cubemapDebug/_nx-dxt.ktx


二进制
Playground/textures/cubemapDebug/_nx-etc1.ktx


二进制
Playground/textures/cubemapDebug/_nx-etc2.ktx


二进制
Playground/textures/cubemapDebug/_nx-pvrtc.ktx


二进制
Playground/textures/cubemapDebug/_nx.jpg


二进制
Playground/textures/cubemapDebug/_ny-astc.ktx


二进制
Playground/textures/cubemapDebug/_ny-dxt.ktx


二进制
Playground/textures/cubemapDebug/_ny-etc1.ktx


二进制
Playground/textures/cubemapDebug/_ny-etc2.ktx


二进制
Playground/textures/cubemapDebug/_ny-pvrtc.ktx


二进制
Playground/textures/cubemapDebug/_ny.jpg


二进制
Playground/textures/cubemapDebug/_nz-astc.ktx


二进制
Playground/textures/cubemapDebug/_nz-dxt.ktx


二进制
Playground/textures/cubemapDebug/_nz-etc1.ktx


二进制
Playground/textures/cubemapDebug/_nz-etc2.ktx


二进制
Playground/textures/cubemapDebug/_nz-pvrtc.ktx


二进制
Playground/textures/cubemapDebug/_nz.jpg


二进制
Playground/textures/cubemapDebug/_px-astc.ktx


二进制
Playground/textures/cubemapDebug/_px-dxt.ktx


二进制
Playground/textures/cubemapDebug/_px-etc1.ktx


二进制
Playground/textures/cubemapDebug/_px-etc2.ktx


二进制
Playground/textures/cubemapDebug/_px-pvrtc.ktx


二进制
Playground/textures/cubemapDebug/_px.jpg


二进制
Playground/textures/cubemapDebug/_py-astc.ktx


二进制
Playground/textures/cubemapDebug/_py-dxt.ktx


二进制
Playground/textures/cubemapDebug/_py-etc1.ktx


二进制
Playground/textures/cubemapDebug/_py-etc2.ktx


二进制
Playground/textures/cubemapDebug/_py-pvrtc.ktx


二进制
Playground/textures/cubemapDebug/_py.jpg


二进制
Playground/textures/cubemapDebug/_pz-astc.ktx


二进制
Playground/textures/cubemapDebug/_pz-dxt.ktx


二进制
Playground/textures/cubemapDebug/_pz-etc1.ktx


二进制
Playground/textures/cubemapDebug/_pz-etc2.ktx


二进制
Playground/textures/cubemapDebug/_pz-pvrtc.ktx


二进制
Playground/textures/cubemapDebug/_pz.jpg


+ 474 - 262
dist/preview release/babylon.d.ts

@@ -12180,6 +12180,14 @@ declare module BABYLON {
      */
     export class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
         /**
+         * @hidden
+         */
+        _keyboardInput: Nullable<FreeCameraKeyboardMoveInput>;
+        /**
+         * @hidden
+         */
+        _mouseInput: Nullable<FreeCameraMouseInput>;
+        /**
          * Instantiates a new FreeCameraInputsManager.
          * @param camera Defines the camera the inputs belong to
          */
@@ -12196,6 +12204,11 @@ declare module BABYLON {
          */
         addMouse(touchEnabled?: boolean): FreeCameraInputsManager;
         /**
+         * Removes the mouse input support from the manager
+         * @returns the current input manager
+         */
+        removeMouse(): FreeCameraInputsManager;
+        /**
          * Add touch input support to the input manager.
          * @returns the current input manager
          */
@@ -21207,6 +21220,15 @@ declare module BABYLON {
           */
         static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
         /**
+          * Creates a hemisphere mesh. Please consider using the same method from the MeshBuilder class instead
+          * @param name defines the name of the mesh to create
+          * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)
+          * @param diameter sets the diameter size (float) of the sphere (default 1)
+          * @param scene defines the hosting scene
+          * @returns a new Mesh
+          */
+        static CreateHemisphere(name: string, segments: number, diameter: number, scene?: Scene): Mesh;
+        /**
          * Creates a cylinder or a cone mesh. Please consider using the same method from the MeshBuilder class instead
          * @param name defines the name of the mesh to create
          * @param height sets the height size (float) of the cylinder/cone (float, default 2)
@@ -36873,6 +36895,10 @@ declare module BABYLON {
 declare module BABYLON {
         interface FreeCameraInputsManager {
             /**
+             * @hidden
+             */
+            _deviceOrientationInput: Nullable<FreeCameraDeviceOrientationInput>;
+            /**
              * Add orientation input support to the input manager.
              * @returns the current input manager
              */
@@ -36892,6 +36918,10 @@ declare module BABYLON {
         private _beta;
         private _gamma;
         /**
+         * @hidden
+         */
+        _onDeviceOrientationChangedObservable: Observable<void>;
+        /**
          * Instantiates a new input
          * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
          */
@@ -42446,10 +42476,286 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * A directional light is defined by a direction (what a surprise!).
+     * The light is emitted from everywhere in the specified direction, and has an infinite range.
+     * An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object.
+     * Documentation: https://doc.babylonjs.com/babylon101/lights
+     */
+    export class DirectionalLight extends ShadowLight {
+        private _shadowFrustumSize;
+        /**
+         * Fix frustum size for the shadow generation. This is disabled if the value is 0.
+         */
+        /**
+        * Specifies a fix frustum size for the shadow generation.
+        */
+        shadowFrustumSize: number;
+        private _shadowOrthoScale;
+        /**
+         * Gets the shadow projection scale against the optimal computed one.
+         * 0.1 by default which means that the projection window is increase by 10% from the optimal size.
+         * This does not impact in fixed frustum size (shadowFrustumSize being set)
+         */
+        /**
+        * Sets the shadow projection scale against the optimal computed one.
+        * 0.1 by default which means that the projection window is increase by 10% from the optimal size.
+        * This does not impact in fixed frustum size (shadowFrustumSize being set)
+        */
+        shadowOrthoScale: number;
+        /**
+         * Automatically compute the projection matrix to best fit (including all the casters)
+         * on each frame.
+         */
+        autoUpdateExtends: boolean;
+        private _orthoLeft;
+        private _orthoRight;
+        private _orthoTop;
+        private _orthoBottom;
+        /**
+         * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).
+         * The directional light is emitted from everywhere in the given direction.
+         * It can cast shadows.
+         * Documentation : https://doc.babylonjs.com/babylon101/lights
+         * @param name The friendly name of the light
+         * @param direction The direction of the light
+         * @param scene The scene the light belongs to
+         */
+        constructor(name: string, direction: Vector3, scene: Scene);
+        /**
+         * Returns the string "DirectionalLight".
+         * @return The class name
+         */
+        getClassName(): string;
+        /**
+         * Returns the integer 1.
+         * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x
+         */
+        getTypeID(): number;
+        /**
+         * Sets the passed matrix "matrix" as projection matrix for the shadows cast by the light according to the passed view matrix.
+         * Returns the DirectionalLight Shadow projection matrix.
+         */
+        protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
+        /**
+         * Sets the passed matrix "matrix" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.
+         * Returns the DirectionalLight Shadow projection matrix.
+         */
+        protected _setDefaultFixedFrustumShadowProjectionMatrix(matrix: Matrix): void;
+        /**
+         * Sets the passed matrix "matrix" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.
+         * Returns the DirectionalLight Shadow projection matrix.
+         */
+        protected _setDefaultAutoExtendShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
+        protected _buildUniformLayout(): void;
+        /**
+         * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.
+         * @param effect The effect to update
+         * @param lightIndex The index of the light in the effect to update
+         * @returns The directional light
+         */
+        transferToEffect(effect: Effect, lightIndex: string): DirectionalLight;
+        /**
+         * Gets the minZ used for shadow according to both the scene and the light.
+         *
+         * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
+         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
+         * @param activeCamera The camera we are returning the min for
+         * @returns the depth min z
+         */
+        getDepthMinZ(activeCamera: Camera): number;
+        /**
+         * Gets the maxZ used for shadow according to both the scene and the light.
+         *
+         * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
+         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
+         * @param activeCamera The camera we are returning the max for
+         * @returns the depth max z
+         */
+        getDepthMaxZ(activeCamera: Camera): number;
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        prepareLightSpecificDefines(defines: any, lightIndex: number): void;
+    }
+}
+declare module BABYLON {
+    /**
+     * Class containing static functions to help procedurally build meshes
+     */
+    export class HemisphereBuilder {
+        /**
+         * Creates a hemisphere mesh
+         * @param name defines the name of the mesh
+         * @param options defines the options used to create the mesh
+         * @param scene defines the hosting scene
+         * @returns the hemisphere mesh
+         */
+        static CreateHemisphere(name: string, options: {
+            segments?: number;
+            diameter?: number;
+            sideOrientation?: number;
+        }, scene: any): Mesh;
+    }
+}
+declare module BABYLON {
+    /**
+     * A spot light is defined by a position, a direction, an angle, and an exponent.
+     * These values define a cone of light starting from the position, emitting toward the direction.
+     * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,
+     * and the exponent defines the speed of the decay of the light with distance (reach).
+     * Documentation: https://doc.babylonjs.com/babylon101/lights
+     */
+    export class SpotLight extends ShadowLight {
+        private _angle;
+        private _innerAngle;
+        private _cosHalfAngle;
+        private _lightAngleScale;
+        private _lightAngleOffset;
+        /**
+         * Gets the cone angle of the spot light in Radians.
+         */
+        /**
+        * Sets the cone angle of the spot light in Radians.
+        */
+        angle: number;
+        /**
+         * Only used in gltf falloff mode, this defines the angle where
+         * the directional falloff will start before cutting at angle which could be seen
+         * as outer angle.
+         */
+        /**
+        * Only used in gltf falloff mode, this defines the angle where
+        * the directional falloff will start before cutting at angle which could be seen
+        * as outer angle.
+        */
+        innerAngle: number;
+        private _shadowAngleScale;
+        /**
+         * Allows scaling the angle of the light for shadow generation only.
+         */
+        /**
+        * Allows scaling the angle of the light for shadow generation only.
+        */
+        shadowAngleScale: number;
+        /**
+         * The light decay speed with the distance from the emission spot.
+         */
+        exponent: number;
+        private _projectionTextureMatrix;
+        /**
+        * Allows reading the projecton texture
+        */
+        readonly projectionTextureMatrix: Matrix;
+        protected _projectionTextureLightNear: number;
+        /**
+         * Gets the near clip of the Spotlight for texture projection.
+         */
+        /**
+        * Sets the near clip of the Spotlight for texture projection.
+        */
+        projectionTextureLightNear: number;
+        protected _projectionTextureLightFar: number;
+        /**
+         * Gets the far clip of the Spotlight for texture projection.
+         */
+        /**
+        * Sets the far clip of the Spotlight for texture projection.
+        */
+        projectionTextureLightFar: number;
+        protected _projectionTextureUpDirection: Vector3;
+        /**
+         * Gets the Up vector of the Spotlight for texture projection.
+         */
+        /**
+        * Sets the Up vector of the Spotlight for texture projection.
+        */
+        projectionTextureUpDirection: Vector3;
+        private _projectionTexture;
+        /**
+         * Gets the projection texture of the light.
+        */
+        /**
+        * Sets the projection texture of the light.
+        */
+        projectionTexture: Nullable<BaseTexture>;
+        private _projectionTextureViewLightDirty;
+        private _projectionTextureProjectionLightDirty;
+        private _projectionTextureDirty;
+        private _projectionTextureViewTargetVector;
+        private _projectionTextureViewLightMatrix;
+        private _projectionTextureProjectionLightMatrix;
+        private _projectionTextureScalingMatrix;
+        /**
+         * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.
+         * It can cast shadows.
+         * Documentation : https://doc.babylonjs.com/babylon101/lights
+         * @param name The light friendly name
+         * @param position The position of the spot light in the scene
+         * @param direction The direction of the light in the scene
+         * @param angle The cone angle of the light in Radians
+         * @param exponent The light decay speed with the distance from the emission spot
+         * @param scene The scene the lights belongs to
+         */
+        constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
+        /**
+         * Returns the string "SpotLight".
+         * @returns the class name
+         */
+        getClassName(): string;
+        /**
+         * Returns the integer 2.
+         * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x
+         */
+        getTypeID(): number;
+        /**
+         * Overrides the direction setter to recompute the projection texture view light Matrix.
+         */
+        protected _setDirection(value: Vector3): void;
+        /**
+         * Overrides the position setter to recompute the projection texture view light Matrix.
+         */
+        protected _setPosition(value: Vector3): void;
+        /**
+         * Sets the passed matrix "matrix" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.
+         * Returns the SpotLight.
+         */
+        protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
+        protected _computeProjectionTextureViewLightMatrix(): void;
+        protected _computeProjectionTextureProjectionLightMatrix(): void;
+        /**
+         * Main function for light texture projection matrix computing.
+         */
+        protected _computeProjectionTextureMatrix(): void;
+        protected _buildUniformLayout(): void;
+        private _computeAngleValues;
+        /**
+         * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.
+         * @param effect The effect to update
+         * @param lightIndex The index of the light in the effect to update
+         * @returns The spot light
+         */
+        transferToEffect(effect: Effect, lightIndex: string): SpotLight;
+        /**
+         * Disposes the light and the associated resources.
+         */
+        dispose(): void;
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        prepareLightSpecificDefines(defines: any, lightIndex: number): void;
+    }
+}
+declare module BABYLON {
+    /**
      * Gizmo that enables viewing a light
      */
     export class LightGizmo extends Gizmo {
-        private _box;
+        private _lightMesh;
+        private _material;
         /**
          * Creates a LightGizmo
          * @param gizmoLayer The utility layer the gizmo will be added to
@@ -42465,6 +42771,15 @@ declare module BABYLON {
          * Updates the gizmo to match the attached mesh's position/rotation
          */
         protected _update(): void;
+        private static _Scale;
+        /**
+         * Creates the lines for a light mesh
+         */
+        private static _createLightLines;
+        private static _CreateHemisphericLightMesh;
+        private static _CreatePointLightMesh;
+        private static _CreateSpotLightMesh;
+        private static _CreateDirectionalLightMesh;
     }
 }
 declare module BABYLON {
@@ -43838,6 +44153,160 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
+     * Manages the defines for the PBR Material.
+     * @hidden
+     */
+    export class PBRMaterialDefines extends MaterialDefines implements IImageProcessingConfigurationDefines, IMaterialClearCoatDefines, IMaterialAnisotropicDefines, IMaterialBRDFDefines, IMaterialSheenDefines {
+        PBR: boolean;
+        MAINUV1: boolean;
+        MAINUV2: boolean;
+        UV1: boolean;
+        UV2: boolean;
+        ALBEDO: boolean;
+        ALBEDODIRECTUV: number;
+        VERTEXCOLOR: boolean;
+        AMBIENT: boolean;
+        AMBIENTDIRECTUV: number;
+        AMBIENTINGRAYSCALE: boolean;
+        OPACITY: boolean;
+        VERTEXALPHA: boolean;
+        OPACITYDIRECTUV: number;
+        OPACITYRGB: boolean;
+        ALPHATEST: boolean;
+        DEPTHPREPASS: boolean;
+        ALPHABLEND: boolean;
+        ALPHAFROMALBEDO: boolean;
+        ALPHATESTVALUE: string;
+        SPECULAROVERALPHA: boolean;
+        RADIANCEOVERALPHA: boolean;
+        ALPHAFRESNEL: boolean;
+        LINEARALPHAFRESNEL: boolean;
+        PREMULTIPLYALPHA: boolean;
+        EMISSIVE: boolean;
+        EMISSIVEDIRECTUV: number;
+        REFLECTIVITY: boolean;
+        REFLECTIVITYDIRECTUV: number;
+        SPECULARTERM: boolean;
+        MICROSURFACEFROMREFLECTIVITYMAP: boolean;
+        MICROSURFACEAUTOMATIC: boolean;
+        LODBASEDMICROSFURACE: boolean;
+        MICROSURFACEMAP: boolean;
+        MICROSURFACEMAPDIRECTUV: number;
+        METALLICWORKFLOW: boolean;
+        ROUGHNESSSTOREINMETALMAPALPHA: boolean;
+        ROUGHNESSSTOREINMETALMAPGREEN: boolean;
+        METALLNESSSTOREINMETALMAPBLUE: boolean;
+        AOSTOREINMETALMAPRED: boolean;
+        ENVIRONMENTBRDF: boolean;
+        ENVIRONMENTBRDF_RGBD: boolean;
+        NORMAL: boolean;
+        TANGENT: boolean;
+        BUMP: boolean;
+        BUMPDIRECTUV: number;
+        OBJECTSPACE_NORMALMAP: boolean;
+        PARALLAX: boolean;
+        PARALLAXOCCLUSION: boolean;
+        NORMALXYSCALE: boolean;
+        LIGHTMAP: boolean;
+        LIGHTMAPDIRECTUV: number;
+        USELIGHTMAPASSHADOWMAP: boolean;
+        GAMMALIGHTMAP: boolean;
+        REFLECTION: boolean;
+        REFLECTIONMAP_3D: boolean;
+        REFLECTIONMAP_SPHERICAL: boolean;
+        REFLECTIONMAP_PLANAR: boolean;
+        REFLECTIONMAP_CUBIC: boolean;
+        USE_LOCAL_REFLECTIONMAP_CUBIC: boolean;
+        REFLECTIONMAP_PROJECTION: boolean;
+        REFLECTIONMAP_SKYBOX: boolean;
+        REFLECTIONMAP_SKYBOX_TRANSFORMED: boolean;
+        REFLECTIONMAP_EXPLICIT: boolean;
+        REFLECTIONMAP_EQUIRECTANGULAR: boolean;
+        REFLECTIONMAP_EQUIRECTANGULAR_FIXED: boolean;
+        REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED: boolean;
+        INVERTCUBICMAP: boolean;
+        USESPHERICALFROMREFLECTIONMAP: boolean;
+        USESPHERICALINVERTEX: boolean;
+        REFLECTIONMAP_OPPOSITEZ: boolean;
+        LODINREFLECTIONALPHA: boolean;
+        GAMMAREFLECTION: boolean;
+        RGBDREFLECTION: boolean;
+        RADIANCEOCCLUSION: boolean;
+        HORIZONOCCLUSION: boolean;
+        REFRACTION: boolean;
+        REFRACTIONMAP_3D: boolean;
+        REFRACTIONMAP_OPPOSITEZ: boolean;
+        LODINREFRACTIONALPHA: boolean;
+        GAMMAREFRACTION: boolean;
+        RGBDREFRACTION: boolean;
+        LINKREFRACTIONTOTRANSPARENCY: boolean;
+        INSTANCES: boolean;
+        NUM_BONE_INFLUENCERS: number;
+        BonesPerMesh: number;
+        BONETEXTURE: boolean;
+        NONUNIFORMSCALING: boolean;
+        MORPHTARGETS: boolean;
+        MORPHTARGETS_NORMAL: boolean;
+        MORPHTARGETS_TANGENT: boolean;
+        NUM_MORPH_INFLUENCERS: number;
+        IMAGEPROCESSING: boolean;
+        VIGNETTE: boolean;
+        VIGNETTEBLENDMODEMULTIPLY: boolean;
+        VIGNETTEBLENDMODEOPAQUE: boolean;
+        TONEMAPPING: boolean;
+        TONEMAPPING_ACES: boolean;
+        CONTRAST: boolean;
+        COLORCURVES: boolean;
+        COLORGRADING: boolean;
+        COLORGRADING3D: boolean;
+        SAMPLER3DGREENDEPTH: boolean;
+        SAMPLER3DBGRMAP: boolean;
+        IMAGEPROCESSINGPOSTPROCESS: boolean;
+        EXPOSURE: boolean;
+        MULTIVIEW: boolean;
+        USEPHYSICALLIGHTFALLOFF: boolean;
+        USEGLTFLIGHTFALLOFF: boolean;
+        TWOSIDEDLIGHTING: boolean;
+        SHADOWFLOAT: boolean;
+        CLIPPLANE: boolean;
+        CLIPPLANE2: boolean;
+        CLIPPLANE3: boolean;
+        CLIPPLANE4: boolean;
+        POINTSIZE: boolean;
+        FOG: boolean;
+        LOGARITHMICDEPTH: boolean;
+        FORCENORMALFORWARD: boolean;
+        SPECULARAA: boolean;
+        CLEARCOAT: boolean;
+        CLEARCOAT_DEFAULTIOR: boolean;
+        CLEARCOAT_TEXTURE: boolean;
+        CLEARCOAT_TEXTUREDIRECTUV: number;
+        CLEARCOAT_BUMP: boolean;
+        CLEARCOAT_BUMPDIRECTUV: number;
+        CLEARCOAT_TINT: boolean;
+        CLEARCOAT_TINT_TEXTURE: boolean;
+        CLEARCOAT_TINT_TEXTUREDIRECTUV: number;
+        ANISOTROPIC: boolean;
+        ANISOTROPIC_TEXTURE: boolean;
+        ANISOTROPIC_TEXTUREDIRECTUV: number;
+        BRDF_V_HEIGHT_CORRELATED: boolean;
+        MS_BRDF_ENERGY_CONSERVATION: boolean;
+        SHEEN: boolean;
+        SHEEN_TEXTURE: boolean;
+        SHEEN_TEXTUREDIRECTUV: number;
+        SHEEN_LINKWITHALBEDO: boolean;
+        UNLIT: boolean;
+        DEBUGMODE: number;
+        /**
+         * Initializes the PBR Material defines.
+         */
+        constructor();
+        /**
+         * Resets the PBR Material defines.
+         */
+        reset(): void;
+    }
+    /**
      * The Physically based material base class of BJS.
      *
      * This offers the main features of a standard PBR material.
@@ -44221,6 +44690,10 @@ declare module BABYLON {
          */
         readonly sheen: PBRSheenConfiguration;
         /**
+         * Custom callback helping to override the default shader used in the material.
+         */
+        customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: PBRMaterialDefines) => string;
+        /**
          * Instantiates a new PBRMaterial instance.
          *
          * @param name The material name
@@ -44236,11 +44709,6 @@ declare module BABYLON {
          */
         getClassName(): string;
         /**
-         * Gets the name of the material shader.
-         * @returns - string that specifies the shader program of the material.
-         */
-        getShaderName(): string;
-        /**
          * Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.
          */
         /**
@@ -46729,112 +47197,6 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
-     * A directional light is defined by a direction (what a surprise!).
-     * The light is emitted from everywhere in the specified direction, and has an infinite range.
-     * An example of a directional light is when a distance planet is lit by the apparently parallel lines of light from its sun. Light in a downward direction will light the top of an object.
-     * Documentation: https://doc.babylonjs.com/babylon101/lights
-     */
-    export class DirectionalLight extends ShadowLight {
-        private _shadowFrustumSize;
-        /**
-         * Fix frustum size for the shadow generation. This is disabled if the value is 0.
-         */
-        /**
-        * Specifies a fix frustum size for the shadow generation.
-        */
-        shadowFrustumSize: number;
-        private _shadowOrthoScale;
-        /**
-         * Gets the shadow projection scale against the optimal computed one.
-         * 0.1 by default which means that the projection window is increase by 10% from the optimal size.
-         * This does not impact in fixed frustum size (shadowFrustumSize being set)
-         */
-        /**
-        * Sets the shadow projection scale against the optimal computed one.
-        * 0.1 by default which means that the projection window is increase by 10% from the optimal size.
-        * This does not impact in fixed frustum size (shadowFrustumSize being set)
-        */
-        shadowOrthoScale: number;
-        /**
-         * Automatically compute the projection matrix to best fit (including all the casters)
-         * on each frame.
-         */
-        autoUpdateExtends: boolean;
-        private _orthoLeft;
-        private _orthoRight;
-        private _orthoTop;
-        private _orthoBottom;
-        /**
-         * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).
-         * The directional light is emitted from everywhere in the given direction.
-         * It can cast shadows.
-         * Documentation : https://doc.babylonjs.com/babylon101/lights
-         * @param name The friendly name of the light
-         * @param direction The direction of the light
-         * @param scene The scene the light belongs to
-         */
-        constructor(name: string, direction: Vector3, scene: Scene);
-        /**
-         * Returns the string "DirectionalLight".
-         * @return The class name
-         */
-        getClassName(): string;
-        /**
-         * Returns the integer 1.
-         * @return The light Type id as a constant defines in Light.LIGHTTYPEID_x
-         */
-        getTypeID(): number;
-        /**
-         * Sets the passed matrix "matrix" as projection matrix for the shadows cast by the light according to the passed view matrix.
-         * Returns the DirectionalLight Shadow projection matrix.
-         */
-        protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
-        /**
-         * Sets the passed matrix "matrix" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.
-         * Returns the DirectionalLight Shadow projection matrix.
-         */
-        protected _setDefaultFixedFrustumShadowProjectionMatrix(matrix: Matrix): void;
-        /**
-         * Sets the passed matrix "matrix" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.
-         * Returns the DirectionalLight Shadow projection matrix.
-         */
-        protected _setDefaultAutoExtendShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
-        protected _buildUniformLayout(): void;
-        /**
-         * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.
-         * @param effect The effect to update
-         * @param lightIndex The index of the light in the effect to update
-         * @returns The directional light
-         */
-        transferToEffect(effect: Effect, lightIndex: string): DirectionalLight;
-        /**
-         * Gets the minZ used for shadow according to both the scene and the light.
-         *
-         * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
-         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
-         * @param activeCamera The camera we are returning the min for
-         * @returns the depth min z
-         */
-        getDepthMinZ(activeCamera: Camera): number;
-        /**
-         * Gets the maxZ used for shadow according to both the scene and the light.
-         *
-         * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
-         * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
-         * @param activeCamera The camera we are returning the max for
-         * @returns the depth max z
-         */
-        getDepthMaxZ(activeCamera: Camera): number;
-        /**
-         * Prepares the list of defines specific to the light type.
-         * @param defines the list of defines
-         * @param lightIndex defines the index of the light for the effect
-         */
-        prepareLightSpecificDefines(defines: any, lightIndex: number): void;
-    }
-}
-declare module BABYLON {
-    /**
      * A point light is a light defined by an unique point in world space.
      * The light is emitted in every direction from this point.
      * A good example of a point light is a standard light bulb.
@@ -46924,156 +47286,6 @@ declare module BABYLON {
 }
 declare module BABYLON {
     /**
-     * A spot light is defined by a position, a direction, an angle, and an exponent.
-     * These values define a cone of light starting from the position, emitting toward the direction.
-     * The angle, in radians, defines the size (field of illumination) of the spotlight's conical beam,
-     * and the exponent defines the speed of the decay of the light with distance (reach).
-     * Documentation: https://doc.babylonjs.com/babylon101/lights
-     */
-    export class SpotLight extends ShadowLight {
-        private _angle;
-        private _innerAngle;
-        private _cosHalfAngle;
-        private _lightAngleScale;
-        private _lightAngleOffset;
-        /**
-         * Gets the cone angle of the spot light in Radians.
-         */
-        /**
-        * Sets the cone angle of the spot light in Radians.
-        */
-        angle: number;
-        /**
-         * Only used in gltf falloff mode, this defines the angle where
-         * the directional falloff will start before cutting at angle which could be seen
-         * as outer angle.
-         */
-        /**
-        * Only used in gltf falloff mode, this defines the angle where
-        * the directional falloff will start before cutting at angle which could be seen
-        * as outer angle.
-        */
-        innerAngle: number;
-        private _shadowAngleScale;
-        /**
-         * Allows scaling the angle of the light for shadow generation only.
-         */
-        /**
-        * Allows scaling the angle of the light for shadow generation only.
-        */
-        shadowAngleScale: number;
-        /**
-         * The light decay speed with the distance from the emission spot.
-         */
-        exponent: number;
-        private _projectionTextureMatrix;
-        /**
-        * Allows reading the projecton texture
-        */
-        readonly projectionTextureMatrix: Matrix;
-        protected _projectionTextureLightNear: number;
-        /**
-         * Gets the near clip of the Spotlight for texture projection.
-         */
-        /**
-        * Sets the near clip of the Spotlight for texture projection.
-        */
-        projectionTextureLightNear: number;
-        protected _projectionTextureLightFar: number;
-        /**
-         * Gets the far clip of the Spotlight for texture projection.
-         */
-        /**
-        * Sets the far clip of the Spotlight for texture projection.
-        */
-        projectionTextureLightFar: number;
-        protected _projectionTextureUpDirection: Vector3;
-        /**
-         * Gets the Up vector of the Spotlight for texture projection.
-         */
-        /**
-        * Sets the Up vector of the Spotlight for texture projection.
-        */
-        projectionTextureUpDirection: Vector3;
-        private _projectionTexture;
-        /**
-         * Gets the projection texture of the light.
-        */
-        /**
-        * Sets the projection texture of the light.
-        */
-        projectionTexture: Nullable<BaseTexture>;
-        private _projectionTextureViewLightDirty;
-        private _projectionTextureProjectionLightDirty;
-        private _projectionTextureDirty;
-        private _projectionTextureViewTargetVector;
-        private _projectionTextureViewLightMatrix;
-        private _projectionTextureProjectionLightMatrix;
-        private _projectionTextureScalingMatrix;
-        /**
-         * Creates a SpotLight object in the scene. A spot light is a simply light oriented cone.
-         * It can cast shadows.
-         * Documentation : https://doc.babylonjs.com/babylon101/lights
-         * @param name The light friendly name
-         * @param position The position of the spot light in the scene
-         * @param direction The direction of the light in the scene
-         * @param angle The cone angle of the light in Radians
-         * @param exponent The light decay speed with the distance from the emission spot
-         * @param scene The scene the lights belongs to
-         */
-        constructor(name: string, position: Vector3, direction: Vector3, angle: number, exponent: number, scene: Scene);
-        /**
-         * Returns the string "SpotLight".
-         * @returns the class name
-         */
-        getClassName(): string;
-        /**
-         * Returns the integer 2.
-         * @returns The light Type id as a constant defines in Light.LIGHTTYPEID_x
-         */
-        getTypeID(): number;
-        /**
-         * Overrides the direction setter to recompute the projection texture view light Matrix.
-         */
-        protected _setDirection(value: Vector3): void;
-        /**
-         * Overrides the position setter to recompute the projection texture view light Matrix.
-         */
-        protected _setPosition(value: Vector3): void;
-        /**
-         * Sets the passed matrix "matrix" as perspective projection matrix for the shadows and the passed view matrix with the fov equal to the SpotLight angle and and aspect ratio of 1.0.
-         * Returns the SpotLight.
-         */
-        protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
-        protected _computeProjectionTextureViewLightMatrix(): void;
-        protected _computeProjectionTextureProjectionLightMatrix(): void;
-        /**
-         * Main function for light texture projection matrix computing.
-         */
-        protected _computeProjectionTextureMatrix(): void;
-        protected _buildUniformLayout(): void;
-        private _computeAngleValues;
-        /**
-         * Sets the passed Effect object with the SpotLight transfomed position (or position if not parented) and normalized direction.
-         * @param effect The effect to update
-         * @param lightIndex The index of the light in the effect to update
-         * @returns The spot light
-         */
-        transferToEffect(effect: Effect, lightIndex: string): SpotLight;
-        /**
-         * Disposes the light and the associated resources.
-         */
-        dispose(): void;
-        /**
-         * Prepares the list of defines specific to the light type.
-         * @param defines the list of defines
-         * @param lightIndex defines the index of the light for the effect
-         */
-        prepareLightSpecificDefines(defines: any, lightIndex: number): void;
-    }
-}
-declare module BABYLON {
-    /**
      * Header information of HDR texture files.
      */
     export interface HDRInfo {

文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/babylon.js


文件差异内容过多而无法显示
+ 391 - 95
dist/preview release/babylon.max.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/babylon.max.js.map


文件差异内容过多而无法显示
+ 973 - 542
dist/preview release/babylon.module.d.ts


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.cellMaterial.min.js


+ 230 - 6
dist/preview release/materialsLibrary/babylon.customMaterial.js

@@ -455,17 +455,17 @@ var CustomMaterial = /** @class */ (function (_super) {
             .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : ""))
             .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : ""))
             .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : ""))
-            .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : ""));
-        // #define CUSTOM_VERTEX_MAIN_END
+            .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : ""))
+            .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : ""));
         babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["Effect"].ShadersStore[name + "PixelShader"] = this.FragmentShader
             .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : ""))
             .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : ""))
             .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : ""))
             .replace('#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE', (this.CustomParts.Fragment_Custom_Diffuse ? this.CustomParts.Fragment_Custom_Diffuse : ""))
             .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : ""))
+            .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : ""))
+            .replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', (this.CustomParts.Fragment_Before_Fog ? this.CustomParts.Fragment_Before_Fog : ""))
             .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : ""));
-        // #define CUSTOM_FRAGMENT_BEFORE_LIGHTS
-        // #define CUSTOM_FRAGMENT_BEFORE_FOG
         this._isCreatedShader = true;
         this._createdShaderName = name;
         return name;
@@ -509,6 +509,14 @@ var CustomMaterial = /** @class */ (function (_super) {
         this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace("result", "alpha");
         return this;
     };
+    CustomMaterial.prototype.Fragment_Before_Lights = function (shaderPart) {
+        this.CustomParts.Fragment_Before_Lights = shaderPart;
+        return this;
+    };
+    CustomMaterial.prototype.Fragment_Before_Fog = function (shaderPart) {
+        this.CustomParts.Fragment_Before_Fog = shaderPart;
+        return this;
+    };
     CustomMaterial.prototype.Fragment_Before_FragColor = function (shaderPart) {
         this.CustomParts.Fragment_Before_FragColor = shaderPart.replace("result", "color");
         return this;
@@ -533,6 +541,10 @@ var CustomMaterial = /** @class */ (function (_super) {
         this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace("result", "normalUpdated");
         return this;
     };
+    CustomMaterial.prototype.Vertex_MainEnd = function (shaderPart) {
+        this.CustomParts.Vertex_MainEnd = shaderPart;
+        return this;
+    };
     CustomMaterial.ShaderIndexer = 1;
     return CustomMaterial;
 }(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["StandardMaterial"]));
@@ -546,7 +558,7 @@ babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].Registered
 /*!*************************!*\
   !*** ./custom/index.ts ***!
   \*************************/
-/*! exports provided: CustomShaderStructure, ShaderSpecialParts, CustomMaterial */
+/*! exports provided: CustomShaderStructure, ShaderSpecialParts, CustomMaterial, ShaderAlebdoParts, PBRCustomMaterial */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -558,7 +570,215 @@ __webpack_require__.r(__webpack_exports__);
 
 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CustomMaterial", function() { return _customMaterial__WEBPACK_IMPORTED_MODULE_0__["CustomMaterial"]; });
 
+/* harmony import */ var _pbrCustomMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pbrCustomMaterial */ "./custom/pbrCustomMaterial.ts");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ShaderAlebdoParts", function() { return _pbrCustomMaterial__WEBPACK_IMPORTED_MODULE_1__["ShaderAlebdoParts"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PBRCustomMaterial", function() { return _pbrCustomMaterial__WEBPACK_IMPORTED_MODULE_1__["PBRCustomMaterial"]; });
+
+
+
+
+
+/***/ }),
+
+/***/ "./custom/pbrCustomMaterial.ts":
+/*!*************************************!*\
+  !*** ./custom/pbrCustomMaterial.ts ***!
+  \*************************************/
+/*! exports provided: ShaderAlebdoParts, PBRCustomMaterial */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ShaderAlebdoParts", function() { return ShaderAlebdoParts; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PBRCustomMaterial", function() { return PBRCustomMaterial; });
+/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
+/* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
+/* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__);
+
+
+
+
+var ShaderAlebdoParts = /** @class */ (function () {
+    function ShaderAlebdoParts() {
+    }
+    return ShaderAlebdoParts;
+}());
+
+var PBRCustomMaterial = /** @class */ (function (_super) {
+    tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](PBRCustomMaterial, _super);
+    function PBRCustomMaterial(name, scene) {
+        var _this = _super.call(this, name, scene) || this;
+        _this.CustomParts = new ShaderAlebdoParts();
+        _this.customShaderNameResolve = _this.Builder;
+        _this.FragmentShader = babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["Effect"].ShadersStore["pbrPixelShader"];
+        _this.VertexShader = babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["Effect"].ShadersStore["pbrVertexShader"];
+        return _this;
+    }
+    PBRCustomMaterial.prototype.AttachAfterBind = function (mesh, effect) {
+        for (var el in this._newUniformInstances) {
+            var ea = el.toString().split('-');
+            if (ea[0] == 'vec2') {
+                effect.setVector2(ea[1], this._newUniformInstances[el]);
+            }
+            else if (ea[0] == 'vec3') {
+                effect.setVector3(ea[1], this._newUniformInstances[el]);
+            }
+            else if (ea[0] == 'vec4') {
+                effect.setVector4(ea[1], this._newUniformInstances[el]);
+            }
+            else if (ea[0] == 'mat4') {
+                effect.setMatrix(ea[1], this._newUniformInstances[el]);
+            }
+            else if (ea[0] == 'float') {
+                effect.setFloat(ea[1], this._newUniformInstances[el]);
+            }
+        }
+        for (var el in this._newSamplerInstances) {
+            var ea = el.toString().split('-');
+            if (ea[0] == 'sampler2D' && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {
+                effect.setTexture(ea[1], this._newSamplerInstances[el]);
+            }
+        }
+    };
+    PBRCustomMaterial.prototype.ReviewUniform = function (name, arr) {
+        if (name == "uniform") {
+            for (var ind in this._newUniforms) {
+                if (this._customUniform[ind].indexOf('sampler') == -1) {
+                    arr.push(this._newUniforms[ind]);
+                }
+            }
+        }
+        if (name == "sampler") {
+            for (var ind in this._newUniforms) {
+                if (this._customUniform[ind].indexOf('sampler') != -1) {
+                    arr.push(this._newUniforms[ind]);
+                }
+            }
+        }
+        return arr;
+    };
+    PBRCustomMaterial.prototype.Builder = function (shaderName, uniforms, uniformBuffers, samplers, defines) {
+        var _this = this;
+        if (this._isCreatedShader) {
+            return this._createdShaderName;
+        }
+        this._isCreatedShader = false;
+        PBRCustomMaterial.ShaderIndexer++;
+        var name = "custom_" + PBRCustomMaterial.ShaderIndexer;
+        this.ReviewUniform("uniform", uniforms);
+        this.ReviewUniform("sampler", samplers);
+        var fn_afterBind = this._afterBind.bind(this);
+        this._afterBind = function (m, e) {
+            if (!e) {
+                return;
+            }
+            _this.AttachAfterBind(m, e);
+            try {
+                fn_afterBind(m, e);
+            }
+            catch (e) { }
+        };
+        babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["Effect"].ShadersStore[name + "VertexShader"] = this.VertexShader
+            .replace('#define CUSTOM_VERTEX_BEGIN', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : ""))
+            .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : ""))
+            .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : ""))
+            .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : ""))
+            .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : ""))
+            .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : ""));
+        babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["Effect"].ShadersStore[name + "PixelShader"] = this.FragmentShader
+            .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : ""))
+            .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : ""))
+            .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : ""))
+            .replace('#define CUSTOM_FRAGMENT_UPDATE_ALBEDO', (this.CustomParts.Fragment_Custom_Albedo ? this.CustomParts.Fragment_Custom_Albedo : ""))
+            .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : ""))
+            .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : ""))
+            .replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', (this.CustomParts.Fragment_Before_Fog ? this.CustomParts.Fragment_Before_Fog : ""))
+            .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : ""));
+        this._isCreatedShader = true;
+        this._createdShaderName = name;
+        return name;
+    };
+    PBRCustomMaterial.prototype.AddUniform = function (name, kind, param) {
+        if (!this._customUniform) {
+            this._customUniform = new Array();
+            this._newUniforms = new Array();
+            this._newSamplerInstances = new Array();
+            this._newUniformInstances = new Array();
+        }
+        if (param) {
+            if (kind.indexOf("sampler") == -1) {
+                this._newUniformInstances[kind + "-" + name] = param;
+            }
+            else {
+                this._newUniformInstances[kind + "-" + name] = param;
+            }
+        }
+        this._customUniform.push("uniform " + kind + " " + name + ";");
+        this._newUniforms.push(name);
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Begin = function (shaderPart) {
+        this.CustomParts.Fragment_Begin = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Definitions = function (shaderPart) {
+        this.CustomParts.Fragment_Definitions = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_MainBegin = function (shaderPart) {
+        this.CustomParts.Fragment_MainBegin = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Custom_Albedo = function (shaderPart) {
+        this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace("result", "surfaceAlbedo");
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Custom_Alpha = function (shaderPart) {
+        this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace("result", "alpha");
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Before_Lights = function (shaderPart) {
+        this.CustomParts.Fragment_Before_Lights = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Before_Fog = function (shaderPart) {
+        this.CustomParts.Fragment_Before_Fog = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Before_FragColor = function (shaderPart) {
+        this.CustomParts.Fragment_Before_FragColor = shaderPart.replace("result", "color");
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_Begin = function (shaderPart) {
+        this.CustomParts.Vertex_Begin = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_Definitions = function (shaderPart) {
+        this.CustomParts.Vertex_Definitions = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_MainBegin = function (shaderPart) {
+        this.CustomParts.Vertex_MainBegin = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_Before_PositionUpdated = function (shaderPart) {
+        this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace("result", "positionUpdated");
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_Before_NormalUpdated = function (shaderPart) {
+        this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace("result", "normalUpdated");
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_MainEnd = function (shaderPart) {
+        this.CustomParts.Vertex_MainEnd = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.ShaderIndexer = 1;
+    return PBRCustomMaterial;
+}(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["PBRMaterial"]));
 
+babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.PBRCustomMaterial"] = PBRCustomMaterial;
 
 
 /***/ }),
@@ -567,7 +787,7 @@ __webpack_require__.r(__webpack_exports__);
 /*!*********************************!*\
   !*** ./legacy/legacy-custom.ts ***!
   \*********************************/
-/*! exports provided: CustomShaderStructure, ShaderSpecialParts, CustomMaterial */
+/*! exports provided: CustomShaderStructure, ShaderSpecialParts, CustomMaterial, ShaderAlebdoParts, PBRCustomMaterial */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -579,6 +799,10 @@ __webpack_require__.r(__webpack_exports__);
 
 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CustomMaterial", function() { return _custom_index__WEBPACK_IMPORTED_MODULE_0__["CustomMaterial"]; });
 
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ShaderAlebdoParts", function() { return _custom_index__WEBPACK_IMPORTED_MODULE_0__["ShaderAlebdoParts"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PBRCustomMaterial", function() { return _custom_index__WEBPACK_IMPORTED_MODULE_0__["PBRCustomMaterial"]; });
+
 
 /**
  * This is the entry point for the UMD module.

文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.js.map


文件差异内容过多而无法显示
+ 2 - 2
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.fireMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.furMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.gradientMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.gridMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.lavaMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.mixMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.normalMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.simpleMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.skyMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.terrainMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.triPlanarMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


+ 56 - 0
dist/preview release/materialsLibrary/babylonjs.materials.d.ts

@@ -52,6 +52,8 @@ declare module BABYLON {
         Fragment_Definitions: string;
         Fragment_MainBegin: string;
         Fragment_Custom_Diffuse: string;
+        Fragment_Before_Lights: string;
+        Fragment_Before_Fog: string;
         Fragment_Custom_Alpha: string;
         Fragment_Before_FragColor: string;
         Vertex_Begin: string;
@@ -59,6 +61,7 @@ declare module BABYLON {
         Vertex_MainBegin: string;
         Vertex_Before_PositionUpdated: string;
         Vertex_Before_NormalUpdated: string;
+        Vertex_MainEnd: string;
     }
     export class CustomMaterial extends BABYLON.StandardMaterial {
         static ShaderIndexer: number;
@@ -81,12 +84,65 @@ declare module BABYLON {
         Fragment_MainBegin(shaderPart: string): CustomMaterial;
         Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
         Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
+        Fragment_Before_Lights(shaderPart: string): CustomMaterial;
+        Fragment_Before_Fog(shaderPart: string): CustomMaterial;
         Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
         Vertex_Begin(shaderPart: string): CustomMaterial;
         Vertex_Definitions(shaderPart: string): CustomMaterial;
         Vertex_MainBegin(shaderPart: string): CustomMaterial;
         Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
         Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
+        Vertex_MainEnd(shaderPart: string): CustomMaterial;
+    }
+}
+declare module BABYLON {
+    export class ShaderAlebdoParts {
+        constructor();
+        Fragment_Begin: string;
+        Fragment_Definitions: string;
+        Fragment_MainBegin: string;
+        Fragment_Custom_Albedo: string;
+        Fragment_Before_Lights: string;
+        Fragment_Before_Fog: string;
+        Fragment_Custom_Alpha: string;
+        Fragment_Before_FragColor: string;
+        Vertex_Begin: string;
+        Vertex_Definitions: string;
+        Vertex_MainBegin: string;
+        Vertex_Before_PositionUpdated: string;
+        Vertex_Before_NormalUpdated: string;
+        Vertex_MainEnd: string;
+    }
+    export class PBRCustomMaterial extends BABYLON.PBRMaterial {
+        static ShaderIndexer: number;
+        CustomParts: ShaderAlebdoParts;
+        _isCreatedShader: boolean;
+        _createdShaderName: string;
+        _customUniform: string[];
+        _newUniforms: string[];
+        _newUniformInstances: any[];
+        _newSamplerInstances: BABYLON.Texture[];
+        FragmentShader: string;
+        VertexShader: string;
+        AttachAfterBind(mesh: BABYLON.Mesh, effect: BABYLON.Effect): void;
+        ReviewUniform(name: string, arr: string[]): string[];
+        Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: BABYLON.PBRMaterialDefines): string;
+        constructor(name: string, scene: BABYLON.Scene);
+        AddUniform(name: string, kind: string, param: any): PBRCustomMaterial;
+        Fragment_Begin(shaderPart: string): PBRCustomMaterial;
+        Fragment_Definitions(shaderPart: string): PBRCustomMaterial;
+        Fragment_MainBegin(shaderPart: string): PBRCustomMaterial;
+        Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial;
+        Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial;
+        Vertex_Begin(shaderPart: string): PBRCustomMaterial;
+        Vertex_Definitions(shaderPart: string): PBRCustomMaterial;
+        Vertex_MainBegin(shaderPart: string): PBRCustomMaterial;
+        Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial;
+        Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial;
+        Vertex_MainEnd(shaderPart: string): PBRCustomMaterial;
     }
 }
 declare module BABYLON {

+ 235 - 7
dist/preview release/materialsLibrary/babylonjs.materials.js

@@ -843,17 +843,17 @@ var CustomMaterial = /** @class */ (function (_super) {
             .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : ""))
             .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : ""))
             .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : ""))
-            .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : ""));
-        // #define CUSTOM_VERTEX_MAIN_END
+            .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : ""))
+            .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : ""));
         babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["Effect"].ShadersStore[name + "PixelShader"] = this.FragmentShader
             .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : ""))
             .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : ""))
             .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : ""))
             .replace('#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE', (this.CustomParts.Fragment_Custom_Diffuse ? this.CustomParts.Fragment_Custom_Diffuse : ""))
             .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : ""))
+            .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : ""))
+            .replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', (this.CustomParts.Fragment_Before_Fog ? this.CustomParts.Fragment_Before_Fog : ""))
             .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : ""));
-        // #define CUSTOM_FRAGMENT_BEFORE_LIGHTS
-        // #define CUSTOM_FRAGMENT_BEFORE_FOG
         this._isCreatedShader = true;
         this._createdShaderName = name;
         return name;
@@ -897,6 +897,14 @@ var CustomMaterial = /** @class */ (function (_super) {
         this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace("result", "alpha");
         return this;
     };
+    CustomMaterial.prototype.Fragment_Before_Lights = function (shaderPart) {
+        this.CustomParts.Fragment_Before_Lights = shaderPart;
+        return this;
+    };
+    CustomMaterial.prototype.Fragment_Before_Fog = function (shaderPart) {
+        this.CustomParts.Fragment_Before_Fog = shaderPart;
+        return this;
+    };
     CustomMaterial.prototype.Fragment_Before_FragColor = function (shaderPart) {
         this.CustomParts.Fragment_Before_FragColor = shaderPart.replace("result", "color");
         return this;
@@ -921,6 +929,10 @@ var CustomMaterial = /** @class */ (function (_super) {
         this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace("result", "normalUpdated");
         return this;
     };
+    CustomMaterial.prototype.Vertex_MainEnd = function (shaderPart) {
+        this.CustomParts.Vertex_MainEnd = shaderPart;
+        return this;
+    };
     CustomMaterial.ShaderIndexer = 1;
     return CustomMaterial;
 }(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["StandardMaterial"]));
@@ -934,7 +946,7 @@ babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].Registered
 /*!*************************!*\
   !*** ./custom/index.ts ***!
   \*************************/
-/*! exports provided: CustomShaderStructure, ShaderSpecialParts, CustomMaterial */
+/*! exports provided: CustomShaderStructure, ShaderSpecialParts, CustomMaterial, ShaderAlebdoParts, PBRCustomMaterial */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -946,11 +958,219 @@ __webpack_require__.r(__webpack_exports__);
 
 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CustomMaterial", function() { return _customMaterial__WEBPACK_IMPORTED_MODULE_0__["CustomMaterial"]; });
 
+/* harmony import */ var _pbrCustomMaterial__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pbrCustomMaterial */ "./custom/pbrCustomMaterial.ts");
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ShaderAlebdoParts", function() { return _pbrCustomMaterial__WEBPACK_IMPORTED_MODULE_1__["ShaderAlebdoParts"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PBRCustomMaterial", function() { return _pbrCustomMaterial__WEBPACK_IMPORTED_MODULE_1__["PBRCustomMaterial"]; });
+
+
 
 
 
 /***/ }),
 
+/***/ "./custom/pbrCustomMaterial.ts":
+/*!*************************************!*\
+  !*** ./custom/pbrCustomMaterial.ts ***!
+  \*************************************/
+/*! exports provided: ShaderAlebdoParts, PBRCustomMaterial */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ShaderAlebdoParts", function() { return ShaderAlebdoParts; });
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PBRCustomMaterial", function() { return PBRCustomMaterial; });
+/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
+/* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
+/* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__);
+
+
+
+
+var ShaderAlebdoParts = /** @class */ (function () {
+    function ShaderAlebdoParts() {
+    }
+    return ShaderAlebdoParts;
+}());
+
+var PBRCustomMaterial = /** @class */ (function (_super) {
+    tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](PBRCustomMaterial, _super);
+    function PBRCustomMaterial(name, scene) {
+        var _this = _super.call(this, name, scene) || this;
+        _this.CustomParts = new ShaderAlebdoParts();
+        _this.customShaderNameResolve = _this.Builder;
+        _this.FragmentShader = babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["Effect"].ShadersStore["pbrPixelShader"];
+        _this.VertexShader = babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["Effect"].ShadersStore["pbrVertexShader"];
+        return _this;
+    }
+    PBRCustomMaterial.prototype.AttachAfterBind = function (mesh, effect) {
+        for (var el in this._newUniformInstances) {
+            var ea = el.toString().split('-');
+            if (ea[0] == 'vec2') {
+                effect.setVector2(ea[1], this._newUniformInstances[el]);
+            }
+            else if (ea[0] == 'vec3') {
+                effect.setVector3(ea[1], this._newUniformInstances[el]);
+            }
+            else if (ea[0] == 'vec4') {
+                effect.setVector4(ea[1], this._newUniformInstances[el]);
+            }
+            else if (ea[0] == 'mat4') {
+                effect.setMatrix(ea[1], this._newUniformInstances[el]);
+            }
+            else if (ea[0] == 'float') {
+                effect.setFloat(ea[1], this._newUniformInstances[el]);
+            }
+        }
+        for (var el in this._newSamplerInstances) {
+            var ea = el.toString().split('-');
+            if (ea[0] == 'sampler2D' && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {
+                effect.setTexture(ea[1], this._newSamplerInstances[el]);
+            }
+        }
+    };
+    PBRCustomMaterial.prototype.ReviewUniform = function (name, arr) {
+        if (name == "uniform") {
+            for (var ind in this._newUniforms) {
+                if (this._customUniform[ind].indexOf('sampler') == -1) {
+                    arr.push(this._newUniforms[ind]);
+                }
+            }
+        }
+        if (name == "sampler") {
+            for (var ind in this._newUniforms) {
+                if (this._customUniform[ind].indexOf('sampler') != -1) {
+                    arr.push(this._newUniforms[ind]);
+                }
+            }
+        }
+        return arr;
+    };
+    PBRCustomMaterial.prototype.Builder = function (shaderName, uniforms, uniformBuffers, samplers, defines) {
+        var _this = this;
+        if (this._isCreatedShader) {
+            return this._createdShaderName;
+        }
+        this._isCreatedShader = false;
+        PBRCustomMaterial.ShaderIndexer++;
+        var name = "custom_" + PBRCustomMaterial.ShaderIndexer;
+        this.ReviewUniform("uniform", uniforms);
+        this.ReviewUniform("sampler", samplers);
+        var fn_afterBind = this._afterBind.bind(this);
+        this._afterBind = function (m, e) {
+            if (!e) {
+                return;
+            }
+            _this.AttachAfterBind(m, e);
+            try {
+                fn_afterBind(m, e);
+            }
+            catch (e) { }
+        };
+        babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["Effect"].ShadersStore[name + "VertexShader"] = this.VertexShader
+            .replace('#define CUSTOM_VERTEX_BEGIN', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : ""))
+            .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : ""))
+            .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : ""))
+            .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : ""))
+            .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : ""))
+            .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : ""));
+        babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["Effect"].ShadersStore[name + "PixelShader"] = this.FragmentShader
+            .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : ""))
+            .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : ""))
+            .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : ""))
+            .replace('#define CUSTOM_FRAGMENT_UPDATE_ALBEDO', (this.CustomParts.Fragment_Custom_Albedo ? this.CustomParts.Fragment_Custom_Albedo : ""))
+            .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : ""))
+            .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : ""))
+            .replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', (this.CustomParts.Fragment_Before_Fog ? this.CustomParts.Fragment_Before_Fog : ""))
+            .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : ""));
+        this._isCreatedShader = true;
+        this._createdShaderName = name;
+        return name;
+    };
+    PBRCustomMaterial.prototype.AddUniform = function (name, kind, param) {
+        if (!this._customUniform) {
+            this._customUniform = new Array();
+            this._newUniforms = new Array();
+            this._newSamplerInstances = new Array();
+            this._newUniformInstances = new Array();
+        }
+        if (param) {
+            if (kind.indexOf("sampler") == -1) {
+                this._newUniformInstances[kind + "-" + name] = param;
+            }
+            else {
+                this._newUniformInstances[kind + "-" + name] = param;
+            }
+        }
+        this._customUniform.push("uniform " + kind + " " + name + ";");
+        this._newUniforms.push(name);
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Begin = function (shaderPart) {
+        this.CustomParts.Fragment_Begin = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Definitions = function (shaderPart) {
+        this.CustomParts.Fragment_Definitions = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_MainBegin = function (shaderPart) {
+        this.CustomParts.Fragment_MainBegin = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Custom_Albedo = function (shaderPart) {
+        this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace("result", "surfaceAlbedo");
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Custom_Alpha = function (shaderPart) {
+        this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace("result", "alpha");
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Before_Lights = function (shaderPart) {
+        this.CustomParts.Fragment_Before_Lights = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Before_Fog = function (shaderPart) {
+        this.CustomParts.Fragment_Before_Fog = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Fragment_Before_FragColor = function (shaderPart) {
+        this.CustomParts.Fragment_Before_FragColor = shaderPart.replace("result", "color");
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_Begin = function (shaderPart) {
+        this.CustomParts.Vertex_Begin = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_Definitions = function (shaderPart) {
+        this.CustomParts.Vertex_Definitions = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_MainBegin = function (shaderPart) {
+        this.CustomParts.Vertex_MainBegin = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_Before_PositionUpdated = function (shaderPart) {
+        this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace("result", "positionUpdated");
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_Before_NormalUpdated = function (shaderPart) {
+        this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace("result", "normalUpdated");
+        return this;
+    };
+    PBRCustomMaterial.prototype.Vertex_MainEnd = function (shaderPart) {
+        this.CustomParts.Vertex_MainEnd = shaderPart;
+        return this;
+    };
+    PBRCustomMaterial.ShaderIndexer = 1;
+    return PBRCustomMaterial;
+}(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["PBRMaterial"]));
+
+babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.PBRCustomMaterial"] = PBRCustomMaterial;
+
+
+/***/ }),
+
 /***/ "./fire/fire.fragment.ts":
 /*!*******************************!*\
   !*** ./fire/fire.fragment.ts ***!
@@ -2632,7 +2852,7 @@ __webpack_require__.r(__webpack_exports__);
 /*!******************!*\
   !*** ./index.ts ***!
   \******************/
-/*! exports provided: CellMaterial, CustomShaderStructure, ShaderSpecialParts, CustomMaterial, FireMaterial, FurMaterial, GradientMaterial, GridMaterial, LavaMaterial, MixMaterial, NormalMaterial, ShadowOnlyMaterial, SimpleMaterial, SkyMaterial, TerrainMaterial, TriPlanarMaterial, WaterMaterial */
+/*! exports provided: CellMaterial, CustomShaderStructure, ShaderSpecialParts, CustomMaterial, ShaderAlebdoParts, PBRCustomMaterial, FireMaterial, FurMaterial, GradientMaterial, GridMaterial, LavaMaterial, MixMaterial, NormalMaterial, ShadowOnlyMaterial, SimpleMaterial, SkyMaterial, TerrainMaterial, TriPlanarMaterial, WaterMaterial */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -2647,6 +2867,10 @@ __webpack_require__.r(__webpack_exports__);
 
 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CustomMaterial", function() { return _custom__WEBPACK_IMPORTED_MODULE_1__["CustomMaterial"]; });
 
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ShaderAlebdoParts", function() { return _custom__WEBPACK_IMPORTED_MODULE_1__["ShaderAlebdoParts"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PBRCustomMaterial", function() { return _custom__WEBPACK_IMPORTED_MODULE_1__["PBRCustomMaterial"]; });
+
 /* harmony import */ var _fire__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fire */ "./fire/index.ts");
 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FireMaterial", function() { return _fire__WEBPACK_IMPORTED_MODULE_2__["FireMaterial"]; });
 
@@ -3185,7 +3409,7 @@ babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredT
 /*!**************************!*\
   !*** ./legacy/legacy.ts ***!
   \**************************/
-/*! exports provided: CellMaterial, CustomShaderStructure, ShaderSpecialParts, CustomMaterial, FireMaterial, FurMaterial, GradientMaterial, GridMaterial, LavaMaterial, MixMaterial, NormalMaterial, ShadowOnlyMaterial, SimpleMaterial, SkyMaterial, TerrainMaterial, TriPlanarMaterial, WaterMaterial */
+/*! exports provided: CellMaterial, CustomShaderStructure, ShaderSpecialParts, CustomMaterial, ShaderAlebdoParts, PBRCustomMaterial, FireMaterial, FurMaterial, GradientMaterial, GridMaterial, LavaMaterial, MixMaterial, NormalMaterial, ShadowOnlyMaterial, SimpleMaterial, SkyMaterial, TerrainMaterial, TriPlanarMaterial, WaterMaterial */
 /***/ (function(module, __webpack_exports__, __webpack_require__) {
 
 "use strict";
@@ -3199,6 +3423,10 @@ __webpack_require__.r(__webpack_exports__);
 
 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CustomMaterial", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["CustomMaterial"]; });
 
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ShaderAlebdoParts", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["ShaderAlebdoParts"]; });
+
+/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PBRCustomMaterial", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["PBRCustomMaterial"]; });
+
 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FireMaterial", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["FireMaterial"]; });
 
 /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FurMaterial", function() { return _index__WEBPACK_IMPORTED_MODULE_0__["FurMaterial"]; });

文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylonjs.materials.js.map


文件差异内容过多而无法显示
+ 2 - 2
dist/preview release/materialsLibrary/babylonjs.materials.min.js


+ 119 - 0
dist/preview release/materialsLibrary/babylonjs.materials.module.d.ts

@@ -94,6 +94,8 @@ declare module "babylonjs-materials/custom/customMaterial" {
         Fragment_Definitions: string;
         Fragment_MainBegin: string;
         Fragment_Custom_Diffuse: string;
+        Fragment_Before_Lights: string;
+        Fragment_Before_Fog: string;
         Fragment_Custom_Alpha: string;
         Fragment_Before_FragColor: string;
         Vertex_Begin: string;
@@ -101,6 +103,7 @@ declare module "babylonjs-materials/custom/customMaterial" {
         Vertex_MainBegin: string;
         Vertex_Before_PositionUpdated: string;
         Vertex_Before_NormalUpdated: string;
+        Vertex_MainEnd: string;
     }
     export class CustomMaterial extends StandardMaterial {
         static ShaderIndexer: number;
@@ -123,16 +126,76 @@ declare module "babylonjs-materials/custom/customMaterial" {
         Fragment_MainBegin(shaderPart: string): CustomMaterial;
         Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
         Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
+        Fragment_Before_Lights(shaderPart: string): CustomMaterial;
+        Fragment_Before_Fog(shaderPart: string): CustomMaterial;
         Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
         Vertex_Begin(shaderPart: string): CustomMaterial;
         Vertex_Definitions(shaderPart: string): CustomMaterial;
         Vertex_MainBegin(shaderPart: string): CustomMaterial;
         Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
         Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
+        Vertex_MainEnd(shaderPart: string): CustomMaterial;
+    }
+}
+declare module "babylonjs-materials/custom/pbrCustomMaterial" {
+    import { Texture } from "babylonjs/Materials/Textures/texture";
+    import { Effect } from "babylonjs/Materials/effect";
+    import { PBRMaterialDefines } from "babylonjs/Materials/PBR/pbrBaseMaterial";
+    import { PBRMaterial } from "babylonjs/Materials/PBR/pbrMaterial";
+    import { Mesh } from "babylonjs/Meshes/mesh";
+    import { Scene } from "babylonjs/scene";
+    export class ShaderAlebdoParts {
+        constructor();
+        Fragment_Begin: string;
+        Fragment_Definitions: string;
+        Fragment_MainBegin: string;
+        Fragment_Custom_Albedo: string;
+        Fragment_Before_Lights: string;
+        Fragment_Before_Fog: string;
+        Fragment_Custom_Alpha: string;
+        Fragment_Before_FragColor: string;
+        Vertex_Begin: string;
+        Vertex_Definitions: string;
+        Vertex_MainBegin: string;
+        Vertex_Before_PositionUpdated: string;
+        Vertex_Before_NormalUpdated: string;
+        Vertex_MainEnd: string;
+    }
+    export class PBRCustomMaterial extends PBRMaterial {
+        static ShaderIndexer: number;
+        CustomParts: ShaderAlebdoParts;
+        _isCreatedShader: boolean;
+        _createdShaderName: string;
+        _customUniform: string[];
+        _newUniforms: string[];
+        _newUniformInstances: any[];
+        _newSamplerInstances: Texture[];
+        FragmentShader: string;
+        VertexShader: string;
+        AttachAfterBind(mesh: Mesh, effect: Effect): void;
+        ReviewUniform(name: string, arr: string[]): string[];
+        Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: PBRMaterialDefines): string;
+        constructor(name: string, scene: Scene);
+        AddUniform(name: string, kind: string, param: any): PBRCustomMaterial;
+        Fragment_Begin(shaderPart: string): PBRCustomMaterial;
+        Fragment_Definitions(shaderPart: string): PBRCustomMaterial;
+        Fragment_MainBegin(shaderPart: string): PBRCustomMaterial;
+        Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial;
+        Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial;
+        Vertex_Begin(shaderPart: string): PBRCustomMaterial;
+        Vertex_Definitions(shaderPart: string): PBRCustomMaterial;
+        Vertex_MainBegin(shaderPart: string): PBRCustomMaterial;
+        Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial;
+        Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial;
+        Vertex_MainEnd(shaderPart: string): PBRCustomMaterial;
     }
 }
 declare module "babylonjs-materials/custom/index" {
     export * from "babylonjs-materials/custom/customMaterial";
+    export * from "babylonjs-materials/custom/pbrCustomMaterial";
 }
 declare module "babylonjs-materials/fire/fire.fragment" {
     import "babylonjs/Shaders/ShadersInclude/clipPlaneFragmentDeclaration";
@@ -1523,6 +1586,8 @@ declare module BABYLON {
         Fragment_Definitions: string;
         Fragment_MainBegin: string;
         Fragment_Custom_Diffuse: string;
+        Fragment_Before_Lights: string;
+        Fragment_Before_Fog: string;
         Fragment_Custom_Alpha: string;
         Fragment_Before_FragColor: string;
         Vertex_Begin: string;
@@ -1530,6 +1595,7 @@ declare module BABYLON {
         Vertex_MainBegin: string;
         Vertex_Before_PositionUpdated: string;
         Vertex_Before_NormalUpdated: string;
+        Vertex_MainEnd: string;
     }
     export class CustomMaterial extends BABYLON.StandardMaterial {
         static ShaderIndexer: number;
@@ -1552,12 +1618,65 @@ declare module BABYLON {
         Fragment_MainBegin(shaderPart: string): CustomMaterial;
         Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
         Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
+        Fragment_Before_Lights(shaderPart: string): CustomMaterial;
+        Fragment_Before_Fog(shaderPart: string): CustomMaterial;
         Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
         Vertex_Begin(shaderPart: string): CustomMaterial;
         Vertex_Definitions(shaderPart: string): CustomMaterial;
         Vertex_MainBegin(shaderPart: string): CustomMaterial;
         Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
         Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
+        Vertex_MainEnd(shaderPart: string): CustomMaterial;
+    }
+}
+declare module BABYLON {
+    export class ShaderAlebdoParts {
+        constructor();
+        Fragment_Begin: string;
+        Fragment_Definitions: string;
+        Fragment_MainBegin: string;
+        Fragment_Custom_Albedo: string;
+        Fragment_Before_Lights: string;
+        Fragment_Before_Fog: string;
+        Fragment_Custom_Alpha: string;
+        Fragment_Before_FragColor: string;
+        Vertex_Begin: string;
+        Vertex_Definitions: string;
+        Vertex_MainBegin: string;
+        Vertex_Before_PositionUpdated: string;
+        Vertex_Before_NormalUpdated: string;
+        Vertex_MainEnd: string;
+    }
+    export class PBRCustomMaterial extends BABYLON.PBRMaterial {
+        static ShaderIndexer: number;
+        CustomParts: ShaderAlebdoParts;
+        _isCreatedShader: boolean;
+        _createdShaderName: string;
+        _customUniform: string[];
+        _newUniforms: string[];
+        _newUniformInstances: any[];
+        _newSamplerInstances: BABYLON.Texture[];
+        FragmentShader: string;
+        VertexShader: string;
+        AttachAfterBind(mesh: BABYLON.Mesh, effect: BABYLON.Effect): void;
+        ReviewUniform(name: string, arr: string[]): string[];
+        Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: BABYLON.PBRMaterialDefines): string;
+        constructor(name: string, scene: BABYLON.Scene);
+        AddUniform(name: string, kind: string, param: any): PBRCustomMaterial;
+        Fragment_Begin(shaderPart: string): PBRCustomMaterial;
+        Fragment_Definitions(shaderPart: string): PBRCustomMaterial;
+        Fragment_MainBegin(shaderPart: string): PBRCustomMaterial;
+        Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial;
+        Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial;
+        Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial;
+        Vertex_Begin(shaderPart: string): PBRCustomMaterial;
+        Vertex_Definitions(shaderPart: string): PBRCustomMaterial;
+        Vertex_MainBegin(shaderPart: string): PBRCustomMaterial;
+        Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial;
+        Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial;
+        Vertex_MainEnd(shaderPart: string): PBRCustomMaterial;
     }
 }
 declare module BABYLON {

+ 1 - 1
dist/preview release/packagesSizeBaseLine.json

@@ -1 +1 @@
-{"engineOnly":309056,"sceneOnly":551274,"minGridMaterial":674003,"minStandardMaterial":772858}
+{"engineOnly":309116,"sceneOnly":551531,"minGridMaterial":674533,"minStandardMaterial":773388}

文件差异内容过多而无法显示
+ 973 - 542
dist/preview release/viewer/babylon.module.d.ts


+ 19 - 5
dist/preview release/viewer/babylon.viewer.d.ts

@@ -197,11 +197,11 @@ declare module BabylonViewer {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
+            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<string> | Promise<Template>;
+            hideOverlayScreen(): Promise<Template> | Promise<string>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -218,11 +218,11 @@ declare module BabylonViewer {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<string> | Promise<Template>;
+            showLoadingScreen(): Promise<Template> | Promise<string>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<string> | Promise<Template>;
+            hideLoadingScreen(): Promise<Template> | Promise<string>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -951,7 +951,7 @@ declare module BabylonViewer {
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 declare module BabylonViewer {
@@ -1594,6 +1594,20 @@ declare module BabylonViewer {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 declare module BabylonViewer {
+    /**
+        * A custom upgrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedUpgrade(sceneManager: SceneManager): boolean;
+    /**
+        * A custom degrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedDegrade(sceneManager: SceneManager): boolean;
+}
+declare module BabylonViewer {
     export interface IEnvironmentMapConfiguration {
             /**
                 * Environment map texture path in relative to the asset folder.

文件差异内容过多而无法显示
+ 23 - 19
dist/preview release/viewer/babylon.viewer.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 22 - 5
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -230,11 +230,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
+            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<string> | Promise<Template>;
+            hideOverlayScreen(): Promise<Template> | Promise<string>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -251,11 +251,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<string> | Promise<Template>;
+            showLoadingScreen(): Promise<Template> | Promise<string>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<string> | Promise<Template>;
+            hideLoadingScreen(): Promise<Template> | Promise<string>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -1031,13 +1031,14 @@ declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' {
 }
 
 declare module 'babylonjs-viewer/optimizer/custom' {
+    import { extendedUpgrade } from "babylonjs-viewer/optimizer/custom/extended";
     import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
     /**
       *
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 
@@ -1737,6 +1738,22 @@ declare module 'babylonjs-viewer/loader/plugins' {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 
+declare module 'babylonjs-viewer/optimizer/custom/extended' {
+    import { SceneManager } from 'babylonjs-viewer/managers/sceneManager';
+    /**
+        * A custom upgrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedUpgrade(sceneManager: SceneManager): boolean;
+    /**
+        * A custom degrade-oriented function configuration for the scene optimizer.
+        *
+        * @param viewer the viewer to optimize
+        */
+    export function extendedDegrade(sceneManager: SceneManager): boolean;
+}
+
 declare module 'babylonjs-viewer/configuration/interfaces' {
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';

+ 2 - 1
dist/preview release/what's new.md

@@ -120,7 +120,7 @@
 - Added transparency support to `GlowLayer` ([Sebavan](https://github.com/Sebavan))
 - Added option `forceDisposeChildren` to multiMaterial.dispose ([danjpar](https://github.com/danjpar))
 - Added Pointer bindings for FollowCamera. ([mrdunk](https://github.com))
-- Inspector light gizmo ([TrevorDev](https://github.com/TrevorDev))
+- Inspector light gizmo with icons ([TrevorDev](https://github.com/TrevorDev))
 - Added option `multiMultiMaterials` to mesh.mergeMeshes ([danjpar](https://github.com/danjpar))
 - Expose fallback camera distortion metrics option in vrExperienceHelper ([TrevorDev](https://github.com/TrevorDev))
 - Added OnAfterEnteringVRObservable to webVRHelper ([TrevorDev](https://github.com/TrevorDev))
@@ -130,6 +130,7 @@
 - Added `MeshExploder` class ([danjpar](https://github.com/danjpar))
 - Observables can now make observers top or bottom priority ([TrevorDev](https://github.com/TrevorDev))
 - Mesh outline no longer is shown through the mesh when it's transparent ([TrevorDev](https://github.com/TrevorDev))
+- DeviceOrientationCamera will no longer be modified by mouse input if the orientation sensor is active ([TrevorDev](https://github.com/TrevorDev))
 
 ### OBJ Loader
 - Add color vertex support (not part of standard) ([brianzinn](https://github.com/brianzinn))

+ 22 - 1
src/Cameras/Inputs/freeCameraDeviceOrientationInput.ts

@@ -4,11 +4,16 @@ import { FreeCamera } from "../../Cameras/freeCamera";
 import { Quaternion } from "../../Maths/math";
 import { Tools } from "../../Misc/tools";
 import { FreeCameraInputsManager } from "../../Cameras/freeCameraInputsManager";
+import { Observable } from '../../Misc/observable';
 
 // Module augmentation to abstract orientation inputs from camera.
 declare module "../../Cameras/freeCameraInputsManager" {
     export interface FreeCameraInputsManager {
         /**
+         * @hidden
+         */
+        _deviceOrientationInput: Nullable<FreeCameraDeviceOrientationInput>;
+        /**
          * Add orientation input support to the input manager.
          * @returns the current input manager
          */
@@ -21,7 +26,11 @@ declare module "../../Cameras/freeCameraInputsManager" {
  * @returns the current input manager
  */
 FreeCameraInputsManager.prototype.addDeviceOrientation = function(): FreeCameraInputsManager {
-    this.add(new FreeCameraDeviceOrientationInput());
+    if (!this._deviceOrientationInput) {
+        this._deviceOrientationInput = new FreeCameraDeviceOrientationInput();
+        this.add(this._deviceOrientationInput);
+    }
+
     return this;
 };
 
@@ -43,6 +52,10 @@ export class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera
     private _gamma: number = 0;
 
     /**
+     * @hidden
+     */
+    public _onDeviceOrientationChangedObservable = new Observable<void>();
+    /**
      * Instantiates a new input
      * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
      */
@@ -63,6 +76,11 @@ export class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera
         if (this._camera != null && !this._camera.rotationQuaternion) {
             this._camera.rotationQuaternion = new Quaternion();
         }
+        if (this._camera) {
+            this._camera.onDisposeObservable.add(() => {
+                this._onDeviceOrientationChangedObservable.clear();
+            });
+        }
     }
 
     /**
@@ -88,6 +106,9 @@ export class FreeCameraDeviceOrientationInput implements ICameraInput<FreeCamera
         this._alpha = evt.alpha !== null ? evt.alpha : 0;
         this._beta = evt.beta !== null ? evt.beta : 0;
         this._gamma = evt.gamma !== null ? evt.gamma : 0;
+        if (evt.alpha !== null) {
+            this._onDeviceOrientationChangedObservable.notifyObservers();
+        }
     }
 
     /**

+ 7 - 0
src/Cameras/deviceOrientationCamera.ts

@@ -29,6 +29,13 @@ export class DeviceOrientationCamera extends FreeCamera {
         super(name, position, scene);
         this._quaternionCache = new Quaternion();
         this.inputs.addDeviceOrientation();
+
+        // When the orientation sensor fires it's first event, disable mouse input
+        if (this.inputs._deviceOrientationInput) {
+            this.inputs._deviceOrientationInput._onDeviceOrientationChangedObservable.addOnce(() => {
+                this.inputs.removeMouse();
+            });
+        }
     }
 
     /**

+ 25 - 1
src/Cameras/freeCameraInputsManager.ts

@@ -3,6 +3,7 @@ import { CameraInputsManager } from "./cameraInputsManager";
 import { FreeCameraKeyboardMoveInput } from "../Cameras/Inputs/freeCameraKeyboardMoveInput";
 import { FreeCameraMouseInput } from "../Cameras/Inputs/freeCameraMouseInput";
 import { FreeCameraTouchInput } from "../Cameras/Inputs/freeCameraTouchInput";
+import { Nullable } from '../types';
 
 /**
  * Default Inputs manager for the FreeCamera.
@@ -11,6 +12,15 @@ import { FreeCameraTouchInput } from "../Cameras/Inputs/freeCameraTouchInput";
  */
 export class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
     /**
+     * @hidden
+     */
+    public _keyboardInput: Nullable<FreeCameraKeyboardMoveInput> = null;
+
+    /**
+     * @hidden
+     */
+    public _mouseInput: Nullable<FreeCameraMouseInput> = null;
+    /**
      * Instantiates a new FreeCameraInputsManager.
      * @param camera Defines the camera the inputs belong to
      */
@@ -33,7 +43,21 @@ export class FreeCameraInputsManager extends CameraInputsManager<FreeCamera> {
      * @returns the current input manager
      */
     addMouse(touchEnabled = true): FreeCameraInputsManager {
-        this.add(new FreeCameraMouseInput(touchEnabled));
+        if (!this._mouseInput) {
+            this._mouseInput = new FreeCameraMouseInput(touchEnabled);
+            this.add(this._mouseInput);
+        }
+        return this;
+    }
+
+    /**
+     * Removes the mouse input support from the manager
+     * @returns the current input manager
+     */
+    removeMouse(): FreeCameraInputsManager {
+        if (this._mouseInput) {
+            this.remove(this._mouseInput);
+        }
         return this;
     }
 

+ 6 - 4
src/Engines/engine.ts

@@ -3411,7 +3411,7 @@ export class Engine {
         gl.shaderSource(shader, source);
         gl.compileShader(shader);
 
-        if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
+        if (!this._caps.parallelShaderCompile && !gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
             let log = gl.getShaderInfoLog(shader);
             if (log) {
                 throw new Error(log);
@@ -3470,6 +3470,10 @@ export class Engine {
             throw new Error("Unable to create program");
         }
 
+        if (this._caps.parallelShaderCompile) {
+            shaderProgram.isParallelCompiled = true;
+        }
+
         context.attachShader(shaderProgram, vertexShader);
         context.attachShader(shaderProgram, fragmentShader);
 
@@ -3491,10 +3495,8 @@ export class Engine {
         shaderProgram.vertexShader = vertexShader;
         shaderProgram.fragmentShader = fragmentShader;
 
-        if (!this._caps.parallelShaderCompile) {
+        if (!shaderProgram.isParallelCompiled) {
             this._finalizeProgram(shaderProgram);
-        } else {
-            shaderProgram.isParallelCompiled = true;
         }
 
         return shaderProgram;

+ 193 - 15
src/Gizmos/lightGizmo.ts

@@ -7,12 +7,19 @@ import { UtilityLayerRenderer } from "../Rendering/utilityLayerRenderer";
 
 import { StandardMaterial } from '../Materials/standardMaterial';
 import { Light } from '../Lights/light';
+import { Scene } from '../scene';
+import { HemisphericLight } from '../Lights/hemisphericLight';
+import { DirectionalLight } from '../Lights/directionalLight';
+import { SphereBuilder } from '../Meshes/Builders/sphereBuilder';
+import { HemisphereBuilder } from '../Meshes/Builders/hemisphereBuilder';
+import { SpotLight } from '../Lights/spotLight';
 
 /**
  * Gizmo that enables viewing a light
  */
 export class LightGizmo extends Gizmo {
-    private _box: Mesh;
+    private _lightMesh: Mesh;
+    private _material: StandardMaterial;
 
     /**
      * Creates a LightGizmo
@@ -20,13 +27,10 @@ export class LightGizmo extends Gizmo {
      */
     constructor(gizmoLayer?: UtilityLayerRenderer) {
         super(gizmoLayer);
-        this._box = Mesh.CreateCylinder("light", 0.02, 0, 0.02, 16, 1, this.gizmoLayer.utilityLayerScene);
-        this._box.rotation.x = -Math.PI / 2;
-        this._box.bakeCurrentTransformIntoVertices();
-        this._box.material = new StandardMaterial("", this.gizmoLayer.utilityLayerScene);
-        (this._box.material as StandardMaterial).emissiveColor = Color3.Yellow();
-        this._rootMesh.addChild(this._box);
         this.attachedMesh = new AbstractMesh("", this.gizmoLayer.utilityLayerScene);
+        this._material = new StandardMaterial("light", this.gizmoLayer.originalScene);
+        this._material.diffuseColor = new Color3(0.5, 0.5, 0.5);
+        this._material.specularColor = new Color3(0.1, 0.1, 0.1);
     }
     private _light: Nullable<Light> = null;
 
@@ -35,11 +39,37 @@ export class LightGizmo extends Gizmo {
      */
     public set light(light: Nullable<Light>) {
         this._light = light;
-        if ((light as any).position) {
-            this.attachedMesh!.position.copyFrom((light as any).position);
-        }
-        if ((light as any).direction) {
-            this._box.setDirection((light as any).direction);
+        if (light) {
+            // Create the mesh for the given light type
+            if (this._lightMesh) {
+                this._lightMesh.dispose();
+            }
+
+            if (light instanceof HemisphericLight) {
+                this._lightMesh = LightGizmo._CreateHemisphericLightMesh(this.gizmoLayer.utilityLayerScene);
+            }else if (light instanceof DirectionalLight) {
+                this._lightMesh = LightGizmo._CreateDirectionalLightMesh(this.gizmoLayer.utilityLayerScene);
+            }else if (light instanceof SpotLight) {
+                this._lightMesh = LightGizmo._CreateSpotLightMesh(this.gizmoLayer.utilityLayerScene);
+            }else {
+                this._lightMesh = LightGizmo._CreatePointLightMesh(this.gizmoLayer.utilityLayerScene);
+            }
+            this._lightMesh.getChildMeshes(false).forEach((m) => {
+                m.material = this._material;
+            });
+            this._lightMesh.parent = this._rootMesh;
+
+            // Add lighting to the light gizmo
+            var gizmoLight = this.gizmoLayer._getSharedGizmoLight();
+            gizmoLight.includedOnlyMeshes = gizmoLight.includedOnlyMeshes.concat(this._lightMesh.getChildMeshes(false));
+
+            // Get update position and direction if the light has it
+            if ((light as any).position) {
+                this.attachedMesh!.position.copyFrom((light as any).position);
+            }
+            if ((light as any).direction) {
+                this._lightMesh.setDirection((light as any).direction);
+            }
         }
     }
     public get light() {
@@ -59,12 +89,160 @@ export class LightGizmo extends Gizmo {
             (this._light as any).position.copyFrom(this.attachedMesh!.position);
         }
         if ((this._light as any).direction) {
-            (this._light as any).direction.copyFrom(this._box.forward);
+            (this._light as any).direction.copyFrom(this._lightMesh.forward);
         }
         if (!this._light.isEnabled()) {
-            (this._box.material as StandardMaterial).emissiveColor.set(0, 0, 0);
+            this._material.diffuseColor.set(0, 0, 0);
         } else {
-            (this._box.material as StandardMaterial).emissiveColor.set(1, 1, 1);
+            this._material.diffuseColor.set(this._light.diffuse.r / 3, this._light.diffuse.g / 3, this._light.diffuse.b / 3);
+        }
+    }
+
+    // Static helper methods
+    private static _Scale = 0.007;
+
+    /**
+     * Creates the lines for a light mesh
+     */
+    private static _createLightLines = (levels: number, scene: Scene) => {
+        var distFromSphere = 1.2;
+
+        var root = new Mesh("root", scene);
+        root.rotation.x = Math.PI / 2;
+
+        // Create the top line, this will be cloned for all other lines
+        var linePivot = new Mesh("linePivot", scene);
+        linePivot.parent = root;
+        var line = Mesh.CreateCylinder("line", 2, 0.2, 0.3, 6, 1, scene);
+        line.position.y = line.scaling.y / 2 + distFromSphere;
+        line.parent = linePivot;
+
+        if (levels < 2) {
+            return linePivot;
         }
+        for (var i = 0; i < 4; i++) {
+            var l = linePivot.clone("lineParentClone");
+            l.rotation.z = Math.PI / 4;
+            l.rotation.y = (Math.PI / 2) + (Math.PI / 2 * i);
+
+            l.getChildMeshes()[0].scaling.y = 0.5;
+            l.getChildMeshes()[0].scaling.x = l.getChildMeshes()[0].scaling.z = 0.8;
+            l.getChildMeshes()[0].position.y = l.getChildMeshes()[0].scaling.y / 2 + distFromSphere;
+        }
+
+        if (levels < 3) {
+            return root;
+        }
+        for (var i = 0; i < 4; i++) {
+            var l = linePivot.clone("linePivotClone");
+            l.rotation.z = Math.PI / 2;
+            l.rotation.y = (Math.PI / 2 * i);
+        }
+
+        if (levels < 4) {
+            return root;
+        }
+        for (var i = 0; i < 4; i++) {
+            var l = linePivot.clone("linePivotClone");
+            l.rotation.z = Math.PI + (Math.PI / 4);
+            l.rotation.y = (Math.PI / 2) + (Math.PI / 2 * i);
+
+            l.getChildMeshes()[0].scaling.y = 0.5;
+            l.getChildMeshes()[0].scaling.x = l.getChildMeshes()[0].scaling.z = 0.8;
+            l.getChildMeshes()[0].position.y = l.getChildMeshes()[0].scaling.y / 2 + distFromSphere;
+        }
+
+        if (levels < 5) {
+            return root;
+        }
+        var l = linePivot.clone("linePivotClone");
+        l.rotation.z = Math.PI;
+
+        return root;
+    }
+
+    private static _CreateHemisphericLightMesh(scene: Scene) {
+        var root = new Mesh("hemisphereLight", scene);
+        var hemisphere = HemisphereBuilder.CreateHemisphere(root.name, {segments: 10, diameter: 1}, scene);
+        hemisphere.position.z = -0.15;
+        hemisphere.rotation.x = Math.PI / 2;
+        hemisphere.parent = root;
+
+        var lines = this._createLightLines(3, scene);
+        lines.parent = root;
+        lines.position.z - 0.15;
+
+        root.scaling.scaleInPlace(LightGizmo._Scale);
+        root.rotation.x = Math.PI / 2;
+
+        return root;
+    }
+
+    private static _CreatePointLightMesh(scene: Scene) {
+        var root = new Mesh("pointLight", scene);
+        var sphere = SphereBuilder.CreateSphere(root.name, {segments: 10, diameter: 1}, scene);
+        sphere.rotation.x = Math.PI / 2;
+        sphere.parent = root;
+
+        var lines = this._createLightLines(5, scene);
+        lines.parent = root;
+        root.scaling.scaleInPlace(LightGizmo._Scale);
+        root.rotation.x = Math.PI / 2;
+
+        return root;
+    }
+
+    private static _CreateSpotLightMesh(scene: Scene) {
+        var root = new Mesh("spotLight", scene);
+        var sphere = SphereBuilder.CreateSphere(root.name, {segments: 10, diameter: 1}, scene);
+        sphere.parent = root;
+
+        var hemisphere = HemisphereBuilder.CreateHemisphere(root.name, {segments: 10, diameter: 2}, scene);
+        hemisphere.parent = root;
+        hemisphere.rotation.x = -Math.PI / 2;
+
+        var lines = this._createLightLines(2, scene);
+        lines.parent = root;
+        root.scaling.scaleInPlace(LightGizmo._Scale);
+        root.rotation.x = Math.PI / 2;
+
+        return root;
+    }
+
+    private static _CreateDirectionalLightMesh(scene: Scene) {
+        var root = new Mesh("directionalLight", scene);
+
+        var mesh = new Mesh(root.name, scene);
+        mesh.parent = root;
+        var sphere  = SphereBuilder.CreateSphere(root.name, {diameter: 1.2, segments: 10}, scene);
+        sphere.parent = mesh;
+
+        var line = Mesh.CreateCylinder(root.name, 6, 0.3, 0.3, 6, 1, scene);
+        line.parent = mesh;
+
+        var left = line.clone(root.name);
+        left.scaling.y = 0.5;
+        left.position.x += 1.25;
+
+        var right = line.clone(root.name);
+        right.scaling.y = 0.5;
+        right.position.x += -1.25;
+
+        var arrowHead = Mesh.CreateCylinder(root.name, 1, 0, 0.6, 6, 1, scene);
+        arrowHead.position.y += 3;
+        arrowHead.parent = mesh;
+
+        var left = arrowHead.clone(root.name);
+        left.position.y = 1.5;
+        left.position.x += 1.25;
+
+        var right = arrowHead.clone(root.name);
+        right.position.y = 1.5;
+        right.position.x += -1.25;
+
+        mesh.scaling.scaleInPlace(LightGizmo._Scale);
+        mesh.rotation.z = Math.PI / 2;
+        mesh.rotation.y = Math.PI / 2;
+        return root;
     }
 }

+ 14 - 0
src/Meshes/Builders/groundBuilder.ts

@@ -143,6 +143,14 @@ VertexData.CreateGroundFromHeightMap = function(options: { width: number, height
     var row, col;
     var filter = options.colorFilter || new Color3(0.3, 0.59, 0.11);
     var alphaFilter = options.alphaFilter || 0.0;
+    var invert = false;
+
+    if (options.minHeight > options.maxHeight) {
+        invert = true;
+        let temp = options.maxHeight;
+        options.maxHeight = options.minHeight;
+        options.minHeight = temp;
+    }
 
     // Vertices
     for (row = 0; row <= options.subdivisions; row++) {
@@ -159,6 +167,12 @@ VertexData.CreateGroundFromHeightMap = function(options: { width: number, height
             var b = options.buffer[pos + 2] / 255.0;
             var a = options.buffer[pos + 3] / 255.0;
 
+            if (invert) {
+                r = 1.0 - r;
+                g = 1.0 - g;
+                b = 1.0 - b;
+            }
+
             var gradient = r * filter.r + g * filter.g + b * filter.b;
 
             // If our alpha channel is not within our filter then we will assign a 'special' height

+ 46 - 0
src/Meshes/Builders/hemisphereBuilder.ts

@@ -0,0 +1,46 @@
+import { Mesh, _CreationDataStorage } from "../mesh";
+import { Scene } from "../../scene";
+import { SphereBuilder } from '../Builders/sphereBuilder';
+
+/**
+ * Creates a hemispheric light
+ */
+Mesh.CreateHemisphere = (name: string, segments: number, diameter: number, scene?: Scene): Mesh => {
+    var options = {
+        segments: segments,
+        diameter: diameter
+    };
+
+    return HemisphereBuilder.CreateHemisphere(name, options, scene);
+};
+
+/**
+ * Class containing static functions to help procedurally build meshes
+ */
+export class HemisphereBuilder {
+    /**
+     * Creates a hemisphere mesh
+     * @param name defines the name of the mesh
+     * @param options defines the options used to create the mesh
+     * @param scene defines the hosting scene
+     * @returns the hemisphere mesh
+     */
+    public static CreateHemisphere(name: string, options: { segments?: number, diameter?: number, sideOrientation?: number }, scene: any): Mesh {
+        if (!options.diameter) {
+            options.diameter = 1;
+        }
+        if (!options.segments) {
+            options.segments = 16;
+        }
+
+        var halfSphere = SphereBuilder.CreateSphere("", {slice: 0.5, diameter: options.diameter, segments: options.segments}, scene);
+        var disc = Mesh.CreateDisc("", options.diameter / 2, (options.segments * 3) + (4 - options.segments), scene);
+        disc.rotation.x = -Math.PI / 2;
+        disc.parent = halfSphere;
+
+        var merged = <Mesh>Mesh.MergeMeshes([disc, halfSphere], true);
+        merged.name = name;
+
+        return merged;
+    }
+}

+ 1 - 0
src/Meshes/Builders/index.ts

@@ -2,6 +2,7 @@ export * from "./boxBuilder";
 export * from "./discBuilder";
 export * from "./ribbonBuilder";
 export * from "./sphereBuilder";
+export * from "./hemisphereBuilder";
 export * from "./cylinderBuilder";
 export * from "./torusBuilder";
 export * from "./torusKnotBuilder";

+ 12 - 0
src/Meshes/mesh.ts

@@ -3232,6 +3232,18 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
     }
 
     /**
+      * Creates a hemisphere mesh. Please consider using the same method from the MeshBuilder class instead
+      * @param name defines the name of the mesh to create
+      * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)
+      * @param diameter sets the diameter size (float) of the sphere (default 1)
+      * @param scene defines the hosting scene
+      * @returns a new Mesh
+      */
+    public static CreateHemisphere(name: string, segments: number, diameter: number, scene?: Scene): Mesh {
+        throw _DevTools.WarnImport("MeshBuilder");
+    }
+
+    /**
      * Creates a cylinder or a cone mesh. Please consider using the same method from the MeshBuilder class instead
      * @param name defines the name of the mesh to create
      * @param height sets the height size (float) of the cylinder/cone (float, default 2)

+ 5 - 5
src/scene.ts

@@ -2595,7 +2595,7 @@ export class Scene extends AbstractScene implements IAnimatable {
             this._multiviewSceneUbo.updateMatrix("viewProjectionR", this._transformMatrixR);
             this._multiviewSceneUbo.updateMatrix("view", this._viewMatrix);
             this._multiviewSceneUbo.update();
-        }else if (this._sceneUbo.useUbo) {
+        } else if (this._sceneUbo.useUbo) {
             this._sceneUbo.updateMatrix("viewProjection", this._transformMatrix);
             this._sceneUbo.updateMatrix("view", this._viewMatrix);
             this._sceneUbo.update();
@@ -4031,7 +4031,7 @@ export class Scene extends AbstractScene implements IAnimatable {
             var useMultiview = this.getEngine().getCaps().multiview && this.activeCamera.outputRenderTarget && this.activeCamera.outputRenderTarget.getViewCount() > 1;
             if (useMultiview) {
                 this.activeCamera.outputRenderTarget._bindFrameBuffer();
-            }else {
+            } else {
                 var internalTexture = this.activeCamera.outputRenderTarget.getInternalTexture();
                 if (internalTexture) {
                     this.getEngine().bindFramebuffer(internalTexture);
@@ -4069,7 +4069,7 @@ export class Scene extends AbstractScene implements IAnimatable {
         var useMultiview = this.getEngine().getCaps().multiview && camera.outputRenderTarget && camera.outputRenderTarget.getViewCount() > 1;
         if (useMultiview) {
             this.setTransformMatrix(camera._rigCameras[0].getViewMatrix(), camera._rigCameras[0].getProjectionMatrix(), camera._rigCameras[1].getViewMatrix(), camera._rigCameras[1].getProjectionMatrix());
-        }else {
+        } else {
             this.updateTransformMatrix();
         }
 
@@ -4152,7 +4152,7 @@ export class Scene extends AbstractScene implements IAnimatable {
         }
 
         // Finalize frame
-        if (this.postProcessManager  && !camera._multiviewTexture) {
+        if (this.postProcessManager && !camera._multiviewTexture) {
             this.postProcessManager._finalizeFrame(camera.isIntermediate);
         }
 
@@ -4215,7 +4215,7 @@ export class Scene extends AbstractScene implements IAnimatable {
                 continue;
             }
 
-            for (var actionIndex = 0; actionIndex < sourceMesh.actionManager.actions.length; actionIndex++) {
+            for (var actionIndex = 0; sourceMesh.actionManager && actionIndex < sourceMesh.actionManager.actions.length; actionIndex++) {
                 var action = sourceMesh.actionManager.actions[actionIndex];
 
                 if (action.trigger === Constants.ACTION_OnIntersectionEnterTrigger || action.trigger === Constants.ACTION_OnIntersectionExitTrigger) {