MeshBasicMaterial.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. * lightMap: new THREE.Texture( <Image> ),
  11. *
  12. * specularMap: new THREE.Texture( <Image> ),
  13. *
  14. * envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
  15. * combine: THREE.Multiply,
  16. * reflectivity: <float>,
  17. * refractionRatio: <float>,
  18. *
  19. * shading: THREE.SmoothShading,
  20. * blending: THREE.NormalBlending,
  21. * depthTest: <bool>,
  22. *
  23. * wireframe: <boolean>,
  24. * wireframeLinewidth: <float>,
  25. *
  26. * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,
  27. *
  28. * skinning: <bool>,
  29. * morphTargets: <bool>,
  30. *
  31. * fog: <bool>
  32. * }
  33. */
  34. THREE.MeshBasicMaterial = function ( parameters ) {
  35. THREE.Material.call( this );
  36. this.color = new THREE.Color( 0xffffff ); // emissive
  37. this.map = null;
  38. this.lightMap = null;
  39. this.specularMap = null;
  40. this.envMap = null;
  41. this.combine = THREE.MultiplyOperation;
  42. this.reflectivity = 1;
  43. this.refractionRatio = 0.98;
  44. this.fog = true;
  45. this.shading = THREE.SmoothShading;
  46. this.wireframe = false;
  47. this.wireframeLinewidth = 1;
  48. this.wireframeLinecap = 'round';
  49. this.wireframeLinejoin = 'round';
  50. this.vertexColors = THREE.NoColors;
  51. this.skinning = false;
  52. this.morphTargets = false;
  53. this.setValues( parameters );
  54. };
  55. THREE.MeshBasicMaterial.prototype = Object.create( THREE.Material.prototype );
  56. THREE.MeshBasicMaterial.prototype.clone = function () {
  57. var material = new THREE.MeshBasicMaterial();
  58. THREE.Material.prototype.clone.call( this, material );
  59. material.color.copy( this.color );
  60. material.map = this.map;
  61. material.lightMap = this.lightMap;
  62. material.specularMap = this.specularMap;
  63. material.envMap = this.envMap;
  64. material.combine = this.combine;
  65. material.reflectivity = this.reflectivity;
  66. material.refractionRatio = this.refractionRatio;
  67. material.fog = this.fog;
  68. material.shading = this.shading;
  69. material.wireframe = this.wireframe;
  70. material.wireframeLinewidth = this.wireframeLinewidth;
  71. material.wireframeLinecap = this.wireframeLinecap;
  72. material.wireframeLinejoin = this.wireframeLinejoin;
  73. material.vertexColors = this.vertexColors;
  74. material.skinning = this.skinning;
  75. material.morphTargets = this.morphTargets;
  76. return material;
  77. };