Browse Source

Port changes from @types/three

Nathan Bierema 6 years ago
parent
commit
a5cb67909a
5 changed files with 30 additions and 1 deletions
  1. 1 0
      src/core/BufferGeometry.d.ts
  2. 2 0
      src/core/Object3D.d.ts
  3. 1 0
      src/math/Color.d.ts
  4. 9 0
      src/math/Vector2.d.ts
  5. 17 1
      src/math/Vector3.d.ts

+ 1 - 0
src/core/BufferGeometry.d.ts

@@ -44,6 +44,7 @@ export class BufferGeometry extends EventDispatcher {
   boundingBox: Box3;
   boundingSphere: Sphere;
   drawRange: { start: number; count: number };
+  userData: {[key: string]: any};
 
   getIndex(): BufferAttribute;
   setIndex(index: BufferAttribute | number[]): void;

+ 2 - 0
src/core/Object3D.d.ts

@@ -308,6 +308,8 @@ export class Object3D extends EventDispatcher {
    */
   updateMatrixWorld(force: boolean): void;
 
+  updateWorldMatrix(updateParents: boolean, updateChildren: boolean): void;
+
   toJSON(meta?: {
     geometries: any;
     materials: any;

+ 1 - 0
src/math/Color.d.ts

@@ -125,4 +125,5 @@ export class Color {
   equals(color: Color): boolean;
   fromArray(rgb: number[], offset?: number): this;
   toArray(array?: number[], offset?: number): number[];
+  toArray(xyz: ArrayLike<number>, offset?: number): ArrayLike<number>;
 }

+ 9 - 0
src/math/Vector2.d.ts

@@ -401,9 +401,18 @@ export class Vector2 implements Vector {
    * Returns an array [x, y], or copies x and y into the provided array.
    * @param array (optional) array to store the vector to. If this is not provided, a new array will be created.
    * @param offset (optional) optional offset into the array.
+   * @return The created or provided array.
    */
   toArray(array?: number[], offset?: number): number[];
 
+  /**
+   * Copies x and y into the provided array-like.
+   * @param array array-like to store the vector to.
+   * @param offset (optional) optional offset into the array.
+   * @return The provided array-like.
+   */
+  toArray(array: ArrayLike<number>, offset?: number): ArrayLike<number>;
+
   /**
    * Sets this vector's x and y values from the attribute.
    * @param attribute the source attribute.

+ 17 - 1
src/math/Vector3.d.ts

@@ -112,7 +112,7 @@ export class Vector3 implements Vector {
 
   applyQuaternion(q: Quaternion): this;
 
-  project(camrea: Camera): this;
+  project(camera: Camera): this;
 
   unproject(camera: Camera): this;
 
@@ -246,7 +246,23 @@ export class Vector3 implements Vector {
   equals(v: Vector3): boolean;
 
   fromArray(xyz: number[], offset?: number): Vector3;
+
+  /**
+   * Returns an array [x, y, z], or copies x, y and z into the provided array.
+   * @param array (optional) array to store the vector to. If this is not provided, a new array will be created.
+   * @param offset (optional) optional offset into the array.
+   * @return The created or provided array.
+   */
   toArray(xyz?: number[], offset?: number): number[];
+
+  /**
+   * Copies x, y and z into the provided array-like.
+   * @param array array-like to store the vector to.
+   * @param offset (optional) optional offset into the array.
+   * @return The provided array-like.
+   */
+  toArray(xyz: ArrayLike<number>, offset?: number): ArrayLike<number>;
+
   fromBufferAttribute(
     attribute: BufferAttribute,
     index: number,