Browse Source

Simplify

customisations
alemart 11 months ago
parent
commit
660b26b847
2 changed files with 10 additions and 20 deletions
  1. 1
    1
      demos/hello-three/NOTICE.html
  2. 9
    19
      demos/hello-three/demo.js

+ 1
- 1
demos/hello-three/NOTICE.html View File

35
                 <a href="https://threejs.org" target="_blank" rel="external">https://threejs.org</a>
35
                 <a href="https://threejs.org" target="_blank" rel="external">https://threejs.org</a>
36
             </li>
36
             </li>
37
         </ol>
37
         </ol>
38
-        <p>This application also contains a 3D model of a mage from "Adventurers Character Pack" by <a href="https://kaylousberg.com" target="_blank" rel="external">Kay Lousberg</a>, released under the <a href="#cc0">Creative Commons Zero 1.0 Universal</a>.</p>
38
+        <p>This application also contains a 3D model of a mage by <a href="https://kaylousberg.com" target="_blank" rel="external">Kay Lousberg</a>, released under the <a href="#cc0">Creative Commons Zero 1.0 Universal</a>.</p>
39
         <hr>
39
         <hr>
40
 
40
 
41
         <h2 id="lgpl">GNU Lesser General Public License</h2>
41
         <h2 id="lgpl">GNU Lesser General Public License</h2>

+ 9
- 19
demos/hello-three/demo.js View File

28
         return gltf;
28
         return gltf;
29
     }
29
     }
30
 
30
 
31
-    switchToFrontView(root)
32
-    {
33
-        // top view is the default
34
-        root.rotateX(-Math.PI / 2);
35
-    }
36
-
37
     createAnimationAction(gltf, name = null)
31
     createAnimationAction(gltf, name = null)
38
     {
32
     {
39
         const mixer = new THREE.AnimationMixer(gltf.scene);
33
         const mixer = new THREE.AnimationMixer(gltf.scene);
61
         return mesh;
55
         return mesh;
62
     }
56
     }
63
 
57
 
58
+    switchToFrontView(ar)
59
+    {
60
+        // top view is the default
61
+        ar.root.rotation.set(-Math.PI / 2, 0, 0);
62
+    }
63
+
64
     referenceImage(ar)
64
     referenceImage(ar)
65
     {
65
     {
66
         if(ar.frame === null)
66
         if(ar.frame === null)
165
         // Change the point of view. All virtual objects are descendants of
165
         // Change the point of view. All virtual objects are descendants of
166
         // ar.root, a node that is automatically aligned to the physical scene.
166
         // ar.root, a node that is automatically aligned to the physical scene.
167
         // Adjusting ar.root will adjust all virtual objects.
167
         // Adjusting ar.root will adjust all virtual objects.
168
-        this._utils.switchToFrontView(ar.root);
168
+        this._utils.switchToFrontView(ar);
169
         ar.root.position.set(0, -0.5, 0);
169
         ar.root.position.set(0, -0.5, 0);
170
         ar.root.scale.set(0.7, 0.7, 0.7);
170
         ar.root.scale.set(0.7, 0.7, 0.7);
171
 
171
 
179
 
179
 
180
         // create the magic circle
180
         // create the magic circle
181
         const magicCircle = this._utils.createImagePlane('../assets/magic-circle.png');
181
         const magicCircle = this._utils.createImagePlane('../assets/magic-circle.png');
182
+        magicCircle.material.color = new THREE.Color(0xbeefff);
182
         magicCircle.material.transparent = true;
183
         magicCircle.material.transparent = true;
183
         magicCircle.material.opacity = 0.85;
184
         magicCircle.material.opacity = 0.85;
184
-        magicCircle.material.color = new THREE.Color(0xbeefff);
185
         magicCircle.scale.set(6, 6, 1);
185
         magicCircle.scale.set(6, 6, 1);
186
         ar.root.add(magicCircle);
186
         ar.root.add(magicCircle);
187
 
187
 
191
         ar.root.add(mage);
191
         ar.root.add(mage);
192
 
192
 
193
         // prepare the animation of the mage
193
         // prepare the animation of the mage
194
-        const animationAction = this._utils.createAnimationAction(gltf, 'Idle');
194
+        const animationAction = this._utils.createAnimationAction(gltf);
195
         animationAction.loop = THREE.LoopRepeat;
195
         animationAction.loop = THREE.LoopRepeat;
196
         animationAction.play();
196
         animationAction.play();
197
 
197
 
221
         const magicCircle = this._objects.magicCircle;
221
         const magicCircle = this._objects.magicCircle;
222
         magicCircle.rotateZ(TWO_PI * ROTATIONS_PER_SECOND * delta);
222
         magicCircle.rotateZ(TWO_PI * ROTATIONS_PER_SECOND * delta);
223
     }
223
     }
224
-
225
-    /**
226
-     * Release the augmented scene
227
-     * @param {ARPluginSystem} ar
228
-     * @returns {void}
229
-     */
230
-    release(ar)
231
-    {
232
-        // nothing to do
233
-    }
234
 }
224
 }
235
 
225
 
236
 
226
 

Loading…
Cancel
Save