<!DOCTYPE html>
<html lang="en"><head><meta charset="utf-8"><link type="text/css" rel="stylesheet" href="main.css">
</head><body>
<script src="./jszip.min.js"></script>
<script type="module">
import * as THREE from './three.module.js';
import { OrbitControls } from './OrbitControls.js';
import { KMZLoader } from './KMZLoader.js';
var camera, scene, renderer;
var light;
init();
function init() {
scene = new THREE.Scene();
scene.background = new THREE.Color( 0x999999 );
// var light = new THREE.DirectionalLight( 0xffffff );
light = new THREE.DirectionalLight( 0xffffff );
// light.position.set( -0.8, 0.2, -0.1 ).normalize();
scene.add( light );
camera = new THREE.PerspectiveCamera( 35, window.innerWidth / window.innerHeight, 1, 500 );
camera.position.y = 5;
camera.position.z = 10;
scene.add( camera );
//var grid = new THREE.GridHelper( 50, 50, 0xffffff, 0x555555 );
//scene.add( grid );
renderer = new THREE.WebGLRenderer( { antialias: true } );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
var loader = new KMZLoader();
loader.load( './besedka-2019 lumen.kmz', function ( kmz ) {
kmz.scene.position.y = -2.0;
scene.add( kmz.scene );
render();
} );
var controls = new OrbitControls( camera, renderer.domElement );
controls.addEventListener( 'change', render );
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() {
light.position.set( camera.position.x, camera.position.y ,camera.position.z );
renderer.render( scene, camera );
}
</script>
</body>
</html>
Ну и вдруг сам не найдешь библиотеки
https://threejs.org/build/three.module.js
https://threejs.org/examples/js/libs/jszip.min.js
https://threejs.org/examples/jsm/loaders/KMZLoader.js
https://threejs.org/examples/jsm/con...bitControls.js