David Catuhe 6 年之前
父节点
当前提交
4661ed3e61

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


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


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


+ 15 - 0
dist/preview release/babylon.max.js

@@ -31486,6 +31486,7 @@ var BABYLON;
             if (this._scene) {
                 this._scene.textures.push(this);
                 this._scene.onNewTextureAddedObservable.notifyObservers(this);
+                this.uniqueId = this._scene.getUniqueId();
             }
             this._uid = null;
         }
@@ -31974,6 +31975,9 @@ var BABYLON;
         BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;
         __decorate([
             BABYLON.serialize()
+        ], BaseTexture.prototype, "uniqueId", void 0);
+        __decorate([
+            BABYLON.serialize()
         ], BaseTexture.prototype, "name", void 0);
         __decorate([
             BABYLON.serialize("hasAlpha")
@@ -80641,6 +80645,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        /**
+         * Function used to align with Node.getChildren()
+         * @returns the list of Materials used within the multi material
+         */
+        MultiMaterial.prototype.getChildren = function () {
+            return this.subMaterials;
+        };
         MultiMaterial.prototype._hookArray = function (array) {
             var _this = this;
             var oldPush = array.push;
@@ -108775,6 +108786,7 @@ var BABYLON;
          */
         WebXRSessionManager.prototype.initializeAsync = function () {
             var _this = this;
+            BABYLON.Tools.Warn("The WebXR APIs are still under development and are subject to change in the future.");
             // Check if the browser supports webXR
             this._xrNavigator = navigator;
             if (!this._xrNavigator.xr) {
@@ -108998,6 +109010,9 @@ var BABYLON;
          */
         WebXRExperienceHelper.prototype.enterXRAsync = function (sessionCreationOptions, frameOfReference) {
             var _this = this;
+            if (!this._supported) {
+                throw "XR session not supported by this browser";
+            }
             this._setState(WebXRState.ENTERING_XR);
             return this._sessionManager.enterXRAsync(sessionCreationOptions, frameOfReference).then(function () {
                 // Cache pre xr scene settings

+ 15 - 0
dist/preview release/babylon.no-module.max.js

@@ -31453,6 +31453,7 @@ var BABYLON;
             if (this._scene) {
                 this._scene.textures.push(this);
                 this._scene.onNewTextureAddedObservable.notifyObservers(this);
+                this.uniqueId = this._scene.getUniqueId();
             }
             this._uid = null;
         }
@@ -31941,6 +31942,9 @@ var BABYLON;
         BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;
         __decorate([
             BABYLON.serialize()
+        ], BaseTexture.prototype, "uniqueId", void 0);
+        __decorate([
+            BABYLON.serialize()
         ], BaseTexture.prototype, "name", void 0);
         __decorate([
             BABYLON.serialize("hasAlpha")
@@ -80608,6 +80612,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        /**
+         * Function used to align with Node.getChildren()
+         * @returns the list of Materials used within the multi material
+         */
+        MultiMaterial.prototype.getChildren = function () {
+            return this.subMaterials;
+        };
         MultiMaterial.prototype._hookArray = function (array) {
             var _this = this;
             var oldPush = array.push;
@@ -108742,6 +108753,7 @@ var BABYLON;
          */
         WebXRSessionManager.prototype.initializeAsync = function () {
             var _this = this;
+            BABYLON.Tools.Warn("The WebXR APIs are still under development and are subject to change in the future.");
             // Check if the browser supports webXR
             this._xrNavigator = navigator;
             if (!this._xrNavigator.xr) {
@@ -108965,6 +108977,9 @@ var BABYLON;
          */
         WebXRExperienceHelper.prototype.enterXRAsync = function (sessionCreationOptions, frameOfReference) {
             var _this = this;
+            if (!this._supported) {
+                throw "XR session not supported by this browser";
+            }
             this._setState(WebXRState.ENTERING_XR);
             return this._sessionManager.enterXRAsync(sessionCreationOptions, frameOfReference).then(function () {
                 // Cache pre xr scene settings

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


+ 15 - 0
dist/preview release/es6.js

@@ -31453,6 +31453,7 @@ var BABYLON;
             if (this._scene) {
                 this._scene.textures.push(this);
                 this._scene.onNewTextureAddedObservable.notifyObservers(this);
+                this.uniqueId = this._scene.getUniqueId();
             }
             this._uid = null;
         }
@@ -31941,6 +31942,9 @@ var BABYLON;
         BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;
         __decorate([
             BABYLON.serialize()
+        ], BaseTexture.prototype, "uniqueId", void 0);
+        __decorate([
+            BABYLON.serialize()
         ], BaseTexture.prototype, "name", void 0);
         __decorate([
             BABYLON.serialize("hasAlpha")
@@ -80608,6 +80612,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        /**
+         * Function used to align with Node.getChildren()
+         * @returns the list of Materials used within the multi material
+         */
+        MultiMaterial.prototype.getChildren = function () {
+            return this.subMaterials;
+        };
         MultiMaterial.prototype._hookArray = function (array) {
             var _this = this;
             var oldPush = array.push;
@@ -108742,6 +108753,7 @@ var BABYLON;
          */
         WebXRSessionManager.prototype.initializeAsync = function () {
             var _this = this;
+            BABYLON.Tools.Warn("The WebXR APIs are still under development and are subject to change in the future.");
             // Check if the browser supports webXR
             this._xrNavigator = navigator;
             if (!this._xrNavigator.xr) {
@@ -108965,6 +108977,9 @@ var BABYLON;
          */
         WebXRExperienceHelper.prototype.enterXRAsync = function (sessionCreationOptions, frameOfReference) {
             var _this = this;
+            if (!this._supported) {
+                throw "XR session not supported by this browser";
+            }
             this._setState(WebXRState.ENTERING_XR);
             return this._sessionManager.enterXRAsync(sessionCreationOptions, frameOfReference).then(function () {
                 // Cache pre xr scene settings

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


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


+ 26 - 159
dist/preview release/viewer/babylon.viewer.d.ts

@@ -515,167 +515,10 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
-    /**
-        * The current state of the model
-        */
-    export enum ModelState {
-            INIT = 0,
-            LOADING = 1,
-            LOADED = 2,
-            ENTRY = 3,
-            ENTRYDONE = 4,
-            COMPLETE = 5,
-            CANCELED = 6,
-            ERROR = 7
-    }
-    /**
-        * The viewer model is a container for all assets representing a sngle loaded model.
-        */
-    export class ViewerModel implements BABYLON.IDisposable {
-            /**
-                * The loader used to load this model.
-                */
-            loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
-            /**
-                * This model's root mesh (the parent of all other meshes).
-                * This mesh does not(!) exist in the meshes array.
-                */
-            rootMesh: BABYLON.AbstractMesh;
-            /**
-                * ParticleSystems connected to this model
-                */
-            particleSystems: Array<BABYLON.IParticleSystem>;
-            /**
-                * Skeletons defined in this model
-                */
-            skeletons: Array<BABYLON.Skeleton>;
-            /**
-                * The current model animation.
-                * On init, this will be undefined.
-                */
-            currentAnimation: IModelAnimation;
-            /**
-                * Observers registered here will be executed when the model is done loading
-                */
-            onLoadedObservable: BABYLON.Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed when the loader notified of a progress event
-                */
-            onLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
-            /**
-                * Observers registered here will be executed when the loader notified of an error.
-                */
-            onLoadErrorObservable: BABYLON.Observable<{
-                    message: string;
-                    exception: any;
-            }>;
-            /**
-                * Will be executed after the model finished loading and complete, including entry animation and lod
-                */
-            onCompleteObservable: BABYLON.Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed every time the model is being configured.
-                * This can be used to extend the model's configuration without extending the class itself
-                */
-            onAfterConfigure: BABYLON.Observable<ViewerModel>;
-            /**
-                * The current model state (loaded, error, etc)
-                */
-            state: ModelState;
-            /**
-                * A loadID provided by the modelLoader, unique to ths (Abstract)Viewer instance.
-                */
-            loadId: number;
-            loadInfo: BABYLON.GLTF2.IAsset;
-            constructor(_observablesManager: ObservablesManager, modelConfiguration: IModelConfiguration, _configurationContainer?: ConfigurationContainer | undefined);
-            shadowsRenderedAfterLoad: boolean;
-            getViewerId(): string | undefined;
-            /**
-             * Set whether this model is enabled or not.
-             */
-            enabled: boolean;
-            loaderDone: boolean;
-            /**
-                * Add a mesh to this model.
-                * Any mesh that has no parent will be provided with the root mesh as its new parent.
-                *
-                * @param mesh the new mesh to add
-                * @param triggerLoaded should this mesh trigger the onLoaded observable. Used when adding meshes manually.
-                */
-            addMesh(mesh: BABYLON.AbstractMesh, triggerLoaded?: boolean): Promise<ViewerModel> | undefined;
-            /**
-                * get the list of meshes (excluding the root mesh)
-                */
-            readonly meshes: BABYLON.AbstractMesh[];
-            /**
-             * (Re-)set the model's entire configuration
-             * @param newConfiguration the new configuration to replace the new one
-             */
-            configuration: IModelConfiguration;
-            /**
-                * Update the current configuration with new values.
-                * Configuration will not be overwritten, but merged with the new configuration.
-                * Priority is to the new configuration
-                * @param newConfiguration the configuration to be merged into the current configuration;
-                */
-            updateConfiguration(newConfiguration: Partial<IModelConfiguration>): void;
-            /**
-                * Add a new animation group to this model.
-                * @param animationGroup the new animation group to be added
-                */
-            addAnimationGroup(animationGroup: BABYLON.AnimationGroup): void;
-            /**
-                * Get the ModelAnimation array
-                */
-            getAnimations(): Array<IModelAnimation>;
-            /**
-                * Get the animations' names. Using the names you can play a specific animation.
-                */
-            getAnimationNames(): Array<string>;
-            /**
-                * Get an animation by the provided name. Used mainly when playing n animation.
-                * @param name the name of the animation to find
-                */
-            protected _getAnimationByName(name: string): BABYLON.Nullable<IModelAnimation>;
-            /**
-                * Choose an initialized animation using its name and start playing it
-                * @param name the name of the animation to play
-                * @returns The model aniamtion to be played.
-                */
-            playAnimation(name: string): IModelAnimation;
-            setCurrentAnimationByName(name: string): IModelAnimation;
-            /**
-                * Apply a material configuration to a material
-                * @param material BABYLON.Material to apply configuration to
-                * @hidden
-                */
-            _applyModelMaterialConfiguration(material: BABYLON.Material): void;
-            /**
-             * Begin @animations with the specified @easingFunction
-             * @param animations The BABYLON Animations to begin
-             * @param duration of transition, in seconds
-             * @param easingFunction An easing function to apply
-             * @param easingMode A easing mode to apply to the easingFunction
-             * @param onAnimationEnd Call back trigger at the end of the animation.
-             */
-            transitionTo(animations: BABYLON.Animation[], duration: number, easingFunction: any, easingMode: number | undefined, onAnimationEnd: () => void): void;
-            /**
-                * Stops and removes all animations that have been applied to the model
-                */
-            stopAllAnimations(): void;
-            /**
-                * Will remove this model from the viewer (but NOT dispose it).
-                */
-            remove(): void;
-            /**
-                * Dispose this model, including all of its associated assets.
-                */
-            dispose(): void;
-    }
 }
 declare module BabylonViewer {
     /**
-        * BABYLON.Animation play mode enum - is the animation looping or playing once
+        * Animation play mode enum - is the animation looping or playing once
         */
     export const enum AnimationPlayMode {
             ONCE = 0,
@@ -757,7 +600,7 @@ declare module BabylonViewer {
                 */
             readonly currentFrame: number;
             /**
-                * BABYLON.Animation's FPS value
+                * Animation's FPS value
                 */
             readonly fps: number;
             /**
@@ -1865,6 +1708,30 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
+    export interface IGroundConfiguration {
+        size?: number;
+        receiveShadows?: boolean;
+        shadowLevel?: number;
+        shadowOnly?: boolean;
+        mirror?: boolean | {
+            sizeRatio?: number;
+            blurKernel?: number;
+            amount?: number;
+            fresnelWeight?: number;
+            fallOffDistance?: number;
+            textureType?: number;
+        };
+        texture?: string;
+        color?: {
+            r: number;
+            g: number;
+            b: number;
+        };
+        opacity?: number;
+        material?: {
+            [propName: string]: any;
+        };
+    }
 }
 declare module BabylonViewer {
     export interface IImageProcessingConfiguration {

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


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


+ 25 - 164
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -566,169 +566,7 @@ declare module 'babylonjs-viewer/loader/modelLoader' {
 }
 
 declare module 'babylonjs-viewer/model/viewerModel' {
-    import { ISceneLoaderPlugin, ISceneLoaderPluginAsync, AnimationGroup, AbstractMesh, Observable, SceneLoaderProgressEvent, IParticleSystem, Skeleton, IDisposable, Nullable, Animation, Material } from "babylonjs";
-    import { GLTF2 } from "babylonjs-loaders";
-    import { IModelConfiguration } from "babylonjs-viewer/configuration/interfaces/modelConfiguration";
-    import { IModelAnimation } from "babylonjs-viewer/model/modelAnimation";
-    import { ObservablesManager } from "babylonjs-viewer/managers/observablesManager";
-    import { ConfigurationContainer } from "babylonjs-viewer/configuration/configurationContainer";
-    /**
-        * The current state of the model
-        */
-    export enum ModelState {
-            INIT = 0,
-            LOADING = 1,
-            LOADED = 2,
-            ENTRY = 3,
-            ENTRYDONE = 4,
-            COMPLETE = 5,
-            CANCELED = 6,
-            ERROR = 7
-    }
-    /**
-        * The viewer model is a container for all assets representing a sngle loaded model.
-        */
-    export class ViewerModel implements IDisposable {
-            /**
-                * The loader used to load this model.
-                */
-            loader: ISceneLoaderPlugin | ISceneLoaderPluginAsync;
-            /**
-                * This model's root mesh (the parent of all other meshes).
-                * This mesh does not(!) exist in the meshes array.
-                */
-            rootMesh: AbstractMesh;
-            /**
-                * ParticleSystems connected to this model
-                */
-            particleSystems: Array<IParticleSystem>;
-            /**
-                * Skeletons defined in this model
-                */
-            skeletons: Array<Skeleton>;
-            /**
-                * The current model animation.
-                * On init, this will be undefined.
-                */
-            currentAnimation: IModelAnimation;
-            /**
-                * Observers registered here will be executed when the model is done loading
-                */
-            onLoadedObservable: Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed when the loader notified of a progress event
-                */
-            onLoadProgressObservable: Observable<SceneLoaderProgressEvent>;
-            /**
-                * Observers registered here will be executed when the loader notified of an error.
-                */
-            onLoadErrorObservable: Observable<{
-                    message: string;
-                    exception: any;
-            }>;
-            /**
-                * Will be executed after the model finished loading and complete, including entry animation and lod
-                */
-            onCompleteObservable: Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed every time the model is being configured.
-                * This can be used to extend the model's configuration without extending the class itself
-                */
-            onAfterConfigure: Observable<ViewerModel>;
-            /**
-                * The current model state (loaded, error, etc)
-                */
-            state: ModelState;
-            /**
-                * A loadID provided by the modelLoader, unique to ths (Abstract)Viewer instance.
-                */
-            loadId: number;
-            loadInfo: GLTF2.IAsset;
-            constructor(_observablesManager: ObservablesManager, modelConfiguration: IModelConfiguration, _configurationContainer?: ConfigurationContainer | undefined);
-            shadowsRenderedAfterLoad: boolean;
-            getViewerId(): string | undefined;
-            /**
-             * Set whether this model is enabled or not.
-             */
-            enabled: boolean;
-            loaderDone: boolean;
-            /**
-                * Add a mesh to this model.
-                * Any mesh that has no parent will be provided with the root mesh as its new parent.
-                *
-                * @param mesh the new mesh to add
-                * @param triggerLoaded should this mesh trigger the onLoaded observable. Used when adding meshes manually.
-                */
-            addMesh(mesh: AbstractMesh, triggerLoaded?: boolean): Promise<ViewerModel> | undefined;
-            /**
-                * get the list of meshes (excluding the root mesh)
-                */
-            readonly meshes: AbstractMesh[];
-            /**
-             * (Re-)set the model's entire configuration
-             * @param newConfiguration the new configuration to replace the new one
-             */
-            configuration: IModelConfiguration;
-            /**
-                * Update the current configuration with new values.
-                * Configuration will not be overwritten, but merged with the new configuration.
-                * Priority is to the new configuration
-                * @param newConfiguration the configuration to be merged into the current configuration;
-                */
-            updateConfiguration(newConfiguration: Partial<IModelConfiguration>): void;
-            /**
-                * Add a new animation group to this model.
-                * @param animationGroup the new animation group to be added
-                */
-            addAnimationGroup(animationGroup: AnimationGroup): void;
-            /**
-                * Get the ModelAnimation array
-                */
-            getAnimations(): Array<IModelAnimation>;
-            /**
-                * Get the animations' names. Using the names you can play a specific animation.
-                */
-            getAnimationNames(): Array<string>;
-            /**
-                * Get an animation by the provided name. Used mainly when playing n animation.
-                * @param name the name of the animation to find
-                */
-            protected _getAnimationByName(name: string): Nullable<IModelAnimation>;
-            /**
-                * Choose an initialized animation using its name and start playing it
-                * @param name the name of the animation to play
-                * @returns The model aniamtion to be played.
-                */
-            playAnimation(name: string): IModelAnimation;
-            setCurrentAnimationByName(name: string): IModelAnimation;
-            /**
-                * Apply a material configuration to a material
-                * @param material Material to apply configuration to
-                * @hidden
-                */
-            _applyModelMaterialConfiguration(material: Material): void;
-            /**
-             * Begin @animations with the specified @easingFunction
-             * @param animations The BABYLON Animations to begin
-             * @param duration of transition, in seconds
-             * @param easingFunction An easing function to apply
-             * @param easingMode A easing mode to apply to the easingFunction
-             * @param onAnimationEnd Call back trigger at the end of the animation.
-             */
-            transitionTo(animations: Animation[], duration: number, easingFunction: any, easingMode: number | undefined, onAnimationEnd: () => void): void;
-            /**
-                * Stops and removes all animations that have been applied to the model
-                */
-            stopAllAnimations(): void;
-            /**
-                * Will remove this model from the viewer (but NOT dispose it).
-                */
-            remove(): void;
-            /**
-                * Dispose this model, including all of its associated assets.
-                */
-            dispose(): void;
-    }
+    
 }
 
 declare module 'babylonjs-viewer/model/modelAnimation' {
@@ -2013,7 +1851,30 @@ declare module 'babylonjs-viewer/configuration/interfaces/defaultRenderingPipeli
 }
 
 declare module 'babylonjs-viewer/configuration/interfaces/groundConfiguration' {
-    
+    export interface IGroundConfiguration {
+        size?: number;
+        receiveShadows?: boolean;
+        shadowLevel?: number;
+        shadowOnly?: boolean;
+        mirror?: boolean | {
+            sizeRatio?: number;
+            blurKernel?: number;
+            amount?: number;
+            fresnelWeight?: number;
+            fallOffDistance?: number;
+            textureType?: number;
+        };
+        texture?: string;
+        color?: {
+            r: number;
+            g: number;
+            b: number;
+        };
+        opacity?: number;
+        material?: {
+            [propName: string]: any;
+        };
+    }
 }
 
 declare module 'babylonjs-viewer/configuration/interfaces/imageProcessingConfiguration' {

+ 7 - 0
src/Materials/Textures/babylon.baseTexture.ts

@@ -12,6 +12,12 @@ module BABYLON {
         public static DEFAULT_ANISOTROPIC_FILTERING_LEVEL = 4;
 
         /**
+         * Gets or sets the unique id of the texture
+         */
+        @serialize()
+        public uniqueId: number;
+
+        /**
          * Define the name of the texture.
          */
         @serialize()
@@ -276,6 +282,7 @@ module BABYLON {
             if (this._scene) {
                 this._scene.textures.push(this);
                 this._scene.onNewTextureAddedObservable.notifyObservers(this);
+                this.uniqueId = this._scene.getUniqueId();
             }
             this._uid = null;
         }

+ 8 - 0
src/Materials/babylon.multiMaterial.ts

@@ -21,6 +21,14 @@ module BABYLON {
         }
 
         /**
+         * Function used to align with Node.getChildren()
+         * @returns the list of Materials used within the multi material
+         */
+        public getChildren(): Nullable<Material>[] {
+            return this.subMaterials;
+        }
+
+        /**
          * Instantiates a new Multi Material
          * A multi-material is used to apply different materials to different parts of the same object without the need of
          * separate meshes. This can be use to improve performances.