MeshBasicMaterial.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import { Material } from './Material.js';
  2. import { MultiplyOperation } from '../constants.js';
  3. import { Color } from '../math/Color.js';
  4. /**
  5. * parameters = {
  6. * color: <hex>,
  7. * opacity: <float>,
  8. * map: new THREE.Texture( <Image> ),
  9. *
  10. * lightMap: new THREE.Texture( <Image> ),
  11. * lightMapIntensity: <float>
  12. *
  13. * aoMap: new THREE.Texture( <Image> ),
  14. * aoMapIntensity: <float>
  15. *
  16. * specularMap: new THREE.Texture( <Image> ),
  17. *
  18. * alphaMap: new THREE.Texture( <Image> ),
  19. *
  20. * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
  21. * combine: THREE.Multiply,
  22. * reflectivity: <float>,
  23. * refractionRatio: <float>,
  24. *
  25. * depthTest: <bool>,
  26. * depthWrite: <bool>,
  27. *
  28. * wireframe: <boolean>,
  29. * wireframeLinewidth: <float>,
  30. *
  31. * skinning: <bool>,
  32. * morphTargets: <bool>
  33. * }
  34. */
  35. class MeshBasicMaterial extends Material {
  36. constructor( parameters ) {
  37. super();
  38. Object.defineProperty( this, 'isMeshBasicMaterial', { value: true } );
  39. this.type = 'MeshBasicMaterial';
  40. this.color = new Color( 0xffffff ); // emissive
  41. this.map = null;
  42. this.lightMap = null;
  43. this.lightMapIntensity = 1.0;
  44. this.aoMap = null;
  45. this.aoMapIntensity = 1.0;
  46. this.specularMap = null;
  47. this.alphaMap = null;
  48. this.envMap = null;
  49. this.combine = MultiplyOperation;
  50. this.reflectivity = 1;
  51. this.refractionRatio = 0.98;
  52. this.wireframe = false;
  53. this.wireframeLinewidth = 1;
  54. this.wireframeLinecap = 'round';
  55. this.wireframeLinejoin = 'round';
  56. this.skinning = false;
  57. this.morphTargets = false;
  58. this.setValues( parameters );
  59. }
  60. copy( source ) {
  61. super.copy( source );
  62. this.color.copy( source.color );
  63. this.map = source.map;
  64. this.lightMap = source.lightMap;
  65. this.lightMapIntensity = source.lightMapIntensity;
  66. this.aoMap = source.aoMap;
  67. this.aoMapIntensity = source.aoMapIntensity;
  68. this.specularMap = source.specularMap;
  69. this.alphaMap = source.alphaMap;
  70. this.envMap = source.envMap;
  71. this.combine = source.combine;
  72. this.reflectivity = source.reflectivity;
  73. this.refractionRatio = source.refractionRatio;
  74. this.wireframe = source.wireframe;
  75. this.wireframeLinewidth = source.wireframeLinewidth;
  76. this.wireframeLinecap = source.wireframeLinecap;
  77. this.wireframeLinejoin = source.wireframeLinejoin;
  78. this.skinning = source.skinning;
  79. this.morphTargets = source.morphTargets;
  80. return this;
  81. }
  82. }
  83. export { MeshBasicMaterial };
粤ICP备19079148号