MeshBasicMaterial.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * @author mr.doob / http://mrdoob.com/
  3. * @author alteredq / http://alteredqualia.com/
  4. *
  5. * parameters = {
  6. * color: <hex>,
  7. * map: new THREE.Texture( <Image> ),
  8. * env_map: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
  9. * combine: THREE.Multiply,
  10. * reflectivity: <float>,
  11. * refraction_ratio: <float>,
  12. * opacity: <float>,
  13. * shading: THREE.SmoothShading,
  14. * blending: THREE.NormalBlending,
  15. * wireframe: <boolean>,
  16. * wireframe_linewidth: <float>
  17. * }
  18. */
  19. THREE.MeshBasicMaterial = function ( parameters ) {
  20. this.id = THREE.MeshBasicMaterialCounter.value ++;
  21. this.color = new THREE.Color( 0xeeeeee );
  22. this.map = null;
  23. this.env_map = null;
  24. this.combine = THREE.MultiplyOperation;
  25. this.reflectivity = 1;
  26. this.refraction_ratio = 0.98;
  27. this.opacity = 1;
  28. this.shading = THREE.SmoothShading;
  29. this.blending = THREE.NormalBlending;
  30. this.wireframe = false;
  31. this.wireframe_linewidth = 1;
  32. this.wireframe_linecap = 'round';
  33. this.wireframe_linejoin = 'round';
  34. if ( parameters ) {
  35. if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
  36. if ( parameters.map !== undefined ) this.map = parameters.map;
  37. if ( parameters.env_map !== undefined ) this.env_map = parameters.env_map;
  38. if ( parameters.combine !== undefined ) this.combine = parameters.combine;
  39. if ( parameters.reflectivity !== undefined ) this.reflectivity = parameters.reflectivity;
  40. if ( parameters.refraction_ratio !== undefined ) this.refraction_ratio = parameters.refraction_ratio;
  41. if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
  42. if ( parameters.shading !== undefined ) this.shading = parameters.shading;
  43. if ( parameters.blending !== undefined ) this.blending = parameters.blending;
  44. if ( parameters.wireframe !== undefined ) this.wireframe = parameters.wireframe;
  45. if ( parameters.wireframe_linewidth !== undefined ) this.wireframe_linewidth = parameters.wireframe_linewidth;
  46. if ( parameters.wireframe_linecap !== undefined ) this.wireframe_linecap = parameters.wireframe_linecap;
  47. if ( parameters.wireframe_linejoin !== undefined ) this.wireframe_linejoin = parameters.wireframe_linejoin;
  48. }
  49. this.toString = function () {
  50. return 'THREE.MeshBasicMaterial (<br/>' +
  51. 'id: ' + this.id + '<br/>' +
  52. 'color: ' + this.color + '<br/>' +
  53. 'map: ' + this.map + '<br/>' +
  54. 'env_map: ' + this.env_map + '<br/>' +
  55. 'combine: ' + this.combine + '<br/>' +
  56. 'reflectivity: ' + this.reflectivity + '<br/>' +
  57. 'refraction_ratio: ' + this.refraction_ratio + '<br/>' +
  58. 'opacity: ' + this.opacity + '<br/>' +
  59. 'blending: ' + this.blending + '<br/>' +
  60. 'wireframe: ' + this.wireframe + '<br/>' +
  61. 'wireframe_linewidth: ' + this.wireframe_linewidth +'<br/>' +
  62. 'wireframe_linecap: ' + this.wireframe_linecap +'<br/>' +
  63. 'wireframe_linejoin: ' + this.wireframe_linejoin +'<br/>' +
  64. ')';
  65. };
  66. }
  67. THREE.MeshBasicMaterialCounter = { value: 0 };