David Catuhe 9 роки тому
батько
коміт
45177ee204

Різницю між файлами не показано, бо вона завелика
+ 2 - 2
dist/preview release/babylon.core.js


Різницю між файлами не показано, бо вона завелика
+ 7382 - 7380
dist/preview release/babylon.d.ts


Різницю між файлами не показано, бо вона завелика
+ 16 - 16
dist/preview release/babylon.js


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

@@ -34786,8 +34786,9 @@ var BABYLON;
         /**
         /**
         * Play the sound
         * Play the sound
         * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
         * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
+        * @param offset (optional) Start the sound setting it at a specific time
         */
         */
-        Sound.prototype.play = function (time) {
+        Sound.prototype.play = function (time, offset) {
             var _this = this;
             var _this = this;
             if (this._isReadyToPlay && this._scene.audioEnabled) {
             if (this._isReadyToPlay && this._scene.audioEnabled) {
                 try {
                 try {
@@ -34829,7 +34830,7 @@ var BABYLON;
                         this._soundSource.loop = this.loop;
                         this._soundSource.loop = this.loop;
                         this._soundSource.playbackRate.value = this._playbackRate;
                         this._soundSource.playbackRate.value = this._playbackRate;
                         this._soundSource.onended = function () { _this._onended(); };
                         this._soundSource.onended = function () { _this._onended(); };
-                        this._soundSource.start(startTime, this.isPaused ? this._startOffset % this._soundSource.buffer.duration : 0);
+                        this._soundSource.start(startTime, this.isPaused ? this._startOffset % this._soundSource.buffer.duration : offset ? offset : 0);
                     }
                     }
                     this._startTime = startTime;
                     this._startTime = startTime;
                     this.isPlaying = true;
                     this.isPlaying = true;
@@ -34978,6 +34979,36 @@ var BABYLON;
         Sound.prototype.getAudioBuffer = function () {
         Sound.prototype.getAudioBuffer = function () {
             return this._audioBuffer;
             return this._audioBuffer;
         };
         };
+        Sound.prototype.serialize = function () {
+            var serializationObject = {
+                name: this.name,
+                url: this.name,
+                autoplay: this.autoplay,
+                loop: this.loop,
+                volume: this._volume,
+                spatialSound: this.spatialSound,
+                maxDistance: this.maxDistance,
+                rolloffFactor: this.rolloffFactor,
+                refDistance: this.refDistance,
+                distanceModel: this.distanceModel,
+                playbackRate: this._playbackRate,
+                panningModel: this._panningModel,
+                soundTrackId: this.soundTrackId
+            };
+            if (this.spatialSound) {
+                if (this._connectedMesh)
+                    serializationObject.connectedMeshId = this._connectedMesh.id;
+                serializationObject.position = this._position.asArray();
+                serializationObject.refDistance = this.refDistance;
+                serializationObject.distanceModel = this.distanceModel;
+                serializationObject.isDirectional = this._isDirectional;
+                serializationObject.localDirectionToMesh = this._localDirection.asArray();
+                serializationObject.coneInnerAngle = this._coneInnerAngle;
+                serializationObject.coneOuterAngle = this._coneOuterAngle;
+                serializationObject.coneOuterGain = this._coneOuterGain;
+            }
+            return serializationObject;
+        };
         Sound.Parse = function (parsedSound, scene, rootUrl, sourceSound) {
         Sound.Parse = function (parsedSound, scene, rootUrl, sourceSound) {
             var soundName = parsedSound.name;
             var soundName = parsedSound.name;
             var soundUrl;
             var soundUrl;

Різницю між файлами не показано, бо вона завелика
+ 24 - 24
dist/preview release/babylon.noworker.js


+ 2 - 1
src/Audio/babylon.sound.js

@@ -305,6 +305,7 @@ var BABYLON;
         /**
         /**
         * Play the sound
         * Play the sound
         * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
         * @param time (optional) Start the sound after X seconds. Start immediately (0) by default.
+        * @param offset (optional) Start the sound setting it at a specific time
         */
         */
         Sound.prototype.play = function (time, offset) {
         Sound.prototype.play = function (time, offset) {
             var _this = this;
             var _this = this;
@@ -585,6 +586,6 @@ var BABYLON;
             return newSound;
             return newSound;
         };
         };
         return Sound;
         return Sound;
-    }());
+    })();
     BABYLON.Sound = Sound;
     BABYLON.Sound = Sound;
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 33 - 33
src/Audio/babylon.sound.ts

@@ -347,7 +347,7 @@
                     if (this._startOffset < 0) {
                     if (this._startOffset < 0) {
                         time = -this._startOffset;
                         time = -this._startOffset;
                         this._startOffset = 0;
                         this._startOffset = 0;
-                    }  
+                    }
                     var startTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;
                     var startTime = time ? Engine.audioEngine.audioContext.currentTime + time : Engine.audioEngine.audioContext.currentTime;
                     if (!this._soundSource || !this._streamingSource) {
                     if (!this._soundSource || !this._streamingSource) {
                         if (this.spatialSound) {
                         if (this.spatialSound) {
@@ -536,7 +536,7 @@
             // Can't clone a streaming sound
             // Can't clone a streaming sound
             else {
             else {
                 return null;
                 return null;
-            } 
+            }
         }
         }
 
 
         public getAudioBuffer() {
         public getAudioBuffer() {
@@ -544,35 +544,35 @@
         }
         }
 
 
         public serialize(): any {
         public serialize(): any {
-            var serializationObject: any = {
-                name: this.name,
-                url: this.name,
-                autoplay: this.autoplay,
-                loop: this.loop,
-                volume: this._volume,
-                spatialSound: this.spatialSound,
-                maxDistance: this.maxDistance,
-                rolloffFactor: this.rolloffFactor,
-                refDistance: this.refDistance,
-                distanceModel: this.distanceModel,
-                playbackRate: this._playbackRate,
-                panningModel: this._panningModel,
-                soundTrackId: this.soundTrackId
-            };
-
-            if (this.spatialSound) {
-                if (this._connectedMesh)
-                    serializationObject.connectedMeshId = this._connectedMesh.id;
-
-                serializationObject.position = this._position.asArray();
-                serializationObject.refDistance = this.refDistance;
-                serializationObject.distanceModel = this.distanceModel;
-
-                serializationObject.isDirectional = this._isDirectional;
-                serializationObject.localDirectionToMesh = this._localDirection.asArray();
-                serializationObject.coneInnerAngle = this._coneInnerAngle;
-                serializationObject.coneOuterAngle = this._coneOuterAngle;
-                serializationObject.coneOuterGain = this._coneOuterGain;
+            var serializationObject: any = {
+                name: this.name,
+                url: this.name,
+                autoplay: this.autoplay,
+                loop: this.loop,
+                volume: this._volume,
+                spatialSound: this.spatialSound,
+                maxDistance: this.maxDistance,
+                rolloffFactor: this.rolloffFactor,
+                refDistance: this.refDistance,
+                distanceModel: this.distanceModel,
+                playbackRate: this._playbackRate,
+                panningModel: this._panningModel,
+                soundTrackId: this.soundTrackId
+            };
+
+            if (this.spatialSound) {
+                if (this._connectedMesh)
+                    serializationObject.connectedMeshId = this._connectedMesh.id;
+
+                serializationObject.position = this._position.asArray();
+                serializationObject.refDistance = this.refDistance;
+                serializationObject.distanceModel = this.distanceModel;
+
+                serializationObject.isDirectional = this._isDirectional;
+                serializationObject.localDirectionToMesh = this._localDirection.asArray();
+                serializationObject.coneInnerAngle = this._coneInnerAngle;
+                serializationObject.coneOuterAngle = this._coneOuterAngle;
+                serializationObject.coneOuterGain = this._coneOuterGain;
             }
             }
 
 
             return serializationObject;
             return serializationObject;
@@ -581,7 +581,7 @@
         public static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound {
         public static Parse(parsedSound: any, scene: Scene, rootUrl: string, sourceSound?: Sound): Sound {
             var soundName = parsedSound.name;
             var soundName = parsedSound.name;
             var soundUrl;
             var soundUrl;
-            
+
             if (parsedSound.url) {
             if (parsedSound.url) {
                 soundUrl = rootUrl + parsedSound.url;
                 soundUrl = rootUrl + parsedSound.url;
             }
             }
@@ -637,7 +637,7 @@
                     newSound.attachToMesh(connectedMesh);
                     newSound.attachToMesh(connectedMesh);
                 }
                 }
             }
             }
-            
+
             return newSound;
             return newSound;
         }
         }
     }
     }

+ 1 - 1
src/Materials/babylon.effect.ts

@@ -346,7 +346,7 @@
                     this.onCompiled(this);
                     this.onCompiled(this);
                 }
                 }
             } catch (e) {
             } catch (e) {
-                // Let's go through fallbacks
+                // Let's go through fallbacks then
                 if (fallbacks && fallbacks.isMoreFallbacks) {
                 if (fallbacks && fallbacks.isMoreFallbacks) {
                     Tools.Error("Unable to compile effect with current defines. Trying next fallback.");
                     Tools.Error("Unable to compile effect with current defines. Trying next fallback.");
                     this._dumpShadersName();
                     this._dumpShadersName();