Skip to content

Commit ed27554

Browse files
committed
demo: Switch to latest three.js & jsdelivr
We've switched from jsdelivr to unpkg a few years ago since jsdelivr at the time didn't distribute three.js examples, but now it does and it's much faster than unpkg, so it's time to switch back. This also upgrades three.js to 174 which requires adjusting light setup.
1 parent 98a3fc5 commit ed27554

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

demo/index.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
}
3131
</style>
3232

33-
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
33+
<script async src="https://cdn.jsdelivr.net/npm/es-module-shims@2.0.10/dist/es-module-shims.min.js"></script>
3434
<script type="importmap">
3535
{
3636
"imports": {
37-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
38-
"three-examples/": "https://unpkg.com/three@0.154.0/examples/jsm/"
37+
"three": "https://cdn.jsdelivr.net/npm/three@0.174.0/build/three.module.js",
38+
"three-examples/": "https://cdn.jsdelivr.net/npm/three@0.174.0/examples/jsm/"
3939
}
4040
}
4141
</script>
@@ -72,11 +72,12 @@
7272
scene = new THREE.Scene();
7373
scene.background = new THREE.Color(0x300a24);
7474

75-
var ambientLight = new THREE.AmbientLight(0xcccccc, 0.3);
75+
var ambientLight = new THREE.AmbientLight(0xcccccc, 1);
7676
scene.add(ambientLight);
7777

78-
var pointLight = new THREE.PointLight(0xffffff, 0.8);
78+
var pointLight = new THREE.PointLight(0xffffff, 4);
7979
pointLight.position.set(3, 3, 0);
80+
pointLight.decay = 0.5;
8081
camera.add(pointLight);
8182
scene.add(camera);
8283

demo/simplify.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,13 @@
6868
}
6969
</style>
7070

71-
<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
71+
<script async src="https://cdn.jsdelivr.net/npm/es-module-shims@2.0.10/dist/es-module-shims.min.js"></script>
7272
<script type="importmap">
7373
{
7474
"imports": {
75-
"three": "https://unpkg.com/three@0.154.0/build/three.module.js",
76-
"three-examples/": "https://unpkg.com/three@0.154.0/examples/jsm/"
75+
"three": "https://cdn.jsdelivr.net/npm/three@0.174.0/build/three.module.js",
76+
"three-examples/": "https://cdn.jsdelivr.net/npm/three@0.174.0/examples/jsm/",
77+
"lil-gui": "https://cdn.jsdelivr.net/npm/lil-gui@0.20.0/dist/lil-gui.esm.js"
7778
}
7879
}
7980
</script>
@@ -91,7 +92,7 @@
9192
import { mergeVertices } from 'three-examples/utils/BufferGeometryUtils.js';
9293
import { MeshoptDecoder } from '../js/meshopt_decoder.module.js';
9394
import { MeshoptSimplifier } from '../js/meshopt_simplifier.module.js';
94-
import { GUI } from 'https://unpkg.com/lil-gui@0.17.0/dist/lil-gui.esm.js';
95+
import { GUI } from 'lil-gui';
9596

9697
var container, gridContainer;
9798
var camera, clock;
@@ -282,11 +283,12 @@
282283
scenes.push(scene);
283284

284285
// Add lighting
285-
var ambientLight = new THREE.AmbientLight(0xcccccc, 0.3);
286+
var ambientLight = new THREE.AmbientLight(0xcccccc, 1);
286287
scene.add(ambientLight);
287288

288-
var pointLight = new THREE.PointLight(0xffffff, 0.8);
289+
var pointLight = new THREE.PointLight(0xffffff, 4);
289290
pointLight.position.set(3, 3, 0);
291+
pointLight.decay = 0.5;
290292
scene.add(pointLight);
291293

292294
// Create controls

0 commit comments

Comments
 (0)