MeshFaceMaterial.js 974 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. THREE.MeshFaceMaterial = function ( materials ) {
  5. this.uuid = THREE.Math.generateUUID();
  6. this.type = 'MeshFaceMaterial';
  7. this.materials = materials instanceof Array ? materials : [];
  8. this.visible = true;
  9. };
  10. THREE.MeshFaceMaterial.prototype = {
  11. constructor: THREE.MeshFaceMaterial,
  12. toJSON: function () {
  13. var output = {
  14. metadata: {
  15. version: 4.2,
  16. type: 'material',
  17. generator: 'MaterialExporter'
  18. },
  19. uuid: this.uuid,
  20. type: this.type,
  21. materials: []
  22. };
  23. for ( var i = 0, l = this.materials.length; i < l; i ++ ) {
  24. output.materials.push( this.materials[ i ].toJSON() );
  25. }
  26. output.visible = this.visible;
  27. return output;
  28. },
  29. clone: function () {
  30. var material = new this.constructor();
  31. for ( var i = 0; i < this.materials.length; i ++ ) {
  32. material.materials.push( this.materials[ i ].clone() );
  33. }
  34. material.visible = this.visible;
  35. return material;
  36. }
  37. };
粤ICP备19079148号