babylon.linesMesh.js 3.1 KB

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