babylon.linesMesh.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. var __extends = (this && this.__extends) || function (d, b) {
  2. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3. function __() { this.constructor = d; }
  4. __.prototype = b.prototype;
  5. d.prototype = new __();
  6. };
  7. var BABYLON;
  8. (function (BABYLON) {
  9. var LinesMesh = (function (_super) {
  10. __extends(LinesMesh, _super);
  11. function LinesMesh(name, scene, updatable) {
  12. if (updatable === void 0) { updatable = false; }
  13. _super.call(this, name, scene);
  14. this.color = new BABYLON.Color3(1, 1, 1);
  15. this.alpha = 1;
  16. this._indices = new Array();
  17. this._colorShader = new BABYLON.ShaderMaterial("colorShader", scene, "color", {
  18. attributes: ["position"],
  19. uniforms: ["worldViewProjection", "color"],
  20. needAlphaBlending: true
  21. });
  22. }
  23. Object.defineProperty(LinesMesh.prototype, "material", {
  24. get: function () {
  25. return this._colorShader;
  26. },
  27. enumerable: true,
  28. configurable: true
  29. });
  30. Object.defineProperty(LinesMesh.prototype, "isPickable", {
  31. get: function () {
  32. return false;
  33. },
  34. enumerable: true,
  35. configurable: true
  36. });
  37. Object.defineProperty(LinesMesh.prototype, "checkCollisions", {
  38. get: function () {
  39. return false;
  40. },
  41. enumerable: true,
  42. configurable: true
  43. });
  44. LinesMesh.prototype._bind = function (subMesh, effect, fillMode) {
  45. var engine = this.getScene().getEngine();
  46. var indexToBind = this._geometry.getIndexBuffer();
  47. // VBOs
  48. engine.bindBuffers(this._geometry.getVertexBuffer(BABYLON.VertexBuffer.PositionKind).getBuffer(), indexToBind, [3], 3 * 4, this._colorShader.getEffect());
  49. // Color
  50. this._colorShader.setColor4("color", this.color.toColor4(this.alpha));
  51. };
  52. LinesMesh.prototype._draw = function (subMesh, fillMode, instancesCount) {
  53. if (!this._geometry || !this._geometry.getVertexBuffers() || !this._geometry.getIndexBuffer()) {
  54. return;
  55. }
  56. var engine = this.getScene().getEngine();
  57. // Draw order
  58. engine.draw(false, subMesh.indexStart, subMesh.indexCount);
  59. };
  60. LinesMesh.prototype.intersects = function (ray, fastCheck) {
  61. return null;
  62. };
  63. LinesMesh.prototype.dispose = function (doNotRecurse) {
  64. this._colorShader.dispose();
  65. _super.prototype.dispose.call(this, doNotRecurse);
  66. };
  67. return LinesMesh;
  68. })(BABYLON.Mesh);
  69. BABYLON.LinesMesh = LinesMesh;
  70. })(BABYLON || (BABYLON = {}));
  71. //# sourceMappingURL=babylon.linesMesh.js.map