|
@@ -1,6 +1,6 @@
|
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
|
4
|
* @license LGPL-3.0-or-later
|
5
|
5
|
*/
|
6
|
6
|
|
|
@@ -28,7 +28,7 @@ class ARScene
|
28
|
28
|
/**
|
29
|
29
|
* Initialize the augmented scene
|
30
|
30
|
* @abstract
|
31
|
|
- * @param {ARPluginSystem} ar
|
|
31
|
+ * @param {ARSystem} ar
|
32
|
32
|
* @returns {void | Promise<void> | SpeedyPromise<void>}
|
33
|
33
|
*/
|
34
|
34
|
init(ar)
|
|
@@ -39,7 +39,7 @@ class ARScene
|
39
|
39
|
/**
|
40
|
40
|
* Update / animate the augmented scene
|
41
|
41
|
* @abstract
|
42
|
|
- * @param {ARPluginSystem} ar
|
|
42
|
+ * @param {ARSystem} ar
|
43
|
43
|
* @returns {void}
|
44
|
44
|
*/
|
45
|
45
|
update(ar)
|
|
@@ -49,7 +49,7 @@ class ARScene
|
49
|
49
|
|
50
|
50
|
/**
|
51
|
51
|
* Release the augmented scene
|
52
|
|
- * @param {ARPluginSystem} ar
|
|
52
|
+ * @param {ARSystem} ar
|
53
|
53
|
* @returns {void}
|
54
|
54
|
*/
|
55
|
55
|
release(ar)
|
|
@@ -61,7 +61,7 @@ class ARScene
|
61
|
61
|
/**
|
62
|
62
|
* Helper for augmenting the scenes with three.js
|
63
|
63
|
*/
|
64
|
|
-class ARPluginSystem
|
|
64
|
+class ARSystem
|
65
|
65
|
{
|
66
|
66
|
/**
|
67
|
67
|
* AR Session
|
|
@@ -138,11 +138,11 @@ class ARPluginSystem
|
138
|
138
|
/**
|
139
|
139
|
* Do magic to connect encantar.js to three.js
|
140
|
140
|
* @param {ARScene} scene
|
141
|
|
- * @returns {Promise<ARPluginSystem>}
|
|
141
|
+ * @returns {Promise<ARSystem>}
|
142
|
142
|
*/
|
143
|
143
|
function encantar(scene)
|
144
|
144
|
{
|
145
|
|
- const ar = new ARPluginSystem();
|
|
145
|
+ const ar = new ARSystem();
|
146
|
146
|
|
147
|
147
|
function mix(frame)
|
148
|
148
|
{
|
|
@@ -247,16 +247,16 @@ function encantar(scene)
|
247
|
247
|
|
248
|
248
|
/**
|
249
|
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
|
254
|
window.addEventListener('load', () => {
|
255
|
255
|
try { AR, __THREE__;
|
256
|
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
|
261
|
catch(e) {
|
262
|
262
|
alert(e.message);
|