MeshLambertMaterial.js 2.9 KB

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