circuit-json-to-gltf 0.0.6 → 0.0.8
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/index.js +13 -2
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1770,7 +1770,15 @@ var GLTFBuilder = class {
|
|
|
1770
1770
|
}
|
|
1771
1771
|
}
|
|
1772
1772
|
createGLB(gltf, bufferData) {
|
|
1773
|
-
const
|
|
1773
|
+
const gltfWithBuffer = {
|
|
1774
|
+
...gltf,
|
|
1775
|
+
buffers: [
|
|
1776
|
+
{
|
|
1777
|
+
byteLength: bufferData.byteLength
|
|
1778
|
+
}
|
|
1779
|
+
]
|
|
1780
|
+
};
|
|
1781
|
+
const jsonString = JSON.stringify(gltfWithBuffer);
|
|
1774
1782
|
const jsonData = new TextEncoder().encode(jsonString);
|
|
1775
1783
|
const jsonPadding = (4 - jsonData.length % 4) % 4;
|
|
1776
1784
|
const jsonLength = jsonData.length + jsonPadding;
|
|
@@ -1784,8 +1792,11 @@ var GLTFBuilder = class {
|
|
|
1784
1792
|
view.setUint32(8, totalSize, true);
|
|
1785
1793
|
view.setUint32(12, jsonLength, true);
|
|
1786
1794
|
view.setUint32(16, 1313821514, true);
|
|
1787
|
-
const jsonArray = new Uint8Array(glb, 20,
|
|
1795
|
+
const jsonArray = new Uint8Array(glb, 20, jsonLength);
|
|
1788
1796
|
jsonArray.set(jsonData);
|
|
1797
|
+
for (let i = jsonData.length; i < jsonLength; i++) {
|
|
1798
|
+
jsonArray[i] = 32;
|
|
1799
|
+
}
|
|
1789
1800
|
const binChunkOffset = 20 + jsonLength;
|
|
1790
1801
|
view.setUint32(binChunkOffset, binLength, true);
|
|
1791
1802
|
view.setUint32(binChunkOffset + 4, 5130562, true);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "circuit-json-to-gltf",
|
|
3
3
|
"main": "dist/index.js",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.8",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "bun test tests/",
|
|
8
8
|
"format": "biome format --write .",
|
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
"bun-match-svg": "^0.0.12",
|
|
28
28
|
"circuit-json": "^0.0.226",
|
|
29
29
|
"circuit-to-svg": "^0.0.175",
|
|
30
|
+
"looks-same": "^9.0.1",
|
|
31
|
+
"poppygl": "^0.0.6",
|
|
30
32
|
"react": "^19.1.1",
|
|
31
33
|
"react-cosmos": "^7.0.0",
|
|
32
34
|
"react-cosmos-plugin-vite": "^7.0.0",
|