belowjs 1.7.4 → 1.7.5
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/CHANGELOG.md +15 -5
- package/README.md +3 -3
- package/dist/belowjs.js +97 -34
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,15 +5,25 @@ All notable changes to BelowJS will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [1.7.
|
|
8
|
+
## [1.7.5] - 2026-04-28
|
|
9
9
|
|
|
10
10
|
### Changed
|
|
11
|
-
-
|
|
11
|
+
- Improved GLB loading for Sketchfab photogrammetry exports, with more consistent material handling and cleaner shading.
|
|
12
|
+
- In the guides, clarified how to load directly from [Sketchfab GLB exports](docs/guides/sketchfab-models.html).
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- Reduced texture banding and glossy-material bleed-through on photogrammetry and comparison heatmap views.
|
|
16
|
+
- Model comparison camera locking now waits for a valid alignment solve.
|
|
17
|
+
- Pressing `0` in model comparison reframes the loaded model view.
|
|
18
|
+
- Improved model comparison stability when switching views, dragging markers, and running C2C or height comparisons.
|
|
19
|
+
|
|
20
|
+
## [1.7.4] - 2026-04-28
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- Added the model comparison viewer for aligning two survey models with matched markers, viewing overlay/difference modes, and generating C2C and height comparison maps.
|
|
12
24
|
|
|
13
25
|
### Fixed
|
|
14
|
-
-
|
|
15
|
-
- Large photogrammetry textures no longer show mipmap striping in the viewer.
|
|
16
|
-
- Survey lighting now casts cleaner shadows on close-range photogrammetry surfaces.
|
|
26
|
+
- Survey lighting casts cleaner shadows on close-range photogrammetry surfaces.
|
|
17
27
|
- Long-pressing the viewer on mobile no longer triggers stray text selection, while form controls and editable fields inside the viewer still allow normal text interaction.
|
|
18
28
|
|
|
19
29
|
## [1.7.3] - 2026-03-06
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
📖 **[Full Documentation & Examples](https://patrick-morrison.github.io/belowjs/)**
|
|
8
8
|
|
|
9
|
-
> **Current Version:** `1.7.
|
|
9
|
+
> **Current Version:** `1.7.5` - Sketchfab GLB loading and model comparison polish.
|
|
10
10
|
|
|
11
11
|
**Dive Shipwrecks in Virtual Reality**
|
|
12
12
|
|
|
@@ -60,11 +60,11 @@ This gives you a complete VR-ready 3D viewer with dive lighting, measurement too
|
|
|
60
60
|
{
|
|
61
61
|
"imports": {
|
|
62
62
|
"three": "https://cdn.jsdelivr.net/npm/three@0.179.1/+esm",
|
|
63
|
-
"belowjs": "https://cdn.jsdelivr.net/npm/belowjs@1.7.
|
|
63
|
+
"belowjs": "https://cdn.jsdelivr.net/npm/belowjs@1.7.5/dist/belowjs.js"
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
</script>
|
|
67
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/belowjs@1.7.
|
|
67
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/belowjs@1.7.5/dist/belowjs.css">
|
|
68
68
|
<style>
|
|
69
69
|
body, html { margin: 0; padding: 0; overflow: hidden; }
|
|
70
70
|
</style>
|
package/dist/belowjs.js
CHANGED
|
@@ -3723,40 +3723,19 @@ class ee {
|
|
|
3723
3723
|
});
|
|
3724
3724
|
}
|
|
3725
3725
|
processModel(e) {
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
color: r.color || new f.Color(16777215),
|
|
3736
|
-
side: r.side !== void 0 ? r.side : f.FrontSide,
|
|
3737
|
-
wireframe: r.wireframe || !1,
|
|
3738
|
-
vertexColors: r.vertexColors || !1,
|
|
3739
|
-
fog: r.fog !== void 0 ? r.fog : !0,
|
|
3740
|
-
flatShading: !1,
|
|
3741
|
-
// Realistic shipwreck appearance
|
|
3742
|
-
roughness: 0.8,
|
|
3743
|
-
// Weathered, corroded metal/wood
|
|
3744
|
-
metalness: 0.3
|
|
3745
|
-
// Mix of metal and non-metal
|
|
3746
|
-
});
|
|
3747
|
-
r.map && (A.map = r.map), r.alphaMap && (A.alphaMap = r.alphaMap), r.aoMap && (A.aoMap = r.aoMap), typeof r.aoMapIntensity == "number" && (A.aoMapIntensity = r.aoMapIntensity), r.envMap && (A.envMap = r.envMap), r.roughnessMap && (A.roughnessMap = r.roughnessMap), r.metalnessMap && (A.metalnessMap = r.metalnessMap), r.transparent !== void 0 && (A.transparent = r.transparent), typeof r.opacity == "number" && (A.opacity = r.opacity), r.normalMap && (A.normalMap = r.normalMap, A.normalScale = r.normalScale || new f.Vector2(1, 1)), ["map", "normalMap", "roughnessMap", "metalnessMap", "aoMap"].forEach((d) => {
|
|
3748
|
-
A[d] && this.processTexture(A[d], s, { disableMipmaps: d === "map" });
|
|
3749
|
-
}), A.needsUpdate = !0, Array.isArray(n.material) ? n.material[l] = A : n.material = A, r !== A && typeof r?.dispose == "function" && r.dispose();
|
|
3750
|
-
} else (r.type === "MeshStandardMaterial" || r.type === "MeshPhysicalMaterial") && (["map", "normalMap", "roughnessMap", "metalnessMap", "aoMap", "emissiveMap"].forEach((h) => {
|
|
3751
|
-
r[h] && this.processTexture(r[h], s, { disableMipmaps: h === "map" });
|
|
3752
|
-
}), r.needsUpdate = !0);
|
|
3753
|
-
const c = Array.isArray(n.material) ? n.material[l] : n.material;
|
|
3754
|
-
c && c.needsUpdate !== void 0 && (c.needsUpdate = !0);
|
|
3755
|
-
}), n.geometry && (n.geometry.attributes?.normal || n.geometry.computeVertexNormals(), n.geometry.normalizeNormals(), o.some((l) => l.normalMap) && this.canComputeTangents(n.geometry) && n.geometry.computeTangents());
|
|
3726
|
+
let t = e.scene;
|
|
3727
|
+
const s = this.getMaxAnisotropy(), i = e.parser || null, n = this.shouldNormalizePhotogrammetryAtlas(i);
|
|
3728
|
+
n && (t = this.bakeMeshWorldTransforms(t), e.scene = t), t.traverse((r) => {
|
|
3729
|
+
if (r.isLight && (r.visible = !1), r.isMesh && r.material) {
|
|
3730
|
+
r.castShadow = !0, r.receiveShadow = !0;
|
|
3731
|
+
const c = (Array.isArray(r.material) ? r.material : [r.material]).map(
|
|
3732
|
+
(A) => this.normalizeMaterial(A, i, n, s)
|
|
3733
|
+
);
|
|
3734
|
+
r.material = Array.isArray(r.material) ? c : c[0], r.geometry && (n ? r.geometry.computeVertexNormals() : r.geometry.attributes?.normal || r.geometry.computeVertexNormals(), r.geometry.normalizeNormals(), c.some((h) => h?.normalMap) && this.canComputeTangents(r.geometry) && r.geometry.computeTangents());
|
|
3756
3735
|
}
|
|
3757
3736
|
});
|
|
3758
|
-
const
|
|
3759
|
-
return t.userData.boundingBox =
|
|
3737
|
+
const o = new f.Box3().setFromObject(t);
|
|
3738
|
+
return t.userData.boundingBox = o, t;
|
|
3760
3739
|
}
|
|
3761
3740
|
getMaxAnisotropy() {
|
|
3762
3741
|
if (!this.renderer || !this.renderer.capabilities || typeof this.renderer.capabilities.getMaxAnisotropy != "function")
|
|
@@ -3767,8 +3746,92 @@ class ee {
|
|
|
3767
3746
|
processMaterial(e) {
|
|
3768
3747
|
e && e.needsUpdate !== void 0 && (e.needsUpdate = !0);
|
|
3769
3748
|
}
|
|
3770
|
-
|
|
3771
|
-
|
|
3749
|
+
normalizeMaterial(e, t, s, i) {
|
|
3750
|
+
if (!e)
|
|
3751
|
+
return e;
|
|
3752
|
+
this.clearBakedLighting(e);
|
|
3753
|
+
const n = this.getGLTFMaterialDef(t, e), r = s || e.type === "MeshBasicMaterial" || e.type === "MeshPhongMaterial" ? this.createStandardMaterial(e, n, s) : e;
|
|
3754
|
+
return this.processMaterialTextures(r, i, s), r.needsUpdate !== void 0 && (r.needsUpdate = !0), e !== r && typeof e.dispose == "function" && e.dispose(), r;
|
|
3755
|
+
}
|
|
3756
|
+
clearBakedLighting(e) {
|
|
3757
|
+
e.emissive && e.emissive.setHex(0), e.emissiveIntensity !== void 0 && (e.emissiveIntensity = 0), e.emissiveMap && (e.emissiveMap = null), e.lightMap && (e.lightMap = null), e.lightMapIntensity !== void 0 && (e.lightMapIntensity = 0);
|
|
3758
|
+
}
|
|
3759
|
+
createStandardMaterial(e, t, s) {
|
|
3760
|
+
const i = t?.pbrMetallicRoughness || {}, n = e.color?.clone?.() || new f.Color(16777215), o = new f.MeshStandardMaterial({
|
|
3761
|
+
color: n,
|
|
3762
|
+
side: s ? f.FrontSide : e.side ?? f.FrontSide,
|
|
3763
|
+
wireframe: e.wireframe || !1,
|
|
3764
|
+
vertexColors: e.vertexColors || !1,
|
|
3765
|
+
fog: e.fog ?? !0,
|
|
3766
|
+
flatShading: !1,
|
|
3767
|
+
roughness: s ? 1 : i.roughnessFactor ?? e.roughness ?? 0.8,
|
|
3768
|
+
metalness: s ? 0 : i.metallicFactor ?? e.metalness ?? 0.3
|
|
3769
|
+
});
|
|
3770
|
+
return e.map && (o.map = e.map), e.alphaMap && (o.alphaMap = e.alphaMap), e.transparent !== void 0 && (o.transparent = e.transparent), typeof e.opacity == "number" && (o.opacity = e.opacity), s || (e.aoMap && (o.aoMap = e.aoMap), typeof e.aoMapIntensity == "number" && (o.aoMapIntensity = e.aoMapIntensity), e.envMap && (o.envMap = e.envMap), e.roughnessMap && (o.roughnessMap = e.roughnessMap), e.metalnessMap && (o.metalnessMap = e.metalnessMap), e.normalMap && (o.normalMap = e.normalMap, o.normalScale = e.normalScale || new f.Vector2(1, 1))), o;
|
|
3771
|
+
}
|
|
3772
|
+
processMaterialTextures(e, t, s) {
|
|
3773
|
+
[
|
|
3774
|
+
"map",
|
|
3775
|
+
"alphaMap",
|
|
3776
|
+
"normalMap",
|
|
3777
|
+
"roughnessMap",
|
|
3778
|
+
"metalnessMap",
|
|
3779
|
+
"aoMap",
|
|
3780
|
+
"emissiveMap"
|
|
3781
|
+
].forEach((n) => {
|
|
3782
|
+
e[n] && this.processTexture(e[n], t, {
|
|
3783
|
+
fixPhotogrammetryAtlas: s && n === "map"
|
|
3784
|
+
});
|
|
3785
|
+
});
|
|
3786
|
+
}
|
|
3787
|
+
getGLTFMaterialDef(e, t) {
|
|
3788
|
+
const s = e?.associations?.get?.(t)?.materials;
|
|
3789
|
+
return s == null ? null : e?.json?.materials?.[s] || null;
|
|
3790
|
+
}
|
|
3791
|
+
shouldNormalizePhotogrammetryAtlas(e) {
|
|
3792
|
+
const t = e?.json;
|
|
3793
|
+
if (!t)
|
|
3794
|
+
return !1;
|
|
3795
|
+
const s = t.materials || [], i = t.meshes || [], n = t.accessors || [];
|
|
3796
|
+
if (!s.length || !i.length)
|
|
3797
|
+
return !1;
|
|
3798
|
+
const o = s.some(
|
|
3799
|
+
(c) => c?.pbrMetallicRoughness?.baseColorTexture !== void 0
|
|
3800
|
+
), r = s.some(
|
|
3801
|
+
(c) => c?.normalTexture || c?.occlusionTexture || c?.emissiveTexture || c?.pbrMetallicRoughness?.metallicRoughnessTexture
|
|
3802
|
+
);
|
|
3803
|
+
if (!o || r)
|
|
3804
|
+
return !1;
|
|
3805
|
+
let l = 0;
|
|
3806
|
+
for (const c of i)
|
|
3807
|
+
for (const A of c.primitives || []) {
|
|
3808
|
+
if (A?.attributes?.POSITION === void 0 || A.attributes.TEXCOORD_0 === void 0)
|
|
3809
|
+
return !1;
|
|
3810
|
+
const h = n[A.attributes.POSITION]?.count || 0, d = A.indices !== void 0 ? n[A.indices]?.count || 0 : h;
|
|
3811
|
+
l += Math.floor(d / 3);
|
|
3812
|
+
}
|
|
3813
|
+
return l >= 5e4;
|
|
3814
|
+
}
|
|
3815
|
+
bakeMeshWorldTransforms(e) {
|
|
3816
|
+
if (!e)
|
|
3817
|
+
return e;
|
|
3818
|
+
e.updateMatrixWorld(!0);
|
|
3819
|
+
const t = new f.Group();
|
|
3820
|
+
t.name = e.name || "BakedPhotogrammetryModel", t.userData = { ...e.userData, bakedWorldTransforms: !0 };
|
|
3821
|
+
const s = [];
|
|
3822
|
+
e.traverse((n) => {
|
|
3823
|
+
n.isMesh && s.push(n);
|
|
3824
|
+
});
|
|
3825
|
+
const i = /* @__PURE__ */ new Set();
|
|
3826
|
+
return s.forEach((n) => {
|
|
3827
|
+
const o = n.matrixWorld.clone(), r = n.geometry;
|
|
3828
|
+
r && (i.add(r), n.geometry = r.clone(), n.geometry.applyMatrix4(o)), n.position.set(0, 0, 0), n.quaternion.identity(), n.scale.set(1, 1, 1), n.matrix.identity(), n.matrixWorld.identity(), n.matrixAutoUpdate = !0, t.add(n);
|
|
3829
|
+
}), i.forEach((n) => {
|
|
3830
|
+
typeof n?.dispose == "function" && n.dispose();
|
|
3831
|
+
}), t.updateMatrixWorld(!0), t;
|
|
3832
|
+
}
|
|
3833
|
+
processTexture(e, t = null, { fixPhotogrammetryAtlas: s = !1 } = {}) {
|
|
3834
|
+
e && (t !== null && (e.anisotropy = t), s && (e.isCompressedTexture || (e.generateMipmaps = !1), e.minFilter = f.LinearFilter, e.wrapS = f.ClampToEdgeWrapping, e.wrapT = f.ClampToEdgeWrapping), e.needsUpdate = !0);
|
|
3772
3835
|
}
|
|
3773
3836
|
canComputeTangents(e) {
|
|
3774
3837
|
return !!(e?.index && e.attributes?.position && e.attributes?.normal && e.attributes?.uv);
|
package/package.json
CHANGED