MeshBasicMaterial.js 2.5 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. function MeshBasicMaterial( parameters ) {
  36. Material.call( this );
  37. this.type = 'MeshBasicMaterial';
  38. this.color = new Color( 0xffffff ); // emissive
  39. this.map = null;
  40. this.lightMap = null;
  41. this.lightMapIntensity = 1.0;
  42. this.aoMap = null;
  43. this.aoMapIntensity = 1.0;
  44. this.specularMap = null;
  45. this.alphaMap = null;
  46. this.envMap = null;
  47. this.combine = MultiplyOperation;
  48. this.reflectivity = 1;
  49. this.refractionRatio = 0.98;
  50. this.wireframe = false;
  51. this.wireframeLinewidth = 1;
  52. this.wireframeLinecap = 'round';
  53. this.wireframeLinejoin = 'round';
  54. this.skinning = false;
  55. this.morphTargets = false;
  56. this.setValues( parameters );
  57. }
  58. MeshBasicMaterial.prototype = Object.create( Material.prototype );
  59. MeshBasicMaterial.prototype.constructor = MeshBasicMaterial;
  60. MeshBasicMaterial.prototype.isMeshBasicMaterial = true;
  61. MeshBasicMaterial.prototype.copy = function ( source ) {
  62. Material.prototype.copy.call( this, source );
  63. this.color.copy( source.color );
  64. this.map = source.map;
  65. this.lightMap = source.lightMap;
  66. this.lightMapIntensity = source.lightMapIntensity;
  67. this.aoMap = source.aoMap;
  68. this.aoMapIntensity = source.aoMapIntensity;
  69. this.specularMap = source.specularMap;
  70. this.alphaMap = source.alphaMap;
  71. this.envMap = source.envMap;
  72. this.combine = source.combine;
  73. this.reflectivity = source.reflectivity;
  74. this.refractionRatio = source.refractionRatio;
  75. this.wireframe = source.wireframe;
  76. this.wireframeLinewidth = source.wireframeLinewidth;
  77. this.wireframeLinecap = source.wireframeLinecap;
  78. this.wireframeLinejoin = source.wireframeLinejoin;
  79. this.skinning = source.skinning;
  80. this.morphTargets = source.morphTargets;
  81. return this;
  82. };
  83. export { MeshBasicMaterial };