forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFace3.js
More file actions
65 lines (38 loc) · 1.23 KB
/
Face3.js
File metadata and controls
65 lines (38 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { Color } from '../math/Color';
import { Vector3 } from '../math/Vector3';
/**
* @author mrdoob / http://mrdoob.com/
* @author alteredq / http://alteredqualia.com/
*/
function Face3( a, b, c, normal, color, materialIndex ) {
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 !== undefined ? materialIndex : 0;
}
Face3.prototype = {
constructor: Face3,
clone: function () {
return new this.constructor().copy( this );
},
copy: function ( 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 ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) {
this.vertexNormals[ i ] = source.vertexNormals[ i ].clone();
}
for ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) {
this.vertexColors[ i ] = source.vertexColors[ i ].clone();
}
return this;
}
};
export { Face3 };