David Catuhe 7 anni fa
parent
commit
058ee694ea

File diff suppressed because it is too large
+ 12390 - 12388
Playground/babylon.d.txt


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


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


+ 3 - 2
dist/preview release/babylon.max.js

@@ -93398,7 +93398,7 @@ var BABYLON;
             var pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);
             if (pickedPoint) {
                 this.dragging = true;
-                this.currentDraggingPointerID = 1;
+                this.currentDraggingPointerID = pointerId;
                 this.lastDragPosition.copyFrom(pickedPoint);
                 this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerID });
                 this._targetPosition.copyFrom((this._attachedNode).absolutePosition);
@@ -93716,6 +93716,7 @@ var BABYLON;
                         _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
                         // Attach the virtual drag mesh to the virtual origin mesh so it can be dragged
                         _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);
+                        pickedMesh.computeWorldMatrix();
                         _this._virtualDragMesh.position.copyFrom(pickedMesh.absolutePosition);
                         if (!pickedMesh.rotationQuaternion) {
                             pickedMesh.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(pickedMesh.rotation.y, pickedMesh.rotation.x, pickedMesh.rotation.z);
@@ -97702,7 +97703,7 @@ var BABYLON;
                                     }
                                     var activateLightOnSubMeshes_1 = function (mesh, light) {
                                         var children = mesh.getChildren();
-                                        if (children.length !== 0) {
+                                        if (children && children.length !== 0) {
                                             children.forEach(function (mesh) {
                                                 light.includedOnlyMeshes.push(mesh);
                                                 activateLightOnSubMeshes_1(mesh, light);

+ 3 - 2
dist/preview release/babylon.no-module.max.js

@@ -93365,7 +93365,7 @@ var BABYLON;
             var pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);
             if (pickedPoint) {
                 this.dragging = true;
-                this.currentDraggingPointerID = 1;
+                this.currentDraggingPointerID = pointerId;
                 this.lastDragPosition.copyFrom(pickedPoint);
                 this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerID });
                 this._targetPosition.copyFrom((this._attachedNode).absolutePosition);
@@ -93683,6 +93683,7 @@ var BABYLON;
                         _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
                         // Attach the virtual drag mesh to the virtual origin mesh so it can be dragged
                         _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);
+                        pickedMesh.computeWorldMatrix();
                         _this._virtualDragMesh.position.copyFrom(pickedMesh.absolutePosition);
                         if (!pickedMesh.rotationQuaternion) {
                             pickedMesh.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(pickedMesh.rotation.y, pickedMesh.rotation.x, pickedMesh.rotation.z);
@@ -97669,7 +97670,7 @@ var BABYLON;
                                     }
                                     var activateLightOnSubMeshes_1 = function (mesh, light) {
                                         var children = mesh.getChildren();
-                                        if (children.length !== 0) {
+                                        if (children && children.length !== 0) {
                                             children.forEach(function (mesh) {
                                                 light.includedOnlyMeshes.push(mesh);
                                                 activateLightOnSubMeshes_1(mesh, light);

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


+ 3 - 2
dist/preview release/es6.js

@@ -93365,7 +93365,7 @@ var BABYLON;
             var pickedPoint = this._pickWithRayOnDragPlane(this._startDragRay);
             if (pickedPoint) {
                 this.dragging = true;
-                this.currentDraggingPointerID = 1;
+                this.currentDraggingPointerID = pointerId;
                 this.lastDragPosition.copyFrom(pickedPoint);
                 this.onDragStartObservable.notifyObservers({ dragPlanePoint: pickedPoint, pointerId: this.currentDraggingPointerID });
                 this._targetPosition.copyFrom((this._attachedNode).absolutePosition);
@@ -93683,6 +93683,7 @@ var BABYLON;
                         _this._virtualOriginMesh.lookAt(pointerInfo.pickInfo.ray.origin.subtract(pointerInfo.pickInfo.ray.direction));
                         // Attach the virtual drag mesh to the virtual origin mesh so it can be dragged
                         _this._virtualOriginMesh.removeChild(_this._virtualDragMesh);
+                        pickedMesh.computeWorldMatrix();
                         _this._virtualDragMesh.position.copyFrom(pickedMesh.absolutePosition);
                         if (!pickedMesh.rotationQuaternion) {
                             pickedMesh.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(pickedMesh.rotation.y, pickedMesh.rotation.x, pickedMesh.rotation.z);
@@ -97669,7 +97670,7 @@ var BABYLON;
                                     }
                                     var activateLightOnSubMeshes_1 = function (mesh, light) {
                                         var children = mesh.getChildren();
-                                        if (children.length !== 0) {
+                                        if (children && children.length !== 0) {
                                             children.forEach(function (mesh) {
                                                 light.includedOnlyMeshes.push(mesh);
                                                 activateLightOnSubMeshes_1(mesh, light);

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

@@ -1702,7 +1702,9 @@ declare module BABYLON.GUI {
             /** @hidden */
             _setSelectorButtonBackground(selectorNb: number, color: string): void;
     }
-    /** Class used to hold the controls for the checkboxes, radio buttons and sliders */
+    /** Class used to hold the controls for the checkboxes, radio buttons and sliders
+        * @see http://doc.babylonjs.com/how_to/selector
+     */
     export class SelectionPanel extends Rectangle {
             /** name of SelectionPanel */
             name: string;

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


+ 6 - 2
dist/preview release/gui/babylon.gui.module.d.ts

@@ -1844,7 +1844,9 @@ declare module 'babylonjs-gui/2D/controls/selector' {
             /** @hidden */
             _setSelectorButtonBackground(selectorNb: number, color: string): void;
     }
-    /** Class used to hold the controls for the checkboxes, radio buttons and sliders */
+    /** Class used to hold the controls for the checkboxes, radio buttons and sliders
+        * @see http://doc.babylonjs.com/how_to/selector
+     */
     export class SelectionPanel extends Rectangle {
             /** name of SelectionPanel */
             name: string;
@@ -4508,7 +4510,9 @@ declare module BABYLON.GUI {
             /** @hidden */
             _setSelectorButtonBackground(selectorNb: number, color: string): void;
     }
-    /** Class used to hold the controls for the checkboxes, radio buttons and sliders */
+    /** Class used to hold the controls for the checkboxes, radio buttons and sliders
+        * @see http://doc.babylonjs.com/how_to/selector
+     */
     export class SelectionPanel extends Rectangle {
             /** name of SelectionPanel */
             name: string;

+ 9 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -1865,11 +1865,18 @@ var BABYLON;
                         return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
                     });
                 }
+                // HACK: If byte offset is not a multiple of component type byte length then load as a float array instead of using Babylon buffers.
+                else if (accessor.byteOffset && accessor.byteOffset % BABYLON.VertexBuffer.GetTypeByteLength(accessor.componentType) !== 0) {
+                    BABYLON.Tools.Warn("Accessor byte offset is not a multiple of component type byte length");
+                    accessor._babylonVertexBuffer = this._loadFloatAccessorAsync("#/accessors/" + accessor.index, accessor).then(function (data) {
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
+                    });
+                }
                 else {
                     var bufferView_1 = ArrayItem.Get(context + "/bufferView", this.gltf.bufferViews, accessor.bufferView);
-                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (buffer) {
+                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (babylonBuffer) {
                         var size = GLTFLoader._GetNumComponents(context, accessor.type);
-                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), buffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), babylonBuffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
                     });
                 }
                 return accessor._babylonVertexBuffer;

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


+ 9 - 2
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -4072,11 +4072,18 @@ var BABYLON;
                         return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
                     });
                 }
+                // HACK: If byte offset is not a multiple of component type byte length then load as a float array instead of using Babylon buffers.
+                else if (accessor.byteOffset && accessor.byteOffset % BABYLON.VertexBuffer.GetTypeByteLength(accessor.componentType) !== 0) {
+                    BABYLON.Tools.Warn("Accessor byte offset is not a multiple of component type byte length");
+                    accessor._babylonVertexBuffer = this._loadFloatAccessorAsync("#/accessors/" + accessor.index, accessor).then(function (data) {
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
+                    });
+                }
                 else {
                     var bufferView_1 = ArrayItem.Get(context + "/bufferView", this.gltf.bufferViews, accessor.bufferView);
-                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (buffer) {
+                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (babylonBuffer) {
                         var size = GLTFLoader._GetNumComponents(context, accessor.type);
-                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), buffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), babylonBuffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
                     });
                 }
                 return accessor._babylonVertexBuffer;

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


+ 9 - 2
dist/preview release/loaders/babylonjs.loaders.js

@@ -5131,11 +5131,18 @@ var BABYLON;
                         return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
                     });
                 }
+                // HACK: If byte offset is not a multiple of component type byte length then load as a float array instead of using Babylon buffers.
+                else if (accessor.byteOffset && accessor.byteOffset % BABYLON.VertexBuffer.GetTypeByteLength(accessor.componentType) !== 0) {
+                    BABYLON.Tools.Warn("Accessor byte offset is not a multiple of component type byte length");
+                    accessor._babylonVertexBuffer = this._loadFloatAccessorAsync("#/accessors/" + accessor.index, accessor).then(function (data) {
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), data, kind, false);
+                    });
+                }
                 else {
                     var bufferView_1 = ArrayItem.Get(context + "/bufferView", this.gltf.bufferViews, accessor.bufferView);
-                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (buffer) {
+                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync(bufferView_1, kind).then(function (babylonBuffer) {
                         var size = GLTFLoader._GetNumComponents(context, accessor.type);
-                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), buffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
+                        return new BABYLON.VertexBuffer(_this.babylonScene.getEngine(), babylonBuffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
                     });
                 }
                 return accessor._babylonVertexBuffer;

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


+ 5 - 86
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 {
@@ -2115,73 +2101,6 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
-    /**
-        * A single template configuration object
-        */
-    export interface ITemplateConfiguration {
-            /**
-                * can be either the id of the template's html element or a URL.
-                * See - http://doc.babylonjs.com/extensions/the_templating_system#location-vs-html
-                */
-            location?: string;
-            /**
-                * If no location is provided you can provide here the raw html of this template.
-                * See http://doc.babylonjs.com/extensions/the_templating_system#location-vs-html
-                */
-            html?: string;
-            id?: string;
-            /**
-                * Parameters that will be delivered to the template and will render it accordingly.
-                */
-            params?: {
-                    [key: string]: string | number | boolean | object;
-            };
-            /**
-                * Events to attach to this template.
-                * event name is the key. the value can either be a boolean (attach to the parent element)
-                * or a map of html id elements.
-                *
-                * See - http://doc.babylonjs.com/extensions/the_templating_system#event-binding
-                */
-            events?: {
-                    pointerdown?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointerup?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointermove?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointerover?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointerout?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointerenter?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointerleave?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointercancel?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    click?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    dragstart?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    drop?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    [key: string]: boolean | {
-                            [id: string]: boolean;
-                    } | undefined;
-            };
-    }
 }
 declare module BabylonViewer {
     export interface IVRConfiguration {

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


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


+ 6 - 89
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';
@@ -2277,73 +2260,7 @@ declare module 'babylonjs-viewer/configuration/interfaces/skyboxConfiguration' {
 }
 
 declare module 'babylonjs-viewer/configuration/interfaces/templateConfiguration' {
-    /**
-        * A single template configuration object
-        */
-    export interface ITemplateConfiguration {
-            /**
-                * can be either the id of the template's html element or a URL.
-                * See - http://doc.babylonjs.com/extensions/the_templating_system#location-vs-html
-                */
-            location?: string;
-            /**
-                * If no location is provided you can provide here the raw html of this template.
-                * See http://doc.babylonjs.com/extensions/the_templating_system#location-vs-html
-                */
-            html?: string;
-            id?: string;
-            /**
-                * Parameters that will be delivered to the template and will render it accordingly.
-                */
-            params?: {
-                    [key: string]: string | number | boolean | object;
-            };
-            /**
-                * Events to attach to this template.
-                * event name is the key. the value can either be a boolean (attach to the parent element)
-                * or a map of html id elements.
-                *
-                * See - http://doc.babylonjs.com/extensions/the_templating_system#event-binding
-                */
-            events?: {
-                    pointerdown?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointerup?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointermove?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointerover?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointerout?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointerenter?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointerleave?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    pointercancel?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    click?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    dragstart?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    drop?: boolean | {
-                            [id: string]: boolean;
-                    };
-                    [key: string]: boolean | {
-                            [id: string]: boolean;
-                    } | undefined;
-            };
-    }
+    
 }
 
 declare module 'babylonjs-viewer/configuration/interfaces/vrConfiguration' {