@webviz/subsurface-viewer 1.11.8 → 1.11.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ColorLegend.d.ts +3 -3
- package/dist/components/ColorLegend.js.map +1 -1
- package/dist/components/ColorLegends.d.ts +2 -2
- package/dist/components/Map.d.ts +1 -7
- package/dist/components/Map.js.map +1 -1
- package/dist/layers/axes/box.fs.glsl.d.ts +1 -1
- package/dist/layers/axes/box.fs.glsl.js +3 -3
- package/dist/layers/axes/box.vs.glsl.d.ts +1 -1
- package/dist/layers/axes/box.vs.glsl.js +4 -0
- package/dist/layers/axes/box.vs.glsl.js.map +1 -1
- package/dist/layers/axes/boxLayer.d.ts +1 -2
- package/dist/layers/axes/boxLayer.js +4 -8
- package/dist/layers/axes/boxLayer.js.map +1 -1
- package/dist/layers/axes2d/axes2DLayer.js +13 -24
- package/dist/layers/axes2d/axes2DLayer.js.map +1 -1
- package/dist/layers/colormap/colormap.fs.glsl.d.ts +1 -1
- package/dist/layers/colormap/colormap.fs.glsl.js +4 -4
- package/dist/layers/colormap/colormapLayer.d.ts +4 -3
- package/dist/layers/colormap/colormapLayer.js +31 -50
- package/dist/layers/colormap/colormapLayer.js.map +1 -1
- package/dist/layers/drawing/drawingLayer.js.map +1 -1
- package/dist/layers/gpglLayers/typeDefs.d.ts +24 -0
- package/dist/layers/gpglLayers/typeDefs.js +3 -0
- package/dist/layers/gpglLayers/typeDefs.js.map +1 -0
- package/dist/layers/grid3d/cellProperty.fs.glsl.d.ts +1 -1
- package/dist/layers/grid3d/cellProperty.fs.glsl.js +13 -12
- package/dist/layers/grid3d/cellProperty.fs.glsl.js.map +1 -1
- package/dist/layers/grid3d/cellProperty.vs.glsl.d.ts +1 -1
- package/dist/layers/grid3d/cellProperty.vs.glsl.js +3 -2
- package/dist/layers/grid3d/cellProperty.vs.glsl.js.map +1 -1
- package/dist/layers/grid3d/grid3dLayer.d.ts +5 -4
- package/dist/layers/grid3d/grid3dLayer.js +7 -7
- package/dist/layers/grid3d/line.fs.glsl.d.ts +1 -1
- package/dist/layers/grid3d/line.fs.glsl.js +3 -1
- package/dist/layers/grid3d/line.fs.glsl.js.map +1 -1
- package/dist/layers/grid3d/line.vs.glsl.d.ts +1 -1
- package/dist/layers/grid3d/line.vs.glsl.js +4 -0
- package/dist/layers/grid3d/line.vs.glsl.js.map +1 -1
- package/dist/layers/grid3d/nodeProperty.fs.glsl.d.ts +1 -1
- package/dist/layers/grid3d/nodeProperty.fs.glsl.js +5 -4
- package/dist/layers/grid3d/nodeProperty.fs.glsl.js.map +1 -1
- package/dist/layers/grid3d/nodeProperty.vs.glsl.d.ts +1 -1
- package/dist/layers/grid3d/nodeProperty.vs.glsl.js +3 -2
- package/dist/layers/grid3d/nodeProperty.vs.glsl.js.map +1 -1
- package/dist/layers/grid3d/privateGrid3dLayer.d.ts +7 -25
- package/dist/layers/grid3d/privateGrid3dLayer.js +59 -97
- package/dist/layers/grid3d/privateGrid3dLayer.js.map +1 -1
- package/dist/layers/grid3d/typeDefs.d.ts +0 -6
- package/dist/layers/hillshading2d/hillshading2dLayer.js +10 -10
- package/dist/layers/map/line.fs.glsl.d.ts +1 -1
- package/dist/layers/map/line.fs.glsl.js +2 -1
- package/dist/layers/map/line.fs.glsl.js.map +1 -1
- package/dist/layers/map/line.vs.glsl.d.ts +1 -1
- package/dist/layers/map/line.vs.glsl.js +4 -0
- package/dist/layers/map/line.vs.glsl.js.map +1 -1
- package/dist/layers/map/map.fs.glsl.d.ts +1 -1
- package/dist/layers/map/map.fs.glsl.js +9 -11
- package/dist/layers/map/map.fs.glsl.js.map +1 -1
- package/dist/layers/map/map.vs.glsl.d.ts +1 -1
- package/dist/layers/map/map.vs.glsl.js +2 -4
- package/dist/layers/map/map.vs.glsl.js.map +1 -1
- package/dist/layers/map/mapLayer.d.ts +2 -1
- package/dist/layers/map/mapLayer.js +5 -62
- package/dist/layers/map/mapLayer.js.map +1 -1
- package/dist/layers/map/privateMapLayer.d.ts +7 -7
- package/dist/layers/map/privateMapLayer.js +46 -45
- package/dist/layers/map/privateMapLayer.js.map +1 -1
- package/dist/layers/northarrow/northArrow3DLayer.js +4 -8
- package/dist/layers/northarrow/northArrow3DLayer.js.map +1 -1
- package/dist/layers/northarrow/northarrow.fs.glsl.d.ts +1 -1
- package/dist/layers/northarrow/northarrow.fs.glsl.js +1 -1
- package/dist/layers/piechart/pieChartLayer.js +4 -7
- package/dist/layers/piechart/pieChartLayer.js.map +1 -1
- package/dist/layers/piechart/piechart.fs.glsl.d.ts +1 -1
- package/dist/layers/piechart/piechart.fs.glsl.js +1 -1
- package/dist/layers/points/point.vs.glsl.d.ts +1 -1
- package/dist/layers/points/point.vs.glsl.js +2 -2
- package/dist/layers/polylines/polyline.vs.glsl.d.ts +1 -1
- package/dist/layers/polylines/polyline.vs.glsl.js +1 -1
- package/dist/layers/polylines/polylinesLayer.js +1 -1
- package/dist/layers/polylines/polylinesLayer.js.map +1 -1
- package/dist/layers/selectable_geojson/selectableGeoJsonLayer.js.map +1 -1
- package/dist/layers/shader_modules/decoder.fs.glsl.d.ts +1 -1
- package/dist/layers/shader_modules/decoder.fs.glsl.js +4 -4
- package/dist/layers/triangle/line.fs.glsl.d.ts +1 -1
- package/dist/layers/triangle/line.fs.glsl.js +4 -1
- package/dist/layers/triangle/line.fs.glsl.js.map +1 -1
- package/dist/layers/triangle/line.vs.glsl.d.ts +1 -1
- package/dist/layers/triangle/line.vs.glsl.js +4 -1
- package/dist/layers/triangle/line.vs.glsl.js.map +1 -1
- package/dist/layers/triangle/privateTriangleLayer.d.ts +2 -3
- package/dist/layers/triangle/privateTriangleLayer.js +4 -12
- package/dist/layers/triangle/privateTriangleLayer.js.map +1 -1
- package/dist/layers/triangle/triangle.fs.glsl.d.ts +1 -1
- package/dist/layers/triangle/triangle.fs.glsl.js +5 -5
- package/dist/layers/triangle/triangle.vs.glsl.d.ts +1 -1
- package/dist/layers/triangle/triangle.vs.glsl.js +3 -5
- package/dist/layers/triangle/triangle.vs.glsl.js.map +1 -1
- package/dist/layers/triangle/triangleLayer.d.ts +2 -1
- package/dist/layers/triangle/triangleLayer.js.map +1 -1
- package/dist/layers/utils/colormapTools.d.ts +46 -0
- package/dist/layers/utils/colormapTools.js +79 -0
- package/dist/layers/utils/colormapTools.js.map +1 -0
- package/dist/layers/utils/layerTools.d.ts +9 -19
- package/dist/layers/utils/layerTools.js +0 -42
- package/dist/layers/utils/layerTools.js.map +1 -1
- package/dist/layers/well_markers/marker.fs.glsl.d.ts +1 -1
- package/dist/layers/well_markers/marker.fs.glsl.js +2 -2
- package/dist/layers/well_markers/marker.vs.glsl.d.ts +1 -1
- package/dist/layers/well_markers/marker.vs.glsl.js +3 -5
- package/dist/layers/well_markers/marker.vs.glsl.js.map +1 -1
- package/dist/layers/wells/wellsLayer.d.ts +2 -1
- package/dist/layers/wells/wellsLayer.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/serialize.d.ts +23 -0
- package/dist/utils/serialize.js +105 -0
- package/dist/utils/serialize.js.map +1 -0
- package/dist/utils/typedArray.d.ts +44 -0
- package/dist/utils/typedArray.js +42 -0
- package/dist/utils/typedArray.js.map +1 -0
- package/package.json +1 -1
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const _default: "#version 300 es\n#define SHADER_NAME colormap-fragment-shader\n\nprecision highp float;\n\nin vec2 vTexCoord;\n\nout vec4 fragColor;\n\nuniform sampler2D bitmapTexture; // Property map\nuniform sampler2D colormapTexture;\nuniform sampler2D heightMapTexture; // Height map texture, if defined.\n\n// Compute the normal value for every pixel, based on the current value and two values aroud it.\nvec3 normal(float val) {\n vec2 dr = 1.0 / map.bitmapResolution;\n\n if (map.isHeightMapTextureDefined) {\n float valueRangeSize = map.heightValueRangeMax - map.heightValueRangeMin;\n float p0 = valueRangeSize * val;\n float px = valueRangeSize * decode_rgb2float(texture(heightMapTexture, vTexCoord + vec2(1.0, 0.0) / map.bitmapResolution).rgb);\n float py = valueRangeSize * decode_rgb2float(texture(heightMapTexture, vTexCoord + vec2(0.0, 1.0) / map.bitmapResolution).rgb);\n vec3 dx = vec3(1.0, 0.0, px - p0);\n vec3 dy = vec3(0.0, 1.0, py - p0);\n return normalize(cross(dx, dy));\n }\n else {\n float valueRangeSize = map.valueRangeMax - map.valueRangeMin;\n float p0 = valueRangeSize * val;\n float px = valueRangeSize * decode_rgb2float(texture(bitmapTexture, vTexCoord + vec2(1.0, 0.0) / map.bitmapResolution).rgb);\n float py = valueRangeSize * decode_rgb2float(texture(bitmapTexture, vTexCoord + vec2(0.0, 1.0) / map.bitmapResolution).rgb);\n vec3 dx = vec3(1.0, 0.0, px - p0);\n vec3 dy = vec3(0.0, 1.0, py - p0);\n return normalize(cross(dx, dy));\n }\n}\n\n// Compute how much a pixel is in the shadow based on its normal and where the light comes from.\nfloat shadow(vec3 normal) {\n vec3 lightDirection = vec3(1.0, 1.0, 1.0);\n float ambientLightIntensity = 0.5;\n float diffuseLightIntensity = 0.5;\n float diffuse = diffuseLightIntensity * dot(normal, normalize(lightDirection));\n return clamp(ambientLightIntensity + diffuse, 0.0, 1.0);\n}\n\nvoid main(void) {\n vec4 bitmapColor = texture(bitmapTexture, vTexCoord);\n\n // If it's a picking pass, we just return the raw property map value.\n if (picking.isActive > 0.5) {\n fragColor = bitmapColor;\n return;\n }\n\n // Decode the RGB value into a float. See decoder.fs.glsl for more details.\n float val = decode_rgb2float(bitmapColor.rgb); // The resulting val will be in [0, 1] interval.\n float property = val * (map.valueRangeMax - map.valueRangeMin) + map.valueRangeMin;\n\n // Compute the color from the colormap.\n vec4 color = vec4(1.0, 1.0, 1.0, 1.0);\n float x = (property - map.
|
1
|
+
declare const _default: "#version 300 es\n#define SHADER_NAME colormap-fragment-shader\n\nprecision highp float;\n\nin vec2 vTexCoord;\n\nout vec4 fragColor;\n\nuniform sampler2D bitmapTexture; // Property map\nuniform sampler2D colormapTexture;\nuniform sampler2D heightMapTexture; // Height map texture, if defined.\n\n// Compute the normal value for every pixel, based on the current value and two values aroud it.\nvec3 normal(float val) {\n vec2 dr = 1.0 / map.bitmapResolution;\n\n if (map.isHeightMapTextureDefined) {\n float valueRangeSize = map.heightValueRangeMax - map.heightValueRangeMin;\n float p0 = valueRangeSize * val;\n float px = valueRangeSize * decode_rgb2float(texture(heightMapTexture, vTexCoord + vec2(1.0, 0.0) / map.bitmapResolution).rgb);\n float py = valueRangeSize * decode_rgb2float(texture(heightMapTexture, vTexCoord + vec2(0.0, 1.0) / map.bitmapResolution).rgb);\n vec3 dx = vec3(1.0, 0.0, px - p0);\n vec3 dy = vec3(0.0, 1.0, py - p0);\n return normalize(cross(dx, dy));\n }\n else {\n float valueRangeSize = map.valueRangeMax - map.valueRangeMin;\n float p0 = valueRangeSize * val;\n float px = valueRangeSize * decode_rgb2float(texture(bitmapTexture, vTexCoord + vec2(1.0, 0.0) / map.bitmapResolution).rgb);\n float py = valueRangeSize * decode_rgb2float(texture(bitmapTexture, vTexCoord + vec2(0.0, 1.0) / map.bitmapResolution).rgb);\n vec3 dx = vec3(1.0, 0.0, px - p0);\n vec3 dy = vec3(0.0, 1.0, py - p0);\n return normalize(cross(dx, dy));\n }\n}\n\n// Compute how much a pixel is in the shadow based on its normal and where the light comes from.\nfloat shadow(vec3 normal) {\n vec3 lightDirection = vec3(1.0, 1.0, 1.0);\n float ambientLightIntensity = 0.5;\n float diffuseLightIntensity = 0.5;\n float diffuse = diffuseLightIntensity * dot(normal, normalize(lightDirection));\n return clamp(ambientLightIntensity + diffuse, 0.0, 1.0);\n}\n\nvoid main(void) {\n vec4 bitmapColor = texture(bitmapTexture, vTexCoord);\n\n // If it's a picking pass, we just return the raw property map value.\n if (picking.isActive > 0.5) {\n fragColor = bitmapColor;\n return;\n }\n\n // Decode the RGB value into a float. See decoder.fs.glsl for more details.\n float val = decode_rgb2float(bitmapColor.rgb); // The resulting val will be in [0, 1] interval.\n float property = val * (map.valueRangeMax - map.valueRangeMin) + map.valueRangeMin;\n\n // Compute the color from the colormap.\n vec4 color = vec4(1.0, 1.0, 1.0, 1.0);\n float x = (property - map.colormapRangeMin) / (map.colormapRangeMax - map.colormapRangeMin);\n if (x < 0.0 || x > 1.0) {\n // Out of range. Use clampcolor.\n if (map.isClampColor) {\n color = vec4(map.colormapClampColor.rgb, 1.0);\n }\n else if (map.isColormapClampColorTransparent) {\n discard;\n return;\n }\n else {\n // Use min/max color to clamp.\n x = max(0.0, x);\n x = min(1.0, x);\n\n color = texture(colormapTexture, vec2(x, 0.5));\n }\n }\n else {\n color = texture(colormapTexture, vec2(x, 0.5));\n }\n fragColor = vec4(color.rgb, color.a * bitmapColor.a * layer.opacity);\n\n // Hillshading.\n if (map.hillshading) {\n vec4 texture_val = map.isHeightMapTextureDefined ? texture(heightMapTexture, vTexCoord)\n : texture(bitmapTexture, vTexCoord);\n float val = decode_rgb2float(texture_val.rgb);\n\n // Compute the shadow value, how dark a pixel will be, 1 is in complete shadow, 0 is in complete light.\n float shadow = shadow(normal(val));\n fragColor = vec4(fragColor.rgb * shadow, fragColor.a);\n }\n\n // Contour lines.\n if (map.contours) {\n vec4 texture_val = map.isHeightMapTextureDefined ? texture(heightMapTexture, vTexCoord)\n : texture(bitmapTexture, vTexCoord);\n float val = decode_rgb2float(texture_val.rgb);\n float property = val * (map.heightValueRangeMax - map.heightValueRangeMin) + map.heightValueRangeMin;\n\n float x = (property - map.contourReferencePoint) / map.contourInterval; \n float f = fract(x);\n float df = fwidth(x);\n float c = smoothstep(df * 1.0, df * 2.0, f); // smootstep from/to no of pixels distance from contour line. // keep: \n fragColor = fragColor * vec4(c, c, c, layer.opacity);\n }\n\n geometry.uv = vTexCoord;\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n";
|
2
2
|
export default _default;
|
@@ -59,13 +59,13 @@ void main(void) {
|
|
59
59
|
|
60
60
|
// Compute the color from the colormap.
|
61
61
|
vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
|
62
|
-
float x = (property - map.
|
62
|
+
float x = (property - map.colormapRangeMin) / (map.colormapRangeMax - map.colormapRangeMin);
|
63
63
|
if (x < 0.0 || x > 1.0) {
|
64
64
|
// Out of range. Use clampcolor.
|
65
65
|
if (map.isClampColor) {
|
66
|
-
color = vec4(map.
|
66
|
+
color = vec4(map.colormapClampColor.rgb, 1.0);
|
67
67
|
}
|
68
|
-
else if (map.
|
68
|
+
else if (map.isColormapClampColorTransparent) {
|
69
69
|
discard;
|
70
70
|
return;
|
71
71
|
}
|
@@ -104,7 +104,7 @@ void main(void) {
|
|
104
104
|
float f = fract(x);
|
105
105
|
float df = fwidth(x);
|
106
106
|
float c = smoothstep(df * 1.0, df * 2.0, f); // smootstep from/to no of pixels distance from contour line. // keep:
|
107
|
-
fragColor = fragColor * vec4(c, c, c,
|
107
|
+
fragColor = fragColor * vec4(c, c, c, layer.opacity);
|
108
108
|
}
|
109
109
|
|
110
110
|
geometry.uv = vTexCoord;
|
@@ -1,11 +1,12 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
+
import type { Color, PickingInfo } from "@deck.gl/core";
|
2
3
|
import type { BitmapLayerPickingInfo, BitmapLayerProps } from "@deck.gl/layers";
|
3
4
|
import { BitmapLayer } from "@deck.gl/layers";
|
4
|
-
import type {
|
5
|
-
import type {
|
5
|
+
import type { Model } from "@luma.gl/engine";
|
6
|
+
import type { LayerPickInfo, ReportBoundingBoxAction, TypeAndNameLayerProps } from "../utils/layerTools";
|
7
|
+
import { type ColorMapFunctionType } from "../utils/colormapTools";
|
6
8
|
import { type ValueDecoder } from "../utils/propertyMapTools";
|
7
9
|
import type { ContinuousLegendDataType } from "../../components/ColorLegend";
|
8
|
-
import type { Model } from "@luma.gl/engine";
|
9
10
|
export interface ColormapLayerProps extends BitmapLayerProps, TypeAndNameLayerProps {
|
10
11
|
colorMapName: string;
|
11
12
|
colorMapFunction?: ColorMapFunctionType;
|
@@ -7,36 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
8
|
});
|
9
9
|
};
|
10
|
-
import { BitmapLayer } from "@deck.gl/layers";
|
11
|
-
import { getRgbData } from "@emerson-eps/color-tables";
|
12
10
|
import { project32 } from "@deck.gl/core";
|
11
|
+
import { BitmapLayer } from "@deck.gl/layers";
|
12
|
+
import * as png from "@vivaxy/png";
|
13
13
|
import { getModelMatrix } from "../utils/layerTools";
|
14
|
+
import { getImageData, } from "../utils/colormapTools";
|
14
15
|
import { decodeRGB } from "../utils/propertyMapTools";
|
15
16
|
import fsColormap from "./colormap.fs.glsl";
|
16
|
-
import * as png from "@vivaxy/png";
|
17
|
-
function getImageData(colorMapName, colorTables, colorMapFunction) {
|
18
|
-
const isColorMapFunctionDefined = typeof colorMapFunction !== "undefined";
|
19
|
-
const data = new Uint8Array(256 * 3);
|
20
|
-
for (let i = 0; i < 256; i++) {
|
21
|
-
const value = i / 255.0;
|
22
|
-
const rgb = isColorMapFunctionDefined
|
23
|
-
? colorMapFunction(i / 255)
|
24
|
-
: getRgbData(value, colorMapName, colorTables);
|
25
|
-
let color = [];
|
26
|
-
if (rgb != undefined) {
|
27
|
-
if (Array.isArray(rgb)) {
|
28
|
-
color = rgb;
|
29
|
-
}
|
30
|
-
else {
|
31
|
-
color = [rgb.r, rgb.g, rgb.b];
|
32
|
-
}
|
33
|
-
}
|
34
|
-
data[3 * i + 0] = color[0];
|
35
|
-
data[3 * i + 1] = color[1];
|
36
|
-
data[3 * i + 2] = color[2];
|
37
|
-
}
|
38
|
-
return data;
|
39
|
-
}
|
40
17
|
const defaultProps = {
|
41
18
|
"@@type": "ColormapLayer",
|
42
19
|
name: "Property map",
|
@@ -111,7 +88,7 @@ export default class ColormapLayer extends BitmapLayer {
|
|
111
88
|
createPropertyTexture();
|
112
89
|
}
|
113
90
|
setShaderModuleProps(...props) {
|
114
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
91
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
115
92
|
if (!this.isLoaded) {
|
116
93
|
if (typeof this.props.reportBoundingBox !== "undefined") {
|
117
94
|
const xMin = this.props.bounds[0];
|
@@ -139,15 +116,19 @@ export default class ColormapLayer extends BitmapLayer {
|
|
139
116
|
// Properties for local shader module.
|
140
117
|
const valueRangeMin = (_c = this.props.valueRange[0]) !== null && _c !== void 0 ? _c : 0.0;
|
141
118
|
const valueRangeMax = (_d = this.props.valueRange[1]) !== null && _d !== void 0 ? _d : 1.0;
|
142
|
-
// If specified, color map will extend from
|
119
|
+
// If specified, color map will extend from colormapRangeMin to colormapRangeMax.
|
143
120
|
// Otherwise it will extend from valueRangeMin to valueRangeMax.
|
144
|
-
const
|
145
|
-
const
|
121
|
+
const colormapRangeMin = (_f = (_e = this.props.colorMapRange) === null || _e === void 0 ? void 0 : _e[0]) !== null && _f !== void 0 ? _f : valueRangeMin;
|
122
|
+
const colormapRangeMax = (_h = (_g = this.props.colorMapRange) === null || _g === void 0 ? void 0 : _g[1]) !== null && _h !== void 0 ? _h : valueRangeMax;
|
146
123
|
const colormapTexture = this.context.device.createTexture({
|
147
124
|
width: 256,
|
148
125
|
height: 1,
|
149
126
|
format: "rgb8unorm-webgl",
|
150
|
-
data: getImageData(
|
127
|
+
data: getImageData((_j = this.props.colorMapFunction) !== null && _j !== void 0 ? _j : {
|
128
|
+
colormapName: this.props.colorMapName,
|
129
|
+
colorTables: this.context.userData
|
130
|
+
.colorTables,
|
131
|
+
}),
|
151
132
|
});
|
152
133
|
// eslint-disable-next-line
|
153
134
|
// @ts-ignore
|
@@ -168,9 +149,9 @@ export default class ColormapLayer extends BitmapLayer {
|
|
168
149
|
data: new Uint8Array([1, 1, 1, 1]),
|
169
150
|
});
|
170
151
|
}
|
171
|
-
const heightValueRangeMin = (
|
172
|
-
const heightValueRangeMax = (
|
173
|
-
(
|
152
|
+
const heightValueRangeMin = (_l = (_k = this.props.heightValueRange) === null || _k === void 0 ? void 0 : _k[0]) !== null && _l !== void 0 ? _l : valueRangeMin;
|
153
|
+
const heightValueRangeMax = (_o = (_m = this.props.heightValueRange) === null || _m === void 0 ? void 0 : _m[1]) !== null && _o !== void 0 ? _o : valueRangeMax;
|
154
|
+
(_p = this.state.model) === null || _p === void 0 ? void 0 : _p.setBindings({ colormapTexture, heightMapTexture });
|
174
155
|
const bitmapResolution = this.props.image
|
175
156
|
? [
|
176
157
|
this.props.image.width,
|
@@ -184,25 +165,25 @@ export default class ColormapLayer extends BitmapLayer {
|
|
184
165
|
const isClampColor = this.props.colorMapClampColor !== undefined &&
|
185
166
|
this.props.colorMapClampColor !== true &&
|
186
167
|
this.props.colorMapClampColor !== false;
|
187
|
-
let
|
168
|
+
let colormapClampColor = isClampColor
|
188
169
|
? this.props.colorMapClampColor
|
189
170
|
: [0, 0, 0];
|
190
|
-
|
191
|
-
const
|
171
|
+
colormapClampColor = colormapClampColor.map((x) => (x !== null && x !== void 0 ? x : 0) / 255);
|
172
|
+
const isColormapClampColorTransparent = this.props.colorMapClampColor === false;
|
192
173
|
super.setShaderModuleProps({
|
193
174
|
map: {
|
194
175
|
valueRangeMin,
|
195
176
|
valueRangeMax,
|
196
|
-
|
197
|
-
|
177
|
+
colormapRangeMin,
|
178
|
+
colormapRangeMax,
|
198
179
|
contours,
|
199
180
|
hillshading,
|
200
181
|
bitmapResolution,
|
201
182
|
contourReferencePoint,
|
202
183
|
contourInterval,
|
203
184
|
isClampColor,
|
204
|
-
|
205
|
-
|
185
|
+
colormapClampColor,
|
186
|
+
isColormapClampColorTransparent,
|
206
187
|
isHeightMapTextureDefined,
|
207
188
|
heightValueRangeMin,
|
208
189
|
heightValueRangeMax,
|
@@ -241,7 +222,7 @@ export default class ColormapLayer extends BitmapLayer {
|
|
241
222
|
var _a, _b, _c, _d, _e, _f;
|
242
223
|
const valueRangeMin = (_a = this.props.valueRange[0]) !== null && _a !== void 0 ? _a : 0.0;
|
243
224
|
const valueRangeMax = (_b = this.props.valueRange[1]) !== null && _b !== void 0 ? _b : 1.0;
|
244
|
-
// If specified color map will extend from
|
225
|
+
// If specified color map will extend from colormapRangeMin to colormapRangeMax.
|
245
226
|
// Otherwise it will extend from valueRangeMin to valueRangeMax.
|
246
227
|
const min = (_d = (_c = this.props.colorMapRange) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : valueRangeMin;
|
247
228
|
const max = (_f = (_e = this.props.colorMapRange) === null || _e === void 0 ? void 0 : _e[1]) !== null && _f !== void 0 ? _f : valueRangeMax;
|
@@ -261,16 +242,16 @@ const map2DUniformsBlock = /*glsl*/ `\
|
|
261
242
|
uniform mapUniforms {
|
262
243
|
float valueRangeMin;
|
263
244
|
float valueRangeMax;
|
264
|
-
float
|
265
|
-
float
|
245
|
+
float colormapRangeMin;
|
246
|
+
float colormapRangeMax;
|
266
247
|
vec2 bitmapResolution;
|
267
248
|
bool contours;
|
268
249
|
bool hillshading;
|
269
250
|
float contourReferencePoint;
|
270
251
|
float contourInterval;
|
271
252
|
bool isClampColor;
|
272
|
-
vec3
|
273
|
-
bool
|
253
|
+
vec3 colormapClampColor;
|
254
|
+
bool isColormapClampColorTransparent;
|
274
255
|
bool isHeightMapTextureDefined;
|
275
256
|
float heightValueRangeMin;
|
276
257
|
float heightValueRangeMax;
|
@@ -300,16 +281,16 @@ const map2DUniforms = {
|
|
300
281
|
uniformTypes: {
|
301
282
|
valueRangeMin: "f32",
|
302
283
|
valueRangeMax: "f32",
|
303
|
-
|
304
|
-
|
284
|
+
colormapRangeMin: "f32",
|
285
|
+
colormapRangeMax: "f32",
|
305
286
|
bitmapResolution: "vec2<f32>",
|
306
287
|
contours: "u32",
|
307
288
|
hillshading: "u32",
|
308
289
|
contourReferencePoint: "f32",
|
309
290
|
contourInterval: "f32",
|
310
291
|
isClampColor: "u32",
|
311
|
-
|
312
|
-
|
292
|
+
colormapClampColor: "vec3<f32>",
|
293
|
+
isColormapClampColorTransparent: "u32",
|
313
294
|
isHeightMapTextureDefined: "u32",
|
314
295
|
heightValueRangeMin: "f32",
|
315
296
|
heightValueRangeMax: "f32",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"colormapLayer.js","sourceRoot":"","sources":["../../../src/layers/colormap/colormapLayer.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"colormapLayer.js","sourceRoot":"","sources":["../../../src/layers/colormap/colormapLayer.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9C,OAAO,KAAK,GAAG,MAAM,aAAa,CAAC;AAOnC,OAAO,EAA2B,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAEH,YAAY,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAqB,MAAM,2BAA2B,CAAC;AAEzE,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAyE5C,MAAM,YAAY,GAAG;IACjB,QAAQ,EAAE,eAAe;IACzB,IAAI,EAAE,cAAc;IACpB,EAAE,EAAE,gBAAgB;IACpB,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;IAC5C,aAAa,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IAChC,YAAY,EAAE;QACV,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACpB,oEAAoE;QACpE,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,GAAG,CAAC;QAChD,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,CAAC;KACV;IACD,MAAM,EAAE,CAAC;IAC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BAAkB,GAAG,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCnC,CAAC;AAwBF,gEAAgE;AAChE,MAAM,aAAa,GAAG;IAClB,IAAI,EAAE,KAAK;IACX,EAAE,EAAE,kBAAkB;IACtB,EAAE,EAAE,kBAAkB;IACtB,YAAY,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,aAAa,EAAE,KAAK;QACpB,gBAAgB,EAAE,KAAK;QACvB,gBAAgB,EAAE,KAAK;QACvB,gBAAgB,EAAE,WAAW;QAC7B,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,KAAK;QAClB,qBAAqB,EAAE,KAAK;QAC5B,eAAe,EAAE,KAAK;QACtB,YAAY,EAAE,KAAK;QACnB,kBAAkB,EAAE,WAAW;QAC/B,+BAA+B,EAAE,KAAK;QACtC,yBAAyB,EAAE,KAAK;QAChC,mBAAmB,EAAE,KAAK;QAC1B,mBAAmB,EAAE,KAAK;QAC1B,SAAS,EAAE,WAAW;QACtB,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,KAAK;KACd;CAC2D,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"drawingLayer.js","sourceRoot":"","sources":["../../../src/layers/drawing/drawingLayer.tsx"],"names":[],"mappings":"AAOA,OAAO,EACH,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,UAAU,EACV,aAAa,EACb,QAAQ,GACX,MAAM,oCAAoC,CAAC;AAO5C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;
|
1
|
+
{"version":3,"file":"drawingLayer.js","sourceRoot":"","sources":["../../../src/layers/drawing/drawingLayer.tsx"],"names":[],"mappings":"AAOA,OAAO,EACH,kBAAkB,EAClB,aAAa,EACb,eAAe,EAC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AClC;aACJ;SACJ,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,oBAAoB,CAAC,eAAe,CAAC,CAAC,CAAC;IACvD,CAAC;CACJ;AAED,YAAY,CAAC,SAAS,GAAG,cAAc,CAAC;AACxC,YAAY,CAAC,YAAY,GAAG,YAA4C,CAAC"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import type { Material as DeckGlMaterial } from "@deck.gl/core";
|
2
|
+
/**
|
3
|
+
* Material properties for a graphical surface, used for lighting and shading.
|
4
|
+
*
|
5
|
+
* This type can either be an object specifying material properties,
|
6
|
+
* or a boolean value.
|
7
|
+
*
|
8
|
+
* - If an object, it contains:
|
9
|
+
* - `ambient`: The ambient reflection coefficient.
|
10
|
+
* - `diffuse`: The diffuse reflection coefficient.
|
11
|
+
* - `shininess`: The shininess exponent for specular highlights.
|
12
|
+
* - `specularColor`: The RGB color of the specular reflection as a tuple of three numbers.
|
13
|
+
*
|
14
|
+
* - If a boolean, it may be used as a flag to enable default material or disable the lighting.
|
15
|
+
*/
|
16
|
+
export type Material = {
|
17
|
+
ambient?: number | undefined;
|
18
|
+
diffuse?: number | undefined;
|
19
|
+
shininess?: number | undefined;
|
20
|
+
specularColor?: [number, number, number] | undefined;
|
21
|
+
} | boolean;
|
22
|
+
type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
23
|
+
export declare const _test: Equals<Material, DeckGlMaterial>;
|
24
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"typeDefs.js","sourceRoot":"","sources":["../../../src/layers/gpglLayers/typeDefs.ts"],"names":[],"mappings":"AAgCA,6DAA6D;AAC7D,MAAM,CAAC,MAAM,KAAK,GAAqC,IAAI,CAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const _default: "#version 300 es\n#define SHADER_NAME grid3d-cell-fragment-shader\n\nin vec3 cameraPosition;\nin vec4 position_commonspace;\n\nflat in vec3 normal;\nflat in int vertexIndex;\nflat in float property;\n\nout vec4 fragColor;\n\nuniform sampler2D colormap;\n\n// Calculate color from propertyValue using discrete colormap.\nvec4 getDiscretePropertyColor (float propertyValue) {\n vec4 color = vec4(1.0, 1.0, 1.0, 1.0);\n // On some machines (like in docker container), float comparison and texture lookup may fail due to precision.\n // Use this tolerance for comparison and to shift the lookup position.\n float tolerance = (1.0 / grid.
|
1
|
+
declare const _default: "#version 300 es\n#define SHADER_NAME grid3d-cell-fragment-shader\n\nin vec3 cameraPosition;\nin vec4 position_commonspace;\nin vec4 vColor;\n\nflat in vec3 normal;\nflat in int vertexIndex;\nflat in float property;\n\nout vec4 fragColor;\n\nuniform sampler2D colormap;\n\n// Calculate color from propertyValue using discrete colormap.\nvec4 getDiscretePropertyColor (float propertyValue) {\n vec4 color = vec4(1.0, 1.0, 1.0, 1.0);\n // On some machines (like in docker container), float comparison and texture lookup may fail due to precision.\n // Use this tolerance for comparison and to shift the lookup position.\n float tolerance = (1.0 / grid.colormapSize) * 0.5;\n\n if (propertyValue < grid.colormapRangeMin - tolerance || propertyValue > grid.colormapRangeMax + tolerance) {\n // Out of range. Use clampcolor.\n if (grid.isClampColor) {\n color = grid.colormapClampColor;\n if( color[3] == 0.0 ) {\n discard;\n }\n }\n else {\n // Use min/max color to clamp.\n float p = clamp (propertyValue, grid.colormapRangeMin, grid.colormapRangeMax);\n float x = p / grid.colormapSize;\n color = texture(colormap, vec2(x + tolerance, 0.5));\n }\n }\n else {\n float x = propertyValue / grid.colormapSize;\n color = texture(colormap, vec2(x + tolerance, 0.5));\n }\n \n return color;\n}\n\nvec4 getContinuousPropertyColor (float propertyValue) {\n vec4 color = vec4(1.0, 1.0, 1.0, 1.0);\n float normalizedValue = (propertyValue - grid.colormapRangeMin) / (grid.colormapRangeMax - grid.colormapRangeMin);\n if (normalizedValue < 0.0 || normalizedValue > 1.0) {\n // Out of range. Use clampcolor.\n if (grid.isClampColor) {\n color = grid.colormapClampColor;\n if( color[3] == 0.0 ) {\n discard;\n }\n }\n else {\n // Use min/max color to clamp.\n normalizedValue = clamp (normalizedValue, 0.0, 1.0); \n color = texture(colormap, vec2(normalizedValue, 0.5));\n }\n }\n else {\n color = texture(colormap, vec2(normalizedValue, 0.5));\n }\n return color;\n}\n\nvoid main(void) {\n\n if (picking.isActive > 0.5 && !(picking.isAttribute > 0.5)) {\n fragColor = encodeVertexIndexToRGB(vertexIndex); \n return;\n }\n\n if (isnan(property)) {\n vec3 lightColor = lighting_getLightColor(grid.undefinedPropertyColor.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, vColor.a);\n DECKGL_FILTER_COLOR(fragColor, geometry);\n return;\n }\n\n // This may happen due to GPU interpolation precision causing color artifacts.\n float propertyValue = clamp(property, grid.valueRangeMin, grid.valueRangeMax);\n \n vec4 color = grid.isColoringDiscrete ? getDiscretePropertyColor(round(propertyValue)) : getContinuousPropertyColor(propertyValue);\n\n // Use two sided phong lighting. This has no effect if \"material\" property is not set.\n vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, vColor.a);\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n";
|
2
2
|
export default _default;
|
@@ -4,6 +4,7 @@ export default `\
|
|
4
4
|
|
5
5
|
in vec3 cameraPosition;
|
6
6
|
in vec4 position_commonspace;
|
7
|
+
in vec4 vColor;
|
7
8
|
|
8
9
|
flat in vec3 normal;
|
9
10
|
flat in int vertexIndex;
|
@@ -18,25 +19,25 @@ vec4 getDiscretePropertyColor (float propertyValue) {
|
|
18
19
|
vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
|
19
20
|
// On some machines (like in docker container), float comparison and texture lookup may fail due to precision.
|
20
21
|
// Use this tolerance for comparison and to shift the lookup position.
|
21
|
-
float tolerance = (1.0 / grid.
|
22
|
+
float tolerance = (1.0 / grid.colormapSize) * 0.5;
|
22
23
|
|
23
|
-
if (propertyValue < grid.
|
24
|
+
if (propertyValue < grid.colormapRangeMin - tolerance || propertyValue > grid.colormapRangeMax + tolerance) {
|
24
25
|
// Out of range. Use clampcolor.
|
25
26
|
if (grid.isClampColor) {
|
26
|
-
color = grid.
|
27
|
+
color = grid.colormapClampColor;
|
27
28
|
if( color[3] == 0.0 ) {
|
28
29
|
discard;
|
29
30
|
}
|
30
31
|
}
|
31
32
|
else {
|
32
33
|
// Use min/max color to clamp.
|
33
|
-
float p = clamp (propertyValue, grid.
|
34
|
-
float x = p / grid.
|
34
|
+
float p = clamp (propertyValue, grid.colormapRangeMin, grid.colormapRangeMax);
|
35
|
+
float x = p / grid.colormapSize;
|
35
36
|
color = texture(colormap, vec2(x + tolerance, 0.5));
|
36
37
|
}
|
37
38
|
}
|
38
39
|
else {
|
39
|
-
float x = propertyValue / grid.
|
40
|
+
float x = propertyValue / grid.colormapSize;
|
40
41
|
color = texture(colormap, vec2(x + tolerance, 0.5));
|
41
42
|
}
|
42
43
|
|
@@ -45,11 +46,11 @@ vec4 getDiscretePropertyColor (float propertyValue) {
|
|
45
46
|
|
46
47
|
vec4 getContinuousPropertyColor (float propertyValue) {
|
47
48
|
vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
|
48
|
-
float normalizedValue = (propertyValue - grid.
|
49
|
+
float normalizedValue = (propertyValue - grid.colormapRangeMin) / (grid.colormapRangeMax - grid.colormapRangeMin);
|
49
50
|
if (normalizedValue < 0.0 || normalizedValue > 1.0) {
|
50
51
|
// Out of range. Use clampcolor.
|
51
52
|
if (grid.isClampColor) {
|
52
|
-
color = grid.
|
53
|
+
color = grid.colormapClampColor;
|
53
54
|
if( color[3] == 0.0 ) {
|
54
55
|
discard;
|
55
56
|
}
|
@@ -75,19 +76,19 @@ void main(void) {
|
|
75
76
|
|
76
77
|
if (isnan(property)) {
|
77
78
|
vec3 lightColor = lighting_getLightColor(grid.undefinedPropertyColor.rgb, cameraPosition, position_commonspace.xyz, normal);
|
78
|
-
fragColor = vec4(lightColor,
|
79
|
+
fragColor = vec4(lightColor, vColor.a);
|
79
80
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
80
81
|
return;
|
81
|
-
}
|
82
|
+
}
|
82
83
|
|
83
84
|
// This may happen due to GPU interpolation precision causing color artifacts.
|
84
85
|
float propertyValue = clamp(property, grid.valueRangeMin, grid.valueRangeMax);
|
85
|
-
|
86
|
+
|
86
87
|
vec4 color = grid.isColoringDiscrete ? getDiscretePropertyColor(round(propertyValue)) : getContinuousPropertyColor(propertyValue);
|
87
88
|
|
88
89
|
// Use two sided phong lighting. This has no effect if "material" property is not set.
|
89
90
|
vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
|
90
|
-
fragColor = vec4(lightColor,
|
91
|
+
fragColor = vec4(lightColor, vColor.a);
|
91
92
|
DECKGL_FILTER_COLOR(fragColor, geometry);
|
92
93
|
}
|
93
94
|
`;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cellProperty.fs.glsl.js","sourceRoot":"","sources":["../../../src/layers/grid3d/cellProperty.fs.glsl.ts"],"names":[],"mappings":"AAAA,eAAe
|
1
|
+
{"version":3,"file":"cellProperty.fs.glsl.js","sourceRoot":"","sources":["../../../src/layers/grid3d/cellProperty.fs.glsl.ts"],"names":[],"mappings":"AAAA,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Fd,CAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const _default: "#version 300 es\n#define SHADER_NAME grid3d-cell-vertex-shader\n\nin vec3 positions;\nin vec3 normals;\nin float properties;\n\n// Outputs to fragment shader\nout vec3 cameraPosition;\nout vec4 position_commonspace;\n\nflat out vec3 normal;\nflat out int vertexIndex;\nflat out float property;\n\nconst vec3 pickingColor = vec3(1.0, 1.0, 0.0);\n\nvoid main(void) { \n \n vertexIndex = gl_VertexID;\n cameraPosition = project.cameraPosition; \n geometry.pickingColor = pickingColor;\n\n normal = normals;\n vec3 position = positions;\n\n float zSign = grid.ZIncreasingDownwards ? -1.0 : 1.0;\n\n position.z *= zSign;\n normal.z *= zSign;\n\n property = properties;\n\n position_commonspace = vec4(project_position(position), 0.0);\n gl_Position = project_common_position_to_clipspace(position_commonspace);\n\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n
|
1
|
+
declare const _default: "#version 300 es\n#define SHADER_NAME grid3d-cell-vertex-shader\n\nin vec3 positions;\nin vec3 normals;\nin float properties;\n\n// Outputs to fragment shader\nout vec3 cameraPosition;\nout vec4 position_commonspace;\nout vec4 vColor;\n\nflat out vec3 normal;\nflat out int vertexIndex;\nflat out float property;\n\nconst vec3 pickingColor = vec3(1.0, 1.0, 0.0);\n\nvoid main(void) { \n \n vertexIndex = gl_VertexID;\n cameraPosition = project.cameraPosition; \n geometry.pickingColor = pickingColor;\n\n normal = normals;\n vec3 position = positions;\n\n float zSign = grid.ZIncreasingDownwards ? -1.0 : 1.0;\n\n position.z *= zSign;\n normal.z *= zSign;\n\n property = properties;\n\n position_commonspace = vec4(project_position(position), 0.0);\n gl_Position = project_common_position_to_clipspace(position_commonspace);\n\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n vColor = vec4(0.0, 0.0, 0.0, layer.opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n";
|
2
2
|
export default _default;
|
@@ -9,6 +9,7 @@ in float properties;
|
|
9
9
|
// Outputs to fragment shader
|
10
10
|
out vec3 cameraPosition;
|
11
11
|
out vec4 position_commonspace;
|
12
|
+
out vec4 vColor;
|
12
13
|
|
13
14
|
flat out vec3 normal;
|
14
15
|
flat out int vertexIndex;
|
@@ -37,8 +38,8 @@ void main(void) {
|
|
37
38
|
|
38
39
|
DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
|
39
40
|
|
40
|
-
|
41
|
-
DECKGL_FILTER_COLOR(
|
41
|
+
vColor = vec4(0.0, 0.0, 0.0, layer.opacity);
|
42
|
+
DECKGL_FILTER_COLOR(vColor, geometry);
|
42
43
|
}
|
43
44
|
`;
|
44
45
|
//# sourceMappingURL=cellProperty.vs.glsl.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cellProperty.vs.glsl.js","sourceRoot":"","sources":["../../../src/layers/grid3d/cellProperty.vs.glsl.ts"],"names":[],"mappings":"AAAA,eAAe
|
1
|
+
{"version":3,"file":"cellProperty.vs.glsl.js","sourceRoot":"","sources":["../../../src/layers/grid3d/cellProperty.vs.glsl.ts"],"names":[],"mappings":"AAAA,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Cd,CAAC"}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import type React from "react";
|
2
2
|
import type { Color } from "@deck.gl/core";
|
3
3
|
import { CompositeLayer } from "@deck.gl/core";
|
4
|
-
import type { Material } from "
|
4
|
+
import type { Material } from "../gpglLayers/typeDefs";
|
5
5
|
import PrivateLayer from "./privateGrid3dLayer";
|
6
|
-
import type { ExtendedLayerProps,
|
6
|
+
import type { ExtendedLayerProps, ReportBoundingBoxAction } from "../utils/layerTools";
|
7
|
+
import type { ColorMapFunctionType } from "../utils/colormapTools";
|
7
8
|
export type WebWorkerParams = {
|
8
9
|
points: Float32Array;
|
9
10
|
polys: Uint32Array;
|
@@ -62,7 +63,7 @@ export interface Grid3DLayerProps extends ExtendedLayerProps {
|
|
62
63
|
*/
|
63
64
|
propertiesData: string | number[] | Float32Array | Uint16Array | undefined;
|
64
65
|
/**
|
65
|
-
* Discrete
|
66
|
+
* Discrete property value-name pairs to be displayed in cursor readouts.
|
66
67
|
* The property values are used as the array indices.
|
67
68
|
*/
|
68
69
|
discretePropertyValueNames?: IDiscretePropertyValueName[];
|
@@ -143,5 +144,5 @@ export default class Grid3DLayer extends CompositeLayer<Grid3DLayerProps> {
|
|
143
144
|
private getPropertyValueRange;
|
144
145
|
private getUndefinedPropertyValue;
|
145
146
|
private getUndefinedPropertyColor;
|
146
|
-
private
|
147
|
+
private isColormapFunctionConstantColor;
|
147
148
|
}
|
@@ -169,7 +169,7 @@ export default class Grid3DLayer extends CompositeLayer {
|
|
169
169
|
valueRange: (_a = this.props.colorMapRange) !== null && _a !== void 0 ? _a : propertyValueRange,
|
170
170
|
colorName: this.props.colorMapName,
|
171
171
|
title: "MapLayer",
|
172
|
-
|
172
|
+
colormapFunction: this.props.colorMapFunction,
|
173
173
|
};
|
174
174
|
this.setState({
|
175
175
|
mesh,
|
@@ -216,12 +216,12 @@ export default class Grid3DLayer extends CompositeLayer {
|
|
216
216
|
mesh: this.state["mesh"],
|
217
217
|
meshLines: this.state["mesh_lines"],
|
218
218
|
pickable: this.props.pickable,
|
219
|
-
|
220
|
-
|
221
|
-
|
219
|
+
colormapName: this.props.colorMapName,
|
220
|
+
colormapRange: this.props.colorMapRange,
|
221
|
+
colormapClampColor: this.props.colorMapClampColor,
|
222
222
|
undefinedPropertyValue: undefinedValue,
|
223
223
|
undefinedPropertyColor: undefinedColor,
|
224
|
-
|
224
|
+
colormapFunction: this.props.colorMapFunction,
|
225
225
|
coloringMode: this.props.coloringMode,
|
226
226
|
gridLines: this.props.gridLines,
|
227
227
|
propertyValueRange: this.getPropertyValueRange(),
|
@@ -263,12 +263,12 @@ export default class Grid3DLayer extends CompositeLayer {
|
|
263
263
|
var _a, _b;
|
264
264
|
const colorFunc = this.props.colorMapFunction;
|
265
265
|
if (((_a = this.props.propertiesData) === null || _a === void 0 ? void 0 : _a.length) === 0 &&
|
266
|
-
this.
|
266
|
+
this.isColormapFunctionConstantColor(colorFunc)) {
|
267
267
|
return [colorFunc[0], colorFunc[1], colorFunc[2]];
|
268
268
|
}
|
269
269
|
return (_b = this.props.undefinedPropertyColor) !== null && _b !== void 0 ? _b : [204, 204, 204];
|
270
270
|
}
|
271
|
-
|
271
|
+
isColormapFunctionConstantColor(colorFunc) {
|
272
272
|
return ((Array.isArray(colorFunc) || colorFunc instanceof Uint8Array) &&
|
273
273
|
colorFunc.length >= 3);
|
274
274
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const _default: "#version 300 es\n#define SHADER_NAME grid3d-cell-lines-fragment-shader\n\nprecision highp float;\n\nout vec4 fragColor;\n\nvoid main(void) {\n fragColor =
|
1
|
+
declare const _default: "#version 300 es\n#define SHADER_NAME grid3d-cell-lines-fragment-shader\n\nprecision highp float;\n\nin vec4 vColor;\n\nout vec4 fragColor;\n\nvoid main(void) {\n fragColor = vColor;\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n";
|
2
2
|
export default _default;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"line.fs.glsl.js","sourceRoot":"","sources":["../../../src/layers/grid3d/line.fs.glsl.ts"],"names":[],"mappings":"AAAA,eAAe
|
1
|
+
{"version":3,"file":"line.fs.glsl.js","sourceRoot":"","sources":["../../../src/layers/grid3d/line.fs.glsl.ts"],"names":[],"mappings":"AAAA,eAAe;;;;;;;;;;;;;;CAcd,CAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const _default: "#version 300 es\n#define SHADER_NAME grid3d-lines-vertex-shader\n\nprecision highp float;\n\nin vec3 positions;\n\nout vec4 position_commonspace;\n\nvoid main(void) {\n vec3 position = positions;\n position[2] *= grid.ZIncreasingDownwards ? -1.0 : 1.0;\n\n vec3 position_commonspace = project_position(position);\n gl_Position = project_common_position_to_clipspace(vec4(position_commonspace, 0.0));\n}\n";
|
1
|
+
declare const _default: "#version 300 es\n#define SHADER_NAME grid3d-lines-vertex-shader\n\nprecision highp float;\n\nin vec3 positions;\n\nout vec4 position_commonspace;\nout vec4 vColor;\n\nvoid main(void) {\n vec3 position = positions;\n position[2] *= grid.ZIncreasingDownwards ? -1.0 : 1.0;\n\n vec3 position_commonspace = project_position(position);\n gl_Position = project_common_position_to_clipspace(vec4(position_commonspace, 0.0));\n\n vColor = vec4(0.0, 0.0, 0.0, layer.opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n";
|
2
2
|
export default _default;
|
@@ -7,6 +7,7 @@ precision highp float;
|
|
7
7
|
in vec3 positions;
|
8
8
|
|
9
9
|
out vec4 position_commonspace;
|
10
|
+
out vec4 vColor;
|
10
11
|
|
11
12
|
void main(void) {
|
12
13
|
vec3 position = positions;
|
@@ -14,6 +15,9 @@ void main(void) {
|
|
14
15
|
|
15
16
|
vec3 position_commonspace = project_position(position);
|
16
17
|
gl_Position = project_common_position_to_clipspace(vec4(position_commonspace, 0.0));
|
18
|
+
|
19
|
+
vColor = vec4(0.0, 0.0, 0.0, layer.opacity);
|
20
|
+
DECKGL_FILTER_COLOR(vColor, geometry);
|
17
21
|
}
|
18
22
|
`;
|
19
23
|
//# sourceMappingURL=line.vs.glsl.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"line.vs.glsl.js","sourceRoot":"","sources":["../../../src/layers/grid3d/line.vs.glsl.ts"],"names":[],"mappings":"AAAA,eAAe
|
1
|
+
{"version":3,"file":"line.vs.glsl.js","sourceRoot":"","sources":["../../../src/layers/grid3d/line.vs.glsl.ts"],"names":[],"mappings":"AAAA,eAAe;;;;;;;;;;;;;;;;;;;;;CAqBd,CAAC"}
|