Browse Source

Merge pull request #16596 from sciecode/dev2

Math: includes missing *.d.ts methods.
Mr.doob 6 năm trước cách đây
mục cha
commit
80f77286a1

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

@@ -17,6 +17,8 @@ export class Color {
 	constructor( color?: Color | string | number );
 	constructor( r: number, g: number, b: number );
 
+	isColor: boolean;
+
 	/**
    * Red channel value between 0 and 1. Default is 1.
    */
@@ -95,6 +97,28 @@ export class Color {
    */
 	convertLinearToGamma(): Color;
 
+	/**
+   * Copies given color making conversion from sRGB to linear space.
+   * @param color Color to copy.
+   */
+	copySRGBToLinear(): Color;
+
+	/**
+	 * Copies given color making conversion from linear to sRGB space.
+	 * @param color Color to copy.
+	 */
+	copyLinearToSRGB(): Color;
+
+	/**
+	 * Converts this color from sRGB to linear space.
+	 */
+	convertSRGBToLinear(): Color;
+
+	/**
+	 * Converts this color from linear to sRGB space.
+	 */
+	convertLinearToSRGB(): Color;
+
 	/**
    * Returns the hexadecimal value of this color.
    */

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

@@ -12,5 +12,6 @@ export class Cylindrical {
 	copy( other: Cylindrical ): this;
 	set( radius: number, theta: number, y: number ): this;
 	setFromVector3( vec3: Vector3 ): this;
+	setFromCartesianCoords( x: number, y: number, z: number ): this;
 
 }

+ 1 - 1
src/math/Frustum.d.ts

@@ -37,7 +37,7 @@ export class Frustum {
 	copy( frustum: Frustum ): this;
 	setFromMatrix( m: Matrix4 ): Frustum;
 	intersectsObject( object: Object3D ): boolean;
-	intersectsObject( sprite: Sprite ): boolean;
+	intersectsSprite( sprite: Sprite ): boolean;
 	intersectsSphere( sphere: Sphere ): boolean;
 	intersectsBox( box: Box3 ): boolean;
 	containsPoint( point: Vector3 ): boolean;

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

@@ -27,6 +27,7 @@ export class Plane {
 	intersectLine( line: Line3, target: Vector3 ): Vector3;
 	intersectsLine( line: Line3 ): boolean;
 	intersectsBox( box: Box3 ): boolean;
+	intersectsSphere( sphere: Sphere ): boolean;
 	coplanarPoint( target: Vector3 ): Vector3;
 	applyMatrix4( matrix: Matrix4, optionalNormalMatrix?: Matrix3 ): Plane;
 	translate( offset: Vector3 ): Plane;

+ 13 - 0
src/math/Triangle.d.ts

@@ -1,5 +1,6 @@
 import { Vector3 } from './Vector3';
 import { Plane } from './Plane';
+import { Box3 } from './Box3';
 
 export interface SplineControlPoint {
 	x: number;
@@ -29,7 +30,9 @@ export class Triangle {
 	getNormal( target: Vector3 ): Vector3;
 	getPlane( target: Vector3 ): Plane;
 	getBarycoord( point: Vector3, target: Vector3 ): Vector3;
+	getUV( point: Vector3, uv1: Vector2, uv2: Vector2, uv3: Vector2, target: Vector2 ): Vector2;
 	containsPoint( point: Vector3 ): boolean;
+	intersectsBox( box: Box3 ): boolean;
 	isFrontFacing( direction: Vector3 ): boolean;
 	closestPointToPoint( point: Vector3, target: Vector3 ): Vector3;
 	equals( triangle: Triangle ): boolean;
@@ -53,6 +56,16 @@ export class Triangle {
 		b: Vector3,
 		c: Vector3
 	): boolean;
+	static getUV(
+		point: Vector3,
+		p1: Vector3,
+		p2: Vector3,
+		p3: Vector3,
+		uv1: Vector2,
+		uv2: Vector2,
+		uv3: Vector2,
+		target: Vector2
+	): Vector2;
 	static isFrontFacing(
 		a: Vector3,
 		b: Vector3,

+ 4 - 4
src/math/Triangle.js

@@ -238,15 +238,15 @@ Object.assign( Triangle.prototype, {
 
 	},
 
-	containsPoint: function ( point ) {
+	getUV: function ( point, uv1, uv2, uv3, target ) {
 
-		return Triangle.containsPoint( point, this.a, this.b, this.c );
+		return Triangle.getUV( point, this.a, this.b, this.c, uv1, uv2, uv3, target );
 
 	},
 
-	getUV: function ( point, uv1, uv2, uv3, result ) {
+	containsPoint: function ( point ) {
 
-		return Triangle.getUV( point, this.a, this.b, this.c, uv1, uv2, uv3, result );
+		return Triangle.containsPoint( point, this.a, this.b, this.c );
 
 	},