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