@webviz/subsurface-viewer 0.13.8 → 0.14.1
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/SubsurfaceViewer.d.ts +7 -4
- package/dist/SubsurfaceViewer.js +14 -6
- package/dist/SubsurfaceViewer.js.map +1 -1
- package/dist/components/Map.d.ts +1 -0
- package/dist/components/Map.js +37 -4
- package/dist/components/Map.js.map +1 -1
- package/dist/layers/grid3d/grid3dLayer.d.ts +2 -2
- package/dist/layers/grid3d/grid3dLayer.js +2 -2
- package/dist/layers/grid3d/privateGrid3dLayer.d.ts +3 -4
- package/dist/layers/grid3d/privateGrid3dLayer.js +5 -6
- package/dist/layers/grid3d/privateGrid3dLayer.js.map +1 -1
- package/dist/layers/grid3d/test_data/TruncatedSnubCube.d.ts +3 -3
- package/dist/layers/grid3d/test_data/TruncatedSnubCube.js +3 -3
- package/dist/layers/grid3d/test_data/TruncatedSnubCube.js.map +1 -1
- package/dist/layers/index.d.ts +0 -2
- package/dist/layers/index.js +0 -1
- package/dist/layers/index.js.map +1 -1
- package/dist/layers/map/mapLayer.d.ts +2 -2
- package/dist/layers/map/mapLayer.js +2 -2
- package/dist/layers/map/privateMapLayer.d.ts +3 -4
- package/dist/layers/map/privateMapLayer.js +8 -9
- package/dist/layers/map/privateMapLayer.js.map +1 -1
- package/dist/layers/piechart/pieChartLayer.d.ts +1 -1
- package/dist/layers/piechart/pieChartLayer.js +3 -3
- package/dist/layers/piechart/pieChartLayer.js.map +1 -1
- package/dist/layers/points/pointsLayer.d.ts +2 -1
- package/dist/layers/points/pointsLayer.js +7 -0
- package/dist/layers/points/pointsLayer.js.map +1 -1
- package/dist/layers/triangle/triangleLayer.d.ts +2 -2
- package/dist/layers/triangle/triangleLayer.js +6 -0
- package/dist/layers/triangle/triangleLayer.js.map +1 -1
- package/dist/layers/well_markers/wellMarkersLayer.d.ts +1 -1
- package/dist/redux/types.d.ts +0 -1
- package/dist/redux/types.js +1 -3
- package/dist/redux/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/layers/terrain/map3DLayer.d.ts +0 -46
- package/dist/layers/terrain/map3DLayer.js +0 -319
- package/dist/layers/terrain/map3DLayer.js.map +0 -1
- package/dist/layers/terrain/terrainMapLayer.d.ts +0 -46
- package/dist/layers/terrain/terrainMapLayer.js +0 -186
- package/dist/layers/terrain/terrainMapLayer.js.map +0 -1
- package/dist/layers/terrain/terrainmap.fs.glsl.d.ts +0 -2
- package/dist/layers/terrain/terrainmap.fs.glsl.js +0 -134
- package/dist/layers/terrain/terrainmap.fs.glsl.js.map +0 -1
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { CompositeLayer } from "@deck.gl/core/typed";
|
|
11
|
-
import TerrainMapLayer, { DECODER } from "./terrainMapLayer";
|
|
12
|
-
import { TerrainLoader } from "@loaders.gl/terrain";
|
|
13
|
-
import { ImageLoader } from "@loaders.gl/images";
|
|
14
|
-
import { load } from "@loaders.gl/core";
|
|
15
|
-
import { Vector3 } from "@math.gl/core";
|
|
16
|
-
import { getModelMatrix } from "../utils/layerTools";
|
|
17
|
-
import { isEqual } from "lodash";
|
|
18
|
-
function getMinMax(dim) {
|
|
19
|
-
const nx = dim.count[0];
|
|
20
|
-
const ny = dim.count[1];
|
|
21
|
-
const dx = dim.increment[0];
|
|
22
|
-
const dy = dim.increment[1];
|
|
23
|
-
const xmin = dim.origin[0];
|
|
24
|
-
const ymin = dim.origin[1];
|
|
25
|
-
const xmax = xmin + nx * dx;
|
|
26
|
-
const ymax = ymin + ny * dy;
|
|
27
|
-
return [xmin, ymin, xmax, ymax];
|
|
28
|
-
}
|
|
29
|
-
function mapToRange(resolved_mesh, meshValueRange) {
|
|
30
|
-
const floatScaler = 1.0 / (256.0 * 256.0 * 256.0 - 1.0);
|
|
31
|
-
const [min, max] = meshValueRange;
|
|
32
|
-
const delta = max - min;
|
|
33
|
-
const vertexs = resolved_mesh.attributes.POSITION.value;
|
|
34
|
-
const nvertexs = vertexs.length / 3;
|
|
35
|
-
for (let i = 0; i < nvertexs; i++) {
|
|
36
|
-
let Z = vertexs[i * 3 + 2];
|
|
37
|
-
Z = Z * floatScaler; // maps to [0-1]
|
|
38
|
-
Z = min + Z * delta;
|
|
39
|
-
vertexs[i * 3 + 2] = -Z; // depths are positive along negative z axis.
|
|
40
|
-
}
|
|
41
|
-
return resolved_mesh;
|
|
42
|
-
}
|
|
43
|
-
function add_normals(resolved_mesh, meshImageData, bounds) {
|
|
44
|
-
const vertexs = resolved_mesh.attributes.POSITION.value;
|
|
45
|
-
let indices = resolved_mesh.indices.value;
|
|
46
|
-
let ntriangles = indices.length / 3;
|
|
47
|
-
////////////////////////////////////////////////////////////////
|
|
48
|
-
// Remove all triangles that are in undefined areas. That is triangles which
|
|
49
|
-
const [xmin, ymin, xmax, ymax] = bounds;
|
|
50
|
-
const w = meshImageData.width;
|
|
51
|
-
const h = meshImageData.height;
|
|
52
|
-
const int_view = new Uint8ClampedArray(meshImageData.data, 0, meshImageData.data.length);
|
|
53
|
-
const dx = (xmax - xmin) / (w - 1);
|
|
54
|
-
const dy = (ymax - ymin) / (h - 1);
|
|
55
|
-
const indices_reduced = [];
|
|
56
|
-
for (let tn = 0; tn < ntriangles; tn++) {
|
|
57
|
-
const i0 = indices[tn * 3 + 0];
|
|
58
|
-
const i1 = indices[tn * 3 + 1];
|
|
59
|
-
const i2 = indices[tn * 3 + 2];
|
|
60
|
-
const triangle_indices = [i0, i1, i2];
|
|
61
|
-
const alphas = triangle_indices.map((index) => {
|
|
62
|
-
const x = vertexs[index * 3 + 0];
|
|
63
|
-
const y = vertexs[index * 3 + 1];
|
|
64
|
-
// Note: assumes increasing 'j' along increasing X axis and Y axis and
|
|
65
|
-
// increasing 'i' along decreasing Y axis.
|
|
66
|
-
// 'j' along image width. 'i' along image height.
|
|
67
|
-
const j = Math.round((x - xmin) / dx);
|
|
68
|
-
const i = h - Math.round((y - ymin) / dy);
|
|
69
|
-
const pixelNo = i * w + j;
|
|
70
|
-
// Check alpha (transparency) for this triangle corner.
|
|
71
|
-
const is_transparent = int_view[pixelNo * 4 + 3] < 255;
|
|
72
|
-
return is_transparent;
|
|
73
|
-
});
|
|
74
|
-
const do_remove = alphas.some((a) => a);
|
|
75
|
-
if (!do_remove) {
|
|
76
|
-
indices_reduced.push(i0);
|
|
77
|
-
indices_reduced.push(i1);
|
|
78
|
-
indices_reduced.push(i2);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
resolved_mesh.indices.value = new Uint32Array(indices_reduced);
|
|
82
|
-
indices = resolved_mesh.indices.value;
|
|
83
|
-
ntriangles = indices.length / 3;
|
|
84
|
-
////////////////////////////////////////////////////////////////
|
|
85
|
-
// Calculate one normal pr triangle. And record the triangles each vertex' belongs to.
|
|
86
|
-
const no_unique_vertexes = vertexs.length / 3;
|
|
87
|
-
const vertex_triangles = Array(no_unique_vertexes); // for each vertex a list of triangles it belongs to.
|
|
88
|
-
for (let i = 0; i < no_unique_vertexes; i++) {
|
|
89
|
-
vertex_triangles[i] = new Set();
|
|
90
|
-
}
|
|
91
|
-
const triangle_normals = Array(ntriangles);
|
|
92
|
-
for (let t = 0; t < ntriangles; t++) {
|
|
93
|
-
const i0 = indices[t * 3 + 0];
|
|
94
|
-
const i1 = indices[t * 3 + 1];
|
|
95
|
-
const i2 = indices[t * 3 + 2];
|
|
96
|
-
vertex_triangles[i0].add(t);
|
|
97
|
-
vertex_triangles[i1].add(t);
|
|
98
|
-
vertex_triangles[i2].add(t);
|
|
99
|
-
// Triangles' three corners.
|
|
100
|
-
const v0 = new Vector3(vertexs[i0 * 3 + 0], vertexs[i0 * 3 + 1], vertexs[i0 * 3 + 2]);
|
|
101
|
-
const v1 = new Vector3(vertexs[i1 * 3 + 0], vertexs[i1 * 3 + 1], vertexs[i1 * 3 + 2]);
|
|
102
|
-
const v2 = new Vector3(vertexs[i2 * 3 + 0], vertexs[i2 * 3 + 1], vertexs[i2 * 3 + 2]);
|
|
103
|
-
const vec1 = v1.subtract(v0);
|
|
104
|
-
const vec2 = v2.subtract(v0);
|
|
105
|
-
const normal = vec1.cross(vec2).normalize();
|
|
106
|
-
triangle_normals[t] = normal;
|
|
107
|
-
}
|
|
108
|
-
// Calculate normals. The vertex normal will be the mean of the normals of every triangle the vertex
|
|
109
|
-
// belongs to.
|
|
110
|
-
const normals = Array(vertexs.length).fill(0.0);
|
|
111
|
-
for (let i = 0; i < no_unique_vertexes; i++) {
|
|
112
|
-
const triangles = [...vertex_triangles[i]];
|
|
113
|
-
// Set normal to mean of all triangle normals.
|
|
114
|
-
const v = triangles.length !== 0
|
|
115
|
-
? triangle_normals[triangles[0]]
|
|
116
|
-
: new Vector3(0.0, 0.0, 1.0);
|
|
117
|
-
for (let t = 1; t < triangles.length; t++) {
|
|
118
|
-
v.add(triangle_normals[triangles[t]]);
|
|
119
|
-
}
|
|
120
|
-
v.normalize();
|
|
121
|
-
const idx = i * 3;
|
|
122
|
-
normals[idx + 0] = v[0];
|
|
123
|
-
normals[idx + 1] = v[1];
|
|
124
|
-
normals[idx + 2] = v[2];
|
|
125
|
-
}
|
|
126
|
-
resolved_mesh.attributes.normals = {
|
|
127
|
-
value: new Float32Array(normals),
|
|
128
|
-
size: 3,
|
|
129
|
-
};
|
|
130
|
-
return resolved_mesh;
|
|
131
|
-
}
|
|
132
|
-
function load_mesh_and_texture(mesh_name, bounds, meshMaxError, meshValueRange, smoothShading, texture_name) {
|
|
133
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
const isMesh = mesh_name !== "";
|
|
135
|
-
const isTexture = texture_name !== "";
|
|
136
|
-
if (!isMesh && !isTexture) {
|
|
137
|
-
console.error("Error. One or both of texture and mesh must be given!");
|
|
138
|
-
}
|
|
139
|
-
const image_name = isTexture ? texture_name : mesh_name;
|
|
140
|
-
const texture = yield load(image_name, ImageLoader, {
|
|
141
|
-
image: { type: "data" }, // Will load as ImageData.
|
|
142
|
-
});
|
|
143
|
-
let meshImageData = null;
|
|
144
|
-
let mesh;
|
|
145
|
-
if (isMesh) {
|
|
146
|
-
mesh = yield load(mesh_name, TerrainLoader, {
|
|
147
|
-
terrain: {
|
|
148
|
-
elevationDecoder: DECODER,
|
|
149
|
-
bounds,
|
|
150
|
-
meshMaxError,
|
|
151
|
-
skirtHeight: 0.0,
|
|
152
|
-
},
|
|
153
|
-
worker: false,
|
|
154
|
-
});
|
|
155
|
-
// Remap height to meshValueRange
|
|
156
|
-
mesh = mapToRange(mesh, meshValueRange);
|
|
157
|
-
meshImageData = yield load(mesh_name, ImageLoader, {
|
|
158
|
-
image: { type: "data" }, // Will load as ImageData.
|
|
159
|
-
});
|
|
160
|
-
// Note: mesh contains triangles. No normals they must be added.
|
|
161
|
-
if (smoothShading && meshImageData) {
|
|
162
|
-
mesh = add_normals(mesh, meshImageData, bounds);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
// Mesh data is missing.
|
|
167
|
-
// Make a flat square size of enclosing dim using two triangles. z = 0.
|
|
168
|
-
const [minX, minY, maxX, maxY] = bounds;
|
|
169
|
-
const p0 = [minX, minY, 0.0];
|
|
170
|
-
const p1 = [minX, maxY, 0.0];
|
|
171
|
-
const p2 = [maxX, maxY, 0.0];
|
|
172
|
-
const p3 = [maxX, minY, 0.0];
|
|
173
|
-
const vertexes = [...p0, ...p1, ...p2, ...p3];
|
|
174
|
-
const texture_coord = [0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0];
|
|
175
|
-
mesh = {
|
|
176
|
-
attributes: {
|
|
177
|
-
POSITION: { value: new Float32Array(vertexes), size: 3 },
|
|
178
|
-
TEXCOORD_0: { value: new Float32Array(texture_coord), size: 2 },
|
|
179
|
-
},
|
|
180
|
-
indices: { value: new Uint32Array([0, 1, 3, 1, 3, 2]), size: 1 },
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
return Promise.all([mesh, meshImageData, texture]);
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
const defaultProps = {
|
|
187
|
-
"@@type": "Map3DLayer",
|
|
188
|
-
name: "Map 3D",
|
|
189
|
-
id: "map3d-layer",
|
|
190
|
-
pickable: true,
|
|
191
|
-
visible: true,
|
|
192
|
-
// Url to png image for height field.
|
|
193
|
-
mesh: "",
|
|
194
|
-
meshValueRange: { type: "array", value: [0, 1] },
|
|
195
|
-
// Mesh error in meters. The output mesh is in higher resolution (more vertices) if the error is smaller.
|
|
196
|
-
meshMaxError: { type: "number", value: 5 },
|
|
197
|
-
// Url to png image for map properties. (ex, poro or perm values as a texture)
|
|
198
|
-
propertyTexture: "",
|
|
199
|
-
propertyValueRange: { type: "array", value: [0, 1] },
|
|
200
|
-
contours: [-1.0, -1.0],
|
|
201
|
-
// If contour lines should follow depth or properties.
|
|
202
|
-
isContoursDepth: true,
|
|
203
|
-
smoothShading: true,
|
|
204
|
-
material: true,
|
|
205
|
-
depthTest: true,
|
|
206
|
-
};
|
|
207
|
-
export default class Map3DLayer extends CompositeLayer {
|
|
208
|
-
initializeState() {
|
|
209
|
-
// Load mesh and texture and store in state.
|
|
210
|
-
const isBounds = typeof this.props.bounds !== "undefined";
|
|
211
|
-
if (isBounds) {
|
|
212
|
-
console.warn('"bounds" is deprecated. Use "frame" instead.');
|
|
213
|
-
}
|
|
214
|
-
const isFrame = typeof this.props.frame !== "undefined";
|
|
215
|
-
if (!isBounds && !isFrame) {
|
|
216
|
-
console.error('Error. Either "Frame" or "bounds" must be given for map3DLayer!');
|
|
217
|
-
}
|
|
218
|
-
const bounds = (isFrame ? getMinMax(this.props.frame) : this.props.bounds);
|
|
219
|
-
const p = load_mesh_and_texture(this.props.mesh, bounds, this.props.meshMaxError, this.props.meshValueRange, this.props.smoothShading, this.props.propertyTexture);
|
|
220
|
-
p.then(([mesh, meshImageData, texture]) => {
|
|
221
|
-
this.setState({
|
|
222
|
-
mesh,
|
|
223
|
-
meshImageData,
|
|
224
|
-
texture,
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
// Report back calculated bounding box now that data is loaded.
|
|
228
|
-
p.then(() => {
|
|
229
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
230
|
-
const xinc = (_c = (_b = (_a = this.props.frame) === null || _a === void 0 ? void 0 : _a.increment) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : 0;
|
|
231
|
-
const yinc = (_f = (_e = (_d = this.props.frame) === null || _d === void 0 ? void 0 : _d.increment) === null || _e === void 0 ? void 0 : _e[1]) !== null && _f !== void 0 ? _f : 0;
|
|
232
|
-
const xcount = (_j = (_h = (_g = this.props.frame) === null || _g === void 0 ? void 0 : _g.count) === null || _h === void 0 ? void 0 : _h[0]) !== null && _j !== void 0 ? _j : 1;
|
|
233
|
-
const ycount = (_m = (_l = (_k = this.props.frame) === null || _k === void 0 ? void 0 : _k.count) === null || _l === void 0 ? void 0 : _l[1]) !== null && _m !== void 0 ? _m : 1;
|
|
234
|
-
const xMin = (_q = (_p = (_o = this.props.frame) === null || _o === void 0 ? void 0 : _o.origin) === null || _p === void 0 ? void 0 : _p[0]) !== null && _q !== void 0 ? _q : bounds[0];
|
|
235
|
-
const yMin = (_t = (_s = (_r = this.props.frame) === null || _r === void 0 ? void 0 : _r.origin) === null || _s === void 0 ? void 0 : _s[1]) !== null && _t !== void 0 ? _t : bounds[1];
|
|
236
|
-
const zMin = -this.props.meshValueRange[1];
|
|
237
|
-
const xMax = isFrame ? xMin + xinc * xcount : bounds[2];
|
|
238
|
-
const yMax = isFrame ? yMin + yinc * ycount : bounds[3];
|
|
239
|
-
const zMax = -this.props.meshValueRange[0];
|
|
240
|
-
if (typeof this.props.reportBoundingBox !== "undefined") {
|
|
241
|
-
this.props.reportBoundingBox({
|
|
242
|
-
layerBoundingBox: [xMin, yMin, zMin, xMax, yMax, zMax],
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
updateState({ props, oldProps, }) {
|
|
248
|
-
const needs_reload = !isEqual(props.mesh, oldProps.mesh) ||
|
|
249
|
-
!isEqual(props.bounds, oldProps.bounds) ||
|
|
250
|
-
!isEqual(props.frame, oldProps.frame) ||
|
|
251
|
-
!isEqual(props.meshMaxError, oldProps.meshMaxError) ||
|
|
252
|
-
!isEqual(props.meshValueRange, oldProps.meshValueRange) ||
|
|
253
|
-
!isEqual(props.smoothShading, oldProps.smoothShading) ||
|
|
254
|
-
!isEqual(props.propertyTexture, oldProps.propertyTexture);
|
|
255
|
-
if (needs_reload) {
|
|
256
|
-
// Reload mesh and texture.
|
|
257
|
-
this.initializeState();
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
renderLayers() {
|
|
261
|
-
var _a, _b, _c, _d;
|
|
262
|
-
const isBounds = typeof this.props.bounds !== "undefined";
|
|
263
|
-
const bounds = (isBounds ? this.props.bounds : getMinMax(this.props.frame));
|
|
264
|
-
// Note: these are deprecated so this code may be deleted later.
|
|
265
|
-
const isRotDegDefined = typeof this.props.rotDeg !== "undefined";
|
|
266
|
-
const isRotPointDefined = typeof this.props.rotPoint !== "undefined";
|
|
267
|
-
if (isRotDegDefined) {
|
|
268
|
-
console.warn('"rotDeg" is deprecated. Use "frame.rotDeg" instead.');
|
|
269
|
-
}
|
|
270
|
-
if (isRotPointDefined) {
|
|
271
|
-
console.warn('"rotPoint" is deprecated. Use "frame.rotPoint" instead.');
|
|
272
|
-
}
|
|
273
|
-
const [minX, minY] = [bounds[0], bounds[1]];
|
|
274
|
-
const center = (_b = (_a = this.props.frame) === null || _a === void 0 ? void 0 : _a.rotPoint) !== null && _b !== void 0 ? _b : (isRotPointDefined ? this.props.rotPoint : [minX, minY]);
|
|
275
|
-
const rotatingModelMatrix = getModelMatrix((_d = (_c = this.props.frame) === null || _c === void 0 ? void 0 : _c.rotDeg) !== null && _d !== void 0 ? _d : (isRotDegDefined ? this.props.rotDeg : 0), center[0], center[1]);
|
|
276
|
-
const isModelMatrix = typeof this.props.modelMatrix !== "undefined" &&
|
|
277
|
-
this.props.modelMatrix !== null;
|
|
278
|
-
if (isModelMatrix) {
|
|
279
|
-
rotatingModelMatrix.multiplyRight(this.props.modelMatrix);
|
|
280
|
-
}
|
|
281
|
-
const isMesh = typeof this.props.mesh !== "undefined" && this.props.mesh !== "";
|
|
282
|
-
const layer = new TerrainMapLayer(this.getSubLayerProps({
|
|
283
|
-
mesh: this.state["mesh"],
|
|
284
|
-
texture: this.state["texture"],
|
|
285
|
-
textureImageData: this.state["texture"],
|
|
286
|
-
meshImageData: this.state["meshImageData"],
|
|
287
|
-
meshValueRange: this.props.meshValueRange,
|
|
288
|
-
pickable: this.props.pickable,
|
|
289
|
-
modelMatrix: rotatingModelMatrix,
|
|
290
|
-
contours: this.props.contours,
|
|
291
|
-
colorMapName: this.props.colorMapName,
|
|
292
|
-
colorMapFunction: this.props.colorMapFunction,
|
|
293
|
-
propertyValueRange: this.props.propertyValueRange,
|
|
294
|
-
colorMapRange: this.props.colorMapRange,
|
|
295
|
-
colorMapClampColor: this.props.colorMapClampColor,
|
|
296
|
-
isContoursDepth: !isMesh ? false : this.props.isContoursDepth,
|
|
297
|
-
material: this.props.material,
|
|
298
|
-
wireframe: false,
|
|
299
|
-
depthTest: this.props.depthTest,
|
|
300
|
-
}));
|
|
301
|
-
return [layer];
|
|
302
|
-
}
|
|
303
|
-
getLegendData() {
|
|
304
|
-
const colorRange = this.props.colorMapRange;
|
|
305
|
-
const propertyRange = this.props.propertyTexture && this.props.propertyValueRange;
|
|
306
|
-
const meshRange = this.props.mesh && this.props.meshValueRange;
|
|
307
|
-
const legendRange = colorRange || propertyRange || meshRange;
|
|
308
|
-
return {
|
|
309
|
-
discrete: false,
|
|
310
|
-
valueRange: legendRange,
|
|
311
|
-
colorName: this.props.colorMapName,
|
|
312
|
-
title: "Map3dLayer",
|
|
313
|
-
colorMapFunction: this.props.colorMapFunction,
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
Map3DLayer.layerName = "Map3DLayer";
|
|
318
|
-
Map3DLayer.defaultProps = defaultProps;
|
|
319
|
-
//# sourceMappingURL=map3DLayer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"map3DLayer.js","sourceRoot":"","sources":["../../../src/layers/terrain/map3DLayer.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,eAAe,EAAE,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAM7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAgCjC,SAAS,SAAS,CAAC,GAAU;IACzB,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAExB,MAAM,EA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;SAChD,CAAC;IACN,CAAC;CACJ;AAED,UAAU,CAAC,SAAS,GAAG,YAAY,CAAC;AACpC,UAAU,CAAC,YAAY,GAAG,YAAY,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { SimpleMeshLayerProps } from "@deck.gl/mesh-layers/typed";
|
|
2
|
-
import { SimpleMeshLayer } from "@deck.gl/mesh-layers/typed";
|
|
3
|
-
import type { Color, PickingInfo } from "@deck.gl/core/typed";
|
|
4
|
-
import type { PropertyDataType, colorMapFunctionType } from "../utils/layerTools";
|
|
5
|
-
export type Material = {
|
|
6
|
-
ambient: number;
|
|
7
|
-
diffuse: number;
|
|
8
|
-
shininess: number;
|
|
9
|
-
specularColor: [number, number, number];
|
|
10
|
-
} | boolean;
|
|
11
|
-
export declare const DECODER: {
|
|
12
|
-
rScaler: number;
|
|
13
|
-
gScaler: number;
|
|
14
|
-
bScaler: number;
|
|
15
|
-
offset: number;
|
|
16
|
-
};
|
|
17
|
-
export type DataItem = {
|
|
18
|
-
position: [number, number];
|
|
19
|
-
angle: number;
|
|
20
|
-
color: [number, number, number];
|
|
21
|
-
};
|
|
22
|
-
export type TerrainMapLayerData = [DataItem?];
|
|
23
|
-
export interface TerrainMapLayerProps<D> extends SimpleMeshLayerProps<D> {
|
|
24
|
-
textureImageData: ImageData;
|
|
25
|
-
meshImageData: ImageData;
|
|
26
|
-
meshValueRange: [number, number];
|
|
27
|
-
contours: [number, number];
|
|
28
|
-
isContoursDepth: boolean;
|
|
29
|
-
colorMapName: string;
|
|
30
|
-
colorMapFunction?: colorMapFunctionType;
|
|
31
|
-
propertyValueRange: [number, number];
|
|
32
|
-
colorMapRange: [number, number];
|
|
33
|
-
colorMapClampColor: Color | undefined | boolean;
|
|
34
|
-
depthTest: boolean;
|
|
35
|
-
}
|
|
36
|
-
export default class TerrainMapLayer extends SimpleMeshLayer<TerrainMapLayerData, TerrainMapLayerProps<TerrainMapLayerData>> {
|
|
37
|
-
properties?: PropertyDataType[];
|
|
38
|
-
draw({ uniforms, context }: any): void;
|
|
39
|
-
getShaders(): unknown;
|
|
40
|
-
decodePickingColor(): number;
|
|
41
|
-
getPickingInfo({ info }: {
|
|
42
|
-
info: PickingInfo;
|
|
43
|
-
}): PickingInfo & {
|
|
44
|
-
properties?: PropertyDataType[];
|
|
45
|
-
};
|
|
46
|
-
}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { SimpleMeshLayer } from "@deck.gl/mesh-layers/typed";
|
|
2
|
-
import { COORDINATE_SYSTEM } from "@deck.gl/core/typed";
|
|
3
|
-
import fsShader from "./terrainmap.fs.glsl";
|
|
4
|
-
import GL from "@luma.gl/constants";
|
|
5
|
-
import { Texture2D } from "@luma.gl/webgl";
|
|
6
|
-
import { rgbValues } from "@emerson-eps/color-tables/";
|
|
7
|
-
import { createDefaultContinuousColorScale } from "@emerson-eps/color-tables/dist/component/Utils/legendCommonFunction";
|
|
8
|
-
import { createPropertyData } from "../utils/layerTools";
|
|
9
|
-
const DEFAULT_TEXTURE_PARAMETERS = {
|
|
10
|
-
[GL.TEXTURE_MIN_FILTER]: GL.LINEAR_MIPMAP_LINEAR,
|
|
11
|
-
[GL.TEXTURE_MAG_FILTER]: GL.LINEAR,
|
|
12
|
-
[GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,
|
|
13
|
-
[GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE,
|
|
14
|
-
};
|
|
15
|
-
export const DECODER = {
|
|
16
|
-
rScaler: 256 * 256,
|
|
17
|
-
gScaler: 256,
|
|
18
|
-
bScaler: 1,
|
|
19
|
-
offset: 0,
|
|
20
|
-
};
|
|
21
|
-
function getImageData(colorMapName, colorTables, colorMapFunction) {
|
|
22
|
-
const isColorMapFunctionDefined = typeof colorMapFunction !== "undefined";
|
|
23
|
-
const isColorMapNameDefined = !!colorMapName;
|
|
24
|
-
const data = new Uint8Array(256 * 3);
|
|
25
|
-
const defaultColorMap = createDefaultContinuousColorScale;
|
|
26
|
-
let colorMap = colorMapFunction;
|
|
27
|
-
if (!isColorMapFunctionDefined) {
|
|
28
|
-
colorMap = isColorMapNameDefined
|
|
29
|
-
? (value) => rgbValues(value, colorMapName, colorTables)
|
|
30
|
-
: defaultColorMap();
|
|
31
|
-
}
|
|
32
|
-
for (let i = 0; i < 256; i++) {
|
|
33
|
-
const value = i / 255.0;
|
|
34
|
-
const color = colorMap ? colorMap(value) : [0, 0, 0];
|
|
35
|
-
if (color) {
|
|
36
|
-
data[3 * i + 0] = color[0];
|
|
37
|
-
data[3 * i + 1] = color[1];
|
|
38
|
-
data[3 * i + 2] = color[2];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return data ? data : [0, 0, 0];
|
|
42
|
-
}
|
|
43
|
-
const defaultProps = {
|
|
44
|
-
data: [{ position: [0, 0], angle: 0, color: [255, 0, 0, 0] }],
|
|
45
|
-
getPosition: (d) => d.position,
|
|
46
|
-
getColor: (d) => d.color,
|
|
47
|
-
getOrientation: (d) => [0, d.angle, 0],
|
|
48
|
-
contours: [-1, -1],
|
|
49
|
-
colorMapName: "",
|
|
50
|
-
propertyValueRange: [0.0, 1.0],
|
|
51
|
-
isContoursDepth: true,
|
|
52
|
-
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
53
|
-
textureImageData: { value: null, type: "object", async: true },
|
|
54
|
-
meshImageData: { value: null, type: "object", async: true },
|
|
55
|
-
meshValueRange: [0.0, 1.0],
|
|
56
|
-
depthTest: true,
|
|
57
|
-
};
|
|
58
|
-
// This is a private layer used only by the composite Map3DLayer.
|
|
59
|
-
// It is an extension of SimpleMeshLayer but with modified fragment shader
|
|
60
|
-
// so that the texture pixel values can be used as lookup in a supplied color map.
|
|
61
|
-
export default class TerrainMapLayer extends SimpleMeshLayer {
|
|
62
|
-
// Signature from the base class, eslint doesn't like the any type.
|
|
63
|
-
// eslint-disable-next-line
|
|
64
|
-
draw({ uniforms, context }) {
|
|
65
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
66
|
-
const { gl } = context;
|
|
67
|
-
const contourReferencePoint = (_a = this.props.contours[0]) !== null && _a !== void 0 ? _a : -1.0;
|
|
68
|
-
const contourInterval = (_b = this.props.contours[1]) !== null && _b !== void 0 ? _b : -1.0;
|
|
69
|
-
const isContoursDepth = this.props.isContoursDepth;
|
|
70
|
-
const valueRangeMin = (_c = this.props.propertyValueRange[0]) !== null && _c !== void 0 ? _c : 0.0;
|
|
71
|
-
const valueRangeMax = (_d = this.props.propertyValueRange[1]) !== null && _d !== void 0 ? _d : 1.0;
|
|
72
|
-
// If specified color map will extend from colorMapRangeMin to colorMapRangeMax.
|
|
73
|
-
// Otherwise it will extend from valueRangeMin to valueRangeMax.
|
|
74
|
-
const colorMapRangeMin = (_f = (_e = this.props.colorMapRange) === null || _e === void 0 ? void 0 : _e[0]) !== null && _f !== void 0 ? _f : valueRangeMin;
|
|
75
|
-
const colorMapRangeMax = (_h = (_g = this.props.colorMapRange) === null || _g === void 0 ? void 0 : _g[1]) !== null && _h !== void 0 ? _h : valueRangeMax;
|
|
76
|
-
const isClampColor = this.props.colorMapClampColor !== undefined &&
|
|
77
|
-
this.props.colorMapClampColor !== true &&
|
|
78
|
-
this.props.colorMapClampColor !== false;
|
|
79
|
-
let colorMapClampColor = isClampColor
|
|
80
|
-
? this.props.colorMapClampColor
|
|
81
|
-
: [0, 0, 0];
|
|
82
|
-
// Normalize to [0,1] range.
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
colorMapClampColor = colorMapClampColor.map((x) => (x !== null && x !== void 0 ? x : 0) / 255);
|
|
86
|
-
const isColorMapClampColorTransparent = this.props.colorMapClampColor === false;
|
|
87
|
-
if (!this.props.depthTest) {
|
|
88
|
-
gl.disable(GL.DEPTH_TEST);
|
|
89
|
-
}
|
|
90
|
-
super.draw({
|
|
91
|
-
uniforms: Object.assign(Object.assign({}, uniforms), { colormap: new Texture2D(context.gl, {
|
|
92
|
-
width: 256,
|
|
93
|
-
height: 1,
|
|
94
|
-
format: GL.RGB,
|
|
95
|
-
data: getImageData(this.props.colorMapName, this.context.userData
|
|
96
|
-
.colorTables, this.props.colorMapFunction),
|
|
97
|
-
parameters: DEFAULT_TEXTURE_PARAMETERS,
|
|
98
|
-
}), valueRangeMin,
|
|
99
|
-
valueRangeMax,
|
|
100
|
-
colorMapRangeMin,
|
|
101
|
-
colorMapRangeMax,
|
|
102
|
-
contourReferencePoint,
|
|
103
|
-
contourInterval,
|
|
104
|
-
isContoursDepth,
|
|
105
|
-
colorMapClampColor,
|
|
106
|
-
isColorMapClampColorTransparent,
|
|
107
|
-
isClampColor }),
|
|
108
|
-
});
|
|
109
|
-
if (!this.props.depthTest) {
|
|
110
|
-
gl.enable(GL.DEPTH_TEST);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
getShaders() {
|
|
114
|
-
const parentShaders = super.getShaders();
|
|
115
|
-
// Overwrite the default fragment shader with ours.
|
|
116
|
-
parentShaders.fs = fsShader;
|
|
117
|
-
return Object.assign(Object.assign({}, parentShaders), {
|
|
118
|
-
// Inject this into vertex shader. Vi want to export vertex world position to
|
|
119
|
-
// fragment shader for making contour lines.
|
|
120
|
-
inject: {
|
|
121
|
-
"vs:#decl": `
|
|
122
|
-
out vec3 worldPos;
|
|
123
|
-
`,
|
|
124
|
-
"vs:#main-start": `
|
|
125
|
-
worldPos = positions;
|
|
126
|
-
`,
|
|
127
|
-
} });
|
|
128
|
-
}
|
|
129
|
-
decodePickingColor() {
|
|
130
|
-
return 0;
|
|
131
|
-
}
|
|
132
|
-
getPickingInfo({ info }) {
|
|
133
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
134
|
-
const pickColor = info.color;
|
|
135
|
-
if (!pickColor) {
|
|
136
|
-
return info;
|
|
137
|
-
}
|
|
138
|
-
// Texture coordinates.
|
|
139
|
-
const s = pickColor[0] / 255.0;
|
|
140
|
-
const t = pickColor[1] / 255.0;
|
|
141
|
-
const is_outside = pickColor[2] == 0;
|
|
142
|
-
if (is_outside) {
|
|
143
|
-
// Mouse is outside the non-transparent part of the map.
|
|
144
|
-
return info;
|
|
145
|
-
}
|
|
146
|
-
// MESH HEIGHT VALUE.
|
|
147
|
-
const meshImageData = this.props.meshImageData;
|
|
148
|
-
const isMeshImageData = meshImageData !== null;
|
|
149
|
-
const value_mesh = isMeshImageData
|
|
150
|
-
? getValue(meshImageData, s, t, DECODER)
|
|
151
|
-
: 0;
|
|
152
|
-
// TEXTURE PROPERTY VALUE.
|
|
153
|
-
const textureImageData = this.props.textureImageData;
|
|
154
|
-
const value_property = getValue(textureImageData, s, t, DECODER);
|
|
155
|
-
const layer_properties = [];
|
|
156
|
-
layer_properties.push(getMapProperty("Property", value_property, this.props.propertyValueRange), isMeshImageData
|
|
157
|
-
? getMapProperty("Depth", value_mesh, this.props.meshValueRange)
|
|
158
|
-
: { name: "Depth", value: 0 });
|
|
159
|
-
return Object.assign(Object.assign({}, info), { properties: layer_properties });
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
TerrainMapLayer.layerName = "TerrainMapLayer";
|
|
163
|
-
TerrainMapLayer.defaultProps = defaultProps;
|
|
164
|
-
//================= Local help functions. ==================
|
|
165
|
-
function getMapProperty(name, value, value_range) {
|
|
166
|
-
// Remap the [0, 1] decoded value to property value range.
|
|
167
|
-
const [min, max] = value_range;
|
|
168
|
-
const floatScaler = 1.0 / (256.0 * 256.0 * 256.0 - 1.0);
|
|
169
|
-
const scaled_value = value * floatScaler;
|
|
170
|
-
value = scaled_value * (max - min) + min;
|
|
171
|
-
return createPropertyData(name, value);
|
|
172
|
-
}
|
|
173
|
-
function getValue(imageData, s, t, decoder) {
|
|
174
|
-
const int_view = new Uint8ClampedArray(imageData.data, 0, imageData.data.length);
|
|
175
|
-
const w = imageData.width;
|
|
176
|
-
const h = imageData.height;
|
|
177
|
-
const j = Math.min(Math.floor(w * s), w - 1);
|
|
178
|
-
const i = Math.min(Math.floor(h * t), h - 1);
|
|
179
|
-
const pixelNo = i * w + j;
|
|
180
|
-
const r = int_view[pixelNo * 4 + 0] * decoder.rScaler;
|
|
181
|
-
const g = int_view[pixelNo * 4 + 1] * decoder.gScaler;
|
|
182
|
-
const b = int_view[pixelNo * 4 + 2] * decoder.bScaler;
|
|
183
|
-
const value = r + g + b;
|
|
184
|
-
return value;
|
|
185
|
-
}
|
|
186
|
-
//# sourceMappingURL=terrainMapLayer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"terrainMapLayer.js","sourceRoot":"","sources":["../../../src/layers/terrain/terrainMapLayer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,iCAAiC,EAAE,MAAM,qEAAqE,CAAC;AAKxH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,0BAA0B,GAAG;IAC/B,CAAC,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,CAAC,oBAAoB;IAChD,CAAC,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,CAAC,MAAM;IAClC,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC,aAAa;IACrC,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC,aAAa;CACxC,CAAC;AAWF,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,OAAO,EAAE,GAAG,GAAG,GAAG;IAClB,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,CAAC;IACV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CAAC;IACtD,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IACtD,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IACtD,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAExB,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const fsShader = "#version 300 es\n#define SHADER_NAME terrainmap-shader\n\nprecision highp float;\n\nuniform bool hasTexture;\nuniform sampler2D sampler;\nuniform bool flatShading;\nuniform float opacity;\n\nuniform bool isContoursDepth;\n\nuniform float contourReferencePoint;\nuniform float contourInterval;\n\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\nin vec4 positions;\n\nout vec4 fragColor;\n\nin vec3 worldPos; // we export this from vertex shader (by injecting into it).\n\nuniform sampler2D colormap;\n\nuniform float valueRangeMin;\nuniform float valueRangeMax;\nuniform float colorMapRangeMin;\nuniform float colorMapRangeMax;\n\nuniform vec3 colorMapClampColor;\nuniform bool isClampColor;\nuniform bool isColorMapClampColorTransparent;\n\n\nvoid main(void) {\n geometry.uv = vTexCoord;\n\n vec3 normal;\n if (flatShading) {\n#ifdef DERIVATIVES_AVAILABLE\n normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n#else\n normal = vec3(0.0, 0.0, 1.0);\n#endif\n } else {\n normal = normals_commonspace;\n }\n\n vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;\n\n float texture_alpha = color.a;\n\n // Discard transparent pixels.\n if (!picking_uActive && color.w < 0.99) {\n discard;\n return;\n }\n\n // Picking pass.\n if (picking_uActive) {\n // Send texture coordinates.\n float s = vTexCoord.x;\n float t = vTexCoord.y;\n float b = texture_alpha > 0.95 ? 255.0 : 0.0;\n\n fragColor = vec4(s, t, b, 1.0);\n return;\n }\n\n float propertyValue = 0.0;\n if (hasTexture) {\n float opcacity = color.w;\n float floatScaler = 1.0 / (256.0 * 256.0 * 256.0 - 1.0);\n vec3 rgb = color.rgb;\n rgb *= vec3(16711680.0, 65280.0, 255.0); //255*256*256, 255*256, 255\n float propertyValue_norm = (rgb.r + rgb.g + rgb.b) * floatScaler; // propertyValue_norm will be in range [0-1]\n\n // If colorMapRangeMin/Max specified, color map will span this interval.\n propertyValue = propertyValue_norm * (valueRangeMax - valueRangeMin) + valueRangeMin;\n float x = (propertyValue - colorMapRangeMin) / (colorMapRangeMax - colorMapRangeMin);\n;\n if (x < 0.0 || x > 1.0) {\n // Out of range. Use clampcolor.\n if (isClampColor) {\n color = vec4(colorMapClampColor.rgb, 1.0);\n\n }\n else if (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 = texture2D(colormap, vec2(x, 0.5));\n color.a = opcacity;\n }\n }\n else {\n color = texture2D(colormap, vec2(x, 0.5));\n color.a = opcacity;\n }\n }\n\n bool is_contours = contourReferencePoint != -1.0 && contourInterval != -1.0;\n if (is_contours) {\n // Contours are made of either depths or properties.\n float val = (hasTexture && !isContoursDepth) ? (propertyValue - contourReferencePoint) / contourInterval\n : (abs(worldPos.z) - contourReferencePoint) / contourInterval;\n\n float f = fract(val);\n float df = fwidth(val);\n\n // keep: float c = smoothstep(df * 1.0, df * 2.0, f); // smootstep from/to no of pixels distance fronm contour line.\n float c = smoothstep(0.0, df * 2.0, f);\n\n color = color * vec4(c, c, c, 1.0);\n }\n\n // Use normal lighting.\n vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, color.a * opacity);\n\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n";
|
|
2
|
-
export default fsShader;
|