MeshBasicMaterial.js 2.6 KB

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