|
1 | 1 | <!DOCTYPE html>
|
2 | 2 | <meta name='viewport' content='width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0'>
|
3 | 3 | <title>AR.js Test Runner</title>
|
4 |
| -<!-- three.js library --> |
5 |
| -<script src='../examples/vendor/three.js/build/three.js'></script> |
6 |
| -<!-- include ar.js and ar-threex.js --> |
7 |
| -<script src="../build/ar.js"></script> |
8 |
| -<script src="../build/ar-threex.js"></script> |
9 |
| - |
10 |
| -<script>THREEx.ArToolkitContext.baseURL = '../'</script> |
| 4 | +<!-- include three.js, ar.js and ar-threex.js as modules --> |
| 5 | + |
| 6 | +<script type="importmap"> |
| 7 | + { |
| 8 | + "imports": { |
| 9 | + "arjs": "./../build/ar.module.js", |
| 10 | + "threex": "./../build/ar-threex.module.js", |
| 11 | + "three": "./vendor/three.js/build/three.module.min.js" |
| 12 | + } |
| 13 | + } |
| 14 | +</script> |
11 | 15 |
|
12 | 16 | <body style='margin : 0px; overflow: hidden; font-family: Monospace;'>
|
13 | 17 | <div style='position: absolute; top: 10px; width:100%; text-align: center; z-index: 1;'>
|
|
24 | 28 | /
|
25 | 29 | <a href='?best'>best</a>
|
26 | 30 | </div>
|
27 |
| - <script> |
| 31 | + <script type="module"> |
| 32 | + import * as THREE from 'three' |
| 33 | + import { Profile, Session, Anchor, Context, HitTesting, Utils, SessionDebugUI, AnchorDebugUI } from 'arjs' |
| 34 | + import { ArToolkitProfile, ArToolkitSource, ArToolkitContext, ArMarkerControls } from 'threex' |
| 35 | + ArToolkitContext.baseURL = '../' |
28 | 36 | // ;(function(){
|
29 | 37 | // get tracking method from location.search
|
30 | 38 | var trackingMethod = location.search.substring(1) ? location.search.substring(1) : 'best'
|
|
57 | 65 | // Initialize the camera
|
58 | 66 | //////////////////////////////////////////////////////////////////////////////////
|
59 | 67 |
|
60 |
| - var camera = ARjs.Utils.createDefaultCamera(trackingMethod) |
| 68 | + var camera = Utils.createDefaultCamera(trackingMethod) |
61 | 69 | scene.add(camera)
|
62 | 70 |
|
63 | 71 | ////////////////////////////////////////////////////////////////////////////////
|
64 | 72 | // Set up Arjs.Profile
|
65 | 73 | ////////////////////////////////////////////////////////////////////////////////
|
66 | 74 |
|
67 |
| - var arProfile = new ARjs.Profile().trackingMethod(trackingMethod) |
| 75 | + var arProfile = new Profile().trackingMethod(trackingMethod) |
68 | 76 |
|
69 | 77 | if (arProfile.contextParameters.trackingBackend === 'artoolkit') {
|
70 | 78 | // arProfile.sourceImage(THREEx.ArToolkitContext.baseURL + '../test/data/images/markers-page-ipad.jpg')
|
71 |
| - arProfile.sourceImage(THREEx.ArToolkitContext.baseURL + '../test/data/images/markers-page-ipad-640x480.jpg') |
| 79 | + arProfile.sourceImage(ArToolkitContext.baseURL + '../test/data/images/markers-page-ipad-640x480.jpg') |
72 | 80 | // arProfile.sourceImage('/data/images/img.jpg')
|
73 | 81 | // arProfile.sourceVideo(THREEx.ArToolkitContext.baseURL + '../test/data/videos/markers-page-ipad.mp4')
|
74 | 82 | } else console.assert(false)
|
|
82 | 90 | // build ARjs.Session
|
83 | 91 | //////////////////////////////////////////////////////////////////////////////
|
84 | 92 |
|
85 |
| - ARjs.AnchorDebugUI.MarkersAreaLearnerURL = ARjs.Context.baseURL + 'examples/multi-markers/examples/learner-testrunner.html' |
| 93 | + AnchorDebugUI.MarkersAreaLearnerURL = Context.baseURL + 'examples/multi-markers/examples/learner-testrunner.html' |
86 | 94 |
|
87 |
| - var arSession = new ARjs.Session({ |
| 95 | + var arSession = new Session({ |
88 | 96 | scene: scene,
|
89 | 97 | renderer: renderer,
|
90 | 98 | camera: camera,
|
|
100 | 108 | // Create a ARjs.Anchor
|
101 | 109 | ////////////////////////////////////////////////////////////////////////////////
|
102 | 110 |
|
103 |
| - var arAnchor = new ARjs.Anchor(arSession, arProfile.defaultMarkerParameters) |
| 111 | + var arAnchor = new Anchor(arSession, arProfile.defaultMarkerParameters) |
104 | 112 | onRenderFcts.push(function () {
|
105 | 113 | arAnchor.update()
|
106 | 114 | })
|
|
109 | 117 | // handle Hit Tester
|
110 | 118 | //////////////////////////////////////////////////////////////////////////////
|
111 | 119 |
|
112 |
| - var hitTesting = new ARjs.HitTesting(arSession) |
| 120 | + var hitTesting = new HitTesting(arSession) |
113 | 121 | onRenderFcts.push(function () {
|
114 | 122 | hitTesting.update(camera, arAnchor.object3d, arAnchor.parameters.changeMatrixMode)
|
115 | 123 | })
|
|
156 | 164 | }
|
157 | 165 |
|
158 | 166 |
|
159 |
| - var sessionDebugUI = new ARjs.SessionDebugUI(arSession, null) |
| 167 | + var sessionDebugUI = new SessionDebugUI(arSession, null) |
160 | 168 | document.querySelector('#arjsDebugUIContainer').appendChild(sessionDebugUI.domElement)
|
161 | 169 |
|
162 |
| - var anchorDebugUI = new ARjs.AnchorDebugUI(arAnchor) |
| 170 | + var anchorDebugUI = new AnchorDebugUI(arAnchor) |
163 | 171 | document.querySelector('#arjsDebugUIContainer').appendChild(anchorDebugUI.domElement)
|
164 | 172 |
|
165 | 173 | //////////////////////////////////////////////////////////////////////////////////
|
|
0 commit comments