babylon.stereoscopicInterlacePostProcess.ts 1.1 KB

123456789101112131415161718192021
  1. module BABYLON {
  2. export class StereoscopicInterlacePostProcess extends PostProcess {
  3. private _stepSize : Vector2;
  4. private _passedProcess : Nullable<PostProcess>;
  5. constructor(name: string, rigCameras: Camera[], isStereoscopicHoriz: boolean, samplingMode?: number, engine?: Engine, reusable?: boolean) {
  6. super(name, "stereoscopicInterlace", ['stepSize'], ['camASampler'], 1, rigCameras[1], samplingMode, engine, reusable, isStereoscopicHoriz ? "#define IS_STEREOSCOPIC_HORIZ 1" : undefined);
  7. this._passedProcess = rigCameras[0]._rigPostProcess;
  8. this._stepSize = new Vector2(1 / this.width, 1 / this.height);
  9. this.onSizeChangedObservable.add(() => {
  10. this._stepSize = new Vector2(1 / this.width, 1 / this.height);
  11. });
  12. this.onApplyObservable.add((effect: Effect) => {
  13. effect.setTextureFromPostProcess("camASampler", this._passedProcess);
  14. effect.setFloat2("stepSize", this._stepSize.x, this._stepSize.y);
  15. });
  16. }
  17. }
  18. }