MeshBasicMaterial.js 2.6 KB

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