forked from lumalabs/luma-web-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminimal.html
71 lines (58 loc) · 1.73 KB
/
minimal.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
</style>
</head>
<body>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.157.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.157.0/examples/jsm/",
"@lumaai/luma-web": "https://unpkg.com/@lumaai/luma-web@0.2.0/dist/library/luma-web.module.js"
}
}
</script>
<script type="module">
import { WebGLRenderer, PerspectiveCamera, Scene } from 'three';
// orbit controls
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { LumaSplatsThree } from '@lumaai/luma-web';
let renderer = new WebGLRenderer({ antialias: false });
renderer.domElement.style.position = 'absolute';
renderer.domElement.style.width = '100%';
renderer.domElement.style.height = '100%';
// add canvas to DOM
document.body.appendChild(renderer.domElement);
let camera = new PerspectiveCamera(75, 1, 0.1, 1000);
camera.position.z = 2;
let controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
let scene = new Scene();
let splat = new LumaSplatsThree({
source: 'https://lumalabs.ai/capture/d80d4876-cf71-4b8a-8b5b-49ffac44cd4a'
});
scene.add(splat);
function frameLoop() {
let canvas = renderer.domElement;
let width = canvas.clientWidth;
let height = canvas.clientHeight;
if (canvas.width !== width || canvas.height !== height) {
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.setSize(width, height, false);
}
controls.update();
renderer.render(scene, camera);
}
renderer.setAnimationLoop(frameLoop);
</script>
</body>
</html>