hilbert-chart-3d 0.6.1 → 0.7.0
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/README.md +1 -1
- package/dist/hilbert-chart-3d.d.ts +2 -2
- package/dist/hilbert-chart-3d.js +168 -121
- package/dist/hilbert-chart-3d.js.map +1 -1
- package/dist/hilbert-chart-3d.min.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ new HilbertChart3D(<domElement>, { configOptions })
|
|
|
71
71
|
### Render control
|
|
72
72
|
| Method | Description | Default |
|
|
73
73
|
| --- | --- | :--: |
|
|
74
|
-
| <b>useInstancedMeshes</b>([<i>boolean</i>]) | Getter/setter for whether to render compatible segments with [THREE.InstancedMesh](https://threejs.org/docs/#InstancedMesh) to reduce draw calls.
|
|
74
|
+
| <b>useInstancedMeshes</b>([<i>boolean</i> or <i>fn</i>]) | Getter/setter for whether to render compatible segments with [THREE.InstancedMesh](https://threejs.org/docs/#InstancedMesh) to reduce draw calls. Accepts a boolean or a function of the datum. Recommended for very large datasets. Segments that cannot be instanced use regular meshes. | `false` |
|
|
75
75
|
| <b>zoomToFit</b>([<i>ms</i>], [<i>px</i>]) | Automatically moves the camera so that all of the hilbert segments become visible within its field of view. It accepts two optional arguments: the first defines the duration of the transition (in ms) to animate the camera motion (default: 0ms). The second argument is the amount of padding (in px) between the edge of the canvas and the outermost node location (default: 10px). | `(0, 10)` |
|
|
76
76
|
| <b>focusOn</b>(<i>pos</i>, <i>length</i>, [<i>ms</i>]) | Zoom-in on a particular area of the chart, defined by [`pos`, `pos+length-1`]. `pos` and `length` may be Numbers or BigInts. An optional 3rd argument defines the duration of the transition (in ms) to animate the zooming motion. A value of 0 (default) jumps immediately to the final position. ||
|
|
77
77
|
| <b>cameraPosition</b>([<i>{x,y,z}</i>], [<i>lookAt</i>], [<i>ms</i>]) | Getter/setter for the camera position, in terms of `x`, `y`, `z` coordinates. Each of the coordinates is optional, allowing for motion in just some dimensions. The optional second argument can be used to define the direction that the camera should aim at, in terms of an `{x,y,z}` point in the 3D space. The 3rd optional argument defines the duration of the transition (in ms) to animate the camera motion. A value of 0 (default) moves the camera immediately to the final position. | |
|
|
@@ -48,8 +48,8 @@ declare class HilbertChart<R extends RangeBounds = Range> {
|
|
|
48
48
|
valFormatter(formatter: NumFormatter): HilbertChart<R>;
|
|
49
49
|
simplifyCurves(): boolean;
|
|
50
50
|
simplifyCurves(simplifyCurves: boolean): HilbertChart<R>;
|
|
51
|
-
useInstancedMeshes(): boolean
|
|
52
|
-
useInstancedMeshes(
|
|
51
|
+
useInstancedMeshes(): RangeAccessor<R, boolean>;
|
|
52
|
+
useInstancedMeshes(useInstancedMeshesAccessor: RangeAccessor<R, boolean>): HilbertChart<R>;
|
|
53
53
|
|
|
54
54
|
focusOn(pos: NumericValue, length: NumericValue, ms?: number): void;
|
|
55
55
|
zoomToFit(ms?: number, padding?: number): HilbertChart<R>;
|
package/dist/hilbert-chart-3d.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 0.
|
|
1
|
+
// Version 0.7.0 hilbert-chart-3d - https://github.com/vasturiano/hilbert-chart-3d
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -152591,11 +152591,23 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
152591
152591
|
glyphTexture.colorSpace = SRGBColorSpace;
|
|
152592
152592
|
return glyphTexture;
|
|
152593
152593
|
}
|
|
152594
|
+
const colorCache = new Map();
|
|
152595
|
+
function getMaterialColor(str) {
|
|
152596
|
+
let materialColor = colorCache.get(str);
|
|
152597
|
+
if (!materialColor) {
|
|
152598
|
+
materialColor = {
|
|
152599
|
+
color: new Color$1(colorStr2Hex(str)),
|
|
152600
|
+
opacity: colorAlpha(str)
|
|
152601
|
+
};
|
|
152602
|
+
colorCache.set(str, materialColor);
|
|
152603
|
+
}
|
|
152604
|
+
return materialColor;
|
|
152605
|
+
}
|
|
152594
152606
|
class LabelAtlas {
|
|
152595
152607
|
constructor(data, labelAccessor, labelColorAccessor) {
|
|
152596
152608
|
const labelIds = new Map();
|
|
152597
152609
|
this.labels = new WeakMap();
|
|
152598
|
-
this.
|
|
152610
|
+
this.materials = new Map();
|
|
152599
152611
|
data.forEach(d => {
|
|
152600
152612
|
const label = labelAccessor(d);
|
|
152601
152613
|
const color = labelColorAccessor(d);
|
|
@@ -152639,71 +152651,82 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
152639
152651
|
isEmpty() {
|
|
152640
152652
|
return this.labelCount === 0;
|
|
152641
152653
|
}
|
|
152642
|
-
tagGeometry(geometry, records,
|
|
152643
|
-
|
|
152654
|
+
tagGeometry(geometry, records, {
|
|
152655
|
+
instanced = false,
|
|
152656
|
+
backgroundColorAccessor,
|
|
152657
|
+
recomputeLabels = true
|
|
152658
|
+
} = {}) {
|
|
152644
152659
|
const vertexCount = geometry.getAttribute('position').count;
|
|
152645
152660
|
const count = instanced ? records.length : vertexCount;
|
|
152646
152661
|
const makeAttribute = (array, itemSize) => instanced ? new InstancedBufferAttribute(array, itemSize) : new Float32BufferAttribute(array, itemSize);
|
|
152647
|
-
|
|
152648
|
-
|
|
152649
|
-
|
|
152650
|
-
|
|
152651
|
-
|
|
152652
|
-
|
|
152653
|
-
|
|
152654
|
-
|
|
152655
|
-
|
|
152656
|
-
|
|
152657
|
-
|
|
152658
|
-
|
|
152659
|
-
|
|
152660
|
-
|
|
152661
|
-
|
|
152662
|
-
|
|
152663
|
-
|
|
152664
|
-
|
|
152665
|
-
|
|
152666
|
-
|
|
152667
|
-
|
|
152668
|
-
|
|
152669
|
-
|
|
152670
|
-
|
|
152671
|
-
|
|
152662
|
+
if (backgroundColorAccessor) {
|
|
152663
|
+
const backgroundColors = new Float32Array(count * 3);
|
|
152664
|
+
const opacities = new Float32Array(count);
|
|
152665
|
+
records.forEach((record, index) => {
|
|
152666
|
+
const {
|
|
152667
|
+
color,
|
|
152668
|
+
opacity
|
|
152669
|
+
} = getMaterialColor(backgroundColorAccessor(record));
|
|
152670
|
+
const start = instanced ? index : 0;
|
|
152671
|
+
const end = instanced ? index + 1 : count;
|
|
152672
|
+
for (let i = start; i < end; i++) {
|
|
152673
|
+
color.toArray(backgroundColors, i * 3);
|
|
152674
|
+
opacities[i] = opacity;
|
|
152675
|
+
}
|
|
152676
|
+
});
|
|
152677
|
+
geometry.setAttribute('backgroundColor', makeAttribute(backgroundColors, 3));
|
|
152678
|
+
geometry.setAttribute('opacity', makeAttribute(opacities, 1));
|
|
152679
|
+
}
|
|
152680
|
+
if (recomputeLabels) {
|
|
152681
|
+
if (this.isEmpty()) return;
|
|
152682
|
+
const ids = new Float32Array(count);
|
|
152683
|
+
const lengths = new Float32Array(count);
|
|
152684
|
+
const colors = new Float32Array(count * 4);
|
|
152685
|
+
const dummyAspectRatio = new Float32Array(count);
|
|
152686
|
+
records.forEach((d, index) => {
|
|
152687
|
+
const label = this.labels.get(d);
|
|
152688
|
+
if (!label) return;
|
|
152689
|
+
const {
|
|
152690
|
+
color,
|
|
152691
|
+
opacity
|
|
152692
|
+
} = getMaterialColor(label.color);
|
|
152693
|
+
const id = label ? label.id : -1;
|
|
152694
|
+
const len = label ? label.length : 0;
|
|
152695
|
+
const start = instanced ? index : 0;
|
|
152696
|
+
const end = instanced ? index + 1 : count;
|
|
152697
|
+
for (let i = start; i < end; i++) {
|
|
152698
|
+
ids[i] = id;
|
|
152699
|
+
lengths[i] = len;
|
|
152700
|
+
colors[i * 4] = color.r;
|
|
152701
|
+
colors[i * 4 + 1] = color.g;
|
|
152702
|
+
colors[i * 4 + 2] = color.b;
|
|
152703
|
+
colors[i * 4 + 3] = opacity;
|
|
152704
|
+
dummyAspectRatio[i] = 2.0;
|
|
152705
|
+
}
|
|
152706
|
+
});
|
|
152707
|
+
geometry.setAttribute('labelId', makeAttribute(ids, 1));
|
|
152708
|
+
geometry.setAttribute('labelLength', makeAttribute(lengths, 1));
|
|
152709
|
+
geometry.setAttribute('labelColor', makeAttribute(colors, 4));
|
|
152710
|
+
if (!geometry.getAttribute('aspectRatio')) {
|
|
152711
|
+
console.warn(`Geometry requires aspectRatio attribute. Setting 2.0 throughout the faces.`);
|
|
152712
|
+
geometry.setAttribute('aspectRatio', makeAttribute(dummyAspectRatio, 1));
|
|
152672
152713
|
}
|
|
152673
|
-
});
|
|
152674
|
-
geometry.setAttribute('labelId', makeAttribute(ids, 1));
|
|
152675
|
-
geometry.setAttribute('labelLength', makeAttribute(lengths, 1));
|
|
152676
|
-
geometry.setAttribute('labelColor', makeAttribute(colors, 4));
|
|
152677
|
-
if (!geometry.getAttribute('aspectRatio')) {
|
|
152678
|
-
console.warn(`Geometry requires aspectRatio attribute. Setting 2.0 throughout the faces.`);
|
|
152679
|
-
geometry.setAttribute('aspectRatio', makeAttribute(dummyAspectRatio, 1));
|
|
152680
152714
|
}
|
|
152681
152715
|
}
|
|
152682
|
-
getMaterial(
|
|
152683
|
-
let material = this.
|
|
152716
|
+
getMaterial(transparent = false) {
|
|
152717
|
+
let material = this.materials.get(transparent);
|
|
152684
152718
|
if (material) return material;
|
|
152685
|
-
material = new MeshLambertMaterial(
|
|
152686
|
-
|
|
152687
|
-
|
|
152688
|
-
|
|
152689
|
-
material.
|
|
152690
|
-
|
|
152691
|
-
|
|
152692
|
-
|
|
152693
|
-
|
|
152694
|
-
|
|
152695
|
-
|
|
152696
|
-
shader.uniforms.labelDataTexture = {
|
|
152697
|
-
value: this.labelTexture
|
|
152698
|
-
};
|
|
152699
|
-
shader.uniforms.labelDataTextureSize = {
|
|
152700
|
-
value: new Vector2(this.labelTexture.image.width, this.labelTexture.image.height)
|
|
152701
|
-
};
|
|
152702
|
-
shader.uniforms.labelLabelsPerRow = {
|
|
152703
|
-
value: this.labelsPerRow
|
|
152704
|
-
};
|
|
152705
|
-
shader.vertexShader = shader.vertexShader.replace('#include <common>', `#include <common>
|
|
152706
|
-
attribute float aspectRatio;
|
|
152719
|
+
material = new MeshLambertMaterial({
|
|
152720
|
+
transparent
|
|
152721
|
+
});
|
|
152722
|
+
this.materials.set(transparent, material);
|
|
152723
|
+
material.onBeforeCompile = shader => {
|
|
152724
|
+
shader.vertexShader = shader.vertexShader.replace('#include <common>', `#include <common>
|
|
152725
|
+
attribute vec3 backgroundColor;
|
|
152726
|
+
attribute float opacity;
|
|
152727
|
+
varying vec3 vBackgroundColor;
|
|
152728
|
+
varying float vOpacity;
|
|
152729
|
+
${!this.isEmpty() ? `attribute float aspectRatio;
|
|
152707
152730
|
attribute vec4 labelColor;
|
|
152708
152731
|
attribute float labelId;
|
|
152709
152732
|
attribute float labelLength;
|
|
@@ -152711,14 +152734,18 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
152711
152734
|
varying vec4 vLabelColor;
|
|
152712
152735
|
varying float vLabelId;
|
|
152713
152736
|
varying float vLabelLength;
|
|
152714
|
-
varying vec2 vLabelUv;`).replace('#include <begin_vertex>', `#include <begin_vertex>
|
|
152715
|
-
|
|
152737
|
+
varying vec2 vLabelUv;` : ''}`).replace('#include <begin_vertex>', `#include <begin_vertex>
|
|
152738
|
+
vBackgroundColor = backgroundColor;
|
|
152739
|
+
vOpacity = opacity;
|
|
152740
|
+
${!this.isEmpty() ? `vAspectRatio = aspectRatio;
|
|
152716
152741
|
vLabelColor = labelColor;
|
|
152717
152742
|
vLabelId = labelId;
|
|
152718
152743
|
vLabelLength = labelLength;
|
|
152719
|
-
vLabelUv = uv;`);
|
|
152720
|
-
|
|
152721
|
-
|
|
152744
|
+
vLabelUv = uv;` : ''}`);
|
|
152745
|
+
shader.fragmentShader = shader.fragmentShader.replace('#include <common>', `#include <common>
|
|
152746
|
+
varying vec3 vBackgroundColor;
|
|
152747
|
+
varying float vOpacity;
|
|
152748
|
+
${!this.isEmpty() ? `uniform sampler2D labelGlyphTexture;
|
|
152722
152749
|
uniform sampler2D labelDataTexture;
|
|
152723
152750
|
uniform vec2 labelDataTextureSize;
|
|
152724
152751
|
uniform float labelLabelsPerRow;
|
|
@@ -152726,7 +152753,27 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
152726
152753
|
varying vec4 vLabelColor;
|
|
152727
152754
|
varying float vLabelId;
|
|
152728
152755
|
varying float vLabelLength;
|
|
152729
|
-
varying vec2 vLabelUv;`).replace('#include <map_fragment>', `#include <map_fragment>
|
|
152756
|
+
varying vec2 vLabelUv;` : ''}`).replace('#include <map_fragment>', `#include <map_fragment>
|
|
152757
|
+
diffuseColor.rgb *= vBackgroundColor;
|
|
152758
|
+
diffuseColor.a *= vOpacity;`);
|
|
152759
|
+
if (this.isEmpty()) return;
|
|
152760
|
+
shader.uniforms.labelGlyphTexture = {
|
|
152761
|
+
value: this.glyphTexture
|
|
152762
|
+
};
|
|
152763
|
+
shader.uniforms.labelDataTexture = {
|
|
152764
|
+
value: this.labelTexture
|
|
152765
|
+
};
|
|
152766
|
+
shader.uniforms.labelDataTextureSize = {
|
|
152767
|
+
value: new Vector2(this.labelTexture.image.width, this.labelTexture.image.height)
|
|
152768
|
+
};
|
|
152769
|
+
shader.uniforms.labelLabelsPerRow = {
|
|
152770
|
+
value: this.labelsPerRow
|
|
152771
|
+
};
|
|
152772
|
+
shader.fragmentShader = shader.fragmentShader.replace(`#include <map_fragment>
|
|
152773
|
+
diffuseColor.rgb *= vBackgroundColor;
|
|
152774
|
+
diffuseColor.a *= vOpacity;`, `#include <map_fragment>
|
|
152775
|
+
diffuseColor.rgb *= vBackgroundColor;
|
|
152776
|
+
diffuseColor.a *= vOpacity;
|
|
152730
152777
|
if (vLabelId >= 0.0 && vLabelUv.x >= 0.0 && vLabelUv.x <= 1.0) {
|
|
152731
152778
|
float aspect = max(vAspectRatio, 0.001);
|
|
152732
152779
|
float visibleLength = vLabelLength;
|
|
@@ -152775,13 +152822,13 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
152775
152822
|
}
|
|
152776
152823
|
}
|
|
152777
152824
|
}`);
|
|
152778
|
-
|
|
152779
|
-
|
|
152780
|
-
}
|
|
152825
|
+
};
|
|
152826
|
+
material.customProgramCacheKey = () => `three-label-glyph-atlas-${this.isEmpty() ? 'empty' : 'labels'}-geometry-color-${transparent}`;
|
|
152781
152827
|
return material;
|
|
152782
152828
|
}
|
|
152783
152829
|
dispose() {
|
|
152784
152830
|
this.labelTexture?.dispose();
|
|
152831
|
+
this.materials.forEach(material => material.dispose());
|
|
152785
152832
|
}
|
|
152786
152833
|
}
|
|
152787
152834
|
|
|
@@ -152825,9 +152872,11 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
152825
152872
|
const geometryCache = new Map();
|
|
152826
152873
|
const fallbackGeometries = new Map();
|
|
152827
152874
|
const batches = new Map();
|
|
152875
|
+
const useInstancingAccessor = index$3(useInstancing);
|
|
152828
152876
|
data.forEach(d => {
|
|
152829
152877
|
const padding = paddingAccessor(d);
|
|
152830
152878
|
const paddingAbsolute = paddingAbsoluteAccessor(d);
|
|
152879
|
+
const useInstancing = useInstancingAccessor(d);
|
|
152831
152880
|
const description = useInstancing && getSimpleHilbertGeometry(order, d.start, d.length, padding, paddingAbsolute, simplifyCurves);
|
|
152832
152881
|
if (!useInstancing || !description) {
|
|
152833
152882
|
// skip instancing
|
|
@@ -152862,7 +152911,7 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
152862
152911
|
scale
|
|
152863
152912
|
});
|
|
152864
152913
|
});
|
|
152865
|
-
const instancedGeometries = Array.from(batches.values());
|
|
152914
|
+
const instancedGeometries = new Map(Array.from(batches.values()).map(batch => [batch.instances.map(i => i.data), batch]));
|
|
152866
152915
|
instancedGeometries.forEach(batch => {
|
|
152867
152916
|
const sourceGeometry = batch.geometry;
|
|
152868
152917
|
batch.geometry = createTemplateGeometry(sourceGeometry, batch.origin, batch.scale);
|
|
@@ -153209,6 +153258,9 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
153209
153258
|
bbox.min.multiplyScalar(SCALE);
|
|
153210
153259
|
bbox.max.multiplyScalar(SCALE);
|
|
153211
153260
|
return bbox;
|
|
153261
|
+
},
|
|
153262
|
+
_destructor: function () {
|
|
153263
|
+
this.prevLabelAtlas?.dispose();
|
|
153212
153264
|
}
|
|
153213
153265
|
},
|
|
153214
153266
|
stateInit() {
|
|
@@ -153241,70 +153293,65 @@ var<${access}> ${ name } : ${ structName };`;
|
|
|
153241
153293
|
const labelAccessor = index$3(state.label);
|
|
153242
153294
|
const labelColorAccessor = index$3(state.labelColor);
|
|
153243
153295
|
const getColor = d => colorAccessor?.(d) || state.defaultColorScale(labelAccessor(d) || '');
|
|
153244
|
-
const
|
|
153296
|
+
const propsChanged = props => props.some(p => changedProps.hasOwnProperty(p));
|
|
153297
|
+
const atlasChanged = propsChanged(['data', 'label', 'labelColor']);
|
|
153298
|
+
const geometriesChanged = propsChanged(['useInstancedMeshes', 'data', 'order', 'padding', 'paddingAbsolute', 'simplifyCurves']);
|
|
153299
|
+
const labelAtlas = atlasChanged ? state.prevLabelAtlas = (state.prevLabelAtlas?.dispose(), new LabelAtlas(state.data, labelAccessor, labelColorAccessor)) : state.prevLabelAtlas;
|
|
153245
153300
|
const {
|
|
153246
153301
|
instancedGeometries,
|
|
153247
153302
|
fallbackGeometries
|
|
153248
|
-
} = createHilbertGeometries({
|
|
153303
|
+
} = geometriesChanged ? state.prevHilbertGeometries = createHilbertGeometries({
|
|
153249
153304
|
useInstancing: state.useInstancedMeshes,
|
|
153250
153305
|
data: state.data,
|
|
153251
153306
|
order: state.order,
|
|
153252
153307
|
paddingAccessor,
|
|
153253
153308
|
paddingAbsoluteAccessor,
|
|
153254
153309
|
simplifyCurves: state.simplifyCurves
|
|
153255
|
-
});
|
|
153256
|
-
|
|
153257
|
-
|
|
153258
|
-
|
|
153259
|
-
geometryBatch.instances.forEach(instance => {
|
|
153260
|
-
// split by color
|
|
153261
|
-
const color = getColor(instance.data);
|
|
153262
|
-
let batch = colorBatches.get(color);
|
|
153263
|
-
if (!batch) {
|
|
153264
|
-
batch = {
|
|
153265
|
-
material: labelAtlas.getMaterial(color),
|
|
153266
|
-
instances: []
|
|
153267
|
-
};
|
|
153268
|
-
colorBatches.set(color, batch);
|
|
153269
|
-
}
|
|
153270
|
-
batch.instances.push(instance);
|
|
153271
|
-
});
|
|
153272
|
-
colorBatches.forEach(({
|
|
153273
|
-
material,
|
|
153310
|
+
}) : state.prevHilbertGeometries;
|
|
153311
|
+
state.instancedDataMapper.onCreateObj(d => {
|
|
153312
|
+
const {
|
|
153313
|
+
geometry,
|
|
153274
153314
|
instances
|
|
153275
|
-
}
|
|
153276
|
-
|
|
153277
|
-
|
|
153278
|
-
|
|
153279
|
-
|
|
153280
|
-
|
|
153281
|
-
|
|
153282
|
-
|
|
153283
|
-
|
|
153284
|
-
|
|
153285
|
-
|
|
153286
|
-
|
|
153287
|
-
|
|
153288
|
-
|
|
153289
|
-
|
|
153290
|
-
matrices[matrixOffset + 14] = position.z;
|
|
153291
|
-
matrices[matrixOffset + 15] = 1;
|
|
153292
|
-
});
|
|
153293
|
-
mesh.instanceMatrix.needsUpdate = true;
|
|
153294
|
-
mesh.computeBoundingSphere();
|
|
153295
|
-
const data = instances.map(instance => instance.data);
|
|
153296
|
-
instancedMeshes.set(data, mesh);
|
|
153315
|
+
} = instancedGeometries.get(d);
|
|
153316
|
+
const mesh = new InstancedMesh(geometry, undefined, d.length);
|
|
153317
|
+
const matrices = mesh.instanceMatrix.array;
|
|
153318
|
+
instances.forEach(({
|
|
153319
|
+
scale,
|
|
153320
|
+
position
|
|
153321
|
+
}, i) => {
|
|
153322
|
+
const matrixOffset = i * 16;
|
|
153323
|
+
matrices[matrixOffset] = scale;
|
|
153324
|
+
matrices[matrixOffset + 5] = scale;
|
|
153325
|
+
matrices[matrixOffset + 10] = scale;
|
|
153326
|
+
matrices[matrixOffset + 12] = position.x;
|
|
153327
|
+
matrices[matrixOffset + 13] = position.y;
|
|
153328
|
+
matrices[matrixOffset + 14] = position.z;
|
|
153329
|
+
matrices[matrixOffset + 15] = 1;
|
|
153297
153330
|
});
|
|
153298
|
-
|
|
153299
|
-
|
|
153300
|
-
|
|
153301
|
-
|
|
153331
|
+
mesh.instanceMatrix.needsUpdate = true;
|
|
153332
|
+
mesh.computeBoundingSphere();
|
|
153333
|
+
return mesh;
|
|
153334
|
+
}).onUpdateObj((mesh, d) => {
|
|
153335
|
+
labelAtlas.tagGeometry(mesh.geometry, d, {
|
|
153336
|
+
instanced: true,
|
|
153337
|
+
backgroundColorAccessor: getColor,
|
|
153338
|
+
recomputeLabels: geometriesChanged || atlasChanged
|
|
153339
|
+
});
|
|
153340
|
+
const transparent = mesh.geometry.getAttribute('opacity').array.some(o => o < 1);
|
|
153341
|
+
mesh.material = labelAtlas.getMaterial(transparent);
|
|
153342
|
+
}).digest([...instancedGeometries.keys()]);
|
|
153302
153343
|
state.fallbackDataMapper.onUpdateObj((obj, d) => {
|
|
153303
|
-
|
|
153304
|
-
|
|
153305
|
-
|
|
153344
|
+
if (geometriesChanged) {
|
|
153345
|
+
obj.geometry?.dispose();
|
|
153346
|
+
obj.geometry = fallbackGeometries.get(d);
|
|
153347
|
+
}
|
|
153348
|
+
labelAtlas.tagGeometry(obj.geometry, [d], {
|
|
153349
|
+
backgroundColorAccessor: getColor,
|
|
153350
|
+
recomputeLabels: geometriesChanged || atlasChanged
|
|
153351
|
+
});
|
|
153352
|
+
const transparent = obj.geometry.getAttribute('opacity').array.some(o => o < 1);
|
|
153353
|
+
obj.material = labelAtlas.getMaterial(transparent);
|
|
153306
153354
|
}).digest([...fallbackGeometries.keys()]);
|
|
153307
|
-
labelAtlas.dispose();
|
|
153308
153355
|
}
|
|
153309
153356
|
});
|
|
153310
153357
|
|