x_ite-sog-parser 1.0.4 → 1.1.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 CHANGED
@@ -13,18 +13,22 @@ Include the script after X_ITE:
13
13
 
14
14
  ```html
15
15
  <script defer src="https://cdn.jsdelivr.net/npm/x_ite@VERSION/dist/x_ite.min.js"></script>
16
- <script defer src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.0.4/dist/x_ite-sog-parser-2.min.js"></script>
16
+ <script defer src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.1.0/dist/x_ite-sog-parser-2.min.js"></script>
17
17
  <!-- or as ES module -->
18
18
  <script type="module" src="https://cdn.jsdelivr.net/npm/x_ite@VERSION/dist/x_ite.min.mjs"></script>
19
- <script type="module" src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.0.4/dist/x_ite-sog-parser-2.min.js"></script>
19
+ <script type="module" src="https://cdn.jsdelivr.net/npm/x_ite-sog-parser@1.1.0/dist/x_ite-sog-parser-2.min.js"></script>
20
20
  ```
21
21
 
22
- Now you can load 3DGS SOG files:
22
+ Now you can directly load `.sog` files with the `src` attribute, but you also have to add the `extensions` attribute with a number, how many X_ITE extension you have included. Each extension will decrease this count and when it becomes `0`, the canvas knows that all extensions are loaded and now starts loading the file in the `src` attribute.
23
+
24
+ You can also use `.sog` files as source of an Inline node.
23
25
 
24
26
  ```html
25
- <x3d-canvas src="room.sog"></x3d-canvas>
27
+ <x3d-canvas data-src="room.sog"></x3d-canvas>
26
28
  ```
27
29
 
30
+ ## NPM
31
+
28
32
  You can also install it from npm:
29
33
 
30
34
  ```sh
@@ -3150,5 +3150,16 @@ class SOGParser extends X3D .X3DParser
3150
3150
 
3151
3151
  X3D .GoldenGate .addParsers (SOGParser);
3152
3152
 
3153
+ // Decrement extensions attribute to show that the parser is loaded.
3154
+
3155
+ const canvases = document .querySelectorAll ("x3d-canvas");
3156
+
3157
+ for (const canvas of canvases)
3158
+ {
3159
+ const { element } = X3D .getBrowser (canvas);
3160
+
3161
+ element .setAttribute ("extensions", Math .max ((element .getAttribute ("extensions")|0) - 1, 0));
3162
+ }
3163
+
3153
3164
  /******/ })()
3154
3165
  ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x_ite-sog-parser",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "description": "3DGS SOG File Format Parser for X_ITE",
5
5
  "main": "dist/x_ite-sog-parser-2.js",
6
6
  "module": "dist/x_ite-sog-parser-2.js",