UNPKG

@webviz/subsurface-viewer

Version:

3D visualization component for subsurface reservoir data

63 lines 2.1 kB
import { PathLayer } from "@deck.gl/layers"; import { precisionForTests } from "../shader_modules/test-precision/precisionForTests"; import fs from "./polyline.fs.glsl"; import vs from "./polyline.vs.glsl"; export class PrivatePolylinesLayer extends PathLayer { constructor(props) { super(props); } getShaders() { const superShaders = super.getShaders(); // use object.assign to make sure we don't overwrite existing fields like `vs`, `modules`... return Object.assign({}, superShaders, { vs: vs, fs: fs, modules: [ ...superShaders.modules, polylinesUniforms, precisionForTests, ], }); } // eslint-disable-next-line @typescript-eslint/no-explicit-any draw(args) { var _a; //conf g = context.device.getDefaultCanvasContext(); const { gl } = this.context; let restoreDepthTest = false; if (typeof this.props.depthTest === "boolean" && !this.props.depthTest) { restoreDepthTest = true; gl.disable(gl.DEPTH_TEST); } // inject the local uniforms into the shader (_a = this.state.model) === null || _a === void 0 ? void 0 : _a.shaderInputs.setProps({ polylines: { opacity: this.props.opacity, ZIncreasingDownwards: this.props.ZIncreasingDownwards, }, }); super.draw(args.uniforms); if (restoreDepthTest) { gl.enable(gl.DEPTH_TEST); } } } PrivatePolylinesLayer.layerName = "PrivatePolylinesLayer"; const polylinesUniformsBlock = /*glsl*/ `\ uniform polylinesUniforms { float opacity; bool ZIncreasingDownwards; } polylines; `; // NOTE: this must exactly the same name than in the uniform block const polylinesUniforms = { name: "polylines", vs: polylinesUniformsBlock, fs: undefined, uniformTypes: { opacity: "f32", ZIncreasingDownwards: "u32", }, }; //# sourceMappingURL=privatePolylinesLayer.js.map