David Catuhe 6 rokov pred
rodič
commit
fcd185cc3d

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 3303 - 3282
Playground/babylon.d.txt


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 3316 - 3295
dist/preview release/babylon.d.ts


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
dist/preview release/babylon.js


+ 18 - 11
dist/preview release/babylon.max.js

@@ -7710,8 +7710,11 @@ var BABYLON;
          * @returns the current matrix
          */
         Matrix.prototype.addToRef = function (other, result) {
+            var m = this._m;
+            var resultM = result._m;
+            var otherM = other.m;
             for (var index = 0; index < 16; index++) {
-                result._m[index] = this._m[index] + other._m[index];
+                resultM[index] = m[index] + otherM[index];
             }
             result._markAsUpdated();
             return this;
@@ -7722,8 +7725,10 @@ var BABYLON;
          * @returns the current updated matrix
          */
         Matrix.prototype.addToSelf = function (other) {
+            var m = this._m;
+            var otherM = other.m;
             for (var index = 0; index < 16; index++) {
-                this._m[index] += other._m[index];
+                m[index] += otherM[index];
             }
             this._markAsUpdated();
             return this;
@@ -8579,8 +8584,11 @@ var BABYLON;
          * @param result defines the Matrix object where to store data
          */
         Matrix.LerpToRef = function (startValue, endValue, gradient, result) {
+            var resultM = result._m;
+            var startM = startValue.m;
+            var endM = endValue.m;
             for (var index = 0; index < 16; index++) {
-                result._m[index] = startValue._m[index] * (1.0 - gradient) + endValue._m[index] * gradient;
+                resultM[index] = startM[index] * (1.0 - gradient) + endM[index] * gradient;
             }
             result._markAsUpdated();
         };
@@ -8964,10 +8972,8 @@ var BABYLON;
          * @returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the given matrix
          */
         Matrix.GetAsMatrix2x2 = function (matrix) {
-            return new Float32Array([
-                matrix._m[0], matrix._m[1],
-                matrix._m[4], matrix._m[5]
-            ]);
+            var m = matrix.m;
+            return new Float32Array([m[0], m[1], m[4], m[5]]);
         };
         /**
          * Extracts a 3x3 matrix from a given matrix and store the result in a Float32Array
@@ -8975,10 +8981,11 @@ var BABYLON;
          * @returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the given matrix
          */
         Matrix.GetAsMatrix3x3 = function (matrix) {
+            var m = matrix.m;
             return new Float32Array([
-                matrix._m[0], matrix._m[1], matrix._m[2],
-                matrix._m[4], matrix._m[5], matrix._m[6],
-                matrix._m[8], matrix._m[9], matrix._m[10]
+                m[0], m[1], m[2],
+                m[4], m[5], m[6],
+                m[8], m[9], m[10]
             ]);
         };
         /**
@@ -8998,7 +9005,7 @@ var BABYLON;
          */
         Matrix.TransposeToRef = function (matrix, result) {
             var rm = result._m;
-            var mm = matrix._m;
+            var mm = matrix.m;
             rm[0] = mm[0];
             rm[1] = mm[4];
             rm[2] = mm[8];

+ 18 - 11
dist/preview release/babylon.no-module.max.js

@@ -7677,8 +7677,11 @@ var BABYLON;
          * @returns the current matrix
          */
         Matrix.prototype.addToRef = function (other, result) {
+            var m = this._m;
+            var resultM = result._m;
+            var otherM = other.m;
             for (var index = 0; index < 16; index++) {
-                result._m[index] = this._m[index] + other._m[index];
+                resultM[index] = m[index] + otherM[index];
             }
             result._markAsUpdated();
             return this;
@@ -7689,8 +7692,10 @@ var BABYLON;
          * @returns the current updated matrix
          */
         Matrix.prototype.addToSelf = function (other) {
+            var m = this._m;
+            var otherM = other.m;
             for (var index = 0; index < 16; index++) {
-                this._m[index] += other._m[index];
+                m[index] += otherM[index];
             }
             this._markAsUpdated();
             return this;
@@ -8546,8 +8551,11 @@ var BABYLON;
          * @param result defines the Matrix object where to store data
          */
         Matrix.LerpToRef = function (startValue, endValue, gradient, result) {
+            var resultM = result._m;
+            var startM = startValue.m;
+            var endM = endValue.m;
             for (var index = 0; index < 16; index++) {
-                result._m[index] = startValue._m[index] * (1.0 - gradient) + endValue._m[index] * gradient;
+                resultM[index] = startM[index] * (1.0 - gradient) + endM[index] * gradient;
             }
             result._markAsUpdated();
         };
@@ -8931,10 +8939,8 @@ var BABYLON;
          * @returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the given matrix
          */
         Matrix.GetAsMatrix2x2 = function (matrix) {
-            return new Float32Array([
-                matrix._m[0], matrix._m[1],
-                matrix._m[4], matrix._m[5]
-            ]);
+            var m = matrix.m;
+            return new Float32Array([m[0], m[1], m[4], m[5]]);
         };
         /**
          * Extracts a 3x3 matrix from a given matrix and store the result in a Float32Array
@@ -8942,10 +8948,11 @@ var BABYLON;
          * @returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the given matrix
          */
         Matrix.GetAsMatrix3x3 = function (matrix) {
+            var m = matrix.m;
             return new Float32Array([
-                matrix._m[0], matrix._m[1], matrix._m[2],
-                matrix._m[4], matrix._m[5], matrix._m[6],
-                matrix._m[8], matrix._m[9], matrix._m[10]
+                m[0], m[1], m[2],
+                m[4], m[5], m[6],
+                m[8], m[9], m[10]
             ]);
         };
         /**
@@ -8965,7 +8972,7 @@ var BABYLON;
          */
         Matrix.TransposeToRef = function (matrix, result) {
             var rm = result._m;
-            var mm = matrix._m;
+            var mm = matrix.m;
             rm[0] = mm[0];
             rm[1] = mm[4];
             rm[2] = mm[8];

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
dist/preview release/babylon.worker.js


+ 18 - 11
dist/preview release/es6.js

@@ -7677,8 +7677,11 @@ var BABYLON;
          * @returns the current matrix
          */
         Matrix.prototype.addToRef = function (other, result) {
+            var m = this._m;
+            var resultM = result._m;
+            var otherM = other.m;
             for (var index = 0; index < 16; index++) {
-                result._m[index] = this._m[index] + other._m[index];
+                resultM[index] = m[index] + otherM[index];
             }
             result._markAsUpdated();
             return this;
@@ -7689,8 +7692,10 @@ var BABYLON;
          * @returns the current updated matrix
          */
         Matrix.prototype.addToSelf = function (other) {
+            var m = this._m;
+            var otherM = other.m;
             for (var index = 0; index < 16; index++) {
-                this._m[index] += other._m[index];
+                m[index] += otherM[index];
             }
             this._markAsUpdated();
             return this;
@@ -8546,8 +8551,11 @@ var BABYLON;
          * @param result defines the Matrix object where to store data
          */
         Matrix.LerpToRef = function (startValue, endValue, gradient, result) {
+            var resultM = result._m;
+            var startM = startValue.m;
+            var endM = endValue.m;
             for (var index = 0; index < 16; index++) {
-                result._m[index] = startValue._m[index] * (1.0 - gradient) + endValue._m[index] * gradient;
+                resultM[index] = startM[index] * (1.0 - gradient) + endM[index] * gradient;
             }
             result._markAsUpdated();
         };
@@ -8931,10 +8939,8 @@ var BABYLON;
          * @returns a new Float32Array array with 4 elements : the 2x2 matrix extracted from the given matrix
          */
         Matrix.GetAsMatrix2x2 = function (matrix) {
-            return new Float32Array([
-                matrix._m[0], matrix._m[1],
-                matrix._m[4], matrix._m[5]
-            ]);
+            var m = matrix.m;
+            return new Float32Array([m[0], m[1], m[4], m[5]]);
         };
         /**
          * Extracts a 3x3 matrix from a given matrix and store the result in a Float32Array
@@ -8942,10 +8948,11 @@ var BABYLON;
          * @returns a new Float32Array array with 9 elements : the 3x3 matrix extracted from the given matrix
          */
         Matrix.GetAsMatrix3x3 = function (matrix) {
+            var m = matrix.m;
             return new Float32Array([
-                matrix._m[0], matrix._m[1], matrix._m[2],
-                matrix._m[4], matrix._m[5], matrix._m[6],
-                matrix._m[8], matrix._m[9], matrix._m[10]
+                m[0], m[1], m[2],
+                m[4], m[5], m[6],
+                m[8], m[9], m[10]
             ]);
         };
         /**
@@ -8965,7 +8972,7 @@ var BABYLON;
          */
         Matrix.TransposeToRef = function (matrix, result) {
             var rm = result._m;
-            var mm = matrix._m;
+            var mm = matrix.m;
             rm[0] = mm[0];
             rm[1] = mm[4];
             rm[2] = mm[8];

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js.map


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.js.map


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

@@ -515,10 +515,167 @@ 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 {
     /**
-        * Animation play mode enum - is the animation looping or playing once
+        * BABYLON.Animation play mode enum - is the animation looping or playing once
         */
     export const enum AnimationPlayMode {
             ONCE = 0,
@@ -600,7 +757,7 @@ declare module BabylonViewer {
                 */
             readonly currentFrame: number;
             /**
-                * Animation's FPS value
+                * BABYLON.Animation's FPS value
                 */
             readonly fps: number;
             /**

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 2 - 2
dist/preview release/viewer/babylon.viewer.js


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 3 - 3
dist/preview release/viewer/babylon.viewer.max.js


+ 163 - 1
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -566,7 +566,169 @@ 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' {