David Catuhe пре 7 година
родитељ
комит
ecf0150d25

Разлика између датотеке није приказан због своје велике величине
+ 744 - 744
dist/preview release/babylon.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 31 - 31
dist/preview release/babylon.js


+ 73 - 28
dist/preview release/babylon.max.js

@@ -11352,12 +11352,18 @@ var BABYLON;
         };
         // Loading screen
         Engine.prototype.displayLoadingUI = function () {
+            if (!BABYLON.Tools.IsWindowObjectExist()) {
+                return;
+            }
             var loadingScreen = this.loadingScreen;
             if (loadingScreen) {
                 loadingScreen.displayLoadingUI();
             }
         };
         Engine.prototype.hideLoadingUI = function () {
+            if (!BABYLON.Tools.IsWindowObjectExist()) {
+                return;
+            }
             var loadingScreen = this.loadingScreen;
             if (loadingScreen) {
                 loadingScreen.hideLoadingUI();
@@ -36510,12 +36516,12 @@ var BABYLON;
         TargetCamera.prototype._updateCameraRotationMatrix = function () {
             if (this.rotationQuaternion) {
                 this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix);
-                //update the up vector!
-                BABYLON.Vector3.TransformNormalToRef(this._defaultUpVector, this._cameraRotationMatrix, this.upVector);
             }
             else {
                 BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
             }
+            //update the up vector!
+            BABYLON.Vector3.TransformNormalToRef(this._defaultUpVector, this._cameraRotationMatrix, this.upVector);
         };
         TargetCamera.prototype._getViewMatrix = function () {
             if (!this.lockedTarget) {
@@ -39355,12 +39361,32 @@ var BABYLON;
             }
             for (index = 0; index < parsedAnimation.keys.length; index++) {
                 var key = parsedAnimation.keys[index];
+                var inTangent;
+                var outTangent;
                 switch (dataType) {
                     case Animation.ANIMATIONTYPE_FLOAT:
                         data = key.values[0];
+                        if (key.values.length >= 1) {
+                            inTangent = key.values[1];
+                        }
+                        if (key.values.length >= 2) {
+                            outTangent = key.values[2];
+                        }
                         break;
                     case Animation.ANIMATIONTYPE_QUATERNION:
                         data = BABYLON.Quaternion.FromArray(key.values);
+                        if (key.values.length >= 8) {
+                            var _inTangent = BABYLON.Quaternion.FromArray(key.values.slice(4, 8));
+                            if (!_inTangent.equals(BABYLON.Quaternion.Zero())) {
+                                inTangent = _inTangent;
+                            }
+                        }
+                        if (key.values.length >= 12) {
+                            var _outTangent = BABYLON.Quaternion.FromArray(key.values.slice(8, 12));
+                            if (!_outTangent.equals(BABYLON.Quaternion.Zero())) {
+                                outTangent = _outTangent;
+                            }
+                        }
                         break;
                     case Animation.ANIMATIONTYPE_MATRIX:
                         data = BABYLON.Matrix.FromArray(key.values);
@@ -39373,10 +39399,16 @@ var BABYLON;
                         data = BABYLON.Vector3.FromArray(key.values);
                         break;
                 }
-                keys.push({
-                    frame: key.frame,
-                    value: data
-                });
+                var keyData = {};
+                keyData.frame = key.frame;
+                keyData.value = data;
+                if (inTangent != undefined) {
+                    keyData.inTangent = inTangent;
+                }
+                if (outTangent != undefined) {
+                    keyData.outTangent = outTangent;
+                }
+                keys.push(keyData);
             }
             animation.setKeys(keys);
             if (parsedAnimation.ranges) {
@@ -43682,6 +43714,7 @@ var BABYLON;
             this._cam_axisX = BABYLON.Vector3.Zero();
             this._axisZ = BABYLON.Axis.Z;
             this._camDir = BABYLON.Vector3.Zero();
+            this._camInvertedPosition = BABYLON.Vector3.Zero();
             this._rotMatrix = new BABYLON.Matrix();
             this._invertMatrix = new BABYLON.Matrix();
             this._rotated = BABYLON.Vector3.Zero();
@@ -43703,14 +43736,13 @@ var BABYLON;
             this._mustUnrotateFixedNormals = false;
             this._minimum = BABYLON.Tmp.Vector3[0];
             this._maximum = BABYLON.Tmp.Vector3[1];
-            this._scale = BABYLON.Tmp.Vector3[2];
-            this._translation = BABYLON.Tmp.Vector3[3];
             this._minBbox = BABYLON.Tmp.Vector3[4];
             this._maxBbox = BABYLON.Tmp.Vector3[5];
             this._particlesIntersect = false;
             this._depthSortFunction = function (p1, p2) {
                 return (p2.sqDistance - p1.sqDistance);
             };
+            this._needs32Bits = false;
             this._bSphereOnly = false;
             this._bSphereRadiusFactor = 1.0;
             this.name = name;
@@ -43757,7 +43789,7 @@ var BABYLON;
             }
             var vertexData = new BABYLON.VertexData();
             if (this._depthSort) {
-                this._depthSortedIndices = this._indices.slice();
+                this._depthSortedIndices = (this._needs32Bits) ? new Uint32Array(this._indices) : new Uint16Array(this._indices);
                 vertexData.indices = this._depthSortedIndices;
             }
             else {
@@ -43989,7 +44021,11 @@ var BABYLON;
                 }
             }
             for (i = 0; i < meshInd.length; i++) {
-                indices.push(p + meshInd[i]);
+                var current_ind = p + meshInd[i];
+                indices.push(current_ind);
+                if (current_ind > 65535) {
+                    this._needs32Bits = true;
+                }
             }
             if (this._pickable) {
                 var nbfaces = meshInd.length / 3;
@@ -44157,23 +44193,27 @@ var BABYLON;
             this._cam_axisZ.x = 0.0;
             this._cam_axisZ.y = 0.0;
             this._cam_axisZ.z = 1.0;
+            // cases when the World Matrix is to be computed first
+            if (this.billboard || this._depthSort) {
+                this.mesh.computeWorldMatrix(true);
+                this.mesh._worldMatrix.invertToRef(this._invertMatrix);
+            }
             // if the particles will always face the camera
             if (this.billboard) {
-                this.mesh.computeWorldMatrix(true);
                 // compute the camera position and un-rotate it by the current mesh rotation
-                if (this.mesh._worldMatrix.decompose(this._scale, this._quaternion, this._translation)) {
-                    this._quaternionToRotationMatrix();
-                    this._rotMatrix.invertToRef(this._invertMatrix);
-                    this._camera.getDirectionToRef(this._axisZ, this._camDir);
-                    BABYLON.Vector3.TransformNormalToRef(this._camDir, this._invertMatrix, this._cam_axisZ);
-                    this._cam_axisZ.normalize();
-                    // same for camera up vector extracted from the cam view matrix
-                    var view = this._camera.getViewMatrix(true);
-                    BABYLON.Vector3.TransformNormalFromFloatsToRef(view.m[1], view.m[5], view.m[9], this._invertMatrix, this._cam_axisY);
-                    BABYLON.Vector3.CrossToRef(this._cam_axisY, this._cam_axisZ, this._cam_axisX);
-                    this._cam_axisY.normalize();
-                    this._cam_axisX.normalize();
-                }
+                this._camera.getDirectionToRef(this._axisZ, this._camDir);
+                BABYLON.Vector3.TransformNormalToRef(this._camDir, this._invertMatrix, this._cam_axisZ);
+                this._cam_axisZ.normalize();
+                // same for camera up vector extracted from the cam view matrix
+                var view = this._camera.getViewMatrix(true);
+                BABYLON.Vector3.TransformNormalFromFloatsToRef(view.m[1], view.m[5], view.m[9], this._invertMatrix, this._cam_axisY);
+                BABYLON.Vector3.CrossToRef(this._cam_axisY, this._cam_axisZ, this._cam_axisX);
+                this._cam_axisY.normalize();
+                this._cam_axisX.normalize();
+            }
+            // if depthSort, compute the camera global position in the mesh local system
+            if (this._depthSort) {
+                BABYLON.Vector3.TransformCoordinatesToRef(this._camera.globalPosition, this._invertMatrix, this._camInvertedPosition); // then un-rotate the camera
             }
             BABYLON.Matrix.IdentityToRef(this._rotMatrix);
             var idx = 0; // current position index in the global array positions32
@@ -44241,7 +44281,7 @@ var BABYLON;
                         var dsp = this.depthSortedParticles[p];
                         dsp.ind = this._particle._ind;
                         dsp.indicesLength = this._particle._model._indicesLength;
-                        dsp.sqDistance = BABYLON.Vector3.DistanceSquared(this._particle.position, this._camera.position);
+                        dsp.sqDistance = BABYLON.Vector3.DistanceSquared(this._particle.position, this._camInvertedPosition);
                     }
                     // particle vertex loop
                     for (pt = 0; pt < this._shape.length; pt++) {
@@ -53586,10 +53626,15 @@ var BABYLON;
             this._babylonGamepads = [];
             this._oneGamepadConnected = false;
             this._isMonitoring = false;
-            this._gamepadEventSupported = 'GamepadEvent' in window;
-            this._gamepadSupport = (navigator.getGamepads ||
-                navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads);
             this.onGamepadDisconnectedObservable = new BABYLON.Observable();
+            if (!BABYLON.Tools.IsWindowObjectExist()) {
+                this._gamepadEventSupported = false;
+            }
+            else {
+                this._gamepadEventSupported = 'GamepadEvent' in window;
+                this._gamepadSupport = (navigator.getGamepads ||
+                    navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads);
+            }
             this.onGamepadConnectedObservable = new BABYLON.Observable(function (observer) {
                 // This will be used to raise the onGamepadConnected for all gamepads ALREADY connected
                 for (var i in _this._babylonGamepads) {

Разлика између датотеке није приказан због своје велике величине
+ 744 - 744
dist/preview release/babylon.module.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 31 - 31
dist/preview release/babylon.worker.js


Разлика између датотеке није приказан због своје велике величине
+ 1957 - 1957
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 47 - 47
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 73 - 28
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -11352,12 +11352,18 @@ var BABYLON;
         };
         // Loading screen
         Engine.prototype.displayLoadingUI = function () {
+            if (!BABYLON.Tools.IsWindowObjectExist()) {
+                return;
+            }
             var loadingScreen = this.loadingScreen;
             if (loadingScreen) {
                 loadingScreen.displayLoadingUI();
             }
         };
         Engine.prototype.hideLoadingUI = function () {
+            if (!BABYLON.Tools.IsWindowObjectExist()) {
+                return;
+            }
             var loadingScreen = this.loadingScreen;
             if (loadingScreen) {
                 loadingScreen.hideLoadingUI();
@@ -36510,12 +36516,12 @@ var BABYLON;
         TargetCamera.prototype._updateCameraRotationMatrix = function () {
             if (this.rotationQuaternion) {
                 this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix);
-                //update the up vector!
-                BABYLON.Vector3.TransformNormalToRef(this._defaultUpVector, this._cameraRotationMatrix, this.upVector);
             }
             else {
                 BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
             }
+            //update the up vector!
+            BABYLON.Vector3.TransformNormalToRef(this._defaultUpVector, this._cameraRotationMatrix, this.upVector);
         };
         TargetCamera.prototype._getViewMatrix = function () {
             if (!this.lockedTarget) {
@@ -39355,12 +39361,32 @@ var BABYLON;
             }
             for (index = 0; index < parsedAnimation.keys.length; index++) {
                 var key = parsedAnimation.keys[index];
+                var inTangent;
+                var outTangent;
                 switch (dataType) {
                     case Animation.ANIMATIONTYPE_FLOAT:
                         data = key.values[0];
+                        if (key.values.length >= 1) {
+                            inTangent = key.values[1];
+                        }
+                        if (key.values.length >= 2) {
+                            outTangent = key.values[2];
+                        }
                         break;
                     case Animation.ANIMATIONTYPE_QUATERNION:
                         data = BABYLON.Quaternion.FromArray(key.values);
+                        if (key.values.length >= 8) {
+                            var _inTangent = BABYLON.Quaternion.FromArray(key.values.slice(4, 8));
+                            if (!_inTangent.equals(BABYLON.Quaternion.Zero())) {
+                                inTangent = _inTangent;
+                            }
+                        }
+                        if (key.values.length >= 12) {
+                            var _outTangent = BABYLON.Quaternion.FromArray(key.values.slice(8, 12));
+                            if (!_outTangent.equals(BABYLON.Quaternion.Zero())) {
+                                outTangent = _outTangent;
+                            }
+                        }
                         break;
                     case Animation.ANIMATIONTYPE_MATRIX:
                         data = BABYLON.Matrix.FromArray(key.values);
@@ -39373,10 +39399,16 @@ var BABYLON;
                         data = BABYLON.Vector3.FromArray(key.values);
                         break;
                 }
-                keys.push({
-                    frame: key.frame,
-                    value: data
-                });
+                var keyData = {};
+                keyData.frame = key.frame;
+                keyData.value = data;
+                if (inTangent != undefined) {
+                    keyData.inTangent = inTangent;
+                }
+                if (outTangent != undefined) {
+                    keyData.outTangent = outTangent;
+                }
+                keys.push(keyData);
             }
             animation.setKeys(keys);
             if (parsedAnimation.ranges) {
@@ -43682,6 +43714,7 @@ var BABYLON;
             this._cam_axisX = BABYLON.Vector3.Zero();
             this._axisZ = BABYLON.Axis.Z;
             this._camDir = BABYLON.Vector3.Zero();
+            this._camInvertedPosition = BABYLON.Vector3.Zero();
             this._rotMatrix = new BABYLON.Matrix();
             this._invertMatrix = new BABYLON.Matrix();
             this._rotated = BABYLON.Vector3.Zero();
@@ -43703,14 +43736,13 @@ var BABYLON;
             this._mustUnrotateFixedNormals = false;
             this._minimum = BABYLON.Tmp.Vector3[0];
             this._maximum = BABYLON.Tmp.Vector3[1];
-            this._scale = BABYLON.Tmp.Vector3[2];
-            this._translation = BABYLON.Tmp.Vector3[3];
             this._minBbox = BABYLON.Tmp.Vector3[4];
             this._maxBbox = BABYLON.Tmp.Vector3[5];
             this._particlesIntersect = false;
             this._depthSortFunction = function (p1, p2) {
                 return (p2.sqDistance - p1.sqDistance);
             };
+            this._needs32Bits = false;
             this._bSphereOnly = false;
             this._bSphereRadiusFactor = 1.0;
             this.name = name;
@@ -43757,7 +43789,7 @@ var BABYLON;
             }
             var vertexData = new BABYLON.VertexData();
             if (this._depthSort) {
-                this._depthSortedIndices = this._indices.slice();
+                this._depthSortedIndices = (this._needs32Bits) ? new Uint32Array(this._indices) : new Uint16Array(this._indices);
                 vertexData.indices = this._depthSortedIndices;
             }
             else {
@@ -43989,7 +44021,11 @@ var BABYLON;
                 }
             }
             for (i = 0; i < meshInd.length; i++) {
-                indices.push(p + meshInd[i]);
+                var current_ind = p + meshInd[i];
+                indices.push(current_ind);
+                if (current_ind > 65535) {
+                    this._needs32Bits = true;
+                }
             }
             if (this._pickable) {
                 var nbfaces = meshInd.length / 3;
@@ -44157,23 +44193,27 @@ var BABYLON;
             this._cam_axisZ.x = 0.0;
             this._cam_axisZ.y = 0.0;
             this._cam_axisZ.z = 1.0;
+            // cases when the World Matrix is to be computed first
+            if (this.billboard || this._depthSort) {
+                this.mesh.computeWorldMatrix(true);
+                this.mesh._worldMatrix.invertToRef(this._invertMatrix);
+            }
             // if the particles will always face the camera
             if (this.billboard) {
-                this.mesh.computeWorldMatrix(true);
                 // compute the camera position and un-rotate it by the current mesh rotation
-                if (this.mesh._worldMatrix.decompose(this._scale, this._quaternion, this._translation)) {
-                    this._quaternionToRotationMatrix();
-                    this._rotMatrix.invertToRef(this._invertMatrix);
-                    this._camera.getDirectionToRef(this._axisZ, this._camDir);
-                    BABYLON.Vector3.TransformNormalToRef(this._camDir, this._invertMatrix, this._cam_axisZ);
-                    this._cam_axisZ.normalize();
-                    // same for camera up vector extracted from the cam view matrix
-                    var view = this._camera.getViewMatrix(true);
-                    BABYLON.Vector3.TransformNormalFromFloatsToRef(view.m[1], view.m[5], view.m[9], this._invertMatrix, this._cam_axisY);
-                    BABYLON.Vector3.CrossToRef(this._cam_axisY, this._cam_axisZ, this._cam_axisX);
-                    this._cam_axisY.normalize();
-                    this._cam_axisX.normalize();
-                }
+                this._camera.getDirectionToRef(this._axisZ, this._camDir);
+                BABYLON.Vector3.TransformNormalToRef(this._camDir, this._invertMatrix, this._cam_axisZ);
+                this._cam_axisZ.normalize();
+                // same for camera up vector extracted from the cam view matrix
+                var view = this._camera.getViewMatrix(true);
+                BABYLON.Vector3.TransformNormalFromFloatsToRef(view.m[1], view.m[5], view.m[9], this._invertMatrix, this._cam_axisY);
+                BABYLON.Vector3.CrossToRef(this._cam_axisY, this._cam_axisZ, this._cam_axisX);
+                this._cam_axisY.normalize();
+                this._cam_axisX.normalize();
+            }
+            // if depthSort, compute the camera global position in the mesh local system
+            if (this._depthSort) {
+                BABYLON.Vector3.TransformCoordinatesToRef(this._camera.globalPosition, this._invertMatrix, this._camInvertedPosition); // then un-rotate the camera
             }
             BABYLON.Matrix.IdentityToRef(this._rotMatrix);
             var idx = 0; // current position index in the global array positions32
@@ -44241,7 +44281,7 @@ var BABYLON;
                         var dsp = this.depthSortedParticles[p];
                         dsp.ind = this._particle._ind;
                         dsp.indicesLength = this._particle._model._indicesLength;
-                        dsp.sqDistance = BABYLON.Vector3.DistanceSquared(this._particle.position, this._camera.position);
+                        dsp.sqDistance = BABYLON.Vector3.DistanceSquared(this._particle.position, this._camInvertedPosition);
                     }
                     // particle vertex loop
                     for (pt = 0; pt < this._shape.length; pt++) {
@@ -53586,10 +53626,15 @@ var BABYLON;
             this._babylonGamepads = [];
             this._oneGamepadConnected = false;
             this._isMonitoring = false;
-            this._gamepadEventSupported = 'GamepadEvent' in window;
-            this._gamepadSupport = (navigator.getGamepads ||
-                navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads);
             this.onGamepadDisconnectedObservable = new BABYLON.Observable();
+            if (!BABYLON.Tools.IsWindowObjectExist()) {
+                this._gamepadEventSupported = false;
+            }
+            else {
+                this._gamepadEventSupported = 'GamepadEvent' in window;
+                this._gamepadSupport = (navigator.getGamepads ||
+                    navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads);
+            }
             this.onGamepadConnectedObservable = new BABYLON.Observable(function (observer) {
                 // This will be used to raise the onGamepadConnected for all gamepads ALREADY connected
                 for (var i in _this._babylonGamepads) {

Разлика између датотеке није приказан због своје велике величине
+ 1957 - 1957
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 6 - 0
src/Engine/babylon.engine.ts

@@ -4523,6 +4523,9 @@
 
         // Loading screen
         public displayLoadingUI(): void {
+            if (!Tools.IsWindowObjectExist()) {
+                return;
+            }
             const loadingScreen = this.loadingScreen;
             if (loadingScreen) {
                 loadingScreen.displayLoadingUI();
@@ -4530,6 +4533,9 @@
         }
 
         public hideLoadingUI(): void {
+            if (!Tools.IsWindowObjectExist()) {
+                return;
+            }            
             const loadingScreen = this.loadingScreen;
             if (loadingScreen) {
                 loadingScreen.hideLoadingUI();

+ 11 - 3
src/Gamepad/babylon.gamepadManager.ts

@@ -4,9 +4,8 @@
         private _oneGamepadConnected: boolean = false;
 
         private _isMonitoring: boolean = false;
-        private _gamepadEventSupported: boolean = 'GamepadEvent' in window;
-        private _gamepadSupport: () => Array<any> = (navigator.getGamepads ||
-            navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads);
+        private _gamepadEventSupported: boolean;
+        private _gamepadSupport: () => Array<any>;
 
         public onGamepadConnectedObservable: Observable<Gamepad>;
         public onGamepadDisconnectedObservable = new Observable<Gamepad>();
@@ -15,6 +14,15 @@
         private _onGamepadDisconnectedEvent: (evt: any) => void;
 
         constructor() {
+            if (!Tools.IsWindowObjectExist()) {
+                this._gamepadEventSupported = false;
+            } else  {
+                this._gamepadEventSupported = 'GamepadEvent' in window;
+                this._gamepadSupport = (navigator.getGamepads ||
+                    navigator.webkitGetGamepads || navigator.msGetGamepads || navigator.webkitGamepads);
+            }
+
+
             this.onGamepadConnectedObservable = new Observable<Gamepad>((observer) => {
                 // This will be used to raise the onGamepadConnected for all gamepads ALREADY connected
                 for (var i in this._babylonGamepads) {

+ 35 - 25
tests/nullEngine/app.js

@@ -3,7 +3,6 @@ var LOADERS = require("../../dist/preview release/loaders/babylonjs.loaders");
 global.XMLHttpRequest = require('xhr2').XMLHttpRequest;
 
 var engine = new BABYLON.NullEngine();
-var scene = new BABYLON.Scene(engine);
 
 // //Adding a light
 // var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene);
@@ -99,33 +98,44 @@ var scene = new BABYLON.Scene(engine);
 //     alpha += 0.01;
 
 // });
-	//Adding a light
-	var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene);
+// 	//Adding a light
+// 	var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 20, 100), scene);
     
-        //Adding an Arc Rotate Camera
-        var camera = new BABYLON.ArcRotateCamera("Camera", -0.5, 2.2, 100, BABYLON.Vector3.Zero(), scene);
+//         //Adding an Arc Rotate Camera
+//         var camera = new BABYLON.ArcRotateCamera("Camera", -0.5, 2.2, 100, BABYLON.Vector3.Zero(), scene);
     
-        // The first parameter can be used to specify which mesh to import. Here we import all meshes
-        BABYLON.SceneLoader.ImportMesh("", "https://www.babylonjs-playground.com/scenes/", "skull.babylon", scene, function (newMeshes) {
-            // Set the target of the camera to the first imported mesh
-            camera.target = newMeshes[0];
+//         // The first parameter can be used to specify which mesh to import. Here we import all meshes
+//         BABYLON.SceneLoader.ImportMesh("", "https://www.babylonjs-playground.com/scenes/", "skull.babylon", scene, function (newMeshes) {
+//             // Set the target of the camera to the first imported mesh
+//             camera.target = newMeshes[0];
     
-            newMeshes[0].material = new BABYLON.StandardMaterial("skull", scene);
-            newMeshes[0].material.emissiveColor = new BABYLON.Color3(0.2, 0.2, 0.2);
-        });
+//             newMeshes[0].material = new BABYLON.StandardMaterial("skull", scene);
+//             newMeshes[0].material.emissiveColor = new BABYLON.Color3(0.2, 0.2, 0.2);
+//         });
     
-        // Create the "God Rays" effect (volumetric light scattering)
-        var godrays = new BABYLON.VolumetricLightScatteringPostProcess('godrays', 1.0, camera, null, 100, BABYLON.Texture.BILINEAR_SAMPLINGMODE, engine, false);
+//         // Create the "God Rays" effect (volumetric light scattering)
+//         var godrays = new BABYLON.VolumetricLightScatteringPostProcess('godrays', 1.0, camera, null, 100, BABYLON.Texture.BILINEAR_SAMPLINGMODE, engine, false);
     
-        // By default it uses a billboard to render the sun, just apply the desired texture
-        // position and scale
-        godrays.mesh.material.diffuseTexture = new BABYLON.Texture('https://www.babylonjs-playground.com/textures/sun.png', scene, true, false, BABYLON.Texture.BILINEAR_SAMPLINGMODE);
-        godrays.mesh.material.diffuseTexture.hasAlpha = true;
-        godrays.mesh.position = new BABYLON.Vector3(-150, 150, 150);
-        godrays.mesh.scaling = new BABYLON.Vector3(350, 350, 350);
+//         // By default it uses a billboard to render the sun, just apply the desired texture
+//         // position and scale
+//         godrays.mesh.material.diffuseTexture = new BABYLON.Texture('https://www.babylonjs-playground.com/textures/sun.png', scene, true, false, BABYLON.Texture.BILINEAR_SAMPLINGMODE);
+//         godrays.mesh.material.diffuseTexture.hasAlpha = true;
+//         godrays.mesh.position = new BABYLON.Vector3(-150, 150, 150);
+//         godrays.mesh.scaling = new BABYLON.Vector3(350, 350, 350);
     
-        light.position = godrays.mesh.position;
-
-engine.runRenderLoop(function() {
-    scene.render();
-})
+//         light.position = godrays.mesh.position;
+
+// engine.runRenderLoop(function() {
+//     scene.render();
+// })
+
+BABYLON.SceneLoader.Load("https://playground.babylonjs.com/scenes/", "skull.babylon", engine, (scene) => {
+    console.log('scene loaded!');
+    for (var index = 0; index < scene.meshes.length; index++) {
+        console.log(scene.meshes[index].name);
+    }    
+    engine.runRenderLoop(function() {
+        scene.render();
+    });
+  
+  }, progress => {}, (scene, err) => console.error('error:', err));