Przeglądaj źródła

Update the three.js plugin

customisations
alemart 11 miesięcy temu
rodzic
commit
f4760d612f
1 zmienionych plików z 13 dodań i 13 usunięć
  1. 13
    13
      plugins/three-with-encantar.js

+ 13
- 13
plugins/three-with-encantar.js Wyświetl plik

1
 /**
1
 /**
2
- * @file three.js plugin for encantar.js
3
- * @author Alexandre Martins (https://github.com/alemart)
2
+ * three.js plugin for encantar.js
3
+ * @author Alexandre Martins <alemartf(at)gmail.com> (https://github.com/alemart/encantar-js)
4
  * @license LGPL-3.0-or-later
4
  * @license LGPL-3.0-or-later
5
  */
5
  */
6
 
6
 
28
     /**
28
     /**
29
      * Initialize the augmented scene
29
      * Initialize the augmented scene
30
      * @abstract
30
      * @abstract
31
-     * @param {ARPluginSystem} ar
31
+     * @param {ARSystem} ar
32
      * @returns {void | Promise<void> | SpeedyPromise<void>}
32
      * @returns {void | Promise<void> | SpeedyPromise<void>}
33
      */
33
      */
34
     init(ar)
34
     init(ar)
39
     /**
39
     /**
40
      * Update / animate the augmented scene
40
      * Update / animate the augmented scene
41
      * @abstract
41
      * @abstract
42
-     * @param {ARPluginSystem} ar
42
+     * @param {ARSystem} ar
43
      * @returns {void}
43
      * @returns {void}
44
      */
44
      */
45
     update(ar)
45
     update(ar)
49
 
49
 
50
     /**
50
     /**
51
      * Release the augmented scene
51
      * Release the augmented scene
52
-     * @param {ARPluginSystem} ar
52
+     * @param {ARSystem} ar
53
      * @returns {void}
53
      * @returns {void}
54
      */
54
      */
55
     release(ar)
55
     release(ar)
61
 /**
61
 /**
62
  * Helper for augmenting the scenes with three.js
62
  * Helper for augmenting the scenes with three.js
63
  */
63
  */
64
-class ARPluginSystem
64
+class ARSystem
65
 {
65
 {
66
     /**
66
     /**
67
      * AR Session
67
      * AR Session
138
 /**
138
 /**
139
  * Do magic to connect encantar.js to three.js
139
  * Do magic to connect encantar.js to three.js
140
  * @param {ARScene} scene
140
  * @param {ARScene} scene
141
- * @returns {Promise<ARPluginSystem>}
141
+ * @returns {Promise<ARSystem>}
142
  */
142
  */
143
 function encantar(scene)
143
 function encantar(scene)
144
 {
144
 {
145
-    const ar = new ARPluginSystem();
145
+    const ar = new ARSystem();
146
 
146
 
147
     function mix(frame)
147
     function mix(frame)
148
     {
148
     {
247
 
247
 
248
 /**
248
 /**
249
  * Version check
249
  * Version check
250
- * @param {object} json
250
+ * @param {object} libs
251
  */
251
  */
252
-function __THIS_PLUGIN_HAS_BEEN_TESTED_WITH__(json)
252
+function __THIS_PLUGIN_HAS_BEEN_TESTED_WITH__(libs)
253
 {
253
 {
254
     window.addEventListener('load', () => {
254
     window.addEventListener('load', () => {
255
         try { AR, __THREE__;
255
         try { AR, __THREE__;
256
             const versionOf = { 'encantar.js': AR.version.replace(/-.*$/, ''), 'three.js': __THREE__ };
256
             const versionOf = { 'encantar.js': AR.version.replace(/-.*$/, ''), 'three.js': __THREE__ };
257
-            const check = (x,v,w) => v !== w ? console.warn(`\n\n\nWARNING\n\nThis plugin has been tested with ${x} version ${v}. The version in use is ${w}. Usage of ${x} version ${v} is recommended instead.\n\n\n`) : void 0;
258
-            for(const [x, expected] of Object.entries(json))
259
-                check(x, expected.version, versionOf[x]);
257
+            const check = (x,v,w) => v != w ? console.warn(`\n\n\nWARNING\n\nThis plugin has been tested with ${x} version ${v}. The version in use is ${w}. Usage of ${x} version ${v} is recommended instead.\n\n\n`) : void 0;
258
+            for(const [lib, expected] of Object.entries(libs))
259
+                check(lib, expected.version, versionOf[lib]);
260
         }
260
         }
261
         catch(e) {
261
         catch(e) {
262
             alert(e.message);
262
             alert(e.message);

Ładowanie…
Anuluj
Zapisz