|
@@ -13,6 +13,40 @@ __THIS_PLUGIN_HAS_BEEN_TESTED_WITH__({
|
13
|
13
|
});
|
14
|
14
|
|
15
|
15
|
/**
|
|
16
|
+ * AR Base System
|
|
17
|
+ * @mixin ARBaseSystem
|
|
18
|
+ */
|
|
19
|
+const ARBaseSystem = () => ({
|
|
20
|
+
|
|
21
|
+ /**
|
|
22
|
+ * AR Session
|
|
23
|
+ * @type {Session | null}
|
|
24
|
+ */
|
|
25
|
+ session: null,
|
|
26
|
+
|
|
27
|
+ /**
|
|
28
|
+ * Current frame: an object holding data to augment the physical scene.
|
|
29
|
+ * If the AR scene is not initialized, this will be null.
|
|
30
|
+ * @type {Frame | null}
|
|
31
|
+ */
|
|
32
|
+ frame: null,
|
|
33
|
+
|
|
34
|
+ /**
|
|
35
|
+ * AR Viewer
|
|
36
|
+ * @type {Viewer | null}
|
|
37
|
+ */
|
|
38
|
+ viewer: null,
|
|
39
|
+
|
|
40
|
+ /**
|
|
41
|
+ * Pointer-based input in the current frame (touch, mouse, pen...)
|
|
42
|
+ * You need a PointerTracker in your session in order to use these
|
|
43
|
+ * @type {TrackablePointer[]}
|
|
44
|
+ */
|
|
45
|
+ pointers: [],
|
|
46
|
+
|
|
47
|
+});
|
|
48
|
+
|
|
49
|
+/**
|
16
|
50
|
* AR Utilities
|
17
|
51
|
*/
|
18
|
52
|
const ARUtils = () => ({
|
|
@@ -73,18 +107,16 @@ const ARUtils = () => ({
|
73
|
107
|
|
74
|
108
|
/**
|
75
|
109
|
* AR System
|
|
110
|
+ * @name ARSystem
|
|
111
|
+ * @type {object}
|
|
112
|
+ * @mixes ARBaseSystem
|
76
|
113
|
*/
|
77
|
|
-AFRAME.registerSystem('ar', {
|
|
114
|
+AFRAME.registerSystem('ar', Object.assign(ARBaseSystem(), {
|
78
|
115
|
|
79
|
116
|
// el;
|
80
|
117
|
// data;
|
81
|
118
|
// schema;
|
82
|
119
|
|
83
|
|
- session: /** @type {Session | null} */ (null),
|
84
|
|
- frame: /** @type {Frame | null} */ (null),
|
85
|
|
- viewer: /** @type {Viewer | null} */ (null),
|
86
|
|
- pointers: /** @type {TrackablePointer[]} */ ([]),
|
87
|
|
-
|
88
|
120
|
_utils: ARUtils(),
|
89
|
121
|
_started: false,
|
90
|
122
|
_components: [],
|
|
@@ -335,10 +367,11 @@ AFRAME.registerSystem('ar', {
|
335
|
367
|
this.pointers.push.apply(this.pointers, newPointers);
|
336
|
368
|
},
|
337
|
369
|
|
338
|
|
-});
|
|
370
|
+}));
|
339
|
371
|
|
340
|
372
|
/**
|
341
|
373
|
* AR Component
|
|
374
|
+ * @mixin ARComponent
|
342
|
375
|
*/
|
343
|
376
|
const ARComponent = obj => Object.assign({}, obj, {
|
344
|
377
|
|