@deck.gl/core 9.3.0-alpha.6 → 9.3.0-beta.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/dist.dev.js +125 -56
- package/dist/index.cjs +125 -60
- package/dist/index.cjs.map +3 -3
- package/dist/lib/attribute/attribute.d.ts +2 -0
- package/dist/lib/attribute/attribute.d.ts.map +1 -1
- package/dist/lib/attribute/attribute.js +57 -27
- package/dist/lib/attribute/attribute.js.map +1 -1
- package/dist/lib/constants.d.ts +11 -6
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +8 -9
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/init.js +2 -2
- package/dist/lib/init.js.map +1 -1
- package/dist/lib/layer.d.ts.map +1 -1
- package/dist/lib/layer.js +4 -6
- package/dist/lib/layer.js.map +1 -1
- package/dist/shaderlib/picking/picking.d.ts +1 -2
- package/dist/shaderlib/picking/picking.d.ts.map +1 -1
- package/dist/shaderlib/picking/picking.js +4 -4
- package/dist/shaderlib/picking/picking.js.map +1 -1
- package/dist/shaderlib/project/project-functions.d.ts.map +1 -1
- package/dist/shaderlib/project/project-functions.js +19 -10
- package/dist/shaderlib/project/project-functions.js.map +1 -1
- package/dist/shaderlib/project/project.glsl.d.ts.map +1 -1
- package/dist/shaderlib/project/project.glsl.js +10 -5
- package/dist/shaderlib/project/project.glsl.js.map +1 -1
- package/dist/shaderlib/project/project.wgsl.d.ts.map +1 -1
- package/dist/shaderlib/project/project.wgsl.js +10 -5
- package/dist/shaderlib/project/project.wgsl.js.map +1 -1
- package/dist/shaderlib/project/viewport-uniforms.d.ts +1 -0
- package/dist/shaderlib/project/viewport-uniforms.d.ts.map +1 -1
- package/dist/shaderlib/project/viewport-uniforms.js +28 -17
- package/dist/shaderlib/project/viewport-uniforms.js.map +1 -1
- package/dist/shaderlib/shadow/shadow.d.ts +1 -1
- package/dist/shaderlib/shadow/shadow.d.ts.map +1 -1
- package/dist/shaderlib/shadow/shadow.js +3 -2
- package/dist/shaderlib/shadow/shadow.js.map +1 -1
- package/dist.min.js +84 -84
- package/package.json +2 -2
- package/src/lib/attribute/attribute.ts +70 -27
- package/src/lib/constants.ts +18 -12
- package/src/lib/layer.ts +4 -6
- package/src/shaderlib/picking/picking.ts +4 -4
- package/src/shaderlib/project/project-functions.ts +20 -10
- package/src/shaderlib/project/project.glsl.ts +15 -6
- package/src/shaderlib/project/project.wgsl.ts +15 -6
- package/src/shaderlib/project/viewport-uniforms.ts +30 -21
- package/src/shaderlib/shadow/shadow.ts +6 -2
package/dist/dist.dev.js
CHANGED
|
@@ -27748,33 +27748,33 @@ float smoothedge(float edge, float x) {
|
|
|
27748
27748
|
/**
|
|
27749
27749
|
* `LNGLAT` if rendering into a geospatial viewport, `CARTESIAN` otherwise
|
|
27750
27750
|
*/
|
|
27751
|
-
DEFAULT:
|
|
27751
|
+
DEFAULT: "default",
|
|
27752
27752
|
/**
|
|
27753
27753
|
* Positions are interpreted as [longitude, latitude, elevation]
|
|
27754
27754
|
* longitude/latitude are in degrees, elevation is in meters.
|
|
27755
27755
|
* Dimensions are in meters.
|
|
27756
27756
|
*/
|
|
27757
|
-
LNGLAT:
|
|
27757
|
+
LNGLAT: "lnglat",
|
|
27758
27758
|
/**
|
|
27759
27759
|
* Positions are interpreted as [x, y, z] in meter offsets from the coordinate origin.
|
|
27760
27760
|
* Dimensions are in meters.
|
|
27761
27761
|
*/
|
|
27762
|
-
METER_OFFSETS:
|
|
27762
|
+
METER_OFFSETS: "meter-offsets",
|
|
27763
27763
|
/**
|
|
27764
27764
|
* Positions are interpreted as [deltaLng, deltaLat, elevation] from the coordinate origin.
|
|
27765
27765
|
* deltaLng/deltaLat are in degrees, elevation is in meters.
|
|
27766
27766
|
* Dimensions are in meters.
|
|
27767
27767
|
*/
|
|
27768
|
-
LNGLAT_OFFSETS:
|
|
27768
|
+
LNGLAT_OFFSETS: "lnglat-offsets",
|
|
27769
27769
|
/**
|
|
27770
27770
|
* Positions and dimensions are in the common units of the viewport.
|
|
27771
27771
|
*/
|
|
27772
|
-
CARTESIAN:
|
|
27772
|
+
CARTESIAN: "cartesian"
|
|
27773
27773
|
};
|
|
27774
27774
|
Object.defineProperty(COORDINATE_SYSTEM, "IDENTITY", {
|
|
27775
27775
|
get: () => {
|
|
27776
27776
|
log_default.deprecated("COORDINATE_SYSTEM.IDENTITY", "COORDINATE_SYSTEM.CARTESIAN")();
|
|
27777
|
-
return
|
|
27777
|
+
return COORDINATE_SYSTEM.CARTESIAN;
|
|
27778
27778
|
}
|
|
27779
27779
|
});
|
|
27780
27780
|
var PROJECTION_MODE = {
|
|
@@ -27860,6 +27860,20 @@ float smoothedge(float edge, float x) {
|
|
|
27860
27860
|
var IDENTITY_MATRIX2 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
27861
27861
|
var DEFAULT_PIXELS_PER_UNIT2 = [0, 0, 0];
|
|
27862
27862
|
var DEFAULT_COORDINATE_ORIGIN = [0, 0, 0];
|
|
27863
|
+
var COORDINATE_SYSTEM_NUMBERS = {
|
|
27864
|
+
default: -1,
|
|
27865
|
+
cartesian: 0,
|
|
27866
|
+
lnglat: 1,
|
|
27867
|
+
"meter-offsets": 2,
|
|
27868
|
+
"lnglat-offsets": 3
|
|
27869
|
+
};
|
|
27870
|
+
function getShaderCoordinateSystem(coordinateSystem) {
|
|
27871
|
+
const shaderCoordinateSystem = COORDINATE_SYSTEM_NUMBERS[coordinateSystem];
|
|
27872
|
+
if (shaderCoordinateSystem === void 0) {
|
|
27873
|
+
throw new Error(`Invalid coordinateSystem: ${coordinateSystem}`);
|
|
27874
|
+
}
|
|
27875
|
+
return shaderCoordinateSystem;
|
|
27876
|
+
}
|
|
27863
27877
|
var getMemoizedViewportUniforms = memoize(calculateViewportUniforms);
|
|
27864
27878
|
function getOffsetOrigin(viewport, coordinateSystem, coordinateOrigin = DEFAULT_COORDINATE_ORIGIN) {
|
|
27865
27879
|
if (coordinateOrigin.length < 3) {
|
|
@@ -27868,7 +27882,7 @@ float smoothedge(float edge, float x) {
|
|
|
27868
27882
|
let shaderCoordinateOrigin = coordinateOrigin;
|
|
27869
27883
|
let geospatialOrigin;
|
|
27870
27884
|
let offsetMode = true;
|
|
27871
|
-
if (coordinateSystem ===
|
|
27885
|
+
if (coordinateSystem === "lnglat-offsets" || coordinateSystem === "meter-offsets") {
|
|
27872
27886
|
geospatialOrigin = coordinateOrigin;
|
|
27873
27887
|
} else {
|
|
27874
27888
|
geospatialOrigin = viewport.isGeospatial ? (
|
|
@@ -27878,15 +27892,15 @@ float smoothedge(float edge, float x) {
|
|
|
27878
27892
|
}
|
|
27879
27893
|
switch (viewport.projectionMode) {
|
|
27880
27894
|
case PROJECTION_MODE.WEB_MERCATOR:
|
|
27881
|
-
if (coordinateSystem ===
|
|
27895
|
+
if (coordinateSystem === "lnglat" || coordinateSystem === "cartesian") {
|
|
27882
27896
|
geospatialOrigin = [0, 0, 0];
|
|
27883
27897
|
offsetMode = false;
|
|
27884
27898
|
}
|
|
27885
27899
|
break;
|
|
27886
27900
|
case PROJECTION_MODE.WEB_MERCATOR_AUTO_OFFSET:
|
|
27887
|
-
if (coordinateSystem ===
|
|
27901
|
+
if (coordinateSystem === "lnglat") {
|
|
27888
27902
|
shaderCoordinateOrigin = geospatialOrigin;
|
|
27889
|
-
} else if (coordinateSystem ===
|
|
27903
|
+
} else if (coordinateSystem === "cartesian") {
|
|
27890
27904
|
shaderCoordinateOrigin = [
|
|
27891
27905
|
Math.fround(viewport.center[0]),
|
|
27892
27906
|
Math.fround(viewport.center[1]),
|
|
@@ -27950,12 +27964,12 @@ float smoothedge(float edge, float x) {
|
|
|
27950
27964
|
devicePixelRatio: devicePixelRatio2 = 1,
|
|
27951
27965
|
modelMatrix = null,
|
|
27952
27966
|
// Match Layer.defaultProps
|
|
27953
|
-
coordinateSystem =
|
|
27967
|
+
coordinateSystem = "default",
|
|
27954
27968
|
coordinateOrigin = DEFAULT_COORDINATE_ORIGIN,
|
|
27955
27969
|
autoWrapLongitude = false
|
|
27956
27970
|
}) {
|
|
27957
|
-
if (coordinateSystem ===
|
|
27958
|
-
coordinateSystem = viewport.isGeospatial ?
|
|
27971
|
+
if (coordinateSystem === "default") {
|
|
27972
|
+
coordinateSystem = viewport.isGeospatial ? "lnglat" : "cartesian";
|
|
27959
27973
|
}
|
|
27960
27974
|
const uniforms = getMemoizedViewportUniforms({
|
|
27961
27975
|
viewport,
|
|
@@ -27989,7 +28003,7 @@ float smoothedge(float edge, float x) {
|
|
|
27989
28003
|
const focalDistance = vec4_exports.transformMat4([], [0, 0, -viewport.focalDistance, 1], viewport.projectionMatrix)[3] || 1;
|
|
27990
28004
|
const uniforms = {
|
|
27991
28005
|
// Projection mode values
|
|
27992
|
-
coordinateSystem,
|
|
28006
|
+
coordinateSystem: getShaderCoordinateSystem(coordinateSystem),
|
|
27993
28007
|
projectionMode: viewport.projectionMode,
|
|
27994
28008
|
coordinateOrigin: shaderCoordinateOrigin,
|
|
27995
28009
|
commonOrigin: originCommon.slice(0, 3),
|
|
@@ -28016,19 +28030,19 @@ float smoothedge(float edge, float x) {
|
|
|
28016
28030
|
if (geospatialOrigin) {
|
|
28017
28031
|
const distanceScalesAtOrigin = viewport.getDistanceScales(geospatialOrigin);
|
|
28018
28032
|
switch (coordinateSystem) {
|
|
28019
|
-
case
|
|
28033
|
+
case "meter-offsets":
|
|
28020
28034
|
uniforms.commonUnitsPerWorldUnit = distanceScalesAtOrigin.unitsPerMeter;
|
|
28021
28035
|
uniforms.commonUnitsPerWorldUnit2 = distanceScalesAtOrigin.unitsPerMeter2;
|
|
28022
28036
|
break;
|
|
28023
|
-
case
|
|
28024
|
-
case
|
|
28037
|
+
case "lnglat":
|
|
28038
|
+
case "lnglat-offsets":
|
|
28025
28039
|
if (!viewport._pseudoMeters) {
|
|
28026
28040
|
uniforms.commonUnitsPerMeter = distanceScalesAtOrigin.unitsPerMeter;
|
|
28027
28041
|
}
|
|
28028
28042
|
uniforms.commonUnitsPerWorldUnit = distanceScalesAtOrigin.unitsPerDegree;
|
|
28029
28043
|
uniforms.commonUnitsPerWorldUnit2 = distanceScalesAtOrigin.unitsPerDegree2;
|
|
28030
28044
|
break;
|
|
28031
|
-
case
|
|
28045
|
+
case "cartesian":
|
|
28032
28046
|
uniforms.commonUnitsPerWorldUnit = [1, 1, distanceScalesAtOrigin.unitsPerMeter[2]];
|
|
28033
28047
|
uniforms.commonUnitsPerWorldUnit2 = [0, 0, distanceScalesAtOrigin.unitsPerMeter2[2]];
|
|
28034
28048
|
break;
|
|
@@ -28040,7 +28054,16 @@ float smoothedge(float edge, float x) {
|
|
|
28040
28054
|
}
|
|
28041
28055
|
|
|
28042
28056
|
// src/shaderlib/project/project.wgsl.ts
|
|
28043
|
-
var
|
|
28057
|
+
var SHADER_COORDINATE_SYSTEMS = [
|
|
28058
|
+
"default",
|
|
28059
|
+
"lnglat",
|
|
28060
|
+
"meter-offsets",
|
|
28061
|
+
"lnglat-offsets",
|
|
28062
|
+
"cartesian"
|
|
28063
|
+
];
|
|
28064
|
+
var COORDINATE_SYSTEM_WGSL_CONSTANTS = SHADER_COORDINATE_SYSTEMS.map(
|
|
28065
|
+
(coordinateSystem) => `const COORDINATE_SYSTEM_${coordinateSystem.toUpperCase().replaceAll("-", "_")}: i32 = ${getShaderCoordinateSystem(coordinateSystem)};`
|
|
28066
|
+
).join("");
|
|
28044
28067
|
var PROJECTION_MODE_WGSL_CONSTANTS = Object.keys(PROJECTION_MODE).map((key) => `const PROJECTION_MODE_${key}: i32 = ${PROJECTION_MODE[key]};`).join("");
|
|
28045
28068
|
var UNIT_WGSL_CONSTANTS = Object.keys(UNIT).map((key) => `const UNIT_${key.toUpperCase()}: i32 = ${UNIT[key]};`).join("");
|
|
28046
28069
|
var projectWGSLHeader = (
|
|
@@ -28334,7 +28357,16 @@ fn project_pixel_size_vec2(pixels: vec2<f32>) -> vec2<f32> {
|
|
|
28334
28357
|
);
|
|
28335
28358
|
|
|
28336
28359
|
// src/shaderlib/project/project.glsl.ts
|
|
28337
|
-
var
|
|
28360
|
+
var SHADER_COORDINATE_SYSTEMS2 = [
|
|
28361
|
+
"default",
|
|
28362
|
+
"lnglat",
|
|
28363
|
+
"meter-offsets",
|
|
28364
|
+
"lnglat-offsets",
|
|
28365
|
+
"cartesian"
|
|
28366
|
+
];
|
|
28367
|
+
var COORDINATE_SYSTEM_GLSL_CONSTANTS = SHADER_COORDINATE_SYSTEMS2.map(
|
|
28368
|
+
(coordinateSystem) => `const int COORDINATE_SYSTEM_${coordinateSystem.toUpperCase().replaceAll("-", "_")} = ${getShaderCoordinateSystem(coordinateSystem)};`
|
|
28369
|
+
).join("");
|
|
28338
28370
|
var PROJECTION_MODE_GLSL_CONSTANTS = Object.keys(PROJECTION_MODE).map((key) => `const int PROJECTION_MODE_${key} = ${PROJECTION_MODE[key]};`).join("");
|
|
28339
28371
|
var UNIT_GLSL_CONSTANTS = Object.keys(UNIT).map((key) => `const int UNIT_${key.toUpperCase()} = ${UNIT[key]};`).join("");
|
|
28340
28372
|
var projectGLSL = (
|
|
@@ -29242,7 +29274,7 @@ ${fragment}
|
|
|
29242
29274
|
for (let i = 0; i < opts.shadowMatrices.length; i++) {
|
|
29243
29275
|
const viewProjectionMatrix = viewProjectionMatrices[i];
|
|
29244
29276
|
const viewProjectionMatrixCentered = viewProjectionMatrix.clone().translate(new Vector3(projectProps.viewport.center).negate());
|
|
29245
|
-
if (projectUniforms.coordinateSystem ===
|
|
29277
|
+
if (projectUniforms.coordinateSystem === getShaderCoordinateSystem("lnglat") && projectUniforms.projectionMode === PROJECTION_MODE.WEB_MERCATOR) {
|
|
29246
29278
|
viewProjectionMatrices[i] = viewProjectionMatrixCentered;
|
|
29247
29279
|
projectCenters[i] = center;
|
|
29248
29280
|
} else {
|
|
@@ -29302,7 +29334,7 @@ ${fragment}
|
|
|
29302
29334
|
isActive: f32,
|
|
29303
29335
|
isAttribute: f32,
|
|
29304
29336
|
isHighlightActive: f32,
|
|
29305
|
-
|
|
29337
|
+
useByteColors: f32,
|
|
29306
29338
|
highlightedObjectColor: vec3<f32>,
|
|
29307
29339
|
highlightColor: vec4<f32>,
|
|
29308
29340
|
};
|
|
@@ -29310,11 +29342,11 @@ ${fragment}
|
|
|
29310
29342
|
@group(0) @binding(auto) var<uniform> picking: pickingUniforms;
|
|
29311
29343
|
|
|
29312
29344
|
fn picking_normalizeColor(color: vec3<f32>) -> vec3<f32> {
|
|
29313
|
-
return select(color / 255.0,
|
|
29345
|
+
return select(color, color / 255.0, picking.useByteColors > 0.5);
|
|
29314
29346
|
}
|
|
29315
29347
|
|
|
29316
29348
|
fn picking_normalizeColor4(color: vec4<f32>) -> vec4<f32> {
|
|
29317
|
-
return select(color / 255.0,
|
|
29349
|
+
return select(color, color / 255.0, picking.useByteColors > 0.5);
|
|
29318
29350
|
}
|
|
29319
29351
|
|
|
29320
29352
|
fn picking_isColorZero(color: vec3<f32>) -> bool {
|
|
@@ -29329,7 +29361,7 @@ fn picking_isColorValid(color: vec3<f32>) -> bool {
|
|
|
29329
29361
|
var picking_default = {
|
|
29330
29362
|
...picking,
|
|
29331
29363
|
source: sourceWGSL,
|
|
29332
|
-
defaultUniforms: { ...picking.defaultUniforms,
|
|
29364
|
+
defaultUniforms: { ...picking.defaultUniforms, useByteColors: true },
|
|
29333
29365
|
inject: {
|
|
29334
29366
|
"vs:DECKGL_FILTER_GL_POSITION": `
|
|
29335
29367
|
// for picking depth values
|
|
@@ -30709,11 +30741,13 @@ fn picking_isColorValid(color: vec3<f32>) -> bool {
|
|
|
30709
30741
|
function normalizeParameters(opts) {
|
|
30710
30742
|
const { viewport, modelMatrix, coordinateOrigin } = opts;
|
|
30711
30743
|
let { coordinateSystem, fromCoordinateSystem, fromCoordinateOrigin } = opts;
|
|
30712
|
-
if (coordinateSystem ===
|
|
30713
|
-
coordinateSystem = viewport.isGeospatial ?
|
|
30744
|
+
if (coordinateSystem === "default") {
|
|
30745
|
+
coordinateSystem = viewport.isGeospatial ? "lnglat" : "cartesian";
|
|
30714
30746
|
}
|
|
30715
30747
|
if (fromCoordinateSystem === void 0) {
|
|
30716
30748
|
fromCoordinateSystem = coordinateSystem;
|
|
30749
|
+
} else if (fromCoordinateSystem === "default") {
|
|
30750
|
+
fromCoordinateSystem = viewport.isGeospatial ? "lnglat" : "cartesian";
|
|
30717
30751
|
}
|
|
30718
30752
|
if (fromCoordinateOrigin === void 0) {
|
|
30719
30753
|
fromCoordinateOrigin = coordinateOrigin;
|
|
@@ -30739,23 +30773,32 @@ fn picking_isColorValid(color: vec3<f32>) -> bool {
|
|
|
30739
30773
|
[x, y, z] = vec4_exports.transformMat4([], [x, y, z, 1], modelMatrix);
|
|
30740
30774
|
}
|
|
30741
30775
|
switch (coordinateSystem) {
|
|
30742
|
-
case
|
|
30776
|
+
case "default":
|
|
30777
|
+
return getWorldPosition(position, {
|
|
30778
|
+
viewport,
|
|
30779
|
+
modelMatrix,
|
|
30780
|
+
coordinateSystem: viewport.isGeospatial ? "lnglat" : "cartesian",
|
|
30781
|
+
coordinateOrigin,
|
|
30782
|
+
offsetMode
|
|
30783
|
+
});
|
|
30784
|
+
case "lnglat":
|
|
30743
30785
|
return lngLatZToWorldPosition([x, y, z], viewport, offsetMode);
|
|
30744
|
-
case
|
|
30786
|
+
case "lnglat-offsets":
|
|
30745
30787
|
return lngLatZToWorldPosition(
|
|
30746
30788
|
[x + coordinateOrigin[0], y + coordinateOrigin[1], z + (coordinateOrigin[2] || 0)],
|
|
30747
30789
|
viewport,
|
|
30748
30790
|
offsetMode
|
|
30749
30791
|
);
|
|
30750
|
-
case
|
|
30792
|
+
case "meter-offsets":
|
|
30751
30793
|
return lngLatZToWorldPosition(
|
|
30752
30794
|
addMetersToLngLat(coordinateOrigin, [x, y, z]),
|
|
30753
30795
|
viewport,
|
|
30754
30796
|
offsetMode
|
|
30755
30797
|
);
|
|
30756
|
-
case
|
|
30757
|
-
default:
|
|
30798
|
+
case "cartesian":
|
|
30758
30799
|
return viewport.isGeospatial ? [x + coordinateOrigin[0], y + coordinateOrigin[1], z + coordinateOrigin[2]] : viewport.projectPosition([x, y, z]);
|
|
30800
|
+
default:
|
|
30801
|
+
throw new Error(`Invalid coordinateSystem: ${coordinateSystem}`);
|
|
30759
30802
|
}
|
|
30760
30803
|
}
|
|
30761
30804
|
function projectPosition(position, params) {
|
|
@@ -37204,10 +37247,14 @@ void main() {
|
|
|
37204
37247
|
}
|
|
37205
37248
|
if (!this.value) {
|
|
37206
37249
|
} else if (this.constant || !this.buffer || this.buffer.byteLength < this.value.byteLength + this.byteOffset) {
|
|
37207
|
-
this.
|
|
37208
|
-
|
|
37209
|
-
|
|
37210
|
-
|
|
37250
|
+
if (this.constant) {
|
|
37251
|
+
this.setConstantValue(context, this.value);
|
|
37252
|
+
} else {
|
|
37253
|
+
this.setData({
|
|
37254
|
+
value: this.value,
|
|
37255
|
+
constant: this.constant
|
|
37256
|
+
});
|
|
37257
|
+
}
|
|
37211
37258
|
this.constant = false;
|
|
37212
37259
|
} else {
|
|
37213
37260
|
for (const [startRow, endRow] of updateRanges) {
|
|
@@ -37227,17 +37274,13 @@ void main() {
|
|
|
37227
37274
|
// Use generic value
|
|
37228
37275
|
// Returns true if successful
|
|
37229
37276
|
setConstantValue(context, value) {
|
|
37230
|
-
|
|
37231
|
-
if (isWebGPU || value === void 0 || typeof value === "function") {
|
|
37232
|
-
if (isWebGPU && typeof value !== "function") {
|
|
37233
|
-
const normalisedValue = this._normalizeValue(value, [], 0);
|
|
37234
|
-
if (!this._areValuesEqual(normalisedValue, this.value)) {
|
|
37235
|
-
this.setNeedsUpdate("WebGPU constant updated");
|
|
37236
|
-
}
|
|
37237
|
-
}
|
|
37277
|
+
if (value === void 0 || typeof value === "function") {
|
|
37238
37278
|
return false;
|
|
37239
37279
|
}
|
|
37240
37280
|
const transformedValue = this.settings.transform && context ? this.settings.transform.call(context, value) : value;
|
|
37281
|
+
if (this.device.type === "webgpu") {
|
|
37282
|
+
return this.setConstantBufferValue(transformedValue, this.numInstances);
|
|
37283
|
+
}
|
|
37241
37284
|
const hasChanged = this.setData({ constant: true, value: transformedValue });
|
|
37242
37285
|
if (hasChanged) {
|
|
37243
37286
|
this.setNeedsRedraw();
|
|
@@ -37245,6 +37288,41 @@ void main() {
|
|
|
37245
37288
|
this.clearNeedsUpdate();
|
|
37246
37289
|
return true;
|
|
37247
37290
|
}
|
|
37291
|
+
setConstantBufferValue(value, numInstances) {
|
|
37292
|
+
const ArrayType = this.settings.defaultType;
|
|
37293
|
+
const constantValue = this._normalizeValue(value, new ArrayType(this.size), 0);
|
|
37294
|
+
if (this._hasConstantBufferValue(constantValue, numInstances)) {
|
|
37295
|
+
this.constant = false;
|
|
37296
|
+
this.clearNeedsUpdate();
|
|
37297
|
+
return false;
|
|
37298
|
+
}
|
|
37299
|
+
const repeatedValue = new ArrayType(Math.max(numInstances, 1) * this.size);
|
|
37300
|
+
for (let i = 0; i < repeatedValue.length; i += this.size) {
|
|
37301
|
+
repeatedValue.set(constantValue, i);
|
|
37302
|
+
}
|
|
37303
|
+
const hasChanged = this.setData({ value: repeatedValue });
|
|
37304
|
+
this.constant = false;
|
|
37305
|
+
this.clearNeedsUpdate();
|
|
37306
|
+
if (hasChanged) {
|
|
37307
|
+
this.setNeedsRedraw();
|
|
37308
|
+
}
|
|
37309
|
+
return hasChanged;
|
|
37310
|
+
}
|
|
37311
|
+
_hasConstantBufferValue(value, numInstances) {
|
|
37312
|
+
const currentValue = this.value;
|
|
37313
|
+
const expectedLength = Math.max(numInstances, 1) * this.size;
|
|
37314
|
+
if (!ArrayBuffer.isView(currentValue) || currentValue.length !== expectedLength || currentValue.length % this.size !== 0) {
|
|
37315
|
+
return false;
|
|
37316
|
+
}
|
|
37317
|
+
for (let i = 0; i < currentValue.length; i += this.size) {
|
|
37318
|
+
for (let j = 0; j < this.size; j++) {
|
|
37319
|
+
if (currentValue[i + j] !== value[j]) {
|
|
37320
|
+
return false;
|
|
37321
|
+
}
|
|
37322
|
+
}
|
|
37323
|
+
}
|
|
37324
|
+
return true;
|
|
37325
|
+
}
|
|
37248
37326
|
// Use external buffer
|
|
37249
37327
|
// Returns true if successful
|
|
37250
37328
|
// eslint-disable-next-line max-statements
|
|
@@ -37353,18 +37431,10 @@ void main() {
|
|
|
37353
37431
|
props,
|
|
37354
37432
|
numInstances
|
|
37355
37433
|
}) {
|
|
37356
|
-
if (attribute.constant) {
|
|
37357
|
-
if (this.context.device.type !== "webgpu") {
|
|
37358
|
-
return;
|
|
37359
|
-
}
|
|
37360
|
-
}
|
|
37361
37434
|
const { settings, state, value, size, startIndices } = attribute;
|
|
37362
37435
|
const { accessor, transform } = settings;
|
|
37363
|
-
|
|
37436
|
+
const accessorFunc = state.binaryAccessor || // @ts-ignore
|
|
37364
37437
|
(typeof accessor === "function" ? accessor : props[accessor]);
|
|
37365
|
-
if (typeof accessorFunc !== "function" && typeof accessor === "string") {
|
|
37366
|
-
accessorFunc = () => props[accessor];
|
|
37367
|
-
}
|
|
37368
37438
|
assert9(typeof accessorFunc === "function", `accessor "${accessor}" is not a function`);
|
|
37369
37439
|
let i = attribute.getVertexOffset(startRow);
|
|
37370
37440
|
const { iterable, objectInfo } = createIterable(data, startRow, endRow);
|
|
@@ -39520,7 +39590,7 @@ void main(void) {
|
|
|
39520
39590
|
onDragStart: { type: "function", value: null, optional: true },
|
|
39521
39591
|
onDrag: { type: "function", value: null, optional: true },
|
|
39522
39592
|
onDragEnd: { type: "function", value: null, optional: true },
|
|
39523
|
-
coordinateSystem:
|
|
39593
|
+
coordinateSystem: "default",
|
|
39524
39594
|
coordinateOrigin: { type: "array", value: [0, 0, 0], compare: true },
|
|
39525
39595
|
modelMatrix: { type: "array", value: null, compare: true, optional: true },
|
|
39526
39596
|
wrapLongitude: false,
|
|
@@ -39664,7 +39734,7 @@ void main(void) {
|
|
|
39664
39734
|
}
|
|
39665
39735
|
use64bitPositions() {
|
|
39666
39736
|
const { coordinateSystem } = this.props;
|
|
39667
|
-
return coordinateSystem ===
|
|
39737
|
+
return coordinateSystem === "default" || coordinateSystem === "lnglat" || coordinateSystem === "cartesian";
|
|
39668
39738
|
}
|
|
39669
39739
|
// Event handling
|
|
39670
39740
|
onHover(info, pickingEvent) {
|
|
@@ -40044,7 +40114,6 @@ void main(void) {
|
|
|
40044
40114
|
/* (Internal) Called by layer manager when a new layer is found */
|
|
40045
40115
|
_initialize() {
|
|
40046
40116
|
assert9(!this.internalState);
|
|
40047
|
-
assert9(Number.isFinite(this.props.coordinateSystem));
|
|
40048
40117
|
debug(TRACE_INITIALIZE, this);
|
|
40049
40118
|
const attributeManager = this._getAttributeManager();
|
|
40050
40119
|
if (attributeManager) {
|