passes.ts 1.2 KB

12345678910111213141516171819202122232425262728293031
  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. import { AssetManager } from '../../mol-util/assets';
  11. export class Passes {
  12. readonly draw: DrawPass;
  13. readonly pick: PickPass;
  14. readonly multiSample: MultiSamplePass;
  15. constructor(private webgl: WebGLContext, assetManager: AssetManager, attribs: Partial<{ pickScale: number, enableWboit: boolean }> = {}) {
  16. const { gl } = webgl;
  17. this.draw = new DrawPass(webgl, assetManager, gl.drawingBufferWidth, gl.drawingBufferHeight, attribs.enableWboit || false);
  18. this.pick = new PickPass(webgl, this.draw, attribs.pickScale || 0.25);
  19. this.multiSample = new MultiSamplePass(webgl, this.draw);
  20. }
  21. updateSize() {
  22. const { gl } = this.webgl;
  23. this.draw.setSize(gl.drawingBufferWidth, gl.drawingBufferHeight);
  24. this.pick.syncSize();
  25. this.multiSample.syncSize();
  26. }
  27. }