MeshBasicMaterial.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. * 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.TextureCube( [posx, negx, posy, negy, posz, negz] ),
  24. * combine: THREE.Multiply,
  25. * reflectivity: <float>,
  26. * refractionRatio: <float>,
  27. *
  28. * shading: THREE.SmoothShading,
  29. * depthTest: <bool>,
  30. * depthWrite: <bool>,
  31. *
  32. * wireframe: <boolean>,
  33. * wireframeLinewidth: <float>,
  34. *
  35. * skinning: <bool>,
  36. * morphTargets: <bool>
  37. * }
  38. */
  39. function MeshBasicMaterial( parameters ) {
  40. Material.call( this );
  41. this.type = 'MeshBasicMaterial';
  42. this.color = new Color( 0xffffff ); // emissive
  43. this.map = null;
  44. this.lightMap = null;
  45. this.lightMapIntensity = 1.0;
  46. this.aoMap = null;
  47. this.aoMapIntensity = 1.0;
  48. this.specularMap = null;
  49. this.alphaMap = null;
  50. this.envMap = null;
  51. this.combine = MultiplyOperation;
  52. this.reflectivity = 1;
  53. this.refractionRatio = 0.98;
  54. this.wireframe = false;
  55. this.wireframeLinewidth = 1;
  56. this.wireframeLinecap = 'round';
  57. this.wireframeLinejoin = 'round';
  58. this.skinning = false;
  59. this.morphTargets = false;
  60. this.lights = false;
  61. this.setValues( parameters );
  62. }
  63. MeshBasicMaterial.prototype = Object.create( Material.prototype );
  64. MeshBasicMaterial.prototype.constructor = MeshBasicMaterial;
  65. MeshBasicMaterial.prototype.isMeshBasicMaterial = true;
  66. MeshBasicMaterial.prototype.copy = function ( source ) {
  67. Material.prototype.copy.call( this, source );
  68. this.color.copy( source.color );
  69. this.map = source.map;
  70. this.lightMap = source.lightMap;
  71. this.lightMapIntensity = source.lightMapIntensity;
  72. this.aoMap = source.aoMap;
  73. this.aoMapIntensity = source.aoMapIntensity;
  74. this.specularMap = source.specularMap;
  75. this.alphaMap = source.alphaMap;
  76. this.envMap = source.envMap;
  77. this.combine = source.combine;
  78. this.reflectivity = source.reflectivity;
  79. this.refractionRatio = source.refractionRatio;
  80. this.wireframe = source.wireframe;
  81. this.wireframeLinewidth = source.wireframeLinewidth;
  82. this.wireframeLinecap = source.wireframeLinecap;
  83. this.wireframeLinejoin = source.wireframeLinejoin;
  84. this.skinning = source.skinning;
  85. this.morphTargets = source.morphTargets;
  86. return this;
  87. };
  88. export { MeshBasicMaterial };
粤ICP备19079148号