Browse Source

Merge Master

Sebastien Vandenberghe 8 years ago
parent
commit
ec2e30940a

+ 3 - 3
Playground/js/index.js

@@ -296,7 +296,7 @@
                 var initialTabIndex = 0;
 
                 if(document.getElementsByClassName('insp-wrapper').length > 0){                  
-                    for(let i = 0; i < engine.scenes.length; i++){
+                    for(var i = 0; i < engine.scenes.length; i++){
                         if(engine.scenes[i]._debugLayer){
                             //TODO: once inspector is updated on netlify, use getActiveTabIndex instead of the following loop
                             //initialTabIndex = engine.scenes[i]._debugLayer._inspector.getActiveTabIndex();
@@ -668,7 +668,7 @@
                 vsTheme = 'vs'
             }
 
-            let oldCode = jsEditor.getValue();
+            var oldCode = jsEditor.getValue();
             jsEditor.dispose();
             jsEditor = monaco.editor.create(document.getElementById('jsEditor'), {
                 value: "",
@@ -692,7 +692,7 @@
 
             for (var index = 0; index < elementToTheme.length; index++) {
                 var obj = elementToTheme[index];
-                let domObjArr = document.querySelectorAll(obj);
+                var domObjArr = document.querySelectorAll(obj);
                 for (var domObjIndex = 0; domObjIndex < domObjArr.length; domObjIndex++) {
                     var domObj = domObjArr[domObjIndex];
                     domObj.classList.remove('light');

BIN
Playground/textures/mr.jpg


BIN
Playground/textures/sg.png


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


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


+ 7 - 3
dist/preview release/babylon.max.js

@@ -31934,7 +31934,7 @@ var BABYLON;
     /**
      * The PBR material of BJS following the metal roughness convention.
      *
-     * This fits to the define PBR convention in the GLTF definition:
+     * This fits to the PBR convention in the GLTF definition:
      * https://github.com/KhronosGroup/glTF/tree/2.0/specification/2.0
      */
     var PBRMetallicRoughnessMaterial = (function (_super) {
@@ -31947,6 +31947,7 @@ var BABYLON;
          */
         function PBRMetallicRoughnessMaterial(name, scene) {
             var _this = _super.call(this, name, scene) || this;
+            _this._useRoughnessFromMetallicTextureAlpha = false;
             _this._useRoughnessFromMetallicTextureGreen = true;
             _this._useMetallnessFromMetallicTextureBlue = true;
             return _this;
@@ -32026,7 +32027,7 @@ var BABYLON;
     /**
      * The PBR material of BJS following the specular glossiness convention.
      *
-     * This fits to the define PBR convention in the GLTF definition:
+     * This fits to the PBR convention in the GLTF definition:
      * https://github.com/KhronosGroup/glTF/tree/2.0/extensions/Khronos/KHR_materials_pbrSpecularGlossiness
      */
     var PBRSpecularGlossinessMaterial = (function (_super) {
@@ -43463,6 +43464,9 @@ var BABYLON;
             }
             _this.isCube = true;
             _this._textureMatrix = BABYLON.Matrix.Identity();
+            if (prefiltered) {
+                _this.gammaSpace = false;
+            }
             return _this;
         }
         CubeTexture.CreateFromImages = function (files, scene, noMipmap) {
@@ -60290,7 +60294,7 @@ var BABYLON;
                                 if (bpp === 128) {
                                     floatArray = DDSTools._GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
                                 }
-                                else if (bpp === 64 && !engine.getCaps().textureHalfFloat) {
+                                else if (bpp === 64) {
                                     floatArray = DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
                                     info.textureType = BABYLON.Engine.TEXTURETYPE_FLOAT;
                                     format = engine._getWebGLTextureType(info.textureType);

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


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


File diff suppressed because it is too large
+ 4499 - 4499
dist/preview release/customConfigurations/minimalViewer/babylon.d.ts


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


+ 6 - 2
dist/preview release/customConfigurations/minimalViewer/babylon.max.js

@@ -31349,6 +31349,9 @@ var BABYLON;
             }
             _this.isCube = true;
             _this._textureMatrix = BABYLON.Matrix.Identity();
+            if (prefiltered) {
+                _this.gammaSpace = false;
+            }
             return _this;
         }
         CubeTexture.CreateFromImages = function (files, scene, noMipmap) {
@@ -37022,7 +37025,7 @@ var BABYLON;
     /**
      * The PBR material of BJS following the metal roughness convention.
      *
-     * This fits to the define PBR convention in the GLTF definition:
+     * This fits to the PBR convention in the GLTF definition:
      * https://github.com/KhronosGroup/glTF/tree/2.0/specification/2.0
      */
     var PBRMetallicRoughnessMaterial = (function (_super) {
@@ -37035,6 +37038,7 @@ var BABYLON;
          */
         function PBRMetallicRoughnessMaterial(name, scene) {
             var _this = _super.call(this, name, scene) || this;
+            _this._useRoughnessFromMetallicTextureAlpha = false;
             _this._useRoughnessFromMetallicTextureGreen = true;
             _this._useMetallnessFromMetallicTextureBlue = true;
             return _this;
@@ -37114,7 +37118,7 @@ var BABYLON;
     /**
      * The PBR material of BJS following the specular glossiness convention.
      *
-     * This fits to the define PBR convention in the GLTF definition:
+     * This fits to the PBR convention in the GLTF definition:
      * https://github.com/KhronosGroup/glTF/tree/2.0/extensions/Khronos/KHR_materials_pbrSpecularGlossiness
      */
     var PBRSpecularGlossinessMaterial = (function (_super) {

File diff suppressed because it is too large
+ 4499 - 4499
dist/preview release/customConfigurations/minimalViewer/babylon.module.d.ts


+ 1 - 0
src/Materials/PBR/babylon.pbrMetallicRoughnessMaterial.ts

@@ -57,6 +57,7 @@
          */
         constructor(name: string, scene: Scene) {
             super(name, scene);
+            this._useRoughnessFromMetallicTextureAlpha = false;
             this._useRoughnessFromMetallicTextureGreen = true;
             this._useMetallnessFromMetallicTextureBlue = true;
         }

+ 3 - 3
src/Materials/PBR/babylon.pbrSpecularGlossinessMaterial.ts

@@ -8,14 +8,14 @@
     export class PBRSpecularGlossinessMaterial extends Internals.PBRBaseSimpleMaterial {
 
         /**
-         * Specifies the diffuse Color of the material.
+         * Specifies the diffuse color of the material.
          */
         @serializeAsColor3("diffuse")
         @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_albedoColor")
         public diffuseColor: Color3;
         
         /**
-         * Specifies the diffuse texture of the material. This can aslo contains the opcity value in its alpha
+         * Specifies the diffuse texture of the material. This can also contains the opcity value in its alpha
          * channel.
          */
         @serializeAsTexture()
@@ -37,7 +37,7 @@
         public glossiness: number;
         
         /**
-         * Spectifies both the specular color RGB and the glossiness A of the material per pixels.
+         * Specifies both the specular color RGB and the glossiness A of the material per pixels.
          */
         @serializeAsTexture()
         @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_reflectivityTexture")

+ 4 - 0
src/Materials/Textures/babylon.cubeTexture.ts

@@ -73,6 +73,10 @@
             this.isCube = true;
 
             this._textureMatrix = Matrix.Identity();
+
+            if (prefiltered) {
+                this.gammaSpace = false;
+            }
         }
 
         // Methods

+ 52 - 4
src/Physics/babylon.physicsImpostor.ts

@@ -46,7 +46,7 @@ module BABYLON {
 
         private _isDisposed = false;
 
-        private static _tmpVec: Vector3 = Vector3.Zero();
+        private static _tmpVecs: Vector3[] = [Vector3.Zero(), Vector3.Zero(), Vector3.Zero()];
         private static _tmpQuat: Quaternion = Quaternion.Identity();
 
         get isDisposed():boolean{
@@ -498,12 +498,12 @@ module BABYLON {
          * @param bone The bone to sync to the impostor.
          * @param boneMesh The mesh that the bone is influencing.
          * @param jointPivot The pivot of the joint / bone in local space.
+         * @param distToJoint Optional distance from the impostor to the joint.
          * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.
-         * @param distToJoint Optional distance to the impostor to the joint.
          */
-        public syncBoneWithImpostor(bone:Bone, boneMesh:AbstractMesh, jointPivot:Vector3, adjustRotation?:Quaternion, distToJoint?:number){
+        public syncBoneWithImpostor(bone:Bone, boneMesh:AbstractMesh, jointPivot:Vector3, distToJoint?:number, adjustRotation?:Quaternion){
 
-            var tempVec = PhysicsImpostor._tmpVec;
+            var tempVec = PhysicsImpostor._tmpVecs[0];
             var mesh = <AbstractMesh>this.object;
 
             if(adjustRotation){
@@ -546,6 +546,54 @@ module BABYLON {
 
         }
 
+        /**
+         * Sync impostor to a bone
+         * @param bone The bone that the impostor will be synced to.
+         * @param boneMesh The mesh that the bone is influencing.
+         * @param jointPivot The pivot of the joint / bone in local space.
+         * @param distToJoint Optional distance from the impostor to the joint.
+         * @param adjustRotation Optional quaternion for adjusting the local rotation of the bone.
+         * @param boneAxis Optional vector3 axis the bone is aligned with
+         */
+        public syncImpostorWithBone(bone:Bone, boneMesh:AbstractMesh, jointPivot:Vector3, distToJoint?:number, adjustRotation?:Quaternion, boneAxis?:Vector3){
+
+            var mesh = <AbstractMesh>this.object;
+
+            if(adjustRotation){
+                var tempQuat = PhysicsImpostor._tmpQuat;
+                bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, tempQuat);
+                tempQuat.multiplyToRef(adjustRotation, mesh.rotationQuaternion);
+            }else{
+                bone.getRotationQuaternionToRef(Space.WORLD, boneMesh, mesh.rotationQuaternion);
+            }
+
+            var pos = PhysicsImpostor._tmpVecs[0];
+            var boneDir = PhysicsImpostor._tmpVecs[1];
+            
+            if(!boneAxis){
+                boneAxis = PhysicsImpostor._tmpVecs[2];
+                boneAxis.x = 0; 
+                boneAxis.y = 1; 
+                boneAxis.z = 0;
+            }
+
+            bone.getDirectionToRef(boneAxis, boneMesh, boneDir);
+            bone.getAbsolutePositionToRef(boneMesh, pos);
+
+            if((distToJoint === undefined || distToJoint === null) && jointPivot){
+                distToJoint = jointPivot.length();
+            }
+
+            if(distToJoint !== undefined && distToJoint !== null){
+                pos.x += boneDir.x * distToJoint;
+                pos.y += boneDir.y * distToJoint;
+                pos.z += boneDir.z * distToJoint;
+            }
+
+            mesh.setAbsolutePosition(pos);
+            
+        }
+
         //Impostor types
         public static NoImpostor = 0;
         public static SphereImpostor = 1;