LineBasicMaterial.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * @author mr.doob / http://mrdoob.com/
  3. * @author alteredq / http://alteredqualia.com/
  4. *
  5. * parameters = {
  6. * color: <hex>,
  7. * opacity: <float>,
  8. * blending: THREE.NormalBlending,
  9. * depth_test: <bool>,
  10. * linewidth: <float>,
  11. * linecap: "round",
  12. * linejoin: "round",
  13. * vertex_colors: <bool>
  14. * }
  15. */
  16. THREE.LineBasicMaterial = function ( parameters ) {
  17. this.id = THREE.LineBasicMaterialCounter.value ++;
  18. this.color = new THREE.Color( 0xffffff );
  19. this.opacity = 1.0;
  20. this.blending = THREE.NormalBlending;
  21. this.depth_test = true;
  22. this.linewidth = 1.0;
  23. this.linecap = 'round'; // implemented just in CanvasRenderer
  24. this.linejoin = 'round'; // implemented just in CanvasRenderer
  25. this.vertex_colors = false;
  26. if ( parameters ) {
  27. if ( parameters.color !== undefined ) this.color.setHex( parameters.color );
  28. if ( parameters.opacity !== undefined ) this.opacity = parameters.opacity;
  29. if ( parameters.blending !== undefined ) this.blending = parameters.blending;
  30. if ( parameters.depth_test !== undefined ) this.depth_test = parameters.depth_test;
  31. if ( parameters.linewidth !== undefined ) this.linewidth = parameters.linewidth;
  32. if ( parameters.linecap !== undefined ) this.linecap = parameters.linecap;
  33. if ( parameters.linejoin !== undefined ) this.linejoin = parameters.linejoin;
  34. if ( parameters.vertex_colors !== undefined ) this.vertex_colors = parameters.vertex_colors;
  35. }
  36. };
  37. THREE.LineBasicMaterial.prototype = {
  38. toString: function () {
  39. return 'THREE.LineBasicMaterial (<br/>' +
  40. 'id: ' + this.id + '<br/>' +
  41. 'color: ' + this.color + '<br/>' +
  42. 'opacity: ' + this.opacity + '<br/>' +
  43. 'blending: ' + this.blending + '<br/>' +
  44. 'depth_test: ' + this.depth_test + '<br/>' +
  45. 'linewidth: ' + this.linewidth +'<br/>' +
  46. 'linecap: ' + this.linecap +'<br/>' +
  47. 'linejoin: ' + this.linejoin +'<br/>' +
  48. 'vertex_colors: ' + this.vertex_colors + '<br/>' +
  49. ')';
  50. }
  51. };
  52. THREE.LineBasicMaterialCounter = { value: 0 };
粤ICP备19079148号