potree_build/public/test-potree.html

96 lines
3.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Potree Test</title>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="/potree/potree.css">
<link rel="stylesheet" type="text/css" href="/libs/jquery-ui/jquery-ui.min.css">
<link rel="stylesheet" type="text/css" href="/libs/openlayers3/ol.css">
<link rel="stylesheet" type="text/css" href="/libs/spectrum/spectrum.css">
<link rel="stylesheet" type="text/css" href="/libs/jstree/themes/mixed/style.css">
</head>
<body>
<div id="potree_render_area" style="width: 100%; height: 100vh; background: #000;"></div>
<script>
console.log('Starting Potree test...');
// Загружаем скрипты последовательно
const scripts = [
'/libs/jquery/jquery-3.1.1.min.js',
'/libs/spectrum/spectrum.js',
'/libs/jquery-ui/jquery-ui.min.js',
'/libs/other/BinaryHeap.js',
'/libs/tween/tween.min.js',
'/libs/d3/d3.js',
'/libs/proj4/proj4.js',
'/libs/openlayers3/ol.js',
'/libs/i18next/i18next.js',
'/libs/jstree/jstree.js',
'/potree/potree.js',
'/libs/plasio/js/laslaz.js'
];
let currentScript = 0;
function loadNextScript() {
if (currentScript >= scripts.length) {
console.log('All scripts loaded, initializing Potree...');
initPotree();
return;
}
const script = document.createElement('script');
script.src = scripts[currentScript];
script.onload = () => {
console.log('Loaded:', scripts[currentScript]);
currentScript++;
setTimeout(loadNextScript, 200);
};
script.onerror = () => {
console.error('Failed to load:', scripts[currentScript]);
currentScript++;
setTimeout(loadNextScript, 200);
};
document.head.appendChild(script);
}
function initPotree() {
try {
console.log('Checking globals:', {
Potree: !!window.Potree,
jQuery: !!window.$,
TWEEN: !!window.TWEEN
});
if (!window.Potree) {
console.error('Potree not loaded!');
return;
}
const renderArea = document.getElementById('potree_render_area');
console.log('Render area:', renderArea);
const viewer = new Potree.Viewer(renderArea);
console.log('Viewer created:', viewer);
viewer.setEDLEnabled(false);
viewer.setFOV(60);
viewer.setPointBudget(1_000_000);
viewer.setBackground("skybox");
console.log('Potree initialized successfully!');
} catch (error) {
console.error('Error initializing Potree:', error);
}
}
// Начинаем загрузку
loadNextScript();
</script>
</body>
</html>