babylon.postProcessRenderPass.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "use strict";
  2. var BABYLON = BABYLON || {};
  3. (function () {
  4. BABYLON.PostProcessRenderPass = function PostProcessRenderPass(scene, name, size, renderList, beforeRender, afterRender) {
  5. this._name = name;
  6. this._enabled = true;
  7. this._renderList = renderList;
  8. this._renderTexture = new BABYLON.RenderTargetTexture(name, size, scene);
  9. this.setRenderList(renderList);
  10. this._renderTexture.onBeforeRender = beforeRender;
  11. this._renderTexture.onAfterRender = afterRender;
  12. this._scene = scene;
  13. this._refCount = 0;
  14. };
  15. BABYLON.PostProcessRenderPass.prototype.incRefCount = function () {
  16. if (this._refCount == 0) {
  17. this._scene.customRenderTargets.push(this._renderTexture);
  18. }
  19. this._refCount++;
  20. };
  21. BABYLON.PostProcessRenderPass.prototype.decRefCount = function () {
  22. this._refCount--;
  23. if (this._refCount <= 0) {
  24. this._scene.customRenderTargets.splice(this._scene.customRenderTargets.indexOf(this._renderTexture), 1);
  25. }
  26. };
  27. BABYLON.PostProcessRenderPass.prototype.setRenderList = function (renderList) {
  28. this._renderTexture.renderList = renderList;
  29. };
  30. BABYLON.PostProcessRenderPass.prototype.getRenderTexture = function () {
  31. return this._renderTexture;
  32. };
  33. BABYLON.PostProcessRenderPass.prototype._update = function () {
  34. this.setRenderList(this._renderList);
  35. };
  36. })();