passes.ts 1.1 KB

123456789101112131415161718192021222324252627282930
  1. /**
  2. * Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. import { DrawPass } from './draw';
  7. import { PickPass } from './pick';
  8. import { MultiSamplePass } from './multi-sample';
  9. import { WebGLContext } from '../../mol-gl/webgl/context';
  10. export class Passes {
  11. readonly draw: DrawPass;
  12. readonly pick: PickPass;
  13. readonly multiSample: MultiSamplePass;
  14. constructor(private webgl: WebGLContext, attribs: Partial<{ pickScale: number, enableWboit: boolean }> = {}) {
  15. const { gl } = webgl;
  16. this.draw = new DrawPass(webgl, gl.drawingBufferWidth, gl.drawingBufferHeight, attribs.enableWboit || false);
  17. this.pick = new PickPass(webgl, this.draw, attribs.pickScale || 0.25);
  18. this.multiSample = new MultiSamplePass(webgl, this.draw);
  19. }
  20. updateSize() {
  21. const { gl } = this.webgl;
  22. this.draw.setSize(gl.drawingBufferWidth, gl.drawingBufferHeight);
  23. this.pick.syncSize();
  24. this.multiSample.syncSize();
  25. }
  26. }