1 | /**
|
---|
2 | * @author mrdoob / http://mrdoob.com/
|
---|
3 | * @author alteredq / http://alteredqualia.com/
|
---|
4 | */
|
---|
5 |
|
---|
6 | THREE.Face3 = function ( a, b, c, normal, color, materialIndex ) {
|
---|
7 |
|
---|
8 | this.a = a;
|
---|
9 | this.b = b;
|
---|
10 | this.c = c;
|
---|
11 |
|
---|
12 | this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3();
|
---|
13 | this.vertexNormals = normal instanceof Array ? normal : [ ];
|
---|
14 |
|
---|
15 | this.color = color instanceof THREE.Color ? color : new THREE.Color();
|
---|
16 | this.vertexColors = color instanceof Array ? color : [];
|
---|
17 |
|
---|
18 | this.vertexTangents = [];
|
---|
19 |
|
---|
20 | this.materialIndex = materialIndex !== undefined ? materialIndex : 0;
|
---|
21 |
|
---|
22 | this.centroid = new THREE.Vector3();
|
---|
23 |
|
---|
24 | };
|
---|
25 |
|
---|
26 | THREE.Face3.prototype = {
|
---|
27 |
|
---|
28 | constructor: THREE.Face3,
|
---|
29 |
|
---|
30 | clone: function () {
|
---|
31 |
|
---|
32 | var face = new THREE.Face3( this.a, this.b, this.c );
|
---|
33 |
|
---|
34 | face.normal.copy( this.normal );
|
---|
35 | face.color.copy( this.color );
|
---|
36 | face.centroid.copy( this.centroid );
|
---|
37 |
|
---|
38 | face.materialIndex = this.materialIndex;
|
---|
39 |
|
---|
40 | var i, il;
|
---|
41 | for ( i = 0, il = this.vertexNormals.length; i < il; i ++ ) face.vertexNormals[ i ] = this.vertexNormals[ i ].clone();
|
---|
42 | for ( i = 0, il = this.vertexColors.length; i < il; i ++ ) face.vertexColors[ i ] = this.vertexColors[ i ].clone();
|
---|
43 | for ( i = 0, il = this.vertexTangents.length; i < il; i ++ ) face.vertexTangents[ i ] = this.vertexTangents[ i ].clone();
|
---|
44 |
|
---|
45 | return face;
|
---|
46 |
|
---|
47 | }
|
---|
48 |
|
---|
49 | };
|
---|