Browse Source

More code comments

David Catuhe 7 years ago
parent
commit
0c913011e9

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


+ 2 - 325
dist/preview release/typedocValidationBaseline.json

@@ -1,7 +1,7 @@
 {
-  "errors": 2751,
+  "errors": 2483,
   "babylon.typedoc.json": {
-    "errors": 2751,
+    "errors": 2483,
     "AsyncLoop": {
       "Method": {
         "Run": {
@@ -317,50 +317,6 @@
         }
       }
     },
-    "BezierCurve": {
-      "Class": {
-        "Comments": {
-          "MissingText": true
-        }
-      },
-      "Method": {
-        "interpolate": {
-          "Naming": {
-            "NotPascalCase": true
-          },
-          "Comments": {
-            "MissingReturn": true
-          },
-          "Parameter": {
-            "t": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "x1": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "y1": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "x2": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "y2": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      }
-    },
     "BlackAndWhitePostProcess": {
       "Class": {
         "Comments": {
@@ -375,232 +331,6 @@
         }
       }
     },
-    "BoundingBox": {
-      "Class": {
-        "Comments": {
-          "MissingText": true
-        }
-      },
-      "Property": {
-        "center": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "centerWorld": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "directions": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "extendSize": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "extendSizeWorld": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "maximum": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "maximumWorld": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "minimum": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "minimumWorld": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "vectors": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "vectorsWorld": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      },
-      "Method": {
-        "getWorldMatrix": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "intersectsMinMax": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "min": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "max": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "intersectsPoint": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "point": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "intersectsSphere": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "sphere": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "isCompletelyInFrustum": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "frustumPlanes": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "isInFrustum": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "frustumPlanes": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setWorldMatrix": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "matrix": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "Intersects": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "box0": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "box1": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "IntersectsSphere": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "minPoint": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "maxPoint": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "sphereCenter": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "sphereRadius": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "IsCompletelyInFrustum": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "boundingVectors": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "frustumPlanes": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "IsInFrustum": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "boundingVectors": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "frustumPlanes": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      }
-    },
     "BoundingBoxRenderer": {
       "Class": {
         "Comments": {
@@ -13438,59 +13168,6 @@
         }
       }
     },
-    "Viewport": {
-      "Class": {
-        "Comments": {
-          "MissingText": true
-        }
-      },
-      "Property": {
-        "height": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "width": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "x": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "y": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      },
-      "Method": {
-        "clone": {
-          "Comments": {
-            "MissingReturn": true
-          }
-        },
-        "toGlobal": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "renderWidthOrEngine": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "renderHeight": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      }
-    },
     "VolumetricLightScatteringPostProcess": {
       "Class": {
         "Comments": {

+ 1 - 1
src/Animations/babylon.easing.ts

@@ -338,7 +338,7 @@
 
         /** @hidden */
         public easeInCore(gradient: number): number {
-            return BezierCurve.interpolate(gradient, this.x1, this.y1, this.x2, this.y2);
+            return BezierCurve.Interpolate(gradient, this.x1, this.y1, this.x2, this.y2);
         }
     }
 }

+ 98 - 0
src/Culling/babylon.boundingBox.ts

@@ -1,15 +1,51 @@
 module BABYLON {
+    /**
+     * Class used to store bounding box information
+     */
     export class BoundingBox implements ICullable {
+        /**
+         * Gets the 8 vectors representing the bounding box in local space
+         */
         public vectors: Vector3[];
+        /**
+         * Gets the center of the bounding box in local space
+         */
         public center: Vector3;
+        /**
+         * Gets the center of the bounding box in world space
+         */
         public centerWorld: Vector3;
+        /**
+         * Gets the extend size in local space
+         */
         public extendSize: Vector3;
+        /**
+         * Gets the extend size in world space
+         */
         public extendSizeWorld: Vector3;
+        /**
+         * Gets the OBB (object bounding box) directions
+         */
         public directions: Vector3[];
+        /**
+         * Gets the 8 vectors representing the bounding box in world space
+         */        
         public vectorsWorld: Vector3[] = new Array<Vector3>();
+        /**
+         * Gets the minimum vector in world space
+         */
         public minimumWorld: Vector3;
+        /**
+         * Gets the maximum vector in world space
+         */
         public maximumWorld: Vector3;
+        /**
+         * Gets the minimum vector in local space
+         */
         public minimum: Vector3;
+        /**
+         * Gets the maximum vector in local space
+         */
         public maximum: Vector3;
 
         private _worldMatrix: Matrix;
@@ -95,10 +131,19 @@
             return this;
         }
 
+        /**
+         * Gets the world matrix of the bounding box
+         * @returns a matrix
+         */
         public getWorldMatrix(): Matrix {
             return this._worldMatrix;
         }
 
+        /**
+         * Sets the world matrix stored in the bounding box
+         * @param matrix defines the matrix to store
+         * @returns current bounding box
+         */
         public setWorldMatrix(matrix: Matrix): BoundingBox {
             this._worldMatrix.copyFrom(matrix);
             return this;
@@ -143,14 +188,29 @@
             this._worldMatrix = world;
         }
 
+        /**
+         * Tests if the bounding box is intersecting the frustum planes
+         * @param frustumPlanes defines the frustum planes to test
+         * @returns true if there is an intersection
+         */
         public isInFrustum(frustumPlanes: Plane[]): boolean {
             return BoundingBox.IsInFrustum(this.vectorsWorld, frustumPlanes);
         }
 
+        /**
+         * Tests if the bounding box is entirely inside the frustum planes
+         * @param frustumPlanes defines the frustum planes to test
+         * @returns true if there is an inclusion
+         */        
         public isCompletelyInFrustum(frustumPlanes: Plane[]): boolean {
             return BoundingBox.IsCompletelyInFrustum(this.vectorsWorld, frustumPlanes);
         }
 
+        /**
+         * Tests if a point is inside the bounding box
+         * @param point defines the point to test
+         * @returns true if the point is inside the bounding box
+         */
         public intersectsPoint(point: Vector3): boolean {
             var delta = -Epsilon;
 
@@ -166,10 +226,21 @@
             return true;
         }
 
+        /**
+         * Tests if the bounding box intersects with a bounding sphere
+         * @param sphere defines the sphere to test
+         * @returns true if there is an intersection
+         */
         public intersectsSphere(sphere: BoundingSphere): boolean {
             return BoundingBox.IntersectsSphere(this.minimumWorld, this.maximumWorld, sphere.centerWorld, sphere.radiusWorld);
         }
 
+        /**
+         * Tests if the bounding box intersects with a box defined by a min and max vectors
+         * @param min defines the min vector to use
+         * @param max defines the max vector to use
+         * @returns true if there is an intersection
+         */
         public intersectsMinMax(min: Vector3, max: Vector3): boolean {
             if (this.maximumWorld.x < min.x || this.minimumWorld.x > max.x)
                 return false;
@@ -184,6 +255,13 @@
         }
 
         // Statics
+
+        /**
+         * Tests if two bounding boxes are intersections
+         * @param box0 defines the first box to test
+         * @param box1 defines the second box to test
+         * @returns true if there is an intersection
+         */
         public static Intersects(box0: BoundingBox, box1: BoundingBox): boolean {
             if (box0.maximumWorld.x < box1.minimumWorld.x || box0.minimumWorld.x > box1.maximumWorld.x)
                 return false;
@@ -197,12 +275,26 @@
             return true;
         }
 
+        /**
+         * Tests if a bounding box defines by a min/max vectors intersects a sphere
+         * @param minPoint defines the minimum vector of the bounding box
+         * @param maxPoint defines the maximum vector of the bounding box
+         * @param sphereCenter defines the sphere center
+         * @param sphereRadius defines the sphere radius
+         * @returns true if there is an intersection
+         */
         public static IntersectsSphere(minPoint: Vector3, maxPoint: Vector3, sphereCenter: Vector3, sphereRadius: number): boolean {
             var vector = Vector3.Clamp(sphereCenter, minPoint, maxPoint);
             var num = Vector3.DistanceSquared(sphereCenter, vector);
             return (num <= (sphereRadius * sphereRadius));
         }
 
+        /**
+         * Tests if a bounding box defined with 8 vectors is entirely inside frustum planes
+         * @param boundingVectors defines an array of 8 vectors representing a bounding box
+         * @param frustumPlanes defines the frustum planes to test
+         * @return true if there is an inclusion
+         */
         public static IsCompletelyInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean {
             for (var p = 0; p < 6; p++) {
                 for (var i = 0; i < 8; i++) {
@@ -214,6 +306,12 @@
             return true;
         }
 
+        /**
+         * Tests if a bounding box defined with 8 vectors intersects frustum planes
+         * @param boundingVectors defines an array of 8 vectors representing a bounding box 
+         * @param frustumPlanes defines the frustum planes to test
+         * @return true if there is an intersection 
+         */
         public static IsInFrustum(boundingVectors: Vector3[], frustumPlanes: Plane[]): boolean {
             for (var p = 0; p < 6; p++) {
                 var inCount = 8;

+ 35 - 5
src/Math/babylon.math.ts

@@ -5985,13 +5985,34 @@
         }
     }
 
+    /**
+     * Class used to represent a viewport on screen
+     */
     export class Viewport {
         /**
-         * Creates a Viewport object located at (x, y) and sized (width, height).  
+         * Creates a Viewport object located at (x, y) and sized (width, height)
+         * @param x defines viewport left coordinate
+         * @param y defines viewport top coordinate
+         * @param width defines the viewport width
+         * @param height defines the viewport height
          */
-        constructor(public x: number, public y: number, public width: number, public height: number) {
+        constructor(
+            /** viewport left coordinate */
+            public x: number, 
+            /** viewport top coordinate */
+            public y: number, 
+            /**viewport width */
+            public width: number, 
+            /** viewport height */
+            public height: number) {
         }
 
+        /**
+         * Creates a new viewport using absolute sizing (from 0-> width, 0-> height instead of 0->1)
+         * @param renderWidthOrEngine defines either an engine or the rendering width
+         * @param renderHeight defines the rendering height
+         * @returns a new Viewport
+         */
         public toGlobal(renderWidthOrEngine: number | Engine, renderHeight: number): Viewport {
             if ((<Engine>renderWidthOrEngine).getRenderWidth) {
                 var engine = (<Engine>renderWidthOrEngine);
@@ -6000,8 +6021,10 @@
             let renderWidth = <number>renderWidthOrEngine;
             return new Viewport(this.x * renderWidth, this.y * renderHeight, this.width * renderWidth, this.height * renderHeight);
         }
+
         /**
-         * Returns a new Viewport copied from the current one.  
+         * Returns a new Viewport copied from the current one
+         * @returns a new Viewport
          */
         public clone(): Viewport {
             return new Viewport(this.x, this.y, this.width, this.height);
@@ -6113,11 +6136,18 @@
         public static Z: Vector3 = new Vector3(0.0, 0.0, 1.0);
     };
 
+    /** Class used to represent a Bezier curve */
     export class BezierCurve {
         /**
-         * Returns the cubic Bezier interpolated value (float) at "t" (float) from the given x1, y1, x2, y2 floats.  
+         * Returns the cubic Bezier interpolated value (float) at "t" (float) from the given x1, y1, x2, y2 floats
+         * @param t defines the time
+         * @param x1 defines the left coordinate on X axis
+         * @param y1 defines the left coordinate on Y axis
+         * @param x2 defines the right coordinate on X axis
+         * @param y2 defines the right coordinate on Y axis
+         * @returns the interpolated value
          */
-        public static interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number {
+        public static Interpolate(t: number, x1: number, y1: number, x2: number, y2: number): number {
 
             // Extract X (which is equal to time here)
             var f0 = 1 - 3 * x2 + 3 * x1;