MeshLambertMaterial.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. *
  9. * map: new THREE.Texture( <Image> ),
  10. *
  11. * lightMap: new THREE.Texture( <Image> ),
  12. * lightMapIntensity: <float>
  13. *
  14. * aoMap: new THREE.Texture( <Image> ),
  15. * aoMapIntensity: <float>
  16. *
  17. * emissive: <hex>,
  18. * emissiveIntensity: <float>
  19. * emissiveMap: new THREE.Texture( <Image> ),
  20. *
  21. * specularMap: new THREE.Texture( <Image> ),
  22. *
  23. * alphaMap: new THREE.Texture( <Image> ),
  24. *
  25. * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
  26. * combine: THREE.Multiply,
  27. * reflectivity: <float>,
  28. * refractionRatio: <float>,
  29. *
  30. * wireframe: <boolean>,
  31. * wireframeLinewidth: <float>,
  32. *
  33. * skinning: <bool>,
  34. * morphTargets: <bool>,
  35. * morphNormals: <bool>
  36. * }
  37. */
  38. function MeshLambertMaterial( parameters ) {
  39. Material.call( this );
  40. this.type = 'MeshLambertMaterial';
  41. this.color = new Color( 0xffffff ); // diffuse
  42. this.map = null;
  43. this.lightMap = null;
  44. this.lightMapIntensity = 1.0;
  45. this.aoMap = null;
  46. this.aoMapIntensity = 1.0;
  47. this.emissive = new Color( 0x000000 );
  48. this.emissiveIntensity = 1.0;
  49. this.emissiveMap = null;
  50. this.specularMap = null;
  51. this.alphaMap = null;
  52. this.envMap = null;
  53. this.combine = MultiplyOperation;
  54. this.reflectivity = 1;
  55. this.refractionRatio = 0.98;
  56. this.wireframe = false;
  57. this.wireframeLinewidth = 1;
  58. this.wireframeLinecap = 'round';
  59. this.wireframeLinejoin = 'round';
  60. this.skinning = false;
  61. this.morphTargets = false;
  62. this.morphNormals = false;
  63. this.setValues( parameters );
  64. }
  65. MeshLambertMaterial.prototype = Object.create( Material.prototype );
  66. MeshLambertMaterial.prototype.constructor = MeshLambertMaterial;
  67. MeshLambertMaterial.prototype.isMeshLambertMaterial = true;
  68. MeshLambertMaterial.prototype.copy = function ( source ) {
  69. Material.prototype.copy.call( this, source );
  70. this.color.copy( source.color );
  71. this.map = source.map;
  72. this.lightMap = source.lightMap;
  73. this.lightMapIntensity = source.lightMapIntensity;
  74. this.aoMap = source.aoMap;
  75. this.aoMapIntensity = source.aoMapIntensity;
  76. this.emissive.copy( source.emissive );
  77. this.emissiveMap = source.emissiveMap;
  78. this.emissiveIntensity = source.emissiveIntensity;
  79. this.specularMap = source.specularMap;
  80. this.alphaMap = source.alphaMap;
  81. this.envMap = source.envMap;
  82. this.combine = source.combine;
  83. this.reflectivity = source.reflectivity;
  84. this.refractionRatio = source.refractionRatio;
  85. this.wireframe = source.wireframe;
  86. this.wireframeLinewidth = source.wireframeLinewidth;
  87. this.wireframeLinecap = source.wireframeLinecap;
  88. this.wireframeLinejoin = source.wireframeLinejoin;
  89. this.skinning = source.skinning;
  90. this.morphTargets = source.morphTargets;
  91. this.morphNormals = source.morphNormals;
  92. return this;
  93. };
  94. export { MeshLambertMaterial };
粤ICP备19079148号