stereoscopicInterlacePostProcess.js 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { Vector2 } from "../Maths/math.vector.js";
  2. import { PostProcess } from "./postProcess.js";
  3. import "../Shaders/stereoscopicInterlace.fragment.js";
  4. /**
  5. * StereoscopicInterlacePostProcessI used to render stereo views from a rigged camera with support for alternate line interlacing
  6. */
  7. export class StereoscopicInterlacePostProcessI extends PostProcess {
  8. /**
  9. * Gets a string identifying the name of the class
  10. * @returns "StereoscopicInterlacePostProcessI" string
  11. */
  12. getClassName() {
  13. return "StereoscopicInterlacePostProcessI";
  14. }
  15. /**
  16. * Initializes a StereoscopicInterlacePostProcessI
  17. * @param name The name of the effect.
  18. * @param rigCameras The rig cameras to be applied to the post process
  19. * @param isStereoscopicHoriz If the rendered results are horizontal or vertical
  20. * @param isStereoscopicInterlaced If the rendered results are alternate line interlaced
  21. * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)
  22. * @param engine The engine which the post process will be applied. (default: current engine)
  23. * @param reusable If the post process can be reused on the same frame. (default: false)
  24. */
  25. constructor(name, rigCameras, isStereoscopicHoriz, isStereoscopicInterlaced, samplingMode, engine, reusable) {
  26. super(name, "stereoscopicInterlace", ["stepSize"], ["camASampler"], 1, rigCameras[1], samplingMode, engine, reusable, isStereoscopicInterlaced ? "#define IS_STEREOSCOPIC_INTERLACED 1" : isStereoscopicHoriz ? "#define IS_STEREOSCOPIC_HORIZ 1" : undefined);
  27. this._passedProcess = rigCameras[0]._rigPostProcess;
  28. this._stepSize = new Vector2(1 / this.width, 1 / this.height);
  29. this.onSizeChangedObservable.add(() => {
  30. this._stepSize = new Vector2(1 / this.width, 1 / this.height);
  31. });
  32. this.onApplyObservable.add((effect) => {
  33. effect.setTextureFromPostProcess("camASampler", this._passedProcess);
  34. effect.setFloat2("stepSize", this._stepSize.x, this._stepSize.y);
  35. });
  36. }
  37. }
  38. /**
  39. * StereoscopicInterlacePostProcess used to render stereo views from a rigged camera
  40. */
  41. export class StereoscopicInterlacePostProcess extends PostProcess {
  42. /**
  43. * Gets a string identifying the name of the class
  44. * @returns "StereoscopicInterlacePostProcess" string
  45. */
  46. getClassName() {
  47. return "StereoscopicInterlacePostProcess";
  48. }
  49. /**
  50. * Initializes a StereoscopicInterlacePostProcess
  51. * @param name The name of the effect.
  52. * @param rigCameras The rig cameras to be applied to the post process
  53. * @param isStereoscopicHoriz If the rendered results are horizontal or vertical
  54. * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)
  55. * @param engine The engine which the post process will be applied. (default: current engine)
  56. * @param reusable If the post process can be reused on the same frame. (default: false)
  57. */
  58. constructor(name, rigCameras, isStereoscopicHoriz, samplingMode, engine, reusable) {
  59. super(name, "stereoscopicInterlace", ["stepSize"], ["camASampler"], 1, rigCameras[1], samplingMode, engine, reusable, isStereoscopicHoriz ? "#define IS_STEREOSCOPIC_HORIZ 1" : undefined);
  60. this._passedProcess = rigCameras[0]._rigPostProcess;
  61. this._stepSize = new Vector2(1 / this.width, 1 / this.height);
  62. this.onSizeChangedObservable.add(() => {
  63. this._stepSize = new Vector2(1 / this.width, 1 / this.height);
  64. });
  65. this.onApplyObservable.add((effect) => {
  66. effect.setTextureFromPostProcess("camASampler", this._passedProcess);
  67. effect.setFloat2("stepSize", this._stepSize.x, this._stepSize.y);
  68. });
  69. }
  70. }
  71. //# sourceMappingURL=stereoscopicInterlacePostProcess.js.map