Sebastien Vandenberghe 7 年之前
父節點
當前提交
90678c3901

文件差異過大導致無法顯示
+ 1717 - 1706
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


文件差異過大導致無法顯示
+ 13 - 13
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 25 - 0
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -5109,6 +5109,25 @@ var BABYLON;
         Scalar.PercentToRange = function (percent, min, max) {
             return ((max - min) * percent + min);
         };
+        /**
+         * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.
+         * @param angle The angle to normalize in radian.
+         * @return The converted angle.
+         */
+        Scalar.NormalizeRadians = function (angle) {
+            // More precise but slower version kept for reference.
+            // angle = angle % Tools.TwoPi;
+            // angle = (angle + Tools.TwoPi) % Tools.TwoPi;
+            //if (angle > Math.PI) {
+            //	angle -= Tools.TwoPi;
+            //}
+            angle -= (Scalar.TwoPi * Math.floor((angle + Math.PI) / Scalar.TwoPi));
+            return angle;
+        };
+        /**
+         * Two pi constants convenient for computation.
+         */
+        Scalar.TwoPi = Math.PI * 2;
         return Scalar;
     }());
     BABYLON.Scalar = Scalar;
@@ -5853,6 +5872,12 @@ var BABYLON;
                 return path;
             return path.substring(index + 1);
         };
+        Tools.GetFolderPath = function (uri) {
+            var index = uri.lastIndexOf("/");
+            if (index < 0)
+                return "";
+            return uri.substring(0, index + 1);
+        };
         Tools.GetDOMTextContent = function (element) {
             var result = "";
             var child = element.firstChild;

文件差異過大導致無法顯示
+ 1717 - 1706
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 26 - 1
src/Math/babylon.math.scalar.ts

@@ -1,6 +1,12 @@
 module BABYLON {
 
     export class Scalar {
+
+        /**
+         * Two pi constants convenient for computation.
+         */
+        public static TwoPi: number = Math.PI * 2;
+
         /**
          * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
          */
@@ -215,6 +221,25 @@
         */
         public static PercentToRange(percent: number, min: number, max: number): number {
             return ((max - min) * percent + min);
-        }        
+        }
+
+        /**
+         * Returns the angle converted to equivalent value between -Math.PI and Math.PI radians.
+         * @param angle The angle to normalize in radian.
+         * @return The converted angle.
+         */
+        public static NormalizeRadians(angle: number): number {
+            // More precise but slower version kept for reference.
+            // angle = angle % Tools.TwoPi;
+            // angle = (angle + Tools.TwoPi) % Tools.TwoPi;
+
+            //if (angle > Math.PI) {
+            //	angle -= Tools.TwoPi;
+            //}
+
+            angle -= (Scalar.TwoPi * Math.floor((angle + Math.PI) / Scalar.TwoPi));
+
+            return angle;
+        }
     }
 }

+ 1 - 1
src/Mesh/babylon.abstractMesh.ts

@@ -801,7 +801,7 @@
          * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units).
          * @param includeDescendants Take the hierarchy's bounding box instead of the mesh's bounding box.
          */
-        public normalizeToUnitCube(includeDescendants = true): AbstractMesh {            
+        public normalizeToUnitCube(includeDescendants = true): AbstractMesh {
             let boundingVectors = this.getHierarchyBoundingVectors(includeDescendants);
             let sizeVec = boundingVectors.max.subtract(boundingVectors.min);
             let maxDimension = Math.max(sizeVec.x, sizeVec.y, sizeVec.z);

+ 8 - 0
src/Tools/babylon.tools.ts

@@ -152,6 +152,14 @@
             return path.substring(index + 1);
         }
 
+        public static GetFolderPath(uri: string): string {
+            var index = uri.lastIndexOf("/");
+            if (index < 0)
+                return "";
+
+            return uri.substring(0, index + 1);
+        }
+
         public static GetDOMTextContent(element: HTMLElement): string {
             var result = "";
             var child = element.firstChild;