babylon.brickProceduralTexture.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /// <reference path="../../../dist/preview release/babylon.d.ts"/>
  2. var BABYLON;
  3. (function (BABYLON) {
  4. var BrickProceduralTexture = (function (_super) {
  5. __extends(BrickProceduralTexture, _super);
  6. function BrickProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
  7. _super.call(this, name, size, "bricktexture", scene, fallbackTexture, generateMipMaps);
  8. this._numberOfBricksHeight = 15;
  9. this._numberOfBricksWidth = 5;
  10. this._jointColor = new BABYLON.Color3(0.72, 0.72, 0.72);
  11. this._brickColor = new BABYLON.Color3(0.77, 0.47, 0.40);
  12. this.updateShaderUniforms();
  13. this.refreshRate = 0;
  14. }
  15. BrickProceduralTexture.prototype.updateShaderUniforms = function () {
  16. this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
  17. this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
  18. this.setColor3("brickColor", this._brickColor);
  19. this.setColor3("jointColor", this._jointColor);
  20. };
  21. Object.defineProperty(BrickProceduralTexture.prototype, "numberOfBricksHeight", {
  22. get: function () {
  23. return this._numberOfBricksHeight;
  24. },
  25. set: function (value) {
  26. this._numberOfBricksHeight = value;
  27. this.updateShaderUniforms();
  28. },
  29. enumerable: true,
  30. configurable: true
  31. });
  32. Object.defineProperty(BrickProceduralTexture.prototype, "numberOfBricksWidth", {
  33. get: function () {
  34. return this._numberOfBricksWidth;
  35. },
  36. set: function (value) {
  37. this._numberOfBricksWidth = value;
  38. this.updateShaderUniforms();
  39. },
  40. enumerable: true,
  41. configurable: true
  42. });
  43. Object.defineProperty(BrickProceduralTexture.prototype, "jointColor", {
  44. get: function () {
  45. return this._jointColor;
  46. },
  47. set: function (value) {
  48. this._jointColor = value;
  49. this.updateShaderUniforms();
  50. },
  51. enumerable: true,
  52. configurable: true
  53. });
  54. Object.defineProperty(BrickProceduralTexture.prototype, "brickColor", {
  55. get: function () {
  56. return this._brickColor;
  57. },
  58. set: function (value) {
  59. this._brickColor = value;
  60. this.updateShaderUniforms();
  61. },
  62. enumerable: true,
  63. configurable: true
  64. });
  65. return BrickProceduralTexture;
  66. })(BABYLON.ProceduralTexture);
  67. BABYLON.BrickProceduralTexture = BrickProceduralTexture;
  68. })(BABYLON || (BABYLON = {}));