Skip to content

Commit b6a75b6

Browse files
committed
load threejs module from url.
1 parent 26953c3 commit b6a75b6

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

web/demo/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<body>
1111
<script>
1212
</script>
13+
1314
<script type="module" src="./main.js"></script>
1415
</body>
1516
</html>

web/demo/main.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import * as THREE from 'three';
1+
//import * as THREE from 'three';
2+
import * as THREE from 'https://cdn.jsdelivr.net/npm/three/build/three.module.js';
23

34
import initTinyUSDZ from 'https://lighttransport.github.io/tinyusdz/tinyusdz.js';
45

@@ -24,7 +25,8 @@ initTinyUSDZ().then(function(TinyUSDZLoader) {
2425

2526
// First mesh only
2627
const mesh = usd.getMesh(0);
27-
console.log(mesh);
28+
//console.log("usd", usd)
29+
//console.log("mesh", mesh);
2830

2931
//const geometry = new THREE.BoxGeometry( 1, 1, 1 );
3032
const geometry = new THREE.BufferGeometry();
@@ -37,10 +39,10 @@ initTinyUSDZ().then(function(TinyUSDZLoader) {
3739
}
3840

3941
const usdMaterial = usd.getMaterial(mesh.materialId);
40-
console.log("usdMat", usdMaterial);
41-
if (usdMaterial.aaa) {
42-
console.log("aaa");
43-
}
42+
//console.log("usdMat", usdMaterial);
43+
//if (usdMaterial.aaa) {
44+
// console.log("aaa");
45+
//}
4446

4547
var material;
4648

@@ -80,8 +82,8 @@ initTinyUSDZ().then(function(TinyUSDZLoader) {
8082

8183
function animate() {
8284

83-
cube.rotation.x += 0.01;
84-
cube.rotation.y += 0.01;
85+
//cube.rotation.x += 0.01;
86+
cube.rotation.y += 0.02;
8587

8688
renderer.render( scene, camera );
8789

0 commit comments

Comments
 (0)