代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html lang="en">
<head>
<title>Verge3D webgl - tilt loader</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link type="text/css" rel="stylesheet" href="main.css">
</head>
<body>
<div id="info">
<a href="https://www.soft8soft.com/verge3d" target="_blank" rel="noopener">Verge3D</a> - tilt loader<br/>
<a href="https://poly.google.com/view/ewUb8s99x_k" target="_blank" rel="noopener">TILTSPHERE</a> by <a href="https://poly.google.com/user/8CZPjCt8LvV" target="_blank" rel="noopener">Rosie Summers</a>
</div>
<script type="module">
import * as v3d from '../build/v3d.module.js';
import { OrbitControls } from './jsm/controls/OrbitControls.js';
import { TiltLoader } from './jsm/loaders/TiltLoader.js';
let camera, scene, renderer;
init();
function init() {
scene = new v3d.Scene();
camera = new v3d.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 500);
camera.position.y = 43;
camera.position.z = 100;
scene.add(camera);
const grid = new v3d.GridHelper(50, 50, 0xffffff, 0x555555);
scene.add(grid);
renderer = new v3d.WebGL1Renderer({ antialias: true });
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
const loader = new TiltLoader();
loader.load('./models/tilt/BRUSH_DOME.tilt', function(object) {
// console.log(object.children.length);
scene.add(object);
render();
});
const controls = new OrbitControls(camera, renderer.domElement);
controls.addEventListener('change', render);
controls.target.y = camera.position.y;
controls.update();
window.addEventListener('resize', onWindowResize, false);
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
render();
}
function render() {
renderer.render(scene, camera);
}
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。