x_ite-sog-parser 1.2.2 → 1.2.4
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 +3 -3
- package/dist/x_ite-sog-parser-2.js +19 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/x_ite-sog-parser)
|
|
4
4
|
[](https://bundlephobia.com/package/x_ite-sog-parser)
|
|
5
|
-
[](https://create3000.github.io/jsdelivr-download-stats/?username=create3000&repository=x_ite)
|
|
5
|
+
[](https://create3000.github.io/jsdelivr-download-stats/?username=create3000&repository=x_ite-sog-parser)
|
|
6
6
|
[](https://npmtrends.com/x_ite-sog-parser)
|
|
7
7
|
|
|
8
8
|
SOG File Format Parser for [X_ITE](https://create3000.github.io/x_ite/) for 3D Gaussian Splatting
|
|
@@ -12,10 +12,10 @@ SOG File Format Parser for [X_ITE](https://create3000.github.io/x_ite/) for 3D G
|
|
|
12
12
|
Include the script before X_ITE:
|
|
13
13
|
|
|
14
14
|
```html
|
|
15
|
-
<script defer src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.2.
|
|
15
|
+
<script defer src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.2.4/dist/x_ite-sog-parser-2.min.js"></script>
|
|
16
16
|
<script defer src="https://cdn.jsdelivr.net/npm/x_ite@VERSION/dist/x_ite.min.js"></script>
|
|
17
17
|
<!-- or as ES module -->
|
|
18
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.2.
|
|
18
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.2.4/dist/x_ite-sog-parser-2.min.js"></script>
|
|
19
19
|
<script type="module" src="https://cdn.jsdelivr.net/npm/x_ite@VERSION/dist/x_ite.min.mjs"></script>
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -2758,6 +2758,20 @@ const __webpack_exports__default = __nested_webpack_exports__.A;
|
|
|
2758
2758
|
*/
|
|
2759
2759
|
__webpack_exports__default (X3D => class SOGParser extends X3D .X3DParser
|
|
2760
2760
|
{
|
|
2761
|
+
keys = [
|
|
2762
|
+
"means_l.webp",
|
|
2763
|
+
"means_u.webp",
|
|
2764
|
+
"scales.webp",
|
|
2765
|
+
"sh0.webp",
|
|
2766
|
+
"quats.webp",
|
|
2767
|
+
"meta.json",
|
|
2768
|
+
];
|
|
2769
|
+
|
|
2770
|
+
optionalKeys = [
|
|
2771
|
+
"shN_centroids.webp",
|
|
2772
|
+
"shN_labels.webp",
|
|
2773
|
+
];
|
|
2774
|
+
|
|
2761
2775
|
static
|
|
2762
2776
|
{
|
|
2763
2777
|
X3D .GoldenGate .addParsers (this);
|
|
@@ -2792,18 +2806,9 @@ __webpack_exports__default (X3D => class SOGParser extends X3D .X3DParser
|
|
|
2792
2806
|
|
|
2793
2807
|
// Check minimum requirement for Gaussian Splats.
|
|
2794
2808
|
|
|
2795
|
-
const keys = [
|
|
2796
|
-
"means_l.webp",
|
|
2797
|
-
"means_u.webp",
|
|
2798
|
-
"scales.webp",
|
|
2799
|
-
"sh0.webp",
|
|
2800
|
-
"quats.webp",
|
|
2801
|
-
"meta.json",
|
|
2802
|
-
];
|
|
2803
|
-
|
|
2804
2809
|
this .files = unzipSync (new Uint8Array (this .buffer));
|
|
2805
2810
|
|
|
2806
|
-
if (!keys .every (key => this .files [key]))
|
|
2811
|
+
if (!this .keys .every (key => this .files [key]))
|
|
2807
2812
|
return false;
|
|
2808
2813
|
|
|
2809
2814
|
// Check version.
|
|
@@ -2936,6 +2941,7 @@ __webpack_exports__default (X3D => class SOGParser extends X3D .X3DParser
|
|
|
2936
2941
|
{
|
|
2937
2942
|
return Promise .all (Object .keys (this .files)
|
|
2938
2943
|
.filter (key => key .endsWith (".webp"))
|
|
2944
|
+
.filter (key => this .keys .includes (key) || this .optionalKeys .includes (key))
|
|
2939
2945
|
.map (key => this .unpackImage (key)));
|
|
2940
2946
|
}
|
|
2941
2947
|
|
|
@@ -2945,7 +2951,7 @@ __webpack_exports__default (X3D => class SOGParser extends X3D .X3DParser
|
|
|
2945
2951
|
bytes = this .files [key],
|
|
2946
2952
|
blob = new Blob ([bytes], { type: "image/webp" }),
|
|
2947
2953
|
url = URL .createObjectURL (blob),
|
|
2948
|
-
image = await this .loadImage (url),
|
|
2954
|
+
image = await this .loadImage (key, url),
|
|
2949
2955
|
data = this .readPixels (image);
|
|
2950
2956
|
|
|
2951
2957
|
this .files [key] = image;
|
|
@@ -2954,7 +2960,7 @@ __webpack_exports__default (X3D => class SOGParser extends X3D .X3DParser
|
|
|
2954
2960
|
URL .revokeObjectURL (url);
|
|
2955
2961
|
}
|
|
2956
2962
|
|
|
2957
|
-
loadImage (url)
|
|
2963
|
+
loadImage (key, url)
|
|
2958
2964
|
{
|
|
2959
2965
|
return new Promise ((resolve, reject) =>
|
|
2960
2966
|
{
|
|
@@ -2963,7 +2969,7 @@ __webpack_exports__default (X3D => class SOGParser extends X3D .X3DParser
|
|
|
2963
2969
|
image .onload = () => resolve (image);
|
|
2964
2970
|
|
|
2965
2971
|
image .onerror =
|
|
2966
|
-
image .onabort = event => reject (new Error (`Couldn't load WebP image: ${event .type}.`));
|
|
2972
|
+
image .onabort = event => reject (new Error (`Couldn't load WebP image '${key}': ${event .type}.`));
|
|
2967
2973
|
|
|
2968
2974
|
image .src = url;
|
|
2969
2975
|
});
|