MeshLambertMaterial.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. * 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. * morphNormals: <bool>,
  35. *
  36. * fog: <bool>
  37. * }
  38. */
  39. THREE.MeshLambertMaterial = function ( parameters ) {
  40. THREE.Material.call( this );
  41. this.color = new THREE.Color( 0xffffff ); // diffuse
  42. this.ambient = new THREE.Color( 0xffffff );
  43. this.emissive = new THREE.Color( 0x000000 );
  44. this.wrapAround = false;
  45. this.wrapRGB = new THREE.Vector3( 1, 1, 1 );
  46. this.map = null;
  47. this.lightMap = null;
  48. this.specularMap = null;
  49. this.envMap = null;
  50. this.combine = THREE.MultiplyOperation;
  51. this.reflectivity = 1;
  52. this.refractionRatio = 0.98;
  53. this.fog = true;
  54. this.shading = THREE.SmoothShading;
  55. this.wireframe = false;
  56. this.wireframeLinewidth = 1;
  57. this.wireframeLinecap = 'round';
  58. this.wireframeLinejoin = 'round';
  59. this.vertexColors = THREE.NoColors;
  60. this.skinning = false;
  61. this.morphTargets = false;
  62. this.morphNormals = false;
  63. this.setValues( parameters );
  64. };
  65. THREE.MeshLambertMaterial.prototype = Object.create( THREE.Material.prototype );
  66. THREE.MeshLambertMaterial.prototype.clone = function () {
  67. var material = new THREE.MeshLambertMaterial();
  68. THREE.Material.prototype.clone.call( this, material );
  69. material.color.copy( this.color );
  70. material.ambient.copy( this.ambient );
  71. material.emissive.copy( this.emissive );
  72. material.wrapAround = this.wrapAround;
  73. material.wrapRGB.copy( this.wrapRGB );
  74. material.map = this.map;
  75. material.lightMap = this.lightMap;
  76. material.specularMap = this.specularMap;
  77. material.envMap = this.envMap;
  78. material.combine = this.combine;
  79. material.reflectivity = this.reflectivity;
  80. material.refractionRatio = this.refractionRatio;
  81. material.fog = this.fog;
  82. material.shading = this.shading;
  83. material.wireframe = this.wireframe;
  84. material.wireframeLinewidth = this.wireframeLinewidth;
  85. material.wireframeLinecap = this.wireframeLinecap;
  86. material.wireframeLinejoin = this.wireframeLinejoin;
  87. material.vertexColors = this.vertexColors;
  88. material.skinning = this.skinning;
  89. material.morphTargets = this.morphTargets;
  90. material.morphNormals = this.morphNormals;
  91. return material;
  92. };