Browse Source

Fixing issue with lights, parenting and shadows

David Catuhe 9 years ago
parent
commit
ee709aef92

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


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


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


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

@@ -9554,7 +9554,7 @@ var BABYLON;
                 if (!this.transformedPosition) {
                     this.transformedPosition = BABYLON.Vector3.Zero();
                 }
-                BABYLON.Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);
+                BABYLON.Vector3.TransformCoordinatesToRef(this.getAbsolutePosition(), this.parent.getWorldMatrix(), this.transformedPosition);
                 return true;
             }
             return false;
@@ -14526,6 +14526,12 @@ var BABYLON;
             }
         };
         // Pointers handling
+        /**
+        * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp
+        * @param attachUp defines if you want to attach events to pointerup
+        * @param attachDown defines if you want to attach events to pointerdown
+        * @param attachMove defines if you want to attach events to pointermove
+        */
         Scene.prototype.attachControl = function (attachUp, attachDown, attachMove) {
             var _this = this;
             if (attachUp === void 0) { attachUp = true; }
@@ -18210,6 +18216,14 @@ var BABYLON;
             else {
                 mesh.layerMask = 0x0FFFFFFF;
             }
+            //(Deprecated) physics
+            if (parsedMesh.physicsImpostor) {
+                mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, parsedMesh.physicsImpostor, {
+                    mass: parsedMesh.physicsMass,
+                    friction: parsedMesh.physicsFriction,
+                    restitution: parsedMesh.physicsRestitution
+                }, scene);
+            }
             // Instances
             if (parsedMesh.instances) {
                 for (var index = 0; index < parsedMesh.instances.length; index++) {

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


+ 1 - 1
src/Lights/babylon.pointLight.js

@@ -25,7 +25,7 @@ var BABYLON;
                 if (!this.transformedPosition) {
                     this.transformedPosition = BABYLON.Vector3.Zero();
                 }
-                BABYLON.Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);
+                BABYLON.Vector3.TransformCoordinatesToRef(this.getAbsolutePosition(), this.parent.getWorldMatrix(), this.transformedPosition);
                 return true;
             }
             return false;

+ 1 - 1
src/Lights/babylon.pointLight.ts

@@ -22,7 +22,7 @@
                     this.transformedPosition = Vector3.Zero();
                 }
 
-                Vector3.TransformCoordinatesToRef(this.position, this.parent.getWorldMatrix(), this.transformedPosition);
+                Vector3.TransformCoordinatesToRef(this.getAbsolutePosition(), this.parent.getWorldMatrix(), this.transformedPosition);
 
                 return true;
             }

+ 8 - 0
src/Mesh/babylon.mesh.js

@@ -1543,6 +1543,14 @@ var BABYLON;
             else {
                 mesh.layerMask = 0x0FFFFFFF;
             }
+            //(Deprecated) physics
+            if (parsedMesh.physicsImpostor) {
+                mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, parsedMesh.physicsImpostor, {
+                    mass: parsedMesh.physicsMass,
+                    friction: parsedMesh.physicsFriction,
+                    restitution: parsedMesh.physicsRestitution
+                }, scene);
+            }
             // Instances
             if (parsedMesh.instances) {
                 for (var index = 0; index < parsedMesh.instances.length; index++) {

+ 4 - 3
src/Mesh/babylon.mesh.ts

@@ -163,7 +163,7 @@
                 // Physics clone  
                 var physicsEngine = this.getScene().getPhysicsEngine();
                 if (clonePhysicsImpostor && physicsEngine) {
-                    var impostor = physicsEngine.getImpostorForPhysicsObject(source); 
+                    var impostor = physicsEngine.getImpostorForPhysicsObject(source);
                     if (impostor) {
                         this.physicsImpostor = impostor.clone(this);
                     }
@@ -462,7 +462,7 @@
          * Returns an empty array if the mesh has no geometry.
          */
         public getIndices(copyWhenShared?: boolean): number[] | Int32Array {
-            
+
             if (!this._geometry) {
                 return [];
             }
@@ -1768,7 +1768,7 @@
             
              
             //(Deprecated) physics
-            if(parsedMesh.physicsImpostor) {
+            if (parsedMesh.physicsImpostor) {
                 mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, parsedMesh.physicsImpostor, {
                     mass: parsedMesh.physicsMass,
                     friction: parsedMesh.physicsFriction,
@@ -2532,3 +2532,4 @@
 
 
 
+

+ 6 - 0
src/babylon.scene.js

@@ -438,6 +438,12 @@ var BABYLON;
             }
         };
         // Pointers handling
+        /**
+        * Attach events to the canvas (To handle actionManagers triggers and raise onPointerMove, onPointerDown and onPointerUp
+        * @param attachUp defines if you want to attach events to pointerup
+        * @param attachDown defines if you want to attach events to pointerdown
+        * @param attachMove defines if you want to attach events to pointermove
+        */
         Scene.prototype.attachControl = function (attachUp, attachDown, attachMove) {
             var _this = this;
             if (attachUp === void 0) { attachUp = true; }