babylon.linesMesh.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. var __extends = 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 (typeof updatable === "undefined") { updatable = false; }
  13. _super.call(this, name, scene);
  14. this.color = new BABYLON.Color3(1, 1, 1);
  15. this._indices = new Array();
  16. this._colorShader = new BABYLON.ShaderMaterial("colorShader", scene, "color", {
  17. attributes: ["position"],
  18. uniforms: ["worldViewProjection", "color"]
  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, wireframe) {
  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.setColor3("color", this.color);
  49. };
  50. LinesMesh.prototype._draw = function (subMesh, useTriangles, 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. return LinesMesh;
  66. })(BABYLON.Mesh);
  67. BABYLON.LinesMesh = LinesMesh;
  68. })(BABYLON || (BABYLON = {}));
  69. //# sourceMappingURL=babylon.linesMesh.js.map