UNPKG

@webviz/subsurface-viewer

Version:

3D visualization component for subsurface reservoir data

60 lines 1.99 kB
import { ScatterplotLayer } from "@deck.gl/layers"; import { GL } from "@luma.gl/constants"; import { precisionForTests } from "../shader_modules/test-precision/precisionForTests"; import vs from "./point.vs.glsl"; export class PrivatePointsLayer extends ScatterplotLayer { 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, modules: [ ...superShaders.modules, pointsUniforms, precisionForTests, ], }); } // eslint-disable-next-line @typescript-eslint/no-explicit-any draw(args) { var _a; let restoreDepthTest = false; if (typeof this.props.depthTest === "boolean" && !this.props.depthTest) { restoreDepthTest = true; this.context.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({ points: { opacity: this.props.opacity, ZIncreasingDownwards: this.props.ZIncreasingDownwards, }, }); super.draw(args.uniforms); if (restoreDepthTest) { this.context.gl.enable(GL.DEPTH_TEST); } } } PrivatePointsLayer.layerName = "PrivatePointsLayer"; const pointsUniformsBlock = /*glsl*/ `\ uniform pointsUniforms { float opacity; bool ZIncreasingDownwards; } points; `; // NOTE: this must exactly the same name than in the uniform block const pointsUniforms = { name: "points", vs: pointsUniformsBlock, fs: undefined, uniformTypes: { opacity: "f32", ZIncreasingDownwards: "u32", }, }; //# sourceMappingURL=privatePointsLayer.js.map