Browse Source

Merge pull request #21164 from Mugen87/dev51

Face3: Remove from core.
Mr.doob 4 years ago
parent
commit
945ecfd7ea

+ 0 - 100
docs/api/en/core/Face3.html

@@ -1,100 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8" />
-		<base href="../../../" />
-		<script src="page.js"></script>
-		<link type="text/css" rel="stylesheet" href="page.css" />
-	</head>
-	<body>
-		<h1>[name]</h1>
-
-		<p class="desc">
-		Triangular face used in deprecated geometry. These are created automatically for all
-		standard geometry types, however if you are building a custom geometry you will have to
-		create them manually.
-		</p>
-
-		<h2>Constructor</h2>
-
-		<h3>[name]( [param:Integer a], [param:Integer b], [param:Integer c], [param:Vector3 normal], [param:Color color], [param:Integer materialIndex] )</h3>
-		<p>
-		a — Vertex A index.<br />
-		b — Vertex B index.<br />
-		c — Vertex C index.<br /><br />
-
-		normal — (optional) Face normal ([page:Vector3 Vector3]) or array of vertex normals.
-		If a single vector is passed in, this sets [page:.normal], otherwise if an array of three
-		vectors is passed in this sets [page:.vertexNormals]<br /><br />
-
-		color — (optional) Face [page:Color color] or array of vertex [page:Color colors].
-		If a single vector is passed in, this sets [page:.color], otherwise if an array of three
-		vectors is passed in this sets [page:.vertexColors]<br /><br />
-
-		materialIndex — (optional) which index of an array of materials to associate
-		with the face.
-		</p>
-
-		<h2>Properties</h2>
-
-		<h3>[property:Integer a]</h3>
-		<p>
-		Vertex A index.
-		</p>
-
-		<h3>[property:Integer b]</h3>
-		<p>
-		Vertex B index.
-		</p>
-
-		<h3>[property:Integer c]</h3>
-		<p>
-		Vertex C index.
-		</p>
-
-		<h3>[property:Vector3 normal]</h3>
-		<p>
-		Face normal - vector showing the direction of the Face3. If calculated automatically,
-		this is the normalized cross product of two edges of the
-		triangle. Default is *(0, 0, 0)*.
-		</p>
-
-		<h3>[property:Color color]</h3>
-		<p>
-		Face color - for this to be used a material's [page:Material.vertexColors vertexColors] property
-		must be set to *true*.
-		</p>
-
-		<h3>[property:Array vertexNormals]</h3>
-		<p>
-		Array of 3 [page:Vector3 vertex normals].
-		</p>
-
-		<h3>[property:Array vertexColors]</h3>
-		<p>
-		Array of 3 vertex colors - for these to be used a material's [page:Material.vertexColors vertexColors] property
-		must be set to *true*.
-		</p>
-
-
-		<h3>[property:Integer materialIndex]</h3>
-		<p>
-		Material index (points to an index in the associated array of materials). Default is *0*.
-		</p>
-
-		<h2>Methods</h2>
-
-		<h3>[method:Face3 clone]()</h3>
-		<p>Creates a new clone of the Face3 object.</p>
-
-		<h3>[method:Face3 copy]( [param:Face3 face3] )</h3>
-		<p>Copy the parameters of another Face3 into this.</p>
-
-
-		<h2>Source</h2>
-
-		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
-		</p>
-	</body>
-</html>

+ 1 - 1
docs/api/en/core/Raycaster.html

@@ -172,7 +172,7 @@
 		<p>
 			[page:Float distance] – distance between the origin of the ray and the intersection<br />
 			[page:Vector3 point] – point of intersection, in world coordinates<br />
-			[page:Face3 face] – intersected face<br />
+			[page:Object face] – intersected face<br />
 			[page:Integer faceIndex] – index of the intersected face<br />
 			[page:Object3D object] – the intersected object<br />
 			[page:Vector2 uv] - U,V coordinates at point of intersection<br />

+ 0 - 96
docs/api/zh/core/Face3.html

@@ -1,96 +0,0 @@
-<!DOCTYPE html>
-<html lang="zh">
-	<head>
-		<meta charset="utf-8" />
-		<base href="../../../" />
-		<script src="page.js"></script>
-		<link type="text/css" rel="stylesheet" href="page.css" />
-	</head>
-	<body>
-		<h1>[name]</h1>
-
-		<p class="desc">
-			在 deprecated geometry 中被使用到的三角形面。这些三角形面会为所有标准几何体自动创建。
-			然而,如果你正在构建一个自定义几何体,你需要手动创建这些三角形面。
-		</p>
-
-		<h2>构造函数</h2>
-
-		<h3>[name]( [param:Integer a], [param:Integer b], [param:Integer c], [param:Vector3 normal], [param:Color color], [param:Integer materialIndex] )</h3>
-		<p>
-			a — 顶点 A 的索引。<br />
-			b — 顶点 B 的索引。<br />
-			c — 顶点 C 的索引。<br /><br />
-
-			normal — (可选) 面的法向量 ([page:Vector3 Vector3]) 或顶点法向量队列。
-			如果参数传入单一矢量,则用该量设置面的法向量 [page:.normal],如果传入的是包含三个矢量的队列,
-			则用该量设置 [page:.vertexNormals]<br /><br />
-
-			color — (可选) 面的颜色值 [page:Color color] 或顶点颜色值的队列。
-			如果参数传入单一矢量,则用该量设置 [page:.color],如果传入的是包含三个矢量的队列,
-			则用该量设置 [page:.vertexColors]<br /><br />
-
-			materialIndex — (可选) 材质队列中与该面对应的材质的索引。
-		</p>
-
-		<h2>属性</h2>
-
-		<h3>[property:Integer a]</h3>
-		<p>
-			顶点 A 的索引。
-		</p>
-
-		<h3>[property:Integer b]</h3>
-		<p>
-			顶点 B 的索引。
-		</p>
-
-		<h3>[property:Integer c]</h3>
-		<p>
-			顶点 C 的索引。
-		</p>
-
-		<h3>[property:Vector3 normal]</h3>
-		<p>
-			面的法向量 - 矢量展示 Face3 的方向。如果该量是通过调用自动计算的,
-			该值等于归一化的两条边的差积。默认值是 *(0, 0, 0)*。
-		</p>
-
-		<h3>[property:Color color]</h3>
-		<p>
-			面的颜色值 - 在被用于指定材质的 [page:Material.vertexColors vertexColors] 属性时,该值必须被设置为
-			*true*。
-		</p>
-
-		<h3>[property:Array vertexNormals]</h3>
-		<p>
-			包含三个 [page:Vector3 vertex normals] 的队列。
-		</p>
-
-		<h3>[property:Array vertexColors]</h3>
-		<p>
-			包含 3 个顶点颜色值的队列 - 在被用于指定材质的 [page:Material.vertexColors vertexColors] 属性时,该值必须被设置为
-			*true*。
-		</p>
-
-		<h3>[property:Integer materialIndex]</h3>
-		<p>
-			材质队列中与该面相关的材质的索引。默认值为 *0*。
-		</p>
-
-		<h2>方法</h2>
-
-		<h3>[method:Face3 clone]()</h3>
-		<p>克隆该 Face3 对象。</p>
-
-		<h3>[method:Face3 copy]( [param:Face3 face3] )</h3>
-		<p>将参数指定的 Face3 对象的数据拷贝到当前对象。</p>
-
-
-		<h2>源代码</h2>
-
-		<p>
-			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
-		</p>
-	</body>
-</html>

+ 1 - 1
docs/api/zh/core/Raycaster.html

@@ -175,7 +175,7 @@
 		<p>
 			[page:Float distance] —— 射线投射原点和相交部分之间的距离。<br />
 			[page:Vector3 point] —— 相交部分的点(世界坐标)<br />
-			[page:Face3 face] —— 相交的面<br />
+			[page:Object face] —— 相交的面<br />
 			[page:Integer faceIndex] —— 相交的面的索引<br />
 			[page:Object3D object] —— 相交的物体<br />
 			[page:Vector2 uv] —— 相交部分的点的UV坐标。<br />

+ 0 - 2
docs/list.json

@@ -87,7 +87,6 @@
 				"BufferGeometry": "api/en/core/BufferGeometry",
 				"Clock": "api/en/core/Clock",
 				"EventDispatcher": "api/en/core/EventDispatcher",
-				"Face3": "api/en/core/Face3",
 				"GLBufferAttribute": "api/en/core/GLBufferAttribute",
 				"InstancedBufferAttribute": "api/en/core/InstancedBufferAttribute",
 				"InstancedBufferGeometry": "api/en/core/InstancedBufferGeometry",
@@ -599,7 +598,6 @@
 				"BufferGeometry": "api/zh/core/BufferGeometry",
 				"Clock": "api/zh/core/Clock",
 				"EventDispatcher": "api/zh/core/EventDispatcher",
-				"Face3": "api/zh/core/Face3",
 				"GLBufferAttribute": "api/zh/core/GLBufferAttribute",
 				"InstancedBufferAttribute": "api/zh/core/InstancedBufferAttribute",
 				"InstancedBufferGeometry": "api/zh/core/InstancedBufferGeometry",

+ 97 - 4
examples/jsm/deprecated/Geometry.d.ts

@@ -1,7 +1,6 @@
 import {
 	Vector3,
 	Color,
-	Face3,
 	Vector2,
 	Vector4,
 	Box3,
@@ -17,7 +16,7 @@ import {
 } from '../../../src/Three';
 
 /**
- * @deprecated Use {@link Face3} instead.
+ * @deprecated Use Face3 instead.
  */
 
 export interface MorphTarget {
@@ -37,8 +36,6 @@ export interface MorphNormals {
 
 /**
  * Base class for geometries
- *
- * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Geometry.js|src/core/Geometry.js}
  */
 export class Geometry extends EventDispatcher {
 
@@ -279,3 +276,99 @@ export class Geometry extends EventDispatcher {
 	animations: AnimationClip[];
 
 }
+
+/**
+ * Triangle face.
+ */
+export class Face3 {
+
+	/**
+	 * @param a Vertex A index.
+	 * @param b Vertex B index.
+	 * @param c Vertex C index.
+	 * @param normal Face normal or array of vertex normals.
+	 * @param color Face color or array of vertex colors.
+	 * @param materialIndex Material index.
+	 */
+	constructor(
+		a: number,
+		b: number,
+		c: number,
+		normal?: Vector3,
+		color?: Color,
+		materialIndex?: number
+	);
+	constructor(
+		a: number,
+		b: number,
+		c: number,
+		normal?: Vector3,
+		vertexColors?: Color[],
+		materialIndex?: number
+	);
+	constructor(
+		a: number,
+		b: number,
+		c: number,
+		vertexNormals?: Vector3[],
+		color?: Color,
+		materialIndex?: number
+	);
+	constructor(
+		a: number,
+		b: number,
+		c: number,
+		vertexNormals?: Vector3[],
+		vertexColors?: Color[],
+		materialIndex?: number
+	);
+
+	/**
+	 * Vertex A index.
+	 */
+	a: number;
+
+	/**
+	 * Vertex B index.
+	 */
+	b: number;
+
+	/**
+	 * Vertex C index.
+	 */
+	c: number;
+
+	/**
+	 * Face normal.
+	 * @default new THREE.Vector3()
+	 */
+	normal: Vector3;
+
+	/**
+	 * Array of 3 vertex normals.
+	 * @default []
+	 */
+	vertexNormals: Vector3[];
+
+	/**
+	 * Face color.
+	 * @default new THREE.Color()
+	 */
+	color: Color;
+
+	/**
+	 * Array of 3 vertex colors.
+	 * @default []
+	 */
+	vertexColors: Color[];
+
+	/**
+	 * Material index (points to {@link Mesh.material}).
+	 * @default 0
+	 */
+	materialIndex: number;
+
+	clone(): Face3;
+	copy( source: Face3 ): this;
+
+}

+ 53 - 1
examples/jsm/deprecated/Geometry.js

@@ -4,7 +4,6 @@ import {
 	BufferGeometry,
 	Color,
 	EventDispatcher,
-	Face3,
 	Float32BufferAttribute,
 	Matrix3,
 	Matrix4,
@@ -1814,4 +1813,57 @@ class DirectGeometry {
 
 }
 
+class Face3 {
+
+	constructor( a, b, c, normal, color, materialIndex = 0 ) {
+
+		this.a = a;
+		this.b = b;
+		this.c = c;
+
+		this.normal = ( normal && normal.isVector3 ) ? normal : new Vector3();
+		this.vertexNormals = Array.isArray( normal ) ? normal : [];
+
+		this.color = ( color && color.isColor ) ? color : new Color();
+		this.vertexColors = Array.isArray( color ) ? color : [];
+
+		this.materialIndex = materialIndex;
+
+	}
+
+	clone() {
+
+		return new this.constructor().copy( this );
+
+	}
+
+	copy( source ) {
+
+		this.a = source.a;
+		this.b = source.b;
+		this.c = source.c;
+
+		this.normal.copy( source.normal );
+		this.color.copy( source.color );
+
+		this.materialIndex = source.materialIndex;
+
+		for ( let i = 0, il = source.vertexNormals.length; i < il; i ++ ) {
+
+			this.vertexNormals[ i ] = source.vertexNormals[ i ].clone();
+
+		}
+
+		for ( let i = 0, il = source.vertexColors.length; i < il; i ++ ) {
+
+			this.vertexColors[ i ] = source.vertexColors[ i ].clone();
+
+		}
+
+		return this;
+
+	}
+
+}
+
 export { Geometry };

+ 0 - 8
src/Three.Legacy.js

@@ -24,7 +24,6 @@ import {
 import { BufferGeometry } from './core/BufferGeometry.js';
 import { InstancedBufferGeometry } from './core/InstancedBufferGeometry.js';
 import { InterleavedBuffer } from './core/InterleavedBuffer.js';
-import { Face3 } from './core/Face3.js';
 import { Object3D } from './core/Object3D.js';
 import { Uniform } from './core/Uniform.js';
 import { Raycaster } from './core/Raycaster.js';
@@ -87,13 +86,6 @@ import { Scene } from './scenes/Scene.js';
 
 export { MathUtils as Math };
 
-export function Face4( a, b, c, d, normal, color, materialIndex ) {
-
-	console.warn( 'THREE.Face4 has been removed. A THREE.Face3 will be created instead.' );
-	return new Face3( a, b, c, normal, color, materialIndex );
-
-}
-
 export const LineStrip = 0;
 export const LinePieces = 1;
 export const NoColors = 0;

+ 0 - 1
src/Three.d.ts

@@ -98,7 +98,6 @@ export * from './core/InstancedInterleavedBuffer';
 export * from './core/InterleavedBuffer';
 export * from './core/InstancedBufferAttribute';
 export * from './core/BufferAttribute';
-export * from './core/Face3';
 export * from './core/Object3D';
 export * from './core/Raycaster';
 export * from './core/Layers';

+ 0 - 1
src/Three.js

@@ -95,7 +95,6 @@ export { InterleavedBuffer } from './core/InterleavedBuffer.js';
 export { InstancedBufferAttribute } from './core/InstancedBufferAttribute.js';
 export { GLBufferAttribute } from './core/GLBufferAttribute.js';
 export * from './core/BufferAttribute.js';
-export { Face3 } from './core/Face3.js';
 export { Object3D } from './core/Object3D.js';
 export { Raycaster } from './core/Raycaster.js';
 export { Layers } from './core/Layers.js';

+ 0 - 100
src/core/Face3.d.ts

@@ -1,100 +0,0 @@
-import { Vector3 } from './../math/Vector3';
-import { Color } from './../math/Color';
-
-/**
- * Triangle face.
- *
- * @source https://github.com/mrdoob/three.js/blob/master/src/core/Face3.js
- */
-export class Face3 {
-
-	/**
-	 * @param a Vertex A index.
-	 * @param b Vertex B index.
-	 * @param c Vertex C index.
-	 * @param normal Face normal or array of vertex normals.
-	 * @param color Face color or array of vertex colors.
-	 * @param materialIndex Material index.
-	 */
-	constructor(
-		a: number,
-		b: number,
-		c: number,
-		normal?: Vector3,
-		color?: Color,
-		materialIndex?: number
-	);
-	constructor(
-		a: number,
-		b: number,
-		c: number,
-		normal?: Vector3,
-		vertexColors?: Color[],
-		materialIndex?: number
-	);
-	constructor(
-		a: number,
-		b: number,
-		c: number,
-		vertexNormals?: Vector3[],
-		color?: Color,
-		materialIndex?: number
-	);
-	constructor(
-		a: number,
-		b: number,
-		c: number,
-		vertexNormals?: Vector3[],
-		vertexColors?: Color[],
-		materialIndex?: number
-	);
-
-	/**
-	 * Vertex A index.
-	 */
-	a: number;
-
-	/**
-	 * Vertex B index.
-	 */
-	b: number;
-
-	/**
-	 * Vertex C index.
-	 */
-	c: number;
-
-	/**
-	 * Face normal.
-	 * @default new THREE.Vector3()
-	 */
-	normal: Vector3;
-
-	/**
-	 * Array of 3 vertex normals.
-	 * @default []
-	 */
-	vertexNormals: Vector3[];
-
-	/**
-	 * Face color.
-	 * @default new THREE.Color()
-	 */
-	color: Color;
-
-	/**
-	 * Array of 3 vertex colors.
-	 * @default []
-	 */
-	vertexColors: Color[];
-
-	/**
-	 * Material index (points to {@link Mesh.material}).
-	 * @default 0
-	 */
-	materialIndex: number;
-
-	clone(): Face3;
-	copy( source: Face3 ): this;
-
-}

+ 0 - 58
src/core/Face3.js

@@ -1,58 +0,0 @@
-import { Color } from '../math/Color.js';
-import { Vector3 } from '../math/Vector3.js';
-
-class Face3 {
-
-	constructor( a, b, c, normal, color, materialIndex = 0 ) {
-
-		this.a = a;
-		this.b = b;
-		this.c = c;
-
-		this.normal = ( normal && normal.isVector3 ) ? normal : new Vector3();
-		this.vertexNormals = Array.isArray( normal ) ? normal : [];
-
-		this.color = ( color && color.isColor ) ? color : new Color();
-		this.vertexColors = Array.isArray( color ) ? color : [];
-
-		this.materialIndex = materialIndex;
-
-	}
-
-	clone() {
-
-		return new this.constructor().copy( this );
-
-	}
-
-	copy( source ) {
-
-		this.a = source.a;
-		this.b = source.b;
-		this.c = source.c;
-
-		this.normal.copy( source.normal );
-		this.color.copy( source.color );
-
-		this.materialIndex = source.materialIndex;
-
-		for ( let i = 0, il = source.vertexNormals.length; i < il; i ++ ) {
-
-			this.vertexNormals[ i ] = source.vertexNormals[ i ].clone();
-
-		}
-
-		for ( let i = 0, il = source.vertexColors.length; i < il; i ++ ) {
-
-			this.vertexColors[ i ] = source.vertexColors[ i ].clone();
-
-		}
-
-		return this;
-
-	}
-
-}
-
-
-export { Face3 };

+ 0 - 86
test/unit/src/core/Face3.tests.js

@@ -1,86 +0,0 @@
-/* global QUnit */
-
-import { Face3 } from '../../../../src/core/Face3';
-import { Color } from '../../../../src/math/Color';
-import { Vector3 } from '../../../../src/math/Vector3';
-
-export default QUnit.module( 'Core', () => {
-
-	QUnit.module( 'Face3', () => {
-
-		// INSTANCING
-		QUnit.todo( "Instancing", ( assert ) => {
-
-			assert.ok( false, "everything's gonna be alright" );
-
-		} );
-
-		// PUBLIC STUFF
-		QUnit.test( "copy", ( assert ) => {
-
-			var instance = new Face3( 0, 1, 2, new Vector3( 0, 1, 0 ), new Color( 0.25, 0.5, 0.75 ), 2 );
-			var copiedInstance = new Face3().copy( instance );
-
-			checkCopy( copiedInstance, assert );
-			checkVertexAndColors( copiedInstance, assert );
-
-		} );
-
-		QUnit.test( "copy (more)", ( assert ) => {
-
-			var instance = new Face3( 0, 1, 2,
-				[ new Vector3( 0, 1, 0 ), new Vector3( 1, 0, 1 ) ],
-				[ new Color( 0.25, 0.5, 0.75 ), new Color( 1, 0, 0.4 ) ],
-				2 );
-			var copiedInstance = new Face3().copy( instance );
-
-			checkCopy( copiedInstance, assert );
-			checkVertexAndColorArrays( copiedInstance, assert );
-
-		} );
-
-		QUnit.test( "clone", ( assert ) => {
-
-			var instance = new Face3( 0, 1, 2, new Vector3( 0, 1, 0 ), new Color( 0.25, 0.5, 0.75 ), 2 );
-			var copiedInstance = instance.clone();
-
-			checkCopy( copiedInstance, assert );
-			checkVertexAndColors( copiedInstance, assert );
-
-		} );
-
-		function checkCopy( copiedInstance, assert ) {
-
-			assert.ok( copiedInstance instanceof Face3, "copy created the correct type" );
-			assert.ok(
-				copiedInstance.a === 0 &&
-				copiedInstance.b === 1 &&
-				copiedInstance.c === 2 &&
-				copiedInstance.materialIndex === 2
-				, "properties where copied" );
-
-		}
-
-		function checkVertexAndColors( copiedInstance, assert ) {
-
-			assert.ok(
-				copiedInstance.normal.x === 0 && copiedInstance.normal.y === 1 && copiedInstance.normal.z === 0 &&
-				copiedInstance.color.r === 0.25 && copiedInstance.color.g === 0.5 && copiedInstance.color.b === 0.75
-				, "properties where copied" );
-
-		}
-
-		function checkVertexAndColorArrays( copiedInstance, assert ) {
-
-			assert.ok(
-				copiedInstance.vertexNormals[ 0 ].x === 0 && copiedInstance.vertexNormals[ 0 ].y === 1 && copiedInstance.vertexNormals[ 0 ].z === 0 &&
-				copiedInstance.vertexNormals[ 1 ].x === 1 && copiedInstance.vertexNormals[ 1 ].y === 0 && copiedInstance.vertexNormals[ 1 ].z === 1 &&
-				copiedInstance.vertexColors[ 0 ].r === 0.25 && copiedInstance.vertexColors[ 0 ].g === 0.5 && copiedInstance.vertexColors[ 0 ].b === 0.75 &&
-				copiedInstance.vertexColors[ 1 ].r === 1 && copiedInstance.vertexColors[ 1 ].g === 0 && copiedInstance.vertexColors[ 1 ].b === 0.4
-				, "properties where copied" );
-
-		}
-
-	} );
-
-} );

+ 0 - 1
test/unit/three.source.unit.js

@@ -48,7 +48,6 @@ import './src/core/BufferAttribute.tests';
 import './src/core/BufferGeometry.tests';
 import './src/core/Clock.tests';
 import './src/core/EventDispatcher.tests';
-import './src/core/Face3.tests';
 import './src/core/InstancedBufferAttribute.tests';
 import './src/core/InstancedBufferGeometry.tests';
 import './src/core/InstancedInterleavedBuffer.tests';