displayPassPostProcess.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { Nullable } from "../types";
  2. import { Camera } from "../Cameras/camera";
  3. import { PostProcess, PostProcessOptions } from "./postProcess";
  4. import { Engine } from "../Engines/engine";
  5. import "../Shaders/displayPass.fragment";
  6. import { _TypeStore } from '../Misc/typeStore';
  7. import { SerializationHelper } from '../Misc/decorators';
  8. declare type Scene = import("../scene").Scene;
  9. /**
  10. * DisplayPassPostProcess which produces an output the same as it's input
  11. */
  12. export class DisplayPassPostProcess extends PostProcess {
  13. /**
  14. * Gets a string identifying the name of the class
  15. * @returns "DisplayPassPostProcess" string
  16. */
  17. public getClassName(): string {
  18. return "DisplayPassPostProcess";
  19. }
  20. /**
  21. * Creates the DisplayPassPostProcess
  22. * @param name The name of the effect.
  23. * @param options The required width/height ratio to downsize to before computing the render pass.
  24. * @param camera The camera to apply the render pass to.
  25. * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)
  26. * @param engine The engine which the post process will be applied. (default: current engine)
  27. * @param reusable If the post process can be reused on the same frame. (default: false)
  28. */
  29. constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean) {
  30. super(name, "displayPass", ["passSampler"], ["passSampler"], options, camera, samplingMode, engine, reusable);
  31. }
  32. /** @hidden */
  33. public static _Parse(parsedPostProcess: any, targetCamera: Camera, scene: Scene, rootUrl: string): Nullable<DisplayPassPostProcess> {
  34. return SerializationHelper.Parse(() => {
  35. return new DisplayPassPostProcess(
  36. parsedPostProcess.name,
  37. parsedPostProcess.options, targetCamera,
  38. parsedPostProcess.renderTargetSamplingMode,
  39. scene.getEngine(), parsedPostProcess.reusable);
  40. }, parsedPostProcess, scene, rootUrl);
  41. }
  42. }
  43. _TypeStore.RegisteredTypes["BABYLON.DisplayPassPostProcess"] = DisplayPassPostProcess;