MeshLambertMaterial.js 2.9 KB

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