Skip to content
Snippets Groups Projects
Select Git revision
  • a5771ecd997b013a6efc37e2590d51a62faac599
  • master default protected
  • e-infra2
  • ci-megalinter-speedup
  • egi-fixes
  • e-infra
  • envri-hub-new-aai
  • egi-b2drop-no-collapse
  • lfs
  • gpu_staging
  • resurrect-testing-ownloud
  • experiments/collab
  • update_claim_group_keys
  • envri-hub
  • enable_rtc
  • eosc-ui
  • future/jupyterhub-5.x
  • versioning
  • eosc-templating
  • staging1-raw-image
  • token-exchange
21 results

egi-login.html

Blame
  • postprocessing.ts 23.59 KiB
    /**
     * Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * @author Alexander Rose <alexander.rose@weirdbyte.de>
     * @author Áron Samuel Kovács <aron.kovacs@mail.muni.cz>
     */
    
    import { QuadSchema, QuadValues } from '../../mol-gl/compute/util';
    import { TextureSpec, Values, UniformSpec, DefineSpec } from '../../mol-gl/renderable/schema';
    import { ShaderCode } from '../../mol-gl/shader-code';
    import { WebGLContext } from '../../mol-gl/webgl/context';
    import { Texture } from '../../mol-gl/webgl/texture';
    import { ValueCell } from '../../mol-util';
    import { createComputeRenderItem } from '../../mol-gl/webgl/render-item';
    import { createComputeRenderable, ComputeRenderable } from '../../mol-gl/renderable';
    import { Mat4, Vec2, Vec3 } from '../../mol-math/linear-algebra';
    import { ParamDefinition as PD } from '../../mol-util/param-definition';
    import { RenderTarget } from '../../mol-gl/webgl/render-target';
    import { DrawPass } from './draw';
    import { ICamera } from '../../mol-canvas3d/camera';
    import quad_vert from '../../mol-gl/shader/quad.vert';
    import outlines_frag from '../../mol-gl/shader/outlines.frag';
    import ssao_frag from '../../mol-gl/shader/ssao.frag';
    import ssao_blur_frag from '../../mol-gl/shader/ssao-blur.frag';
    import postprocessing_frag from '../../mol-gl/shader/postprocessing.frag';
    import { Framebuffer } from '../../mol-gl/webgl/framebuffer';
    import { Color } from '../../mol-util/color';
    import { FxaaParams, FxaaPass } from './fxaa';
    import { SmaaParams, SmaaPass } from './smaa';
    
    const OutlinesSchema = {
        ...QuadSchema,
        tDepth: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
        uTexSize: UniformSpec('v2'),
    
        dOrthographic: DefineSpec('number'),
        uNear: UniformSpec('f'),
        uFar: UniformSpec('f'),
    
        uMaxPossibleViewZDiff: UniformSpec('f'),
    };
    type OutlinesRenderable = ComputeRenderable<Values<typeof OutlinesSchema>>
    
    function getOutlinesRenderable(ctx: WebGLContext, depthTexture: Texture): OutlinesRenderable {
        const values: Values<typeof OutlinesSchema> = {
            ...QuadValues,
            tDepth: ValueCell.create(depthTexture),
            uTexSize: ValueCell.create(Vec2.create(depthTexture.getWidth(), depthTexture.getHeight())),
    
            dOrthographic: ValueCell.create(0),
            uNear: ValueCell.create(1),
            uFar: ValueCell.create(10000),
    
            uMaxPossibleViewZDiff: ValueCell.create(0.5),
        };
    
        const schema = { ...OutlinesSchema };
        const shaderCode = ShaderCode('outlines', quad_vert, outlines_frag);
        const renderItem = createComputeRenderItem(ctx, 'triangles', shaderCode, schema, values);
    
        return createComputeRenderable(renderItem, values);
    }
    
    const SsaoSchema = {
        ...QuadSchema,
        tDepth: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
    
        uSamples: UniformSpec('v3[]'),
        dNSamples: DefineSpec('number'),