anaglyphPostProcess.js 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. import { PostProcess } from "./postProcess.js";
  2. import "../Shaders/anaglyph.fragment.js";
  3. import { RegisterClass } from "../Misc/typeStore.js";
  4. /**
  5. * Postprocess used to generate anaglyphic rendering
  6. */
  7. export class AnaglyphPostProcess extends PostProcess {
  8. /**
  9. * Gets a string identifying the name of the class
  10. * @returns "AnaglyphPostProcess" string
  11. */
  12. getClassName() {
  13. return "AnaglyphPostProcess";
  14. }
  15. /**
  16. * Creates a new AnaglyphPostProcess
  17. * @param name defines postprocess name
  18. * @param options defines creation options or target ratio scale
  19. * @param rigCameras defines cameras using this postprocess
  20. * @param samplingMode defines required sampling mode (BABYLON.Texture.NEAREST_SAMPLINGMODE by default)
  21. * @param engine defines hosting engine
  22. * @param reusable defines if the postprocess will be reused multiple times per frame
  23. */
  24. constructor(name, options, rigCameras, samplingMode, engine, reusable) {
  25. super(name, "anaglyph", null, ["leftSampler"], options, rigCameras[1], samplingMode, engine, reusable);
  26. this._passedProcess = rigCameras[0]._rigPostProcess;
  27. this.onApplyObservable.add((effect) => {
  28. effect.setTextureFromPostProcess("leftSampler", this._passedProcess);
  29. });
  30. }
  31. }
  32. RegisterClass("BABYLON.AnaglyphPostProcess", AnaglyphPostProcess);
  33. //# sourceMappingURL=anaglyphPostProcess.js.map