Skip to content

Commit e79e21f

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # aframe/build/aframe-ar-nft.mjs # aframe/build/aframe-ar.mjs
2 parents e550dae + 8d130e9 commit e79e21f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+792
-601
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
steps:
1313
- name: Checkout repository
1414
uses: actions/checkout@v4
15+
with:
16+
ssh-key: ${{ secrets.DEPLOY_KEY }}
1517

1618
- name: Use Node.js from .nvmrc
1719
uses: actions/setup-node@v4

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ node_modules/**
44
test/**
55
aframe/examples/**
66
aframe/build/*.js
7+
aframe/build/*.mjs
78
aframe/src/component-anchor.js
89
aframe/src/component-anchor-nft.js
910
aframe/src/system-arjs.js
1011
aframe/src/system-arjs-nft.js
1112
aframe/src/location-based/stylesheets/*.css
1213
three.js/examples/**
1314
three.js/build/*.js
15+
three.js/build/*.mjs
1416
three.js/src/location-based/README.md
1517
*.md
1618
webpack.config.js

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,31 @@ npm install @ar-js-org/ar.js
221221
yarn add @ar-js-org/ar.js
222222
```
223223
For some examples read this [issue](https://github.com/AR-js-org/AR.js/issues/234).
224+
### New Import Syntax for `ar-threex.mjs` and `ar.mjs`
225+
226+
With the latest updates (3.4.6), `three.js` can now be imported using the ES module syntax.
227+
To align with this standard, `ar-threex.mjs`,`ar.mjs` and `ar-threex-location-only.mjs` should also be imported in the same way using an import map. Here is an example of how to import these modules in your project:
228+
229+
```html
230+
// Example importing ar-threex.mjs
231+
<script type="importmap">
232+
{
233+
"imports": {
234+
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
235+
"threex": "./path/to/ar-threex.mjs",
236+
}
237+
}
238+
</script>
239+
240+
<script type="module">
241+
import * as THREE from 'three';
242+
import { ArToolkitSource, ArToolkitContext, ArMarkerControls } from 'threex'
243+
244+
// Your AR.js code here
245+
</script>
246+
```
247+
Read the examples included in this repository for more information, but basically the only change is the import syntax.
248+
224249
## Troubleshooting, feature requests, community
225250

226251
**You can find a lot of help on the old [AR.js repositories issues](https://github.com/jeromeetienne/AR.js/issues). Please search on open/closed issues, you may find interesting stuff.**

aframe/build/aframe-ar-new-location-only.module.js renamed to aframe/build/aframe-ar-new-location-only.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
File renamed without changes.
File renamed without changes.

aframe/examples/location-based/always-face-user/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
Use the third-party A-Frame 'look-at' component to make the text look at the
2323
camera.
2424
-->
25-
<a-text value='This will always face the user.' look-at='[gps-new-camera]' gps-new-entity-place="latitude: 51.05; longitude: -0.723" scale="50 50 50"></a-entity>
25+
<a-text value='This will always face the user.' look-at='[gps-new-camera]' gps-new-entity-place="latitude: 51.05; longitude: -0.723" scale="50 50 50"></a-text>
2626
</a-scene>
2727

2828
</body>

aframe/src/component-hit-testing.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ AFRAME.registerComponent("arjs-hit-testing", {
7272
hitTesting.update(
7373
camera,
7474
arAnchor.object3d,
75-
arAnchor.parameters.changeMatrixMode
75+
arAnchor.parameters.changeMatrixMode,
7676
);
7777
},
7878
});

aframe/src/location-based/ArjsDeviceOrientationControls.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ const ArjsDeviceOrientationControls = function (object) {
6767
window.addEventListener(
6868
"orientationchange",
6969
onScreenOrientationChangeEvent,
70-
false
70+
false,
7171
);
7272
window.addEventListener(
7373
"deviceorientation",
7474
onDeviceOrientationChangeEvent,
75-
false
75+
false,
7676
);
7777

7878
scope.enabled = true;
@@ -82,12 +82,12 @@ const ArjsDeviceOrientationControls = function (object) {
8282
window.removeEventListener(
8383
"orientationchange",
8484
onScreenOrientationChangeEvent,
85-
false
85+
false,
8686
);
8787
window.removeEventListener(
8888
"deviceorientation",
8989
onDeviceOrientationChangeEvent,
90-
false
90+
false,
9191
);
9292

9393
scope.enabled = false;
@@ -119,13 +119,13 @@ const ArjsDeviceOrientationControls = function (object) {
119119
beta = this._getSmoothedAngle(
120120
beta + Math.PI,
121121
this.lastOrientation.beta,
122-
k
122+
k,
123123
);
124124
gamma = this._getSmoothedAngle(
125125
gamma + this.HALF_PI,
126126
this.lastOrientation.gamma,
127127
k,
128-
Math.PI
128+
Math.PI,
129129
);
130130
} else {
131131
beta += Math.PI;
@@ -142,7 +142,7 @@ const ArjsDeviceOrientationControls = function (object) {
142142
alpha,
143143
beta - Math.PI,
144144
gamma - this.HALF_PI,
145-
orient
145+
orient,
146146
);
147147
}
148148
};

aframe/src/location-based/arjs-look-controls.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ AFRAME.registerComponent("arjs-look-controls", {
8080
"deviceorientationpermissiongranted",
8181
function () {
8282
magicWindowControls.enabled = data.magicWindowTrackingEnabled;
83-
}
83+
},
8484
);
8585
}
8686
}
@@ -157,7 +157,7 @@ AFRAME.registerComponent("arjs-look-controls", {
157157
this.onExitVR = AFRAME.utils.bind(this.onExitVR, this);
158158
this.onPointerLockChange = AFRAME.utils.bind(
159159
this.onPointerLockChange,
160-
this
160+
this,
161161
);
162162
this.onPointerLockError = AFRAME.utils.bind(this.onPointerLockError, this);
163163
},
@@ -184,7 +184,7 @@ AFRAME.registerComponent("arjs-look-controls", {
184184
if (!canvasEl) {
185185
sceneEl.addEventListener(
186186
"render-target-loaded",
187-
AFRAME.utils.bind(this.addEventListeners, this)
187+
AFRAME.utils.bind(this.addEventListeners, this),
188188
);
189189
return;
190190
}
@@ -208,17 +208,17 @@ AFRAME.registerComponent("arjs-look-controls", {
208208
document.addEventListener(
209209
"pointerlockchange",
210210
this.onPointerLockChange,
211-
false
211+
false,
212212
);
213213
document.addEventListener(
214214
"mozpointerlockchange",
215215
this.onPointerLockChange,
216-
false
216+
false,
217217
);
218218
document.addEventListener(
219219
"pointerlockerror",
220220
this.onPointerLockError,
221-
false
221+
false,
222222
);
223223
}
224224
},
@@ -252,17 +252,17 @@ AFRAME.registerComponent("arjs-look-controls", {
252252
document.removeEventListener(
253253
"pointerlockchange",
254254
this.onPointerLockChange,
255-
false
255+
false,
256256
);
257257
document.removeEventListener(
258258
"mozpointerlockchange",
259259
this.onPointerLockChange,
260-
false
260+
false,
261261
);
262262
document.removeEventListener(
263263
"pointerlockerror",
264264
this.onPointerLockError,
265-
false
265+
false,
266266
);
267267
},
268268

@@ -291,7 +291,7 @@ AFRAME.registerComponent("arjs-look-controls", {
291291
poseMatrix.decompose(
292292
object3D.position,
293293
object3D.rotation,
294-
object3D.scale
294+
object3D.scale,
295295
);
296296
}
297297
}
@@ -316,7 +316,7 @@ AFRAME.registerComponent("arjs-look-controls", {
316316
this.magicWindowControls.update();
317317
magicWindowAbsoluteEuler.setFromQuaternion(
318318
this.magicWindowObject.quaternion,
319-
"YXZ"
319+
"YXZ",
320320
);
321321
if (!this.previousMagicWindowYaw && magicWindowAbsoluteEuler.y !== 0) {
322322
this.previousMagicWindowYaw = magicWindowAbsoluteEuler.y;
@@ -367,7 +367,7 @@ AFRAME.registerComponent("arjs-look-controls", {
367367
pitchObject.rotation.x += movementY * 0.002 * direction;
368368
pitchObject.rotation.x = Math.max(
369369
-PI_2,
370-
Math.min(PI_2, pitchObject.rotation.x)
370+
Math.min(PI_2, pitchObject.rotation.x),
371371
);
372372
},
373373

aframe/src/location-based/arjs-webcam-texture.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ AFRAME.registerComponent("arjs-webcam-texture", {
3535
})
3636
.catch((e) => {
3737
this.el.sceneEl.systems["arjs"]._displayErrorPopup(
38-
`Webcam error: ${e}`
38+
`Webcam error: ${e}`,
3939
);
4040
});
4141
} else {
4242
this.el.sceneEl.systems["arjs"]._displayErrorPopup(
43-
"sorry - media devices API not supported"
43+
"sorry - media devices API not supported",
4444
);
4545
}
4646
},

aframe/src/location-based/gps-camera.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ AFRAME.registerComponent("gps-camera", {
8787
this.onGpsEntityPlaceAdded = this._onGpsEntityPlaceAdded.bind(this);
8888
window.addEventListener(
8989
"gps-entity-place-added",
90-
this.onGpsEntityPlaceAdded
90+
this.onGpsEntityPlaceAdded,
9191
);
9292

9393
this.lookControls =
@@ -113,16 +113,16 @@ AFRAME.registerComponent("gps-camera", {
113113
function () {
114114
handler();
115115
},
116-
false
116+
false,
117117
);
118118

119119
this.el.sceneEl.systems["arjs"]._displayErrorPopup(
120-
"After camera permission prompt, please tap the screen to activate geolocation."
120+
"After camera permission prompt, please tap the screen to activate geolocation.",
121121
);
122122
} else {
123123
var timeout = setTimeout(function () {
124124
this.el.sceneEl.systems["arjs"]._displayErrorPopup(
125-
"Please enable device orientation in Settings > Safari > Motion & Orientation Access."
125+
"Please enable device orientation in Settings > Safari > Motion & Orientation Access.",
126126
);
127127
}, 750);
128128
window.addEventListener(eventName, function () {
@@ -162,7 +162,7 @@ AFRAME.registerComponent("gps-camera", {
162162
this.currentCoords = localPosition;
163163
var distMoved = this._haversineDist(
164164
this.lastPosition,
165-
this.currentCoords
165+
this.currentCoords,
166166
);
167167

168168
if (distMoved >= this.data.gpsMinDistance || !this.originCoords) {
@@ -172,7 +172,7 @@ AFRAME.registerComponent("gps-camera", {
172172
latitude: this.currentCoords.latitude,
173173
};
174174
}
175-
}.bind(this)
175+
}.bind(this),
176176
);
177177
}
178178
},
@@ -197,7 +197,7 @@ AFRAME.registerComponent("gps-camera", {
197197

198198
window.removeEventListener(
199199
"gps-entity-place-added",
200-
this.onGpsEntityPlaceAdded
200+
this.onGpsEntityPlaceAdded,
201201
);
202202
},
203203

@@ -233,14 +233,14 @@ AFRAME.registerComponent("gps-camera", {
233233
if (err.code === 1) {
234234
// User denied GeoLocation, let their know that
235235
this.el.sceneEl.systems["arjs"]._displayErrorPopup(
236-
"Please activate Geolocation and refresh the page. If it is already active, please check permissions for this website."
236+
"Please activate Geolocation and refresh the page. If it is already active, please check permissions for this website.",
237237
);
238238
return;
239239
}
240240

241241
if (err.code === 3) {
242242
this.el.sceneEl.systems["arjs"]._displayErrorPopup(
243-
"Cannot retrieve GPS position. Signal is absent."
243+
"Cannot retrieve GPS position. Signal is absent.",
244244
);
245245
return;
246246
}
@@ -332,7 +332,7 @@ AFRAME.registerComponent("gps-camera", {
332332
window.dispatchEvent(
333333
new CustomEvent("gps-camera-update-position", {
334334
detail: { position: this.currentCoords, origin: this.originCoords },
335-
})
335+
}),
336336
);
337337
},
338338
/**
@@ -448,7 +448,7 @@ AFRAME.registerComponent("gps-camera", {
448448
this.heading = this._computeCompassHeading(
449449
event.alpha,
450450
event.beta,
451-
event.gamma
451+
event.gamma,
452452
);
453453
} else {
454454
console.warn("event.absolute === false");
@@ -467,7 +467,7 @@ AFRAME.registerComponent("gps-camera", {
467467
var heading = 360 - this.heading;
468468
var cameraRotation = this.el.getAttribute("rotation").y;
469469
var yawRotation = THREE.MathUtils.radToDeg(
470-
this.lookControls.yawObject.rotation.y
470+
this.lookControls.yawObject.rotation.y,
471471
);
472472
var offset = (heading - (cameraRotation - yawRotation)) % 360;
473473
this.lookControls.yawObject.rotation.y = THREE.MathUtils.degToRad(offset);

0 commit comments

Comments
 (0)