babylon.refractionPostProcess.js 1.0 KB

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