Browse Source

Triangle: Warn about `getUV()` only once. (#25639)

Michael Herzog 2 years ago
parent
commit
73745ff8fd
1 changed files with 16 additions and 2 deletions
  1. 16 2
      src/math/Triangle.js

+ 16 - 2
src/math/Triangle.js

@@ -12,6 +12,8 @@ const _vap = /*@__PURE__*/ new Vector3();
 const _vbp = /*@__PURE__*/ new Vector3();
 const _vbp = /*@__PURE__*/ new Vector3();
 const _vcp = /*@__PURE__*/ new Vector3();
 const _vcp = /*@__PURE__*/ new Vector3();
 
 
+let warnedGetUV = false;
+
 class Triangle {
 class Triangle {
 
 
 	constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
 	constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
@@ -83,7 +85,13 @@ class Triangle {
 
 
 	static getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) {
 	static getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) {
 
 
-		console.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' ); // r151
+		if ( warnedGetUV === false ) {
+
+			console.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' ); // @deprecated since r151
+
+			warnedGetUV = true;
+
+		}
 
 
 		return this.getInterpolation( point, p1, p2, p3, uv1, uv2, uv3, target );
 		return this.getInterpolation( point, p1, p2, p3, uv1, uv2, uv3, target );
 
 
@@ -193,7 +201,13 @@ class Triangle {
 
 
 	getUV( point, uv1, uv2, uv3, target ) {
 	getUV( point, uv1, uv2, uv3, target ) {
 
 
-		console.warn( 'Triangle.getUV() has been renamed to Triangle.getInterpolation().' ); // r151
+		if ( warnedGetUV === false ) {
+
+			console.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' ); // @deprecated since r151
+
+			warnedGetUV = true;
+
+		}
 
 
 		return Triangle.getInterpolation( point, this.a, this.b, this.c, uv1, uv2, uv3, target );
 		return Triangle.getInterpolation( point, this.a, this.b, this.c, uv1, uv2, uv3, target );