Face4.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * @author mr.doob / http://mrdoob.com/
  3. * @author alteredq / http://alteredqualia.com/
  4. */
  5. THREE.Face4 = function ( a, b, c, d, normal, color, materialIndex ) {
  6. this.a = a;
  7. this.b = b;
  8. this.c = c;
  9. this.d = d;
  10. this.normal = normal instanceof THREE.Vector3 ? normal : new THREE.Vector3();
  11. this.vertexNormals = normal instanceof Array ? normal : [ ];
  12. this.color = color instanceof THREE.Color ? color : new THREE.Color();
  13. this.vertexColors = color instanceof Array ? color : [];
  14. this.vertexTangents = [];
  15. this.materialIndex = materialIndex;
  16. this.centroid = new THREE.Vector3();
  17. };
  18. THREE.Face4.prototype = {
  19. constructor: THREE.Face4,
  20. clone: function () {
  21. var tmp = new THREE.Face4( this.a, this.b, this.c, this.d );
  22. tmp.normal.copy( this.normal );
  23. tmp.color.copy( this.color );
  24. tmp.centroid.copy( this.centroid );
  25. tmp.materialIndex = this.materialIndex;
  26. var i, il;
  27. for ( i = 0, il = this.vertexNormals.length; i < il; i ++ ) tmp.vertexNormals[ i ] = this.vertexNormals[ i ].clone();
  28. for ( i = 0, il = this.vertexColors.length; i < il; i ++ ) tmp.vertexColors[ i ] = this.vertexColors[ i ].clone();
  29. for ( i = 0, il = this.vertexTangents.length; i < il; i ++ ) tmp.vertexTangents[ i ] = this.vertexTangents[ i ].clone();
  30. return tmp;
  31. }
  32. };
粤ICP备19079148号