sebastien 7 年之前
父节点
当前提交
5632ad26d3

文件差异内容过多而无法显示
+ 10112 - 10047
Playground/babylon.d.txt


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


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


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


文件差异内容过多而无法显示
+ 212 - 44
dist/preview release/babylon.no-module.max.js


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


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


+ 4 - 0
dist/preview release/gui/babylon.gui.d.ts

@@ -2151,6 +2151,10 @@ declare module BABYLON.GUI {
         */
     export class HolographicButton extends Button3D {
             /**
+                * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
+                */
+            tooltipText: BABYLON.Nullable<string>;
+            /**
                 * Gets or sets text for the button
                 */
             text: string;

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


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


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


+ 9 - 1
dist/preview release/gui/babylon.gui.module.d.ts

@@ -2325,7 +2325,7 @@ declare module 'babylonjs-gui/3D/controls/cylinderPanel' {
 
 declare module 'babylonjs-gui/3D/controls/holographicButton' {
     import { Button3D } from "babylonjs-gui/3D/controls/button3D";
-    import { Mesh, StandardMaterial, Scene, TransformNode } from "babylonjs";
+    import { Mesh, StandardMaterial, Nullable, Scene, TransformNode } from "babylonjs";
     import { FluentMaterial } from "babylonjs-gui/3D/materials/fluentMaterial";
     import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
     /**
@@ -2333,6 +2333,10 @@ declare module 'babylonjs-gui/3D/controls/holographicButton' {
         */
     export class HolographicButton extends Button3D {
             /**
+                * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
+                */
+            tooltipText: Nullable<string>;
+            /**
                 * Gets or sets text for the button
                 */
             text: string;
@@ -4747,6 +4751,10 @@ declare module BABYLON.GUI {
         */
     export class HolographicButton extends Button3D {
             /**
+                * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
+                */
+            tooltipText: BABYLON.Nullable<string>;
+            /**
                 * Gets or sets text for the button
                 */
             text: string;

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


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


+ 2 - 86
dist/preview release/typedocValidationBaseline.json

@@ -1,7 +1,7 @@
 {
-  "errors": 4019,
+  "errors": 4003,
   "babylon.typedoc.json": {
-    "errors": 4019,
+    "errors": 4003,
     "AbstractMesh": {
       "Property": {
         "showBoundingBox": {
@@ -7447,85 +7447,6 @@
         }
       },
       "Method": {
-        "applyDisplacementMap": {
-          "Comments": {
-            "MissingReturn": true
-          },
-          "Parameter": {
-            "url": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "minHeight": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "maxHeight": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "onSuccess": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "uvOffset": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "uvScale": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "applyDisplacementMapFromBuffer": {
-          "Comments": {
-            "MissingReturn": true
-          },
-          "Parameter": {
-            "buffer": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "heightMapWidth": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "heightMapHeight": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "minHeight": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "maxHeight": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "uvOffset": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "uvScale": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
         "applySkeleton": {
           "Comments": {
             "MissingReturn": true
@@ -13773,11 +13694,6 @@
           "Comments": {
             "MissingText": true
           }
-        },
-        "samples": {
-          "Comments": {
-            "MissingText": true
-          }
         }
       }
     },

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

@@ -168,11 +168,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<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -189,11 +189,11 @@ declare module BabylonViewer {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -924,7 +924,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): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 declare module BabylonViewer {
@@ -1558,20 +1558,6 @@ 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 {
 }
 declare module BabylonViewer {
     export interface IEnvironmentMapConfiguration {

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


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


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

@@ -200,11 +200,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<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -221,11 +221,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -985,14 +985,13 @@ 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): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 
@@ -1663,22 +1662,6 @@ 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';

+ 32 - 23
src/Mesh/babylon.mesh.ts

@@ -1858,15 +1858,16 @@
          * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.  
          * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
          * This method returns nothing.   
-         * The parameter `url` is a string, the URL from the image file is to be downloaded.  
-         * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
-         * The parameter `onSuccess` is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.
-         * The parameter `uvOffset` is an optional vector2 used to offset UV.
-         * The parameter `uvScale` is an optional vector2 used to scale UV.  
-         * 
-         * Returns the Mesh.  
-         */
-        public applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void, uvOffset?: Vector2, uvScale?: Vector2): Mesh {
+         * @param url is a string, the URL from the image file is to be downloaded.
+         * @param minHeight is the lower limit of the displacement.
+         * @param maxHeight is the upper limit of the displacement.
+         * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.
+         * @param uvOffset is an optional vector2 used to offset UV.
+         * @param uvScale is an optional vector2 used to scale UV.  
+         * @param forceUpdate defines whether or not to force an update of the generated buffers. This is usefull to apply on a deserialized model for instance.
+         * @returns the Mesh.  
+         */
+        public applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void, uvOffset?: Vector2, uvScale?: Vector2, forceUpdate = false): Mesh {
             var scene = this.getScene();
 
             var onload = (img: HTMLImageElement) => {
@@ -1884,7 +1885,7 @@
                 //Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949
                 var buffer = <Uint8Array>(<any>context.getImageData(0, 0, heightMapWidth, heightMapHeight).data);
 
-                this.applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale);
+                this.applyDisplacementMapFromBuffer(buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight, uvOffset, uvScale, forceUpdate);
                 //execute success callback, if set
                 if (onSuccess) {
                     onSuccess(this);
@@ -1899,16 +1900,18 @@
          * Modifies the mesh geometry according to a displacementMap buffer.
          * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.  
          * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
-         * This method returns nothing.   
-         * The parameter `buffer` is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.
-         * The parameters `heightMapWidth` and `heightMapHeight` are positive integers to set the width and height of the buffer image.     
-         * The parameters `minHeight` and `maxHeight` are the lower and upper limits of the displacement.
-         * The parameter `uvOffset` is an optional vector2 used to offset UV.
-         * The parameter `uvScale` is an optional vector2 used to scale UV.  
-         * 
-         * Returns the Mesh.  
-         */
-        public applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number, uvOffset?: Vector2, uvScale?: Vector2): Mesh {
+         * @param buffer is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.
+         * @param heightMapWidth is the width of the buffer image.
+         * @param heightMapHeight is the height of the buffer image.
+         * @param minHeight is the lower limit of the displacement.
+         * @param maxHeight is the upper limit of the displacement.
+         * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.
+         * @param uvOffset is an optional vector2 used to offset UV.
+         * @param uvScale is an optional vector2 used to scale UV.  
+         * @param forceUpdate defines whether or not to force an update of the generated buffers. This is usefull to apply on a deserialized model for instance.
+         * @returns the Mesh.
+         */
+        public applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number, uvOffset?: Vector2, uvScale?: Vector2, forceUpdate = false): Mesh {
             if (!this.isVerticesDataPresent(VertexBuffer.PositionKind)
                 || !this.isVerticesDataPresent(VertexBuffer.NormalKind)
                 || !this.isVerticesDataPresent(VertexBuffer.UVKind)) {
@@ -1916,7 +1919,7 @@
                 return this;
             }
 
-            var positions = <FloatArray>this.getVerticesData(VertexBuffer.PositionKind);
+            var positions = <FloatArray>this.getVerticesData(VertexBuffer.PositionKind, true, true);
             var normals = <FloatArray>this.getVerticesData(VertexBuffer.NormalKind);
             var uvs = <number[]>this.getVerticesData(VertexBuffer.UVKind);
             var position = Vector3.Zero();
@@ -1951,8 +1954,14 @@
 
             VertexData.ComputeNormals(positions, this.getIndices(), normals);
 
-            this.updateVerticesData(VertexBuffer.PositionKind, positions);
-            this.updateVerticesData(VertexBuffer.NormalKind, normals);
+            if (forceUpdate) {
+                this.setVerticesData(VertexBuffer.PositionKind, positions);
+                this.setVerticesData(VertexBuffer.NormalKind, normals);
+            }
+            else {
+                this.updateVerticesData(VertexBuffer.PositionKind, positions);
+                this.updateVerticesData(VertexBuffer.NormalKind, normals);
+            }
             return this;
         }