Sébastien Vandenberghe 9 tahun lalu
induk
melakukan
1ae7d8886b

File diff ditekan karena terlalu besar
+ 1 - 1
dist/preview release/babylon.core.js


File diff ditekan karena terlalu besar
+ 1023 - 1023
dist/preview release/babylon.d.ts


File diff ditekan karena terlalu besar
+ 1 - 1
dist/preview release/babylon.js


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

@@ -7184,7 +7184,7 @@ var BABYLON;
             if (directDecendantsOnly === void 0) { directDecendantsOnly = false; }
             for (var index = 0; index < list.length; index++) {
                 var item = list[index];
-                if (((directDecendantsOnly && item.parent === this) || (!directDecendantsOnly && item.isDescendantOf(this))) && (!predicate || predicate(item))) {
+                if (((directDecendantsOnly && item.parent === this) || (!directDecendantsOnly && item.isDescendantOf(this))) && (predicate === null || predicate(item))) {
                     results.push(item);
                 }
             }
@@ -8427,12 +8427,14 @@ var BABYLON;
             }
             if (!this._cache.position.equals(this.position))
                 return false;
-            if (!this._cache.rotation.equals(this.rotation))
-                return false;
             if (this.rotationQuaternion) {
                 if (!this._cache.rotationQuaternion.equals(this.rotationQuaternion))
                     return false;
             }
+            else {
+                if (!this._cache.rotation.equals(this.rotation))
+                    return false;
+            }
             if (!this._cache.scaling.equals(this.scaling))
                 return false;
             return true;

File diff ditekan karena terlalu besar
+ 1 - 1
dist/preview release/babylon.noworker.js


+ 3 - 0
materialsLibrary/config.json

@@ -11,6 +11,9 @@
     },
     {
       "file": "materials/pbr/babylon.pbrMaterial.ts",
+      "referenceFiles": [
+        "materials/pbr/includes/helperFunctions.fx"  
+      ],
       "shaderFiles": [
         "materials/pbr/pbr.vertex.fx",
         "materials/pbr/pbr.fragment.fx",

File diff ditekan karena terlalu besar
+ 4 - 2
materialsLibrary/dist/babylon.pbrMaterial.js


File diff ditekan karena terlalu besar
+ 2 - 2
materialsLibrary/dist/babylon.pbrMaterial.min.js


+ 13 - 1
materialsLibrary/gulpfile.js

@@ -20,6 +20,10 @@ function shadersName(filename) {
       .replace('.fx', 'Shader');
 }
 
+function includeShadersName(filename) {
+    return filename.replace('.fx', '');
+}
+
 gulp.task('copyReference', function () {
     return gulp.src("../dist/preview release/babylon.max.js").pipe(gulp.dest("test/refs"));
 });
@@ -57,7 +61,15 @@ gulp.task('default', ["copyReference"], function () {
                 .pipe(uncommentShader())
                 .pipe(srcToVariable("BABYLON.Effect.ShadersStore", true, shadersName));
 
-        return merge2(js, shader)
+        if (!material.referenceFiles) {
+            material.referenceFiles = [];
+        }
+        
+        var includeShader = gulp.src(material.referenceFiles)
+            .pipe(uncommentShader())
+            .pipe(srcToVariable("BABYLON.Effect.IncludesShadersStore", true, includeShadersName));
+        
+        return merge2(js, shader, includeShader)
             .pipe(cleants())
             .pipe(replace(extendsSearchRegex, ""))
             .pipe(concat(material.output))

+ 18 - 0
materialsLibrary/materials/pbr/includes/helperFunctions.fx

@@ -0,0 +1,18 @@
+// PBR HELPER METHODS
+float Square(float value)
+{
+    return value * value;
+}
+
+float getLuminance(vec3 color)
+{
+    return clamp(dot(color, vec3(0.2126, 0.7152, 0.0722)), 0., 1.);
+}
+
+float convertRoughnessToAverageSlope(float roughness)
+{
+    // Calculate AlphaG as square of roughness; add epsilon to avoid numerical issues
+    const float kMinimumVariance = 0.0005;
+    float alphaG = Square(roughness) + kMinimumVariance;
+    return alphaG;
+}

+ 1 - 19
materialsLibrary/materials/pbr/legacypbr.fragment.fx

@@ -33,25 +33,7 @@ const float kPi = 3.1415926535897932384626433832795;
 const float kRougnhessToAlphaScale = 0.1;
 const float kRougnhessToAlphaOffset = 0.29248125;
 
-
-// PBR HELPER METHODS
-float Square(float value)
-{
-    return value * value;
-}
-
-float getLuminance(vec3 color)
-{
-    return clamp(dot(color, vec3(0.2126, 0.7152, 0.0722)), 0., 1.);
-}
-
-float convertRoughnessToAverageSlope(float roughness)
-{
-    // Calculate AlphaG as square of roughness; add epsilon to avoid numerical issues
-    const float kMinimumVariance = 0.0005;
-    float alphaG = Square(roughness) + kMinimumVariance;
-    return alphaG;
-}
+#include<helperFunctions>
 
 // Based on Beckamm roughness to Blinn exponent + http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html 
 float getMipMapIndexFromAverageSlope(float maxMipLevel, float alpha)

+ 1 - 19
materialsLibrary/materials/pbr/pbr.fragment.fx

@@ -81,25 +81,7 @@ const float kPi = 3.1415926535897932384626433832795;
 const float kRougnhessToAlphaScale = 0.1;
 const float kRougnhessToAlphaOffset = 0.29248125;
 
-
-// PBR HELPER METHODS
-float Square(float value)
-{
-    return value * value;
-}
-
-float getLuminance(vec3 color)
-{
-    return clamp(dot(color, vec3(0.2126, 0.7152, 0.0722)), 0., 1.);
-}
-
-float convertRoughnessToAverageSlope(float roughness)
-{
-    // Calculate AlphaG as square of roughness; add epsilon to avoid numerical issues
-    const float kMinimumVariance = 0.0005;
-    float alphaG = Square(roughness) + kMinimumVariance;
-    return alphaG;
-}
+#include<helperFunctions>
 
 // Based on Beckamm roughness to Blinn exponent + http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html 
 float getMipMapIndexFromAverageSlope(float maxMipLevel, float alpha)

+ 5 - 3
materialsLibrary/test/refs/babylon.max.js

@@ -7184,7 +7184,7 @@ var BABYLON;
             if (directDecendantsOnly === void 0) { directDecendantsOnly = false; }
             for (var index = 0; index < list.length; index++) {
                 var item = list[index];
-                if (((directDecendantsOnly && item.parent === this) || (!directDecendantsOnly && item.isDescendantOf(this))) && (!predicate || predicate(item))) {
+                if (((directDecendantsOnly && item.parent === this) || (!directDecendantsOnly && item.isDescendantOf(this))) && (predicate === null || predicate(item))) {
                     results.push(item);
                 }
             }
@@ -8427,12 +8427,14 @@ var BABYLON;
             }
             if (!this._cache.position.equals(this.position))
                 return false;
-            if (!this._cache.rotation.equals(this.rotation))
-                return false;
             if (this.rotationQuaternion) {
                 if (!this._cache.rotationQuaternion.equals(this.rotationQuaternion))
                     return false;
             }
+            else {
+                if (!this._cache.rotation.equals(this.rotation))
+                    return false;
+            }
             if (!this._cache.scaling.equals(this.scaling))
                 return false;
             return true;

+ 4 - 2
src/Mesh/babylon.abstractMesh.js

@@ -424,12 +424,14 @@ var BABYLON;
             }
             if (!this._cache.position.equals(this.position))
                 return false;
-            if (!this._cache.rotation.equals(this.rotation))
-                return false;
             if (this.rotationQuaternion) {
                 if (!this._cache.rotationQuaternion.equals(this.rotationQuaternion))
                     return false;
             }
+            else {
+                if (!this._cache.rotation.equals(this.rotation))
+                    return false;
+            }
             if (!this._cache.scaling.equals(this.scaling))
                 return false;
             return true;

+ 4 - 5
src/Mesh/babylon.abstractMesh.ts

@@ -452,14 +452,13 @@
             if (!this._cache.position.equals(this.position))
                 return false;
 
-
-            if (!this._cache.rotation.equals(this.rotation))
-                return false;
-
             if (this.rotationQuaternion) {
                 if (!this._cache.rotationQuaternion.equals(this.rotationQuaternion))
                     return false;
-            } 
+            } else {
+                if (!this._cache.rotation.equals(this.rotation))
+                    return false;
+            }
 
             if (!this._cache.scaling.equals(this.scaling))
                 return false;

+ 1 - 1
src/babylon.node.js

@@ -142,7 +142,7 @@ var BABYLON;
             if (directDecendantsOnly === void 0) { directDecendantsOnly = false; }
             for (var index = 0; index < list.length; index++) {
                 var item = list[index];
-                if (((directDecendantsOnly && item.parent === this) || (!directDecendantsOnly && item.isDescendantOf(this))) && (!predicate || predicate(item))) {
+                if (((directDecendantsOnly && item.parent === this) || (!directDecendantsOnly && item.isDescendantOf(this))) && (predicate === null || predicate(item))) {
                     results.push(item);
                 }
             }

+ 1 - 1
src/babylon.node.ts

@@ -186,7 +186,7 @@
         public _getDescendants(list: Node[], results: Node[], directDecendantsOnly: boolean = false, predicate?: (node: Node) => boolean): void {
             for (var index = 0; index < list.length; index++) {
                 var item = list[index];
-                if (((directDecendantsOnly && item.parent === this) || (!directDecendantsOnly && item.isDescendantOf(this))) && (!predicate || predicate(item))) { 
+                if (((directDecendantsOnly && item.parent === this) || (!directDecendantsOnly && item.isDescendantOf(this))) && (predicate === null || predicate(item))) {
                     results.push(item);
                 }
             }