MeshLambertMaterial.js 2.7 KB

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