babylon.refractionPostProcess.js 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. var BABYLON = BABYLON || {};
  3. (function () {
  4. BABYLON.RefractionPostProcess = function (name, refractionTextureUrl, color, depth, colorLevel, ratio, camera, samplingMode) {
  5. BABYLON.PostProcess.call(this, name, "refraction", ["baseColor", "depth", "colorLevel"], ["refractionSampler"], ratio, camera, samplingMode);
  6. this.color = color;
  7. this.depth = depth;
  8. this.colorLevel = colorLevel;
  9. this._refRexture = new BABYLON.Texture(refractionTextureUrl, camera.getScene());
  10. var that = this;
  11. this.onApply = function (effect) {
  12. effect.setColor3("baseColor", that.color);
  13. effect.setFloat("depth", that.depth);
  14. effect.setFloat("colorLevel", that.colorLevel);
  15. effect.setTexture("refractionSampler", that._refRexture);
  16. };
  17. };
  18. BABYLON.RefractionPostProcess.prototype = Object.create(BABYLON.PostProcess.prototype);
  19. // Methods
  20. BABYLON.RefractionPostProcess.prototype._onDispose = function () {
  21. this._refRexture.dispose();
  22. };
  23. })();