babylon.depthOfFieldMergePostProcess.ts 1.8 KB

1234567891011121314151617181920212223242526
  1. module BABYLON {
  2. /**
  3. * The DepthOfFieldMergePostProcess merges blurred images with the original based on the values of the circle of confusion.
  4. */
  5. export class DepthOfFieldMergePostProcess extends PostProcess {
  6. /**
  7. * Creates a new instance of @see CircleOfConfusionPostProcess
  8. * @param name The name of the effect.
  9. * @param original The non-blurred image to be modified
  10. * @param circleOfConfusion The circle of confusion post process that will determine how blurred each pixel should become.
  11. * @param options The required width/height ratio to downsize to before computing the render pass.
  12. * @param camera The camera to apply the render pass to.
  13. * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)
  14. * @param engine The engine which the post process will be applied. (default: current engine)
  15. * @param reusable If the post process can be reused on the same frame. (default: false)
  16. * @param textureType Type of textures used when performing the post process. (default: 0)
  17. */
  18. constructor(name: string, original: PostProcess, circleOfConfusion: PostProcess, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT) {
  19. super(name, "depthOfFieldMerge", [], ["circleOfConfusionSampler", "originalSampler"], options, camera, samplingMode, engine, reusable, null, textureType);
  20. this.onApplyObservable.add((effect: Effect) => {
  21. effect.setTextureFromPostProcess("circleOfConfusionSampler", circleOfConfusion);
  22. effect.setTextureFromPostProcess("originalSampler", original);
  23. })
  24. }
  25. }
  26. }