babylon.refractionPostProcess.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 RefractionPostProcess = (function (_super) {
  10. __extends(RefractionPostProcess, _super);
  11. function RefractionPostProcess(name, refractionTextureUrl, color, depth, colorLevel, ratio, camera, samplingMode, engine, reusable) {
  12. var _this = this;
  13. _super.call(this, name, "refraction", ["baseColor", "depth", "colorLevel"], ["refractionSampler"], ratio, camera, samplingMode, engine, reusable);
  14. this.color = color;
  15. this.depth = depth;
  16. this.colorLevel = colorLevel;
  17. this.onActivate = function (cam) {
  18. _this._refRexture = _this._refRexture || new BABYLON.Texture(refractionTextureUrl, cam.getScene());
  19. };
  20. this.onApply = function (effect) {
  21. effect.setColor3("baseColor", _this.color);
  22. effect.setFloat("depth", _this.depth);
  23. effect.setFloat("colorLevel", _this.colorLevel);
  24. effect.setTexture("refractionSampler", _this._refRexture);
  25. };
  26. }
  27. // Methods
  28. RefractionPostProcess.prototype.dispose = function (camera) {
  29. if (this._refRexture) {
  30. this._refRexture.dispose();
  31. }
  32. _super.prototype.dispose.call(this, camera);
  33. };
  34. return RefractionPostProcess;
  35. })(BABYLON.PostProcess);
  36. BABYLON.RefractionPostProcess = RefractionPostProcess;
  37. })(BABYLON || (BABYLON = {}));
  38. //# sourceMappingURL=babylon.refractionPostProcess.js.map