-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrance02.html
111 lines (92 loc) · 4.08 KB
/
entrance02.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="description" content="UTokyo Creates 3D Gaussian Splatting App Based on Al Jazeera Footage" />
<meta property="og:image" content="https://wtnv-lab.github.io/gaza3dgs/sns/entrance02.jpg" />
<meta property="og:description" content="UTokyo Creates 3D Gaussian Splatting App Based on Al Jazeera Footage" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@hwtnv" />
<meta name="twitter:creator" content="@hwtnv" />
<meta name="twitter:title" content="Al Shifa Hospital Entrance 02 | UTokyo & Al Jazeera" />
<meta name="twitter:description" content="UTokyo Creates 3D Gaussian Splatting App Based on Al Jazeera Footage" />
<meta name="twitter:image" content="https://wtnv-lab.github.io/gaza3dgs/sns/entrance02.jpg" />
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>Al Shifa Hospital Entrance 02 | UTokyo & Al Jazeera</title>
<link rel="stylesheet" type="text/css" media="all" href="style.css" />
</head>
<body>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/[email protected]/build/three.module.js",
"three/addons/": "https://unpkg.com/[email protected]/examples/jsm/",
"@lumaai/luma-web": "https://unpkg.com/@lumaai/[email protected]/dist/library/luma-web.module.js"
}
}
</script>
<script type="module">
import { WebGLRenderer, PerspectiveCamera, Scene } from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { LumaSplatsThree } from '@lumaai/luma-web';
import { Color, FogExp2 } from "three";
let renderer = new WebGLRenderer({ antialias: false });
renderer.domElement.style.position = 'absolute';
renderer.domElement.style.width = '100%';
renderer.domElement.style.height = '100%';
renderer.setPixelRatio(1);
// add canvas to DOM
document.body.appendChild(renderer.domElement);
let camera = new PerspectiveCamera(70, -1, 0.1, 50);
// Camera Position Correction
camera.position.x = 2;
camera.position.y = 0;
camera.position.z = 1;
let controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
controls.maxDistance = 7.0;
controls.maxPolarAngle = Math.PI * 0.5;
let scene = new Scene();
scene.fog = new FogExp2(new Color(0x000000).convertLinearToSRGB(), 0.05);
scene.background = scene.fog.color;
let splat = new LumaSplatsThree({
source: 'https://lumalabs.ai/capture/516c1cf7-1d12-490f-93d7-980c1108b965'
});
scene.add(splat);
// Model Position Correction
splat.rotation.x = -0.025;
splat.rotation.y = 0;
splat.rotation.z = -0.05;
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();
animate();
}
renderer.setAnimationLoop(frameLoop);
// FPS Max value
const maxFPS = 60;
let lastUpdateTime = performance.now();
function animate() {
//requestAnimationFrame(animate);
const now = performance.now();
const deltaTime = now - lastUpdateTime;
if (deltaTime < 1000 / maxFPS) {
return;
}
lastUpdateTime = now - (deltaTime % (1000 / maxFPS));
renderer.render(scene, camera);
}
</script>
<div id="credit">© UTokyo & Al Jazeera</div>
</body>
</html>