Skip to content
Snippets Groups Projects
Select Git revision
  • b72ae3e2bb0de77d809cf6e8652abf1500ef9424
  • 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

cvmfs.yaml

Blame
  • texture-mesh.ts 1.88 KiB
    /**
     * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * @author Alexander Rose <alexander.rose@weirdbyte.de>
     */
    
    import { Renderable, RenderableState, createRenderable } from '../renderable';
    import { WebGLContext } from '../webgl/context';
    import { createGraphicsRenderItem } from '../webgl/render-item';
    import { GlobalUniformSchema, BaseSchema, DefineSpec, Values, InternalSchema, InternalValues, UniformSpec, TextureSpec, GlobalTextureSchema, AttributeSpec } from './schema';
    import { MeshShaderCode } from '../shader-code';
    import { ValueCell } from '../../mol-util';
    
    export const TextureMeshSchema = {
        ...BaseSchema,
        aGroup: AttributeSpec('float32', 1, 0),
        uGeoTexDim: UniformSpec('v2'),
        /** texture has vertex positions in XYZ and group id in W */
        tPositionGroup: TextureSpec('texture', 'rgba', 'float', 'nearest'),
        tNormal: TextureSpec('texture', 'rgba', 'float', 'nearest'),
    
        dFlatShaded: DefineSpec('boolean'),
        dDoubleSided: DefineSpec('boolean'),
        dFlipSided: DefineSpec('boolean'),
        dIgnoreLight: DefineSpec('boolean'),
        dXrayShaded: DefineSpec('boolean'),
        dGeoTexture: DefineSpec('boolean'),
    };
    export type TextureMeshSchema = typeof TextureMeshSchema
    export type TextureMeshValues = Values<TextureMeshSchema>
    
    export function TextureMeshRenderable(ctx: WebGLContext, id: number, values: TextureMeshValues, state: RenderableState, materialId: number): Renderable<TextureMeshValues> {
        const schema = { ...GlobalUniformSchema, ...GlobalTextureSchema, ...InternalSchema, ...TextureMeshSchema };
        const internalValues: InternalValues = {
            uObjectId: ValueCell.create(id),
        };
        const shaderCode = MeshShaderCode;
        const renderItem = createGraphicsRenderItem(ctx, 'triangles', shaderCode, schema, { ...values, ...internalValues }, materialId);
    
        return createRenderable(renderItem, values, state);
    }