Face4.js 1.3 KB
Newer Older
M
Mr.doob 已提交
1 2
/**
 * @author mr.doob / http://mrdoob.com/
3
 * @author alteredq / http://alteredqualia.com/
M
Mr.doob 已提交
4 5
 */

6
THREE.Face4 = function ( a, b, c, d, normal, color, materialIndex ) {
7

8
	this.a = a;
M
Mr.doob 已提交
9 10 11
	this.b = b;
	this.c = c;
	this.d = d;
12

U
unknown 已提交
13
	this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3();
A
alteredq 已提交
14
	this.vertexNormals = normal instanceof Array ? normal : [ ];
15

16 17
	this.color = color instanceof THREE.Color ? color : new THREE.Color();
	this.vertexColors = color instanceof Array ? color : [];
18

19
	this.vertexTangents = [];
M
Mr.doob 已提交
20

21
	this.materialIndex = materialIndex;
22

23
	this.centroid = new THREE.Vector3();
24

M
Mr.doob 已提交
25
};
26 27 28 29 30 31 32

THREE.Face4.prototype = {

	constructor: THREE.Face4,

	clone: function () {

33
		var face = new THREE.Face4( this.a, this.b, this.c, this.d );
34

35 36 37
		face.normal.copy( this.normal );
		face.color.copy( this.color );
		face.centroid.copy( this.centroid );
38

39
		face.materialIndex = this.materialIndex;
40 41

		var i, il;
42 43 44
		for ( i = 0, il = this.vertexNormals.length; i < il; i ++ ) face.vertexNormals[ i ] = this.vertexNormals[ i ].clone();
		for ( i = 0, il = this.vertexColors.length; i < il; i ++ ) face.vertexColors[ i ] = this.vertexColors[ i ].clone();
		for ( i = 0, il = this.vertexTangents.length; i < il; i ++ ) face.vertexTangents[ i ] = this.vertexTangents[ i ].clone();
45

46
		return face;
47 48 49 50

	}

};