commit
bd4b610b1c
@ -18,8 +18,6 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -38,7 +36,9 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +36,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.setMinNodeSize(0);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
|
||||
@ -19,8 +19,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -42,7 +40,9 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.cesiumViewer = new Cesium.Viewer('cesiumContainer', {
|
||||
useDefaultRenderLoop: false,
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
potreeViewer.setEDLEnabled(true);
|
||||
potreeViewer.setFOV(60);
|
||||
potreeViewer.setPointBudget(3*1000*1000);
|
||||
potreeViewer.setPointBudget(3_000_000);
|
||||
potreeViewer.setBackground(null);
|
||||
|
||||
potreeViewer.setDescription("");
|
||||
@ -99,9 +99,11 @@
|
||||
|
||||
material.size = 1;
|
||||
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
||||
|
||||
scene.view.position.set(675036.45, 3850315.78, 65076.70);
|
||||
scene.view.lookAt(692869.03, 3925774.14, 1581.51);
|
||||
|
||||
potreeViewer.scene.view.setView(
|
||||
[675036.45, 3850315.78, 65076.70],
|
||||
[692869.03, 3925774.14, 1581.51],
|
||||
);
|
||||
|
||||
let pointcloudProjection = e.pointcloud.projection;
|
||||
let mapProjection = proj4.defs("WGS84");
|
||||
@ -247,67 +249,67 @@
|
||||
|
||||
|
||||
function loop(timestamp){
|
||||
requestAnimationFrame(loop);
|
||||
requestAnimationFrame(loop);
|
||||
|
||||
potreeViewer.update(potreeViewer.clock.getDelta(), timestamp);
|
||||
potreeViewer.update(potreeViewer.clock.getDelta(), timestamp);
|
||||
|
||||
potreeViewer.render();
|
||||
potreeViewer.render();
|
||||
|
||||
if(window.toMap !== undefined){
|
||||
if(window.toMap !== undefined){
|
||||
|
||||
{
|
||||
let camera = potreeViewer.scene.getActiveCamera();
|
||||
{
|
||||
let camera = potreeViewer.scene.getActiveCamera();
|
||||
|
||||
let pPos = new THREE.Vector3(0, 0, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pRight = new THREE.Vector3(600, 0, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pUp = new THREE.Vector3(0, 600, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pTarget = potreeViewer.scene.view.getPivot();
|
||||
let pPos = new THREE.Vector3(0, 0, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pRight = new THREE.Vector3(600, 0, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pUp = new THREE.Vector3(0, 600, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pTarget = potreeViewer.scene.view.getPivot();
|
||||
|
||||
let toCes = (pos) => {
|
||||
let xy = [pos.x, pos.y];
|
||||
let height = pos.z;
|
||||
let deg = toMap.forward(xy);
|
||||
let cPos = Cesium.Cartesian3.fromDegrees(...deg, height);
|
||||
let toCes = (pos) => {
|
||||
let xy = [pos.x, pos.y];
|
||||
let height = pos.z;
|
||||
let deg = toMap.forward(xy);
|
||||
let cPos = Cesium.Cartesian3.fromDegrees(...deg, height);
|
||||
|
||||
return cPos;
|
||||
};
|
||||
return cPos;
|
||||
};
|
||||
|
||||
let cPos = toCes(pPos);
|
||||
let cUpTarget = toCes(pUp);
|
||||
let cTarget = toCes(pTarget);
|
||||
let cPos = toCes(pPos);
|
||||
let cUpTarget = toCes(pUp);
|
||||
let cTarget = toCes(pTarget);
|
||||
|
||||
let cDir = Cesium.Cartesian3.subtract(cTarget, cPos, new Cesium.Cartesian3());
|
||||
let cUp = Cesium.Cartesian3.subtract(cUpTarget, cPos, new Cesium.Cartesian3());
|
||||
let cDir = Cesium.Cartesian3.subtract(cTarget, cPos, new Cesium.Cartesian3());
|
||||
let cUp = Cesium.Cartesian3.subtract(cUpTarget, cPos, new Cesium.Cartesian3());
|
||||
|
||||
cDir = Cesium.Cartesian3.normalize(cDir, new Cesium.Cartesian3());
|
||||
cUp = Cesium.Cartesian3.normalize(cUp, new Cesium.Cartesian3());
|
||||
cDir = Cesium.Cartesian3.normalize(cDir, new Cesium.Cartesian3());
|
||||
cUp = Cesium.Cartesian3.normalize(cUp, new Cesium.Cartesian3());
|
||||
|
||||
cesiumViewer.camera.setView({
|
||||
destination : cPos,
|
||||
orientation : {
|
||||
direction : cDir,
|
||||
up : cUp
|
||||
}
|
||||
});
|
||||
cesiumViewer.camera.setView({
|
||||
destination : cPos,
|
||||
orientation : {
|
||||
direction : cDir,
|
||||
up : cUp
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
let aspect = potreeViewer.scene.getActiveCamera().aspect;
|
||||
if(aspect < 1){
|
||||
let fovy = Math.PI * (potreeViewer.scene.getActiveCamera().fov / 180);
|
||||
cesiumViewer.camera.frustum.fov = fovy;
|
||||
}else{
|
||||
let fovy = Math.PI * (potreeViewer.scene.getActiveCamera().fov / 180);
|
||||
let fovx = Math.atan(Math.tan(0.5 * fovy) * aspect) * 2
|
||||
cesiumViewer.camera.frustum.fov = fovx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let aspect = potreeViewer.scene.getActiveCamera().aspect;
|
||||
if(aspect < 1){
|
||||
let fovy = Math.PI * (potreeViewer.scene.getActiveCamera().fov / 180);
|
||||
cesiumViewer.camera.frustum.fov = fovy;
|
||||
}else{
|
||||
let fovy = Math.PI * (potreeViewer.scene.getActiveCamera().fov / 180);
|
||||
let fovx = Math.atan(Math.tan(0.5 * fovy) * aspect) * 2
|
||||
cesiumViewer.camera.frustum.fov = fovx;
|
||||
}
|
||||
|
||||
cesiumViewer.render();
|
||||
}
|
||||
|
||||
cesiumViewer.render();
|
||||
}
|
||||
|
||||
requestAnimationFrame(loop);
|
||||
requestAnimationFrame(loop);
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +36,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
viewer.setBackground("skybox");
|
||||
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +36,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2*1000*1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,7 +36,9 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
// import * as Potree from "../src/Potree.js";
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(5 * 1000 * 1000);
|
||||
viewer.setPointBudget(5_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -36,7 +34,9 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
@ -66,14 +66,18 @@
|
||||
|
||||
scene.addPointCloud(pointcloud);
|
||||
|
||||
//scene.view.position.set(589974.341, 231698.397, 986.146);
|
||||
//scene.view.lookAt(new THREE.Vector3(589851.587, 231428.213, 715.634));
|
||||
// scene.view.setView(
|
||||
// [589974.341, 231698.397, 986.146],
|
||||
// [589851.587, 231428.213, 715.634],
|
||||
// );
|
||||
viewer.fitToScreen();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
const animation = new Potree.CameraAnimation(viewer);
|
||||
|
||||
@ -104,7 +108,9 @@
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
// viewer.onGUILoaded(() => {
|
||||
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../build/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">
|
||||
@ -20,8 +19,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -45,7 +42,10 @@
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.cesiumViewer = new Cesium.Viewer('cesiumContainer', {
|
||||
useDefaultRenderLoop: false,
|
||||
animation: false,
|
||||
@ -77,7 +77,7 @@
|
||||
});
|
||||
potreeViewer.setEDLEnabled(true);
|
||||
potreeViewer.setFOV(60);
|
||||
potreeViewer.setPointBudget(1000*1000);
|
||||
potreeViewer.setPointBudget(1_000_000);
|
||||
potreeViewer.setMinNodeSize(0);
|
||||
potreeViewer.loadSettingsFromURL();
|
||||
potreeViewer.setBackground(null);
|
||||
@ -91,16 +91,20 @@
|
||||
});
|
||||
|
||||
Potree.loadPointCloud("http://5.9.65.151/mschuetz/potree/resources/pointclouds/opentopography/CA13_1.4/cloud.js", "CA13", function(e){
|
||||
//Potree.loadPointCloud("../pointclouds/vol_total/cloud.js", "sigeom.sa", e => {
|
||||
potreeViewer.scene.addPointCloud(e.pointcloud);
|
||||
//e.pointcloud.position.z = 0;
|
||||
let material = e.pointcloud.material;
|
||||
|
||||
let pointcloud = e.pointcloud;
|
||||
let scene = potreeViewer.scene;
|
||||
let material = pointcloud.material;
|
||||
|
||||
scene.addPointCloud(pointcloud);
|
||||
|
||||
material.size = 1;
|
||||
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
||||
|
||||
potreeViewer.scene.view.position.set(689429.64, 3877023.77, 42878.97);
|
||||
potreeViewer.scene.view.lookAt(new THREE.Vector3(696072.86, 3916730.04, 82.04));
|
||||
|
||||
Potree.measureTimings = true;
|
||||
potreeViewer.scene.view.setView(
|
||||
[689429.64, 3877023.77, 42878.97],
|
||||
[696072.86, 3916730.04, 82.04],
|
||||
);
|
||||
|
||||
let pointcloudProjection = e.pointcloud.projection;
|
||||
let mapProjection = proj4.defs("WGS84");
|
||||
@ -119,14 +123,12 @@
|
||||
|
||||
if(window.toMap !== undefined){
|
||||
|
||||
let camera = potreeViewer.scene.getActiveCamera();
|
||||
{
|
||||
let camera = potreeViewer.scene.getActiveCamera();
|
||||
|
||||
if(camera instanceof THREE.PerspectiveCamera){
|
||||
|
||||
|
||||
let pPos = new THREE.Vector3(0, 0, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pRight = new THREE.Vector3(600, 0, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pUp = new THREE.Vector3(0, 600, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pPos = new THREE.Vector3(0, 0, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pRight = new THREE.Vector3(600, 0, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pUp = new THREE.Vector3(0, 600, 0).applyMatrix4(camera.matrixWorld);
|
||||
let pTarget = potreeViewer.scene.view.getPivot();
|
||||
|
||||
let toCes = (pos) => {
|
||||
@ -166,10 +168,9 @@
|
||||
cesiumViewer.camera.frustum.fov = fovx;
|
||||
}
|
||||
|
||||
cesiumViewer.render();
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
cesiumViewer.render();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,8 +19,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -44,7 +42,10 @@
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.cesiumViewer = new Cesium.Viewer('cesiumContainer', {
|
||||
useDefaultRenderLoop: false,
|
||||
animation: false,
|
||||
@ -76,7 +77,7 @@
|
||||
});
|
||||
potreeViewer.setEDLEnabled(true);
|
||||
potreeViewer.setFOV(60);
|
||||
potreeViewer.setPointBudget(4*1000*1000);
|
||||
potreeViewer.setPointBudget(3_000_000);
|
||||
potreeViewer.setMinNodeSize(50);
|
||||
potreeViewer.loadSettingsFromURL();
|
||||
potreeViewer.setBackground(null);
|
||||
@ -100,7 +101,6 @@
|
||||
|
||||
scene.addPointCloud(e.pointcloud);
|
||||
|
||||
|
||||
e.pointcloud.position.set(569277.402752, 5400050.599046, 0);
|
||||
e.pointcloud.rotation.set(0, 0, -0.035);
|
||||
|
||||
@ -114,8 +114,6 @@
|
||||
scene.view.position.set(570975.577, 5398630.521, 1659.311);
|
||||
scene.view.lookAt(570115.285, 5400866.092, 30.009);
|
||||
|
||||
Potree.measureTimings = true;
|
||||
|
||||
{
|
||||
let aTownHall = new Potree.Annotation({
|
||||
position: [569879.768, 5400886.182, 80.691],
|
||||
@ -181,17 +179,17 @@
|
||||
});
|
||||
|
||||
elTitle.find("span[name=low]").click( () => {
|
||||
potreeViewer.setPointBudget(1 * 1000 * 1000);
|
||||
potreeViewer.setPointBudget(1_000_000);
|
||||
potreeViewer.useHQ = false;
|
||||
});
|
||||
|
||||
elTitle.find("span[name=med]").click( () => {
|
||||
potreeViewer.setPointBudget(3 * 1000 * 1000);
|
||||
potreeViewer.setPointBudget(3_000_000);
|
||||
potreeViewer.useHQ = false;
|
||||
});
|
||||
|
||||
elTitle.find("span[name=high]").click( () => {
|
||||
potreeViewer.setPointBudget(4 * 1000 * 1000);
|
||||
potreeViewer.setPointBudget(4_000_000);
|
||||
potreeViewer.useHQ = true;
|
||||
});
|
||||
|
||||
|
||||
@ -19,8 +19,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -44,7 +42,9 @@
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
window.cesiumViewer = new Cesium.Viewer('cesiumContainer', {
|
||||
useDefaultRenderLoop: false,
|
||||
animation: false,
|
||||
@ -76,7 +76,7 @@
|
||||
});
|
||||
potreeViewer.setEDLEnabled(true);
|
||||
potreeViewer.setFOV(60);
|
||||
potreeViewer.setPointBudget(1000*1000);
|
||||
potreeViewer.setPointBudget(1_000_000);
|
||||
potreeViewer.setMinNodeSize(0);
|
||||
potreeViewer.loadSettingsFromURL();
|
||||
potreeViewer.setBackground(null);
|
||||
@ -95,8 +95,6 @@
|
||||
|
||||
potreeViewer.scene.view.position.set(590093.649, 231823.465, 267.402);
|
||||
potreeViewer.scene.view.lookAt(new THREE.Vector3(589837.149, 231438.996, -0.707));
|
||||
|
||||
Potree.measureTimings = true;
|
||||
|
||||
|
||||
let pointcloudProjection = e.pointcloud.projection;
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -28,28 +27,23 @@
|
||||
<script src="../libs/jstree/jstree.js"></script>
|
||||
<script src="../build/potree/potree.js"></script>
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
|
||||
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
||||
<!-- INCLUDE SETTINGS HERE -->
|
||||
|
||||
<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
|
||||
<div id="potree_render_area" style="background-image: url('../build/potree/resources/images/background.jpg');">
|
||||
|
||||
<span style="position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 10000">
|
||||
|
||||
<input type="button" value="Default Scheme" onclick="setDefaultScheme()"/>
|
||||
<input type="button" value="Tree Scheme" onclick="setTreeScheme()"/>
|
||||
<input type="button" value="Random Scheme" onclick="setRandomScheme()"/>
|
||||
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
@ -61,15 +55,13 @@
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2 * 1000 * 1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
|
||||
viewer.loadGUI(() => {
|
||||
$("#menu_filters").next().show();
|
||||
viewer.toggleSidebar();
|
||||
});
|
||||
|
||||
// Sigeom
|
||||
//Potree.loadPointCloud("../pointclouds/morro_bay_converted/cloud.js", "CA13", function(e){
|
||||
Potree.loadPointCloud("http://5.9.65.151/mschuetz/potree/resources/pointclouds/opentopography/CA13_1.4/cloud.js", "CA13", function(e){
|
||||
viewer.scene.addPointCloud(e.pointcloud);
|
||||
e.pointcloud.position.z = 0;
|
||||
@ -84,25 +76,22 @@
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
function setDefaultScheme(){
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.setDefaultScheme = function(){
|
||||
viewer.setClassifications(Potree.ClassificationScheme.DEFAULT);
|
||||
|
||||
}
|
||||
|
||||
function setTreeScheme(){
|
||||
|
||||
window.setTreeScheme = function(){
|
||||
viewer.setClassifications({
|
||||
5: { visible: true, name: 'trees' , color: [0.0, 1.0, 0.0, 1.0] },
|
||||
DEFAULT: { visible: false, name: 'other' , color: [0.0, 0.0, 0.0, 1.0] },
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function setRandomScheme(){
|
||||
|
||||
window.setRandomScheme = function(){
|
||||
const scheme = {};
|
||||
|
||||
for(let i = 0; i < 32; i++){
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,7 +36,9 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
let clipSpheres = [
|
||||
{position: [0.032, -2.382, 4.279], scale: 3},
|
||||
@ -50,7 +50,7 @@
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2*1000*1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription(`
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,7 +36,9 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +36,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
// viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Point cloud courtesy of <a target='_blank' href='https://www.sigeom.ch/'>sigeom sa</a>");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +36,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Point cloud courtesy of <a target='_blank' href='https://www.sigeom.ch/'>sigeom sa</a>");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,12 +36,14 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2*1000*1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Loading Entwine-generated EPT format");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,12 +36,14 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2*1000*1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Loading Entwine-generated EPT format");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,12 +36,14 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2*1000*1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Loading Entwine-generated EPT format");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +36,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(3*1000*1000);
|
||||
viewer.setPointBudget(3_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -29,8 +27,6 @@
|
||||
<script src="../libs/jstree/jstree.js"></script>
|
||||
<script src="../build/potree/potree.js"></script>
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/other/OBJLoader.js"></script>
|
||||
<script src="../libs/other/PLYLoader.js"></script>
|
||||
|
||||
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
||||
<!-- INCLUDE SETTINGS HERE -->
|
||||
@ -40,13 +36,17 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
import {PLYLoader} from "../libs/three.js/loaders/PLYLoader.js";
|
||||
import {OBJLoader} from "../libs/three.js/loaders/OBJLoader.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Point cloud courtesy of <a target='_blank' href='https://www.sigeom.ch/'>sigeom sa</a>");
|
||||
@ -272,7 +272,7 @@
|
||||
texture.wrapT = THREE.RepeatWrapping;
|
||||
|
||||
let onError = function ( xhr ) {};
|
||||
let loader = new THREE.OBJLoader( manager );
|
||||
let loader = new OBJLoader( manager );
|
||||
loader.load(`${Potree.resourcePath}/models/stanford_bunny_reduced.obj`, function ( object ) {
|
||||
object.traverse( function ( child ) {
|
||||
if ( child instanceof THREE.Mesh ) {
|
||||
@ -306,7 +306,7 @@
|
||||
}
|
||||
|
||||
// Load untextured bunny from ply
|
||||
var loader = new THREE.PLYLoader();
|
||||
var loader = new PLYLoader();
|
||||
loader.load( Potree.resourcePath + "/models/stanford_bunny_reduced.ply", (geometry) => {
|
||||
geometry.computeVertexNormals();
|
||||
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -35,13 +33,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(5 * 1000 * 1000);
|
||||
viewer.setPointBudget(5_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +36,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.setMinNodeSize(10);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -41,23 +39,19 @@
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
let clipSpheres = [
|
||||
{position: [0.032, -2.382, 4.279], scale: 3},
|
||||
{position: [-1.787, 6.011, 1.711], scale: 1},
|
||||
{position: [0.095, 7.636, 10.997], scale: 2},
|
||||
];
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setEDLEnabled(false);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(5*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.setMinNodeSize(0);
|
||||
viewer.loadSettingsFromURL();
|
||||
viewer.setBackground("skybox");
|
||||
viewer.setShowBoundingBox(false);
|
||||
|
||||
viewer.setDescription(`Heidentor point cloud courtesy of <a href="http://archpro.lbg.ac.at/" target="_blank">Ludwig Boltzmann Institute - Archeological Prospection and Virtual Archeology</a> (26M points)`);
|
||||
|
||||
@ -75,10 +69,89 @@
|
||||
let material = e.pointcloud.material;
|
||||
material.size = 1;
|
||||
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
||||
|
||||
viewer.scene.view.setView(
|
||||
[13.856, -9.125, 14.563],
|
||||
[-3.548, 2.728, 6.140],
|
||||
);
|
||||
|
||||
viewer.scene.view.position.set(13.856734292740617, -9.125174923658731, 14.563928417406354);
|
||||
viewer.scene.view.lookAt(-3.5482630104475366, 2.728596783815762, 6.1406044783018725);
|
||||
});
|
||||
|
||||
|
||||
{ // ground plane
|
||||
const texture = new THREE.TextureLoader().load(`${Potree.resourcePath}/textures/rectangle.png`);
|
||||
|
||||
texture.wrapS = THREE.RepeatWrapping;
|
||||
texture.wrapT = THREE.RepeatWrapping;
|
||||
texture.repeat.x = 10;
|
||||
texture.repeat.y = 10;
|
||||
texture.anisotropy = 16;
|
||||
|
||||
let geometry = new THREE.PlaneBufferGeometry(1, 1, 10, 10);
|
||||
let material = new THREE.MeshBasicMaterial();
|
||||
material.map = texture;
|
||||
material.needsUpdate = true;
|
||||
let plane = new THREE.Mesh(geometry, material);
|
||||
plane.scale.set(18, 18, 18);
|
||||
plane.position.set(-2, 3, 0);
|
||||
plane.material.color.setRGB(0.8, 0.8, 0.8);
|
||||
window.plane = plane;
|
||||
viewer.scene.scene.add(plane);
|
||||
}
|
||||
|
||||
// { // spheres to indicate coordinate axes
|
||||
// let sg = new THREE.SphereGeometry(0.1, 8, 8);
|
||||
|
||||
// { // ORIGIN
|
||||
// let sm = new THREE.MeshBasicMaterial({color: 0xaaaaaa});
|
||||
// let sphere = new THREE.Mesh(sg, sm);
|
||||
// sphere.position.set(0, 0, 0);
|
||||
// viewer.scene.scene.add(sphere);
|
||||
// }
|
||||
|
||||
// { // X
|
||||
// let sm = new THREE.MeshBasicMaterial({color: 0xff0000});
|
||||
// let sphere = new THREE.Mesh(sg, sm);
|
||||
// sphere.position.set(2, 0, 0);
|
||||
// viewer.scene.scene.add(sphere);
|
||||
// }
|
||||
|
||||
|
||||
// { // Y
|
||||
// let sm = new THREE.MeshBasicMaterial({color: 0x00ff00});
|
||||
// let sphere = new THREE.Mesh(sg, sm);
|
||||
// sphere.position.set(0, 2, 0);
|
||||
// viewer.scene.scene.add(sphere);
|
||||
// }
|
||||
|
||||
|
||||
// { // Z
|
||||
// let sm = new THREE.MeshBasicMaterial({color: 0x0000ff});
|
||||
// let sphere = new THREE.Mesh(sg, sm);
|
||||
// sphere.position.set(0, 0, 2);
|
||||
// viewer.scene.scene.add(sphere);
|
||||
// }
|
||||
|
||||
// { // RANDOM SPHERES
|
||||
// for(let i = 0; i < 2000; i++){
|
||||
// let color =
|
||||
// ((Math.random() * 255) << 16) |
|
||||
// ((Math.random() * 255) << 8) |
|
||||
// ((Math.random() * 255) << 0);
|
||||
// let sm = new THREE.MeshBasicMaterial({color: color});
|
||||
// let sphere = new THREE.Mesh(sg, sm);
|
||||
// sphere.position.set(
|
||||
// 100 * Math.random() - 50,
|
||||
// 100 * Math.random() - 50,
|
||||
// 2);
|
||||
// sphere.scale.set(3, 3, 3);
|
||||
// viewer.scene.scene.add(sphere);
|
||||
|
||||
// sphere.frustumCulled = false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -41,13 +39,15 @@
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2 * 1000 * 1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
viewer.setMinNodeSize(0);
|
||||
viewer.loadSettingsFromURL();
|
||||
viewer.setServer("http://localhost:3000");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -41,13 +39,15 @@
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2 * 1000 * 1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
viewer.setMinNodeSize(0);
|
||||
viewer.loadSettingsFromURL();
|
||||
viewer.setServer("http://localhost:3000");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -43,7 +41,9 @@
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
$("#animation_toggle").click( () => {
|
||||
if(!animation.tween){
|
||||
@ -59,7 +59,7 @@
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(3 * 1000 * 1000);
|
||||
viewer.setPointBudget(3_000_000);
|
||||
viewer.setMinNodeSize(0);
|
||||
viewer.loadSettingsFromURL();
|
||||
viewer.setServer("http://localhost:3000");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +36,18 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
import {Line2} from "../libs/three.js/lines/Line2.js";
|
||||
import {LineGeometry} from "../libs/three.js/lines/LineGeometry.js";
|
||||
import {LineMaterial} from "../libs/three.js/lines/LineMaterial.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Point cloud courtesy of <a target='_blank' href='https://www.sigeom.ch/'>sigeom sa</a>");
|
||||
@ -78,11 +81,11 @@
|
||||
589702.04, 231336.49, 772.91
|
||||
];
|
||||
|
||||
let lineGeometry = new THREE.LineGeometry();
|
||||
let lineGeometry = new LineGeometry();
|
||||
|
||||
lineGeometry.setPositions(path);
|
||||
|
||||
let lineMaterial = new THREE.LineMaterial({
|
||||
let lineMaterial = new LineMaterial({
|
||||
color: 0x00ff00,
|
||||
dashSize: 5,
|
||||
gapSize: 2,
|
||||
@ -95,7 +98,7 @@
|
||||
|
||||
});
|
||||
|
||||
const line = new THREE.Line2(lineGeometry, lineMaterial);
|
||||
const line = new Line2(lineGeometry, lineMaterial);
|
||||
viewer.scene.scene.add(line);
|
||||
}
|
||||
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
|
||||
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +38,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("");
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +36,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Loading Octree of LAS files");
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
|
||||
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +38,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Loading LAZ compressed octree format");
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
|
||||
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -35,7 +35,9 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
|
||||
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,12 +38,14 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(false);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.loadGUI(() => {
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +36,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Point cloud courtesy of <a target='_blank' href='https://www.sigeom.ch/'>sigeom sa</a>");
|
||||
@ -69,7 +69,7 @@
|
||||
let measure = new Potree.Measure();
|
||||
measure.closed = false;
|
||||
measure.addMarker(new THREE.Vector3(589803.18, 231357.35, 745.38));
|
||||
measure.addMarker(new THREE.Vector3(589795.74, 231323.42, 746.21));
|
||||
measure.addMarker(new THREE.Vector3(589795.74, 231323.42, 746.21));
|
||||
measure.addMarker(new THREE.Vector3(589822.50, 231315.90, 744.45));
|
||||
|
||||
scene.addMeasurement(measure);
|
||||
@ -82,7 +82,7 @@
|
||||
measure.showAngles = true;
|
||||
measure.showDistances = false;
|
||||
measure.addMarker(new THREE.Vector3(589866.11, 231372.25, 737.41));
|
||||
measure.addMarker(new THREE.Vector3(589842.15, 231366.82, 743.61));
|
||||
measure.addMarker(new THREE.Vector3(589842.15, 231366.82, 743.61));
|
||||
measure.addMarker(new THREE.Vector3(589860.61, 231348.01, 740.33));
|
||||
|
||||
scene.addMeasurement(measure);
|
||||
@ -106,7 +106,7 @@
|
||||
measure.showDistances = false;
|
||||
measure.showHeight = true;
|
||||
measure.addMarker(new THREE.Vector3(589849.69, 231327.26, 766.32));
|
||||
measure.addMarker(new THREE.Vector3(589840.96, 231329.53, 744.52));
|
||||
measure.addMarker(new THREE.Vector3(589840.96, 231329.53, 744.52));
|
||||
|
||||
scene.addMeasurement(measure);
|
||||
}
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -29,8 +27,6 @@
|
||||
<script src="../libs/jstree/jstree.js"></script>
|
||||
<script src="../build/potree/potree.js"></script>
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/other/PLYLoader.js"></script>
|
||||
<script src="../libs/other/OBJLoader.js"></script>
|
||||
|
||||
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
||||
<!-- INCLUDE SETTINGS HERE -->
|
||||
@ -40,13 +36,17 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
import {PLYLoader} from "../libs/three.js/loaders/PLYLoader.js";
|
||||
import {OBJLoader} from "../libs/three.js/loaders/OBJLoader.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("Point cloud courtesy of <a target='_blank' href='https://www.sigeom.ch/'>sigeom sa</a>");
|
||||
@ -72,7 +72,7 @@
|
||||
// viewer.fitToScreen();
|
||||
});
|
||||
|
||||
var loader = new THREE.PLYLoader();
|
||||
var loader = new PLYLoader();
|
||||
loader.load( Potree.resourcePath + "/models/stanford_bunny_reduced.ply", (geometry) => {
|
||||
geometry.computeVertexNormals();
|
||||
|
||||
@ -168,7 +168,7 @@
|
||||
texture.wrapS = THREE.RepeatWrapping;
|
||||
texture.wrapT = THREE.RepeatWrapping;
|
||||
|
||||
let loader = new THREE.OBJLoader( manager );
|
||||
let loader = new OBJLoader( manager );
|
||||
loader.load(`${Potree.resourcePath}/models/stanford_bunny_reduced.obj`, function ( object ) {
|
||||
object.traverse( function ( child ) {
|
||||
if ( child instanceof THREE.Mesh ) {
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
|
||||
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,13 +38,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.setMinNodeSize(10);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
|
||||
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -35,7 +35,9 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
@ -79,7 +81,9 @@
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
const cameraParamsPath = "http://5.9.65.151/mschuetz/potree/resources/pointclouds/helimap/epalinges/img_selected/IXM35_190522_nodistortion.xml";
|
||||
const imageParamsPath = "http://5.9.65.151/mschuetz/potree/resources/pointclouds/helimap/epalinges/img_selected/Calib190522_MN95_NF2_cam_estim.txt";
|
||||
|
||||
@ -18,8 +18,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -42,7 +40,9 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
|
||||
viewer.setEDLEnabled(false);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(3*1000*1000);
|
||||
viewer.setPointBudget(3_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('San Simeon, CA Central Coast point cloud taken from <a href="http://opentopo.sdsc.edu/gridsphere/gridsphere?cid=geonlidarframeportlet&gs_action=lidarDataset&opentopoID=OTLAS.032013.26910.2" target="_blank">Open Topography</a> (17.7b points)');
|
||||
@ -189,42 +189,6 @@
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// {
|
||||
// let positions = [
|
||||
// 693738.442, 3916080.340, 175.970,
|
||||
// 694121.015, 3915885.120, 2.500,
|
||||
// 694627.471, 3916099.287, 1.500,
|
||||
// 693961.765, 3916738.056, 1.460,
|
||||
// ];
|
||||
|
||||
// let colors = [
|
||||
// 1, 0, 0,
|
||||
// 1, 0, 0,
|
||||
// 1, 0, 0,
|
||||
// 1, 0, 0,
|
||||
// ];
|
||||
|
||||
// const geometry = new THREE.LineGeometry();
|
||||
// geometry.setPositions( positions );
|
||||
// geometry.setColors( colors );
|
||||
|
||||
// matLine = new THREE.LineMaterial( {
|
||||
// color: 0xff0000,
|
||||
// linewidth: 5, // in pixels
|
||||
// resolution: new THREE.Vector2(2000, 2000),
|
||||
// dashed: false
|
||||
// } );
|
||||
|
||||
// line = new THREE.Line2( geometry, matLine );
|
||||
// line.computeLineDistances();
|
||||
// line.scale.set( 1, 1, 1 );
|
||||
// viewer.scene.scene.add( line );
|
||||
|
||||
// }
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.weiss-ag.org/" target="_blank">Weiss AG</a>. (60M points)');
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +36,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.weiss-ag.org/" target="_blank">Weiss AG</a>. (73M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.weiss-ag.org/" target="_blank">Weiss AG</a>. (50M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.setClipTask(Potree.ClipTask.SHOW_INSIDE);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +36,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.setClipTask(Potree.ClipTask.SHOW_INSIDE);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://pix4d.com/" target="_blank">Pix4D</a>. (68M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription(`Grave point cloud courtesy of <a href="http://www.hs-anhalt.de/" target="_blank">HS Anhalt</a> - Institut für Geoinformation und Vermessung Dessau<br>
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Heidentor point cloud courtesy of <a href="http://archpro.lbg.ac.at/" target="_blank">Ludwig Boltzmann Institute - Archeological Prospection and Virtual Archeology</a> (26M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(3*1000*1000);
|
||||
viewer.setPointBudget(3_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Lake Tahoe point cloud taken from <a href="http://opentopo.sdsc.edu/gridsphere/gridsphere?cid=geonlidarframeportlet&gs_action=lidarDataset&opentopoID=OTLAS.032011.26910.1" target="_blank">Open Topography</a> (8.3b points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2*1000*1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.surfaceandedge.com/" target="_blank">surface & edge</a>. (163M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.weiss-ag.org/" target="_blank">Weiss AG</a>. (47M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.tcproject.net/" target="_blank">Simone Garagnani</a> (12.6M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://pix4d.com/" target="_blank">Pix4D</a> (274M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.surfaceandedge.com/" target="_blank">surface & edge</a>. (228M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2*1000*1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Pielach point cloud courtesy of <a href="http://www.riegl.co.at/" target="_blank">Riegl</a>, provided by <a href="https://geo.tuwien.ac.at/" target="_blank">TU Wien, department of geodesy and geoinformation</a>.');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of the <a href="http://www.map.archi.fr/?page_id=381" target="_blank">CNRS-MAP-Gamsau laboratory</a>');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(3*1000*1000);
|
||||
viewer.setPointBudget(3_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://riegl.com/" target="_blank">Riegl</a><br>');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription(`Pyle, David; Parks, Michelle; Mather, Tamsin; Nomikou, Paraskevi (2014):
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2*1000*1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.faro.com/home" target="_blank">Faro</a>. (78M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://sigeom.ch/" target="_blank">Sigeom Sa</a>. (57M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.weiss-ag.org/" target="_blank">Weiss AG</a>. (75M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.weiss-ag.org/" target="_blank">Weiss AG</a>. (27M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,7 +37,9 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2*1000*1000);
|
||||
viewer.setPointBudget(2_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.faro.com/" target="_blank">Faro</a>. (94M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription('Point cloud courtesy of <a href="http://www.3dlasermapping.com/" target="_blank">3D laser mapping</a> / <a href="http://www.geomlidar.com/" target="_blank">GeoM</a>. (7.7M points)');
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,14 +37,16 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(5 * 1000 * 1000);
|
||||
viewer.setPointBudget(10 * 1000);
|
||||
viewer.setPointBudget(5_000_000);
|
||||
viewer.setPointBudget(10_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("");
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../../libs/three.js/build/three.min.js"></script>
|
||||
|
||||
<script src="../../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../../libs/tween/tween.min.js"></script>
|
||||
<script src="../../libs/d3/d3.js"></script>
|
||||
@ -37,13 +37,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(5 * 1000 * 1000);
|
||||
viewer.setPointBudget(5_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.setDescription("");
|
||||
|
||||
@ -49,7 +49,6 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -59,14 +58,8 @@
|
||||
<script src="../libs/jstree/jstree.js"></script>
|
||||
<script src="../build/potree/potree.js"></script>
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
|
||||
<script src='../libs/sql.js/sql-wasm.js'></script>
|
||||
<script src='../libs/geopackage/geopackage.js'></script>
|
||||
<script src="../libs/three.js/extra/lines/LineSegmentsGeometry.js"></script>
|
||||
<script src="../libs/three.js/extra/lines/LineGeometry.js"></script>
|
||||
<script src="../libs/three.js/extra/lines/LineMaterial.js"></script>
|
||||
<script src="../libs/three.js/extra/lines/LineSegments2.js"></script>
|
||||
<script src="../libs/three.js/extra/lines/Line2.js"></script>
|
||||
|
||||
<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
|
||||
<div id="potree_render_area">
|
||||
@ -75,7 +68,9 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
@ -116,7 +111,9 @@
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from "../libs/three.js/build/three.module.js";
|
||||
|
||||
// 1: define html of toolbar first
|
||||
// 2: then populate with content and actions
|
||||
@ -294,14 +291,14 @@
|
||||
{ // POINT BUDGET
|
||||
elToolbar.find('#sldPointBudget').slider({
|
||||
value: viewer.getPointBudget(),
|
||||
min: 100 * 1000,
|
||||
max: 1 * 1000 * 1000,
|
||||
step: 100 * 1000,
|
||||
slide: (event, ui) => { this.viewer.setPointBudget(ui.value); }
|
||||
min: 100_000,
|
||||
max: 1_000_000,
|
||||
step: 100_000,
|
||||
slide: (event, ui) => { viewer.setPointBudget(ui.value); }
|
||||
});
|
||||
|
||||
const onBudgetChange = () => {
|
||||
let budget = (viewer.getPointBudget() / (1000 * 1000)).toFixed(1) + "M";
|
||||
let budget = (viewer.getPointBudget() / (1000_000)).toFixed(1) + "M";
|
||||
elToolbar.find('span[name=lblPointBudget]').html(budget);
|
||||
};
|
||||
|
||||
|
||||
@ -18,8 +18,8 @@
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
|
||||
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
@ -38,14 +38,15 @@
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
<script type="module">
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setEDLEnabled(false);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setPointBudget(1_000_000);
|
||||
viewer.loadSettingsFromURL();
|
||||
viewer.setBackground("skybox");
|
||||
|
||||
viewer.setDescription("Point cloud courtesy of <a target='_blank' href='https://www.sigeom.ch/'>sigeom sa</a>");
|
||||
|
||||
@ -68,11 +69,13 @@
|
||||
|
||||
scene.addPointCloud(pointcloud);
|
||||
|
||||
//scene.view.position.set(589974.341, 231698.397, 986.146);
|
||||
//scene.view.lookAt(new THREE.Vector3(589851.587, 231428.213, 715.634));
|
||||
viewer.fitToScreen();
|
||||
// scene.view.setView(
|
||||
// [589974.341, 231698.397, 986.146],
|
||||
// [589851.587, 231428.213, 715.634],
|
||||
// );
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
155
examples/vr.html
155
examples/vr.html
@ -1,155 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title>Potree Viewer</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../build/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>
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
<script src="../libs/proj4/proj4.js"></script>
|
||||
<!-- <script src="../libs/openlayers3/ol.js"></script> -->
|
||||
<script src="../libs/i18next/i18next.js"></script>
|
||||
<script src="../libs/jstree/jstree.js"></script>
|
||||
<script src="../build/potree/potree.js"></script>
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/other/OBJLoader.js"></script>
|
||||
|
||||
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
||||
<!-- INCLUDE SETTINGS HERE -->
|
||||
|
||||
<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
|
||||
<div id="potree_render_area" style="background-image: url('../build/potree/resources/images/background.jpg');"></div>
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(false);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(2 * 1000 * 1000);
|
||||
viewer.setDescription(`
|
||||
If your browser supports WebVR, a VR button will appear on the bottom right. <br>
|
||||
(Tested on HTC Vive + Firefox 73 (<font style="color: #88ff88">works</font>),
|
||||
Oculus Quest (<font style="color: #88ff88">works</font>),
|
||||
Chrome 80 (<font style="color: #ff8888">(didn't work) </font>)
|
||||
<br>
|
||||
Controls: Point right controller in desired direction, then push the right joystick forward
|
||||
to fly in that direction.
|
||||
Pushing the left youstick in addition to the right one modifies speed by up to 4x.
|
||||
<br>
|
||||
Point cloud of <a href="http://www.dechenhoehle.de/" target="_blank">Dechen-Cave, Iserlohn</a>. Courtesy of <a href="http://lrg.geog.uni-heidelberg.de" target="_blank">Heidelberg University, LiDAR Research Group (LRG)</a><br>
|
||||
<i style="font-size: small">
|
||||
Hämmerle, M., Höfle, B., Fuchs, J., Schröder-Ritzrau, A., Vollweiler, N. & Frank, N. (2014): <a href="http://lrg.geog.uni-heidelberg.de/dechencave/" target="_blank">Comparison of Kinect and Terrestrial LiDAR Capturing Natural Karst Cave 3D Objects</a>. IEEE Geoscience and Remote Sensing Letters, Vol. 11(11), pp 1896-1900, DOI:<a href="http://dx.doi.org/10.1109/LGRS.2014.2313599" target="_blank">10.1109/LGRS.2014.2313599</a>
|
||||
</i>
|
||||
`);
|
||||
|
||||
viewer.loadGUI(() => {
|
||||
viewer.setLanguage('en');
|
||||
$("#menu_appearance").next().show();
|
||||
$("#menu_tools").next().show();
|
||||
$("#menu_scene").next().show();
|
||||
$("#menu_filters").next().show();
|
||||
viewer.toggleSidebar();
|
||||
|
||||
// reduce selectable range to make it easier to select lower values in
|
||||
// mobile HMDs
|
||||
$('#sldPointBudget').slider({
|
||||
max: 3 * 1000 * 1000,
|
||||
step: 1000,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Potree.loadPointCloud("http://5.9.65.151/mschuetz/potree/resources/pointclouds/uni_heidelberg/dechen_cave/cloud.js", "Dechen Cave", function(e){
|
||||
let scene = viewer.scene;
|
||||
let pointcloud = e.pointcloud;
|
||||
|
||||
let material = pointcloud.material;
|
||||
material.size = 0.27;
|
||||
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
||||
material.shape = Potree.PointShape.SQUARE;
|
||||
material.activeAttributeName = "rgba";
|
||||
material.rgbGamma = 0.6;
|
||||
|
||||
scene.addPointCloud(pointcloud);
|
||||
|
||||
scene.view.setView(
|
||||
[-2.647, -3.353, 22.175],
|
||||
[16.179, 16.701, 2.129],
|
||||
);
|
||||
});
|
||||
|
||||
viewer.onVr( () => {
|
||||
|
||||
viewer.vr.node.position.set(
|
||||
9.837547617156579,
|
||||
13.798520822917606,
|
||||
2.569661863723081);
|
||||
});
|
||||
|
||||
const controls = new Potree.VRControlls(viewer);
|
||||
controls.speed = 2;
|
||||
controls.speedModificationFactor = 4;
|
||||
viewer.addEventListener("update", (e) => controls.update(e.delta));
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
// create VR button if VR display is available
|
||||
async function createVRButton(){
|
||||
|
||||
if(typeof navigator.getVRDisplays === "undefined"){
|
||||
return;
|
||||
}
|
||||
|
||||
const displays = await navigator.getVRDisplays();
|
||||
console.log(displays);
|
||||
|
||||
if(displays.length > 0){
|
||||
|
||||
const controls = new Potree.VRControlls(viewer);
|
||||
viewer.addEventListener("update", (e) => controls.update(e.delta));
|
||||
|
||||
|
||||
const elVR = document.createElement("div");
|
||||
elVR.innerHTML = `
|
||||
<div style="position: absolute; z-index: 10000; right: 10px; bottom: 10px;"
|
||||
onclick="viewer.toggleVR()">
|
||||
<img src="../build/potree/resources/icons/vr_button.svg" />
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(elVR);
|
||||
}
|
||||
}
|
||||
createVRButton();
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,134 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title>Potree Viewer</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../build/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>
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
<script src="../libs/proj4/proj4.js"></script>
|
||||
<script src="../libs/openlayers3/ol.js"></script>
|
||||
<script src="../libs/i18next/i18next.js"></script>
|
||||
<script src="../libs/jstree/jstree.js"></script>
|
||||
<script src="../build/potree/potree.js"></script>
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/other/OBJLoader.js"></script>
|
||||
|
||||
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
||||
<!-- INCLUDE SETTINGS HERE -->
|
||||
|
||||
<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
|
||||
<div id="potree_render_area" style="background-image: url('../build/potree/resources/images/background.jpg');"></div>
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(true);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(3 * 1000 * 1000);
|
||||
viewer.loadSettingsFromURL();
|
||||
|
||||
viewer.loadGUI(() => {
|
||||
viewer.setLanguage('en');
|
||||
$("#menu_tools").next().show();
|
||||
$("#menu_clipping").next().show();
|
||||
//viewer.toggleSidebar();
|
||||
});
|
||||
|
||||
Potree.loadPointCloud("http://5.9.65.151/mschuetz/potree/resources/pointclouds/uni_heidelberg/dechen_cave/cloud.js", "Dechen Cave", function(e){
|
||||
viewer.scene.addPointCloud(e.pointcloud);
|
||||
|
||||
e.pointcloud.position.set(-10, -15, -2);
|
||||
e.pointcloud.scale.set(1, 1, 1);
|
||||
|
||||
const material = e.pointcloud.material;
|
||||
|
||||
material.size = 0.4;
|
||||
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
||||
material.rgbGamma = 0.35;
|
||||
material.rgbBrightness = -0.26;
|
||||
});
|
||||
|
||||
|
||||
{ // Load OBJ File
|
||||
let manager = new THREE.LoadingManager();
|
||||
|
||||
manager.onProgress = function ( item, loaded, total ) {
|
||||
console.log( item, loaded, total );
|
||||
};
|
||||
|
||||
let textureLoader = new THREE.TextureLoader( manager );
|
||||
let texture = textureLoader.load(`${Potree.resourcePath}/textures/brick_pavement.jpg`);
|
||||
let onProgress = function ( xhr ) {
|
||||
if ( xhr.lengthComputable ) {
|
||||
let percentComplete = xhr.loaded / xhr.total * 100;
|
||||
console.log( Math.round(percentComplete, 2) + '% downloaded' );
|
||||
}
|
||||
};
|
||||
texture.wrapS = THREE.RepeatWrapping;
|
||||
texture.wrapT = THREE.RepeatWrapping;
|
||||
|
||||
let onError = function ( xhr ) {};
|
||||
let loader = new THREE.OBJLoader( manager );
|
||||
loader.load(`${Potree.resourcePath}/models/stanford_bunny_reduced.obj`, function ( object ) {
|
||||
object.traverse( function ( child ) {
|
||||
if ( child instanceof THREE.Mesh ) {
|
||||
child.material.map = texture;
|
||||
}
|
||||
});
|
||||
|
||||
//object.position.set(589871.587, 231528.213, 725.634);
|
||||
object.scale.multiplyScalar(3);
|
||||
object.rotation.set(Math.PI / 2, Math.PI, 0)
|
||||
|
||||
viewer.scene.scene.add( object );
|
||||
}, onProgress, onError );
|
||||
}
|
||||
|
||||
{
|
||||
const light1 = new THREE.PointLight( 0xffffff, 0.8);
|
||||
light1.position.set( 15, -15, 3 );
|
||||
viewer.scene.scene.add(light1);
|
||||
|
||||
const light2 = new THREE.PointLight( 0xffffff, 0.8);
|
||||
light2.position.set( 0, 0, 3 );
|
||||
viewer.scene.scene.add(light2);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<div style="position: absolute; z-index: 10000; right: 10px; bottom: 10px;"
|
||||
onclick="viewer.toggleVR()">
|
||||
|
||||
<img src="../resources/icons/vr_button.svg" />
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,163 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title>Potree Viewer</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../build/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>
|
||||
<script src="../libs/jquery/jquery-3.1.1.min.js"></script>
|
||||
<script src="../libs/spectrum/spectrum.js"></script>
|
||||
<script src="../libs/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script src="../libs/three.js/build/three.min.js"></script>
|
||||
<script src="../libs/three.js/extra/lines.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
<script src="../libs/proj4/proj4.js"></script>
|
||||
<!-- <script src="../libs/openlayers3/ol.js"></script> -->
|
||||
<script src="../libs/i18next/i18next.js"></script>
|
||||
<script src="../libs/jstree/jstree.js"></script>
|
||||
<script src="../build/potree/potree.js"></script>
|
||||
<script src="../libs/plasio/js/laslaz.js"></script>
|
||||
<script src="../libs/other/OBJLoader.js"></script>
|
||||
|
||||
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
|
||||
<!-- INCLUDE SETTINGS HERE -->
|
||||
|
||||
<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
|
||||
<div id="potree_render_area" style="background-image: url('../build/potree/resources/images/background.jpg');"></div>
|
||||
<div id="potree_sidebar_container"> </div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
|
||||
|
||||
viewer.setEDLEnabled(false);
|
||||
viewer.setFOV(60);
|
||||
viewer.setPointBudget(0.3 * 1000 * 1000);
|
||||
viewer.loadSettingsFromURL();
|
||||
viewer.setDescription(`
|
||||
If your browser supports WebVR, a VR button will appear on the bottom right. <br>
|
||||
(Tested on HTC Vive + Firefox 73 (<font style="color: #88ff88">works</font>),
|
||||
Oculus Quest (<font style="color: #88ff88">works</font>),
|
||||
Chrome 80 (<font style="color: #ff8888">(didn't work) </font>)
|
||||
<br>
|
||||
Heidentor point cloud courtesy of <a href="http://archpro.lbg.ac.at/" target="_blank">Ludwig Boltzmann Institute - Archeological Prospection and Virtual Archeology</a> (26M points)
|
||||
`);
|
||||
|
||||
viewer.loadGUI(() => {
|
||||
viewer.setLanguage('en');
|
||||
$("#menu_appearance").next().show();
|
||||
$("#menu_tools").next().show();
|
||||
$("#menu_scene").next().show();
|
||||
$("#menu_filters").next().show();
|
||||
viewer.toggleSidebar();
|
||||
});
|
||||
|
||||
Potree.loadPointCloud("http://5.9.65.151/mschuetz/potree/resources/pointclouds/archpro/heidentor/cloud.js", "Heidentor", function(e){
|
||||
viewer.scene.addPointCloud(e.pointcloud);
|
||||
|
||||
e.pointcloud.position.set(-4, -7, -1.1);
|
||||
e.pointcloud.scale.set(1, 1, 1);
|
||||
|
||||
const material = e.pointcloud.material;
|
||||
|
||||
material.size = 0.4;
|
||||
material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
|
||||
|
||||
viewer.scene.view.position.set(-18.626, -5.523, 6.702);
|
||||
viewer.scene.view.lookAt(-0.500, 0.500, -0.707);
|
||||
});
|
||||
|
||||
|
||||
{ // Load OBJ File
|
||||
let manager = new THREE.LoadingManager();
|
||||
|
||||
manager.onProgress = function ( item, loaded, total ) {
|
||||
console.log( item, loaded, total );
|
||||
};
|
||||
|
||||
let textureLoader = new THREE.TextureLoader( manager );
|
||||
let texture = textureLoader.load(`${Potree.resourcePath}/textures/brick_pavement.jpg`);
|
||||
let onProgress = function ( xhr ) {
|
||||
if ( xhr.lengthComputable ) {
|
||||
let percentComplete = xhr.loaded / xhr.total * 100;
|
||||
console.log( Math.round(percentComplete, 2) + '% downloaded' );
|
||||
}
|
||||
};
|
||||
texture.wrapS = THREE.RepeatWrapping;
|
||||
texture.wrapT = THREE.RepeatWrapping;
|
||||
|
||||
let onError = function ( xhr ) {};
|
||||
let loader = new THREE.OBJLoader( manager );
|
||||
loader.load(`${Potree.resourcePath}/models/stanford_bunny_reduced.obj`, function ( object ) {
|
||||
object.traverse( function ( child ) {
|
||||
if ( child instanceof THREE.Mesh ) {
|
||||
child.material.map = texture;
|
||||
}
|
||||
});
|
||||
|
||||
object.position.set(-2, 2, -1);
|
||||
object.scale.multiplyScalar(5);
|
||||
object.rotation.set(Math.PI / 2, Math.PI, 0)
|
||||
|
||||
viewer.scene.scene.add( object );
|
||||
}, onProgress, onError );
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
//const light1 = new THREE.PointLight( 0xffffff, 0.8);
|
||||
//light1.position.set( 10, 10, 5 );
|
||||
//viewer.scene.scene.add(light1);
|
||||
|
||||
const light2 = new THREE.PointLight( 0xffffff, 0.8);
|
||||
light2.position.set( 0, 0, 3 );
|
||||
viewer.scene.scene.add(light2);
|
||||
|
||||
let manager = new THREE.LoadingManager();
|
||||
let textureLoader = new THREE.TextureLoader( manager );
|
||||
let texture = textureLoader.load(`${Potree.resourcePath}/textures/brick_pavement.jpg`);
|
||||
texture.wrapS = THREE.RepeatWrapping;
|
||||
texture.wrapT = THREE.RepeatWrapping;
|
||||
texture.repeat.set(10, 10, 10);
|
||||
|
||||
const geometry = new THREE.PlaneGeometry( 20, 20, 32, 32 );
|
||||
geometry.computeVertexNormals();
|
||||
geometry.computeFaceNormals();
|
||||
//const material = new THREE.MeshPhongMaterial( { side: THREE.DoubleSide} );
|
||||
const material = new THREE.MeshLambertMaterial( { color: 0xffffff, side: THREE.DoubleSide, flatShading: true } );
|
||||
const plane = new THREE.Mesh( geometry, material );
|
||||
plane.position.set(0, 0, -1);
|
||||
viewer.scene.scene.add( plane );
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<div style="position: absolute; z-index: 10000; right: 10px; bottom: 10px;"
|
||||
onclick="viewer.toggleVR()">
|
||||
|
||||
<img src="../resources/icons/vr_button.svg" />
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -170,13 +170,13 @@ MeshLine.prototype.process = function() {
|
||||
this.attributes.index.needsUpdate = true;
|
||||
}
|
||||
|
||||
this.geometry.addAttribute( 'position', this.attributes.position );
|
||||
this.geometry.addAttribute( 'previous', this.attributes.previous );
|
||||
this.geometry.addAttribute( 'next', this.attributes.next );
|
||||
this.geometry.addAttribute( 'side', this.attributes.side );
|
||||
this.geometry.addAttribute( 'width', this.attributes.width );
|
||||
this.geometry.addAttribute( 'uv', this.attributes.uv );
|
||||
this.geometry.addAttribute( 'counters', this.attributes.counters );
|
||||
this.geometry.setAttribute( 'position', this.attributes.position );
|
||||
this.geometry.setAttribute( 'previous', this.attributes.previous );
|
||||
this.geometry.setAttribute( 'next', this.attributes.next );
|
||||
this.geometry.setAttribute( 'side', this.attributes.side );
|
||||
this.geometry.setAttribute( 'width', this.attributes.width );
|
||||
this.geometry.setAttribute( 'uv', this.attributes.uv );
|
||||
this.geometry.setAttribute( 'counters', this.attributes.counters );
|
||||
|
||||
this.geometry.setIndex( this.attributes.index );
|
||||
|
||||
|
||||
@ -1,625 +0,0 @@
|
||||
/**
|
||||
* @author qiao / https://github.com/qiao
|
||||
* @author mrdoob / http://mrdoob.com
|
||||
* @author alteredq / http://alteredqualia.com/
|
||||
* @author WestLangley / http://github.com/WestLangley
|
||||
* @author erich666 / http://erichaines.com
|
||||
*/
|
||||
/*global THREE, console */
|
||||
|
||||
// This set of controls performs orbiting, dollying (zooming), and panning. It maintains
|
||||
// the "up" direction as +Y, unlike the TrackballControls. Touch on tablet and phones is
|
||||
// supported.
|
||||
//
|
||||
// Orbit - left mouse / touch: one finger move
|
||||
// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish
|
||||
// Pan - right mouse, or arrow keys / touch: three finter swipe
|
||||
//
|
||||
// This is a drop-in replacement for (most) TrackballControls used in examples.
|
||||
// That is, include this js file and wherever you see:
|
||||
// controls = new THREE.TrackballControls( camera );
|
||||
// controls.target.z = 150;
|
||||
// Simple substitute "OrbitControls" and the control should work as-is.
|
||||
|
||||
THREE.OrbitControls = function ( object, domElement ) {
|
||||
|
||||
this.object = object;
|
||||
this.domElement = ( domElement !== undefined ) ? domElement : document;
|
||||
|
||||
// API
|
||||
|
||||
// Set to false to disable this control
|
||||
this.enabled = true;
|
||||
|
||||
// "target" sets the location of focus, where the control orbits around
|
||||
// and where it pans with respect to.
|
||||
this.target = new THREE.Vector3();
|
||||
|
||||
// center is old, deprecated; use "target" instead
|
||||
this.center = this.target;
|
||||
|
||||
// This option actually enables dollying in and out; left as "zoom" for
|
||||
// backwards compatibility
|
||||
this.noZoom = false;
|
||||
this.zoomSpeed = 1.0;
|
||||
|
||||
// Limits to how far you can dolly in and out
|
||||
this.minDistance = 0;
|
||||
this.maxDistance = Infinity;
|
||||
|
||||
// Set to true to disable this control
|
||||
this.noRotate = false;
|
||||
this.rotateSpeed = 1.0;
|
||||
|
||||
// Set to true to disable this control
|
||||
this.noPan = false;
|
||||
this.keyPanSpeed = 7.0; // pixels moved per arrow key push
|
||||
|
||||
// Set to true to automatically rotate around the target
|
||||
this.autoRotate = false;
|
||||
this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
|
||||
|
||||
// How far you can orbit vertically, upper and lower limits.
|
||||
// Range is 0 to Math.PI radians.
|
||||
this.minPolarAngle = 0; // radians
|
||||
this.maxPolarAngle = Math.PI; // radians
|
||||
|
||||
// Set to true to disable use of the keys
|
||||
this.noKeys = false;
|
||||
|
||||
// The four arrow keys
|
||||
this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
|
||||
|
||||
////////////
|
||||
// internals
|
||||
|
||||
var scope = this;
|
||||
|
||||
var EPS = 0.000001;
|
||||
|
||||
var rotateStart = new THREE.Vector2();
|
||||
var rotateEnd = new THREE.Vector2();
|
||||
var rotateDelta = new THREE.Vector2();
|
||||
|
||||
var panStart = new THREE.Vector2();
|
||||
var panEnd = new THREE.Vector2();
|
||||
var panDelta = new THREE.Vector2();
|
||||
var panOffset = new THREE.Vector3();
|
||||
|
||||
var offset = new THREE.Vector3();
|
||||
|
||||
var dollyStart = new THREE.Vector2();
|
||||
var dollyEnd = new THREE.Vector2();
|
||||
var dollyDelta = new THREE.Vector2();
|
||||
|
||||
var phiDelta = 0;
|
||||
var thetaDelta = 0;
|
||||
var scale = 1;
|
||||
var pan = new THREE.Vector3();
|
||||
|
||||
var lastPosition = new THREE.Vector3();
|
||||
|
||||
var STATE = { NONE : -1, ROTATE : 0, DOLLY : 1, PAN : 2, TOUCH_ROTATE : 3, TOUCH_DOLLY : 4, TOUCH_PAN : 5 };
|
||||
|
||||
var state = STATE.NONE;
|
||||
|
||||
// for reset
|
||||
|
||||
this.target0 = this.target.clone();
|
||||
this.position0 = this.object.position.clone();
|
||||
|
||||
// events
|
||||
|
||||
var changeEvent = { type: 'change' };
|
||||
var startEvent = { type: 'start'};
|
||||
var endEvent = { type: 'end'};
|
||||
|
||||
this.rotateLeft = function ( angle ) {
|
||||
|
||||
if ( angle === undefined ) {
|
||||
|
||||
angle = getAutoRotationAngle();
|
||||
|
||||
}
|
||||
|
||||
thetaDelta -= angle;
|
||||
|
||||
};
|
||||
|
||||
this.rotateUp = function ( angle ) {
|
||||
|
||||
if ( angle === undefined ) {
|
||||
|
||||
angle = getAutoRotationAngle();
|
||||
|
||||
}
|
||||
|
||||
phiDelta -= angle;
|
||||
|
||||
};
|
||||
|
||||
// pass in distance in world space to move left
|
||||
this.panLeft = function ( distance ) {
|
||||
|
||||
var te = this.object.matrix.elements;
|
||||
|
||||
// get X column of matrix
|
||||
panOffset.set( te[ 0 ], te[ 1 ], te[ 2 ] );
|
||||
panOffset.multiplyScalar( - distance );
|
||||
|
||||
pan.add( panOffset );
|
||||
|
||||
};
|
||||
|
||||
// pass in distance in world space to move up
|
||||
this.panUp = function ( distance ) {
|
||||
|
||||
var te = this.object.matrix.elements;
|
||||
|
||||
// get Y column of matrix
|
||||
panOffset.set( te[ 4 ], te[ 5 ], te[ 6 ] );
|
||||
panOffset.multiplyScalar( distance );
|
||||
|
||||
pan.add( panOffset );
|
||||
|
||||
};
|
||||
|
||||
// pass in x,y of change desired in pixel space,
|
||||
// right and down are positive
|
||||
this.pan = function ( deltaX, deltaY ) {
|
||||
|
||||
var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
|
||||
|
||||
if ( scope.object.fov !== undefined ) {
|
||||
|
||||
// perspective
|
||||
var position = scope.object.position;
|
||||
var offset = position.clone().sub( scope.target );
|
||||
var targetDistance = offset.length();
|
||||
|
||||
// half of the fov is center to top of screen
|
||||
targetDistance *= Math.tan( ( scope.object.fov / 2 ) * Math.PI / 180.0 );
|
||||
|
||||
// we actually don't use screenWidth, since perspective camera is fixed to screen height
|
||||
scope.panLeft( 2 * deltaX * targetDistance / element.clientHeight );
|
||||
scope.panUp( 2 * deltaY * targetDistance / element.clientHeight );
|
||||
|
||||
} else if ( scope.object.top !== undefined ) {
|
||||
|
||||
// orthographic
|
||||
scope.panLeft( deltaX * (scope.object.right - scope.object.left) / element.clientWidth );
|
||||
scope.panUp( deltaY * (scope.object.top - scope.object.bottom) / element.clientHeight );
|
||||
|
||||
} else {
|
||||
|
||||
// camera neither orthographic or perspective
|
||||
console.warn( 'WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.' );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.dollyIn = function ( dollyScale ) {
|
||||
|
||||
if ( dollyScale === undefined ) {
|
||||
|
||||
dollyScale = getZoomScale();
|
||||
|
||||
}
|
||||
|
||||
scale /= dollyScale;
|
||||
|
||||
};
|
||||
|
||||
this.dollyOut = function ( dollyScale ) {
|
||||
|
||||
if ( dollyScale === undefined ) {
|
||||
|
||||
dollyScale = getZoomScale();
|
||||
|
||||
}
|
||||
|
||||
scale *= dollyScale;
|
||||
|
||||
};
|
||||
|
||||
this.update = function () {
|
||||
|
||||
var position = this.object.position;
|
||||
|
||||
offset.copy( position ).sub( this.target );
|
||||
|
||||
// angle from z-axis around y-axis
|
||||
|
||||
var theta = Math.atan2( offset.x, offset.z );
|
||||
|
||||
// angle from y-axis
|
||||
|
||||
var phi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );
|
||||
|
||||
if ( this.autoRotate ) {
|
||||
|
||||
this.rotateLeft( getAutoRotationAngle() );
|
||||
|
||||
}
|
||||
|
||||
theta += thetaDelta;
|
||||
phi += phiDelta;
|
||||
|
||||
// restrict phi to be between desired limits
|
||||
phi = Math.max( this.minPolarAngle, Math.min( this.maxPolarAngle, phi ) );
|
||||
|
||||
// restrict phi to be betwee EPS and PI-EPS
|
||||
phi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) );
|
||||
|
||||
var radius = offset.length() * scale;
|
||||
|
||||
// restrict radius to be between desired limits
|
||||
radius = Math.max( this.minDistance, Math.min( this.maxDistance, radius ) );
|
||||
|
||||
// move target to panned location
|
||||
this.target.add( pan );
|
||||
|
||||
offset.x = radius * Math.sin( phi ) * Math.sin( theta );
|
||||
offset.y = radius * Math.cos( phi );
|
||||
offset.z = radius * Math.sin( phi ) * Math.cos( theta );
|
||||
|
||||
position.copy( this.target ).add( offset );
|
||||
|
||||
this.object.lookAt( this.target );
|
||||
|
||||
thetaDelta = 0;
|
||||
phiDelta = 0;
|
||||
scale = 1;
|
||||
pan.set( 0, 0, 0 );
|
||||
|
||||
if ( lastPosition.distanceTo( this.object.position ) > 0 ) {
|
||||
|
||||
this.dispatchEvent( changeEvent );
|
||||
|
||||
lastPosition.copy( this.object.position );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
this.reset = function () {
|
||||
|
||||
state = STATE.NONE;
|
||||
|
||||
this.target.copy( this.target0 );
|
||||
this.object.position.copy( this.position0 );
|
||||
|
||||
this.update();
|
||||
|
||||
};
|
||||
|
||||
function getAutoRotationAngle() {
|
||||
|
||||
return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
|
||||
|
||||
}
|
||||
|
||||
function getZoomScale() {
|
||||
|
||||
return Math.pow( 0.95, scope.zoomSpeed );
|
||||
|
||||
}
|
||||
|
||||
function onMouseDown( event ) {
|
||||
|
||||
if ( scope.enabled === false ) return;
|
||||
event.preventDefault();
|
||||
|
||||
if ( event.button === 0 ) {
|
||||
if ( scope.noRotate === true ) return;
|
||||
|
||||
state = STATE.ROTATE;
|
||||
|
||||
rotateStart.set( event.clientX, event.clientY );
|
||||
|
||||
} else if ( event.button === 1 ) {
|
||||
if ( scope.noZoom === true ) return;
|
||||
|
||||
state = STATE.DOLLY;
|
||||
|
||||
dollyStart.set( event.clientX, event.clientY );
|
||||
|
||||
} else if ( event.button === 2 ) {
|
||||
if ( scope.noPan === true ) return;
|
||||
|
||||
state = STATE.PAN;
|
||||
|
||||
panStart.set( event.clientX, event.clientY );
|
||||
|
||||
}
|
||||
|
||||
scope.domElement.addEventListener( 'mousemove', onMouseMove, false );
|
||||
scope.domElement.addEventListener( 'mouseup', onMouseUp, false );
|
||||
scope.dispatchEvent( startEvent );
|
||||
|
||||
}
|
||||
|
||||
function onMouseMove( event ) {
|
||||
|
||||
if ( scope.enabled === false ) return;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
|
||||
|
||||
if ( state === STATE.ROTATE ) {
|
||||
|
||||
if ( scope.noRotate === true ) return;
|
||||
|
||||
rotateEnd.set( event.clientX, event.clientY );
|
||||
rotateDelta.subVectors( rotateEnd, rotateStart );
|
||||
|
||||
// rotating across whole screen goes 360 degrees around
|
||||
scope.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
|
||||
|
||||
// rotating up and down along whole screen attempts to go 360, but limited to 180
|
||||
scope.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
|
||||
|
||||
rotateStart.copy( rotateEnd );
|
||||
|
||||
} else if ( state === STATE.DOLLY ) {
|
||||
|
||||
if ( scope.noZoom === true ) return;
|
||||
|
||||
dollyEnd.set( event.clientX, event.clientY );
|
||||
dollyDelta.subVectors( dollyEnd, dollyStart );
|
||||
|
||||
if ( dollyDelta.y > 0 ) {
|
||||
|
||||
scope.dollyIn();
|
||||
|
||||
} else {
|
||||
|
||||
scope.dollyOut();
|
||||
|
||||
}
|
||||
|
||||
dollyStart.copy( dollyEnd );
|
||||
|
||||
} else if ( state === STATE.PAN ) {
|
||||
|
||||
if ( scope.noPan === true ) return;
|
||||
|
||||
panEnd.set( event.clientX, event.clientY );
|
||||
panDelta.subVectors( panEnd, panStart );
|
||||
|
||||
scope.pan( panDelta.x, panDelta.y );
|
||||
|
||||
panStart.copy( panEnd );
|
||||
|
||||
}
|
||||
|
||||
scope.update();
|
||||
|
||||
}
|
||||
|
||||
function onMouseUp( /* event */ ) {
|
||||
|
||||
if ( scope.enabled === false ) return;
|
||||
|
||||
scope.domElement.removeEventListener( 'mousemove', onMouseMove, false );
|
||||
scope.domElement.removeEventListener( 'mouseup', onMouseUp, false );
|
||||
scope.dispatchEvent( endEvent );
|
||||
state = STATE.NONE;
|
||||
|
||||
}
|
||||
|
||||
function onMouseWheel( event ) {
|
||||
|
||||
if ( scope.enabled === false || scope.noZoom === true ) return;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var delta = 0;
|
||||
|
||||
if ( event.wheelDelta !== undefined ) { // WebKit / Opera / Explorer 9
|
||||
|
||||
delta = event.wheelDelta;
|
||||
|
||||
} else if ( event.detail !== undefined ) { // Firefox
|
||||
|
||||
delta = - event.detail;
|
||||
|
||||
}
|
||||
|
||||
if ( delta > 0 ) {
|
||||
|
||||
scope.dollyOut();
|
||||
|
||||
} else {
|
||||
|
||||
scope.dollyIn();
|
||||
|
||||
}
|
||||
|
||||
scope.update();
|
||||
scope.dispatchEvent( startEvent );
|
||||
scope.dispatchEvent( endEvent );
|
||||
|
||||
}
|
||||
|
||||
function onKeyDown( event ) {
|
||||
|
||||
if ( scope.enabled === false || scope.noKeys === true || scope.noPan === true ) return;
|
||||
|
||||
switch ( event.keyCode ) {
|
||||
|
||||
case scope.keys.UP:
|
||||
scope.pan( 0, scope.keyPanSpeed );
|
||||
scope.update();
|
||||
break;
|
||||
|
||||
case scope.keys.BOTTOM:
|
||||
scope.pan( 0, - scope.keyPanSpeed );
|
||||
scope.update();
|
||||
break;
|
||||
|
||||
case scope.keys.LEFT:
|
||||
scope.pan( scope.keyPanSpeed, 0 );
|
||||
scope.update();
|
||||
break;
|
||||
|
||||
case scope.keys.RIGHT:
|
||||
scope.pan( - scope.keyPanSpeed, 0 );
|
||||
scope.update();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function touchstart( event ) {
|
||||
|
||||
if ( scope.enabled === false ) return;
|
||||
|
||||
switch ( event.touches.length ) {
|
||||
|
||||
case 1: // one-fingered touch: rotate
|
||||
|
||||
if ( scope.noRotate === true ) return;
|
||||
|
||||
state = STATE.TOUCH_ROTATE;
|
||||
|
||||
rotateStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
|
||||
break;
|
||||
|
||||
case 2: // two-fingered touch: dolly
|
||||
|
||||
if ( scope.noZoom === true ) return;
|
||||
|
||||
state = STATE.TOUCH_DOLLY;
|
||||
|
||||
var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
|
||||
var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
|
||||
var distance = Math.sqrt( dx * dx + dy * dy );
|
||||
dollyStart.set( 0, distance );
|
||||
break;
|
||||
|
||||
case 3: // three-fingered touch: pan
|
||||
|
||||
if ( scope.noPan === true ) return;
|
||||
|
||||
state = STATE.TOUCH_PAN;
|
||||
|
||||
panStart.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
state = STATE.NONE;
|
||||
|
||||
}
|
||||
|
||||
scope.dispatchEvent( startEvent );
|
||||
|
||||
}
|
||||
|
||||
function touchmove( event ) {
|
||||
|
||||
if ( scope.enabled === false ) return;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
var element = scope.domElement === document ? scope.domElement.body : scope.domElement;
|
||||
|
||||
switch ( event.touches.length ) {
|
||||
|
||||
case 1: // one-fingered touch: rotate
|
||||
|
||||
if ( scope.noRotate === true ) return;
|
||||
if ( state !== STATE.TOUCH_ROTATE ) return;
|
||||
|
||||
rotateEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
|
||||
rotateDelta.subVectors( rotateEnd, rotateStart );
|
||||
|
||||
// rotating across whole screen goes 360 degrees around
|
||||
scope.rotateLeft( 2 * Math.PI * rotateDelta.x / element.clientWidth * scope.rotateSpeed );
|
||||
// rotating up and down along whole screen attempts to go 360, but limited to 180
|
||||
scope.rotateUp( 2 * Math.PI * rotateDelta.y / element.clientHeight * scope.rotateSpeed );
|
||||
|
||||
rotateStart.copy( rotateEnd );
|
||||
|
||||
scope.update();
|
||||
break;
|
||||
|
||||
case 2: // two-fingered touch: dolly
|
||||
|
||||
if ( scope.noZoom === true ) return;
|
||||
if ( state !== STATE.TOUCH_DOLLY ) return;
|
||||
|
||||
var dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
|
||||
var dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
|
||||
var distance = Math.sqrt( dx * dx + dy * dy );
|
||||
|
||||
dollyEnd.set( 0, distance );
|
||||
dollyDelta.subVectors( dollyEnd, dollyStart );
|
||||
|
||||
if ( dollyDelta.y > 0 ) {
|
||||
|
||||
scope.dollyOut();
|
||||
|
||||
} else {
|
||||
|
||||
scope.dollyIn();
|
||||
|
||||
}
|
||||
|
||||
dollyStart.copy( dollyEnd );
|
||||
|
||||
scope.update();
|
||||
break;
|
||||
|
||||
case 3: // three-fingered touch: pan
|
||||
|
||||
if ( scope.noPan === true ) return;
|
||||
if ( state !== STATE.TOUCH_PAN ) return;
|
||||
|
||||
panEnd.set( event.touches[ 0 ].pageX, event.touches[ 0 ].pageY );
|
||||
panDelta.subVectors( panEnd, panStart );
|
||||
|
||||
scope.pan( panDelta.x, panDelta.y );
|
||||
|
||||
panStart.copy( panEnd );
|
||||
|
||||
scope.update();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
state = STATE.NONE;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function touchend( /* event */ ) {
|
||||
|
||||
if ( scope.enabled === false ) return;
|
||||
|
||||
scope.dispatchEvent( endEvent );
|
||||
state = STATE.NONE;
|
||||
|
||||
}
|
||||
|
||||
this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
|
||||
this.domElement.addEventListener( 'mousedown', onMouseDown, false );
|
||||
this.domElement.addEventListener( 'mousewheel', onMouseWheel, false );
|
||||
this.domElement.addEventListener( 'DOMMouseScroll', onMouseWheel, false ); // firefox
|
||||
|
||||
this.domElement.addEventListener( 'touchstart', touchstart, false );
|
||||
this.domElement.addEventListener( 'touchend', touchend, false );
|
||||
this.domElement.addEventListener( 'touchmove', touchmove, false );
|
||||
|
||||
window.addEventListener( 'keydown', onKeyDown, false );
|
||||
|
||||
};
|
||||
|
||||
THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );
|
||||
File diff suppressed because one or more lines are too long
1010
libs/three.js/build/three.min.js
vendored
1010
libs/three.js/build/three.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3939
libs/three.js/extra/GLTFLoader.js
Normal file
3939
libs/three.js/extra/GLTFLoader.js
Normal file
File diff suppressed because it is too large
Load Diff
182
libs/three.js/extra/VRButton.js
Normal file
182
libs/three.js/extra/VRButton.js
Normal file
@ -0,0 +1,182 @@
|
||||
|
||||
// Adapted from three.js VRButton
|
||||
|
||||
|
||||
class VRButton {
|
||||
|
||||
constructor(){
|
||||
this.onStartListeners = [];
|
||||
this.onEndListeners = [];
|
||||
this.element = null;
|
||||
}
|
||||
|
||||
onStart(callback){
|
||||
this.onStartListeners.push(callback);
|
||||
}
|
||||
|
||||
onEnd(callback){
|
||||
this.onEndListeners.push(callback);
|
||||
}
|
||||
|
||||
static async createButton( renderer, options ) {
|
||||
|
||||
if ( options ) {
|
||||
|
||||
console.error( 'THREE.VRButton: The "options" parameter has been removed. Please set the reference space type via renderer.xr.setReferenceSpaceType() instead.' );
|
||||
|
||||
}
|
||||
|
||||
const button = new VRButton();
|
||||
const element = document.createElement( 'button' );
|
||||
|
||||
button.element = element;
|
||||
|
||||
function setEnter(){
|
||||
button.element.innerHTML = `
|
||||
<div style="font-size: 0.5em;">ENTER</div>
|
||||
<div style="font-weight: bold;">VR</div>
|
||||
`;
|
||||
}
|
||||
|
||||
function setExit(){
|
||||
button.element.innerHTML = `
|
||||
<div style="font-size: 0.5em;">EXIT</div>
|
||||
<div style="font-weight: bold;">VR</div>
|
||||
`;
|
||||
}
|
||||
|
||||
function showEnterVR( /*device*/ ) {
|
||||
|
||||
let currentSession = null;
|
||||
|
||||
function onSessionStarted( session ) {
|
||||
|
||||
session.addEventListener( 'end', onSessionEnded );
|
||||
|
||||
for(let listener of button.onStartListeners){
|
||||
listener();
|
||||
}
|
||||
|
||||
|
||||
renderer.xr.setSession( session );
|
||||
setExit();
|
||||
|
||||
currentSession = session;
|
||||
|
||||
}
|
||||
|
||||
function onSessionEnded( /*event*/ ) {
|
||||
|
||||
currentSession.removeEventListener( 'end', onSessionEnded );
|
||||
|
||||
for(let listener of button.onEndListeners){
|
||||
listener();
|
||||
}
|
||||
|
||||
setEnter();
|
||||
|
||||
currentSession = null;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
button.element.style.display = '';
|
||||
|
||||
button.element.style.cursor = 'pointer';
|
||||
|
||||
setEnter();
|
||||
|
||||
button.element.onmouseenter = function () {
|
||||
|
||||
button.element.style.opacity = '1.0';
|
||||
|
||||
};
|
||||
|
||||
button.element.onmouseleave = function () {
|
||||
|
||||
button.element.style.opacity = '0.7';
|
||||
|
||||
};
|
||||
|
||||
button.element.onclick = function () {
|
||||
|
||||
if ( currentSession === null ) {
|
||||
|
||||
// WebXR's requestReferenceSpace only works if the corresponding feature
|
||||
// was requested at session creation time. For simplicity, just ask for
|
||||
// the interesting ones as optional features, but be aware that the
|
||||
// requestReferenceSpace call will fail if it turns out to be unavailable.
|
||||
// ('local' is always available for immersive sessions and doesn't need to
|
||||
// be requested separately.)
|
||||
|
||||
const sessionInit = { optionalFeatures: [ 'local-floor', 'bounded-floor', 'hand-tracking' ] };
|
||||
navigator.xr.requestSession( 'immersive-vr', sessionInit ).then( onSessionStarted );
|
||||
|
||||
} else {
|
||||
|
||||
currentSession.end();
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
function stylizeElement( element ) {
|
||||
|
||||
element.style.position = 'absolute';
|
||||
element.style.bottom = '20px';
|
||||
element.style.padding = '12px 6px';
|
||||
element.style.border = '1px solid #fff';
|
||||
element.style.borderRadius = '4px';
|
||||
element.style.background = 'rgba(0,0,0,0.1)';
|
||||
element.style.color = '#fff';
|
||||
element.style.font = 'normal 13px sans-serif';
|
||||
element.style.textAlign = 'center';
|
||||
element.style.opacity = '0.7';
|
||||
element.style.outline = 'none';
|
||||
element.style.zIndex = '999';
|
||||
|
||||
}
|
||||
|
||||
if ( 'xr' in navigator ) {
|
||||
|
||||
button.element.id = 'VRButton';
|
||||
button.element.style.display = 'none';
|
||||
|
||||
stylizeElement( button.element );
|
||||
|
||||
let supported = await navigator.xr.isSessionSupported( 'immersive-vr' );
|
||||
|
||||
if(supported){
|
||||
showEnterVR();
|
||||
|
||||
return button;
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ( window.isSecureContext === false ) {
|
||||
|
||||
console.log("WEBXR NEEDS HTTPS");
|
||||
|
||||
} else {
|
||||
|
||||
console.log("WEBXR not available");
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export { VRButton };
|
||||
311
libs/three.js/extra/XRControllerModelFactory.js
Normal file
311
libs/three.js/extra/XRControllerModelFactory.js
Normal file
@ -0,0 +1,311 @@
|
||||
import {
|
||||
Mesh,
|
||||
MeshBasicMaterial,
|
||||
Object3D,
|
||||
Quaternion,
|
||||
SphereBufferGeometry,
|
||||
} from '../build/three.module.js';
|
||||
|
||||
import { GLTFLoader } from '../loaders/GLTFLoader.js';
|
||||
|
||||
import {
|
||||
Constants as MotionControllerConstants,
|
||||
fetchProfile,
|
||||
MotionController
|
||||
} from '../libs/motion-controllers.module.js';
|
||||
|
||||
const DEFAULT_PROFILES_PATH = 'https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles';
|
||||
const DEFAULT_PROFILE = 'generic-trigger';
|
||||
|
||||
function XRControllerModel( ) {
|
||||
|
||||
Object3D.call( this );
|
||||
|
||||
this.motionController = null;
|
||||
this.envMap = null;
|
||||
|
||||
}
|
||||
|
||||
XRControllerModel.prototype = Object.assign( Object.create( Object3D.prototype ), {
|
||||
|
||||
constructor: XRControllerModel,
|
||||
|
||||
setEnvironmentMap: function ( envMap ) {
|
||||
|
||||
if ( this.envMap == envMap ) {
|
||||
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
this.envMap = envMap;
|
||||
this.traverse( ( child ) => {
|
||||
|
||||
if ( child.isMesh ) {
|
||||
|
||||
child.material.envMap = this.envMap;
|
||||
child.material.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Polls data from the XRInputSource and updates the model's components to match
|
||||
* the real world data
|
||||
*/
|
||||
updateMatrixWorld: function ( force ) {
|
||||
|
||||
Object3D.prototype.updateMatrixWorld.call( this, force );
|
||||
|
||||
if ( ! this.motionController ) return;
|
||||
|
||||
// Cause the MotionController to poll the Gamepad for data
|
||||
this.motionController.updateFromGamepad();
|
||||
|
||||
// Update the 3D model to reflect the button, thumbstick, and touchpad state
|
||||
Object.values( this.motionController.components ).forEach( ( component ) => {
|
||||
|
||||
// Update node data based on the visual responses' current states
|
||||
Object.values( component.visualResponses ).forEach( ( visualResponse ) => {
|
||||
|
||||
const { valueNode, minNode, maxNode, value, valueNodeProperty } = visualResponse;
|
||||
|
||||
// Skip if the visual response node is not found. No error is needed,
|
||||
// because it will have been reported at load time.
|
||||
if ( ! valueNode ) return;
|
||||
|
||||
// Calculate the new properties based on the weight supplied
|
||||
if ( valueNodeProperty === MotionControllerConstants.VisualResponseProperty.VISIBILITY ) {
|
||||
|
||||
valueNode.visible = value;
|
||||
|
||||
} else if ( valueNodeProperty === MotionControllerConstants.VisualResponseProperty.TRANSFORM ) {
|
||||
|
||||
Quaternion.slerp(
|
||||
minNode.quaternion,
|
||||
maxNode.quaternion,
|
||||
valueNode.quaternion,
|
||||
value
|
||||
);
|
||||
|
||||
valueNode.position.lerpVectors(
|
||||
minNode.position,
|
||||
maxNode.position,
|
||||
value
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
/**
|
||||
* Walks the model's tree to find the nodes needed to animate the components and
|
||||
* saves them to the motionContoller components for use in the frame loop. When
|
||||
* touchpads are found, attaches a touch dot to them.
|
||||
*/
|
||||
function findNodes( motionController, scene ) {
|
||||
|
||||
// Loop through the components and find the nodes needed for each components' visual responses
|
||||
Object.values( motionController.components ).forEach( ( component ) => {
|
||||
|
||||
const { type, touchPointNodeName, visualResponses } = component;
|
||||
|
||||
if ( type === MotionControllerConstants.ComponentType.TOUCHPAD ) {
|
||||
|
||||
component.touchPointNode = scene.getObjectByName( touchPointNodeName );
|
||||
if ( component.touchPointNode ) {
|
||||
|
||||
// Attach a touch dot to the touchpad.
|
||||
const sphereGeometry = new SphereBufferGeometry( 0.001 );
|
||||
const material = new MeshBasicMaterial( { color: 0x0000FF } );
|
||||
const sphere = new Mesh( sphereGeometry, material );
|
||||
component.touchPointNode.add( sphere );
|
||||
|
||||
} else {
|
||||
|
||||
console.warn( `Could not find touch dot, ${component.touchPointNodeName}, in touchpad component ${component.id}` );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Loop through all the visual responses to be applied to this component
|
||||
Object.values( visualResponses ).forEach( ( visualResponse ) => {
|
||||
|
||||
const { valueNodeName, minNodeName, maxNodeName, valueNodeProperty } = visualResponse;
|
||||
|
||||
// If animating a transform, find the two nodes to be interpolated between.
|
||||
if ( valueNodeProperty === MotionControllerConstants.VisualResponseProperty.TRANSFORM ) {
|
||||
|
||||
visualResponse.minNode = scene.getObjectByName( minNodeName );
|
||||
visualResponse.maxNode = scene.getObjectByName( maxNodeName );
|
||||
|
||||
// If the extents cannot be found, skip this animation
|
||||
if ( ! visualResponse.minNode ) {
|
||||
|
||||
console.warn( `Could not find ${minNodeName} in the model` );
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if ( ! visualResponse.maxNode ) {
|
||||
|
||||
console.warn( `Could not find ${maxNodeName} in the model` );
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If the target node cannot be found, skip this animation
|
||||
visualResponse.valueNode = scene.getObjectByName( valueNodeName );
|
||||
if ( ! visualResponse.valueNode ) {
|
||||
|
||||
console.warn( `Could not find ${valueNodeName} in the model` );
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
function addAssetSceneToControllerModel( controllerModel, scene ) {
|
||||
|
||||
// Find the nodes needed for animation and cache them on the motionController.
|
||||
findNodes( controllerModel.motionController, scene );
|
||||
|
||||
// Apply any environment map that the mesh already has set.
|
||||
if ( controllerModel.envMap ) {
|
||||
|
||||
scene.traverse( ( child ) => {
|
||||
|
||||
if ( child.isMesh ) {
|
||||
|
||||
child.material.envMap = controllerModel.envMap;
|
||||
child.material.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
// Add the glTF scene to the controllerModel.
|
||||
controllerModel.add( scene );
|
||||
|
||||
}
|
||||
|
||||
var XRControllerModelFactory = ( function () {
|
||||
|
||||
function XRControllerModelFactory( gltfLoader = null ) {
|
||||
|
||||
this.gltfLoader = gltfLoader;
|
||||
this.path = DEFAULT_PROFILES_PATH;
|
||||
this._assetCache = {};
|
||||
|
||||
// If a GLTFLoader wasn't supplied to the constructor create a new one.
|
||||
if ( ! this.gltfLoader ) {
|
||||
|
||||
this.gltfLoader = new GLTFLoader();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
XRControllerModelFactory.prototype = {
|
||||
|
||||
constructor: XRControllerModelFactory,
|
||||
|
||||
createControllerModel: function ( controller ) {
|
||||
|
||||
const controllerModel = new XRControllerModel();
|
||||
let scene = null;
|
||||
|
||||
controller.addEventListener( 'connected', ( event ) => {
|
||||
|
||||
const xrInputSource = event.data;
|
||||
|
||||
if ( xrInputSource.targetRayMode !== 'tracked-pointer' || ! xrInputSource.gamepad ) return;
|
||||
|
||||
fetchProfile( xrInputSource, this.path, DEFAULT_PROFILE ).then( ( { profile, assetPath } ) => {
|
||||
|
||||
controllerModel.motionController = new MotionController(
|
||||
xrInputSource,
|
||||
profile,
|
||||
assetPath
|
||||
);
|
||||
|
||||
const cachedAsset = this._assetCache[ controllerModel.motionController.assetUrl ];
|
||||
if ( cachedAsset ) {
|
||||
|
||||
scene = cachedAsset.scene.clone();
|
||||
|
||||
addAssetSceneToControllerModel( controllerModel, scene );
|
||||
|
||||
} else {
|
||||
|
||||
if ( ! this.gltfLoader ) {
|
||||
|
||||
throw new Error( 'GLTFLoader not set.' );
|
||||
|
||||
}
|
||||
|
||||
this.gltfLoader.setPath( '' );
|
||||
this.gltfLoader.load( controllerModel.motionController.assetUrl, ( asset ) => {
|
||||
|
||||
this._assetCache[ controllerModel.motionController.assetUrl ] = asset;
|
||||
|
||||
scene = asset.scene.clone();
|
||||
|
||||
addAssetSceneToControllerModel( controllerModel, scene );
|
||||
|
||||
},
|
||||
null,
|
||||
() => {
|
||||
|
||||
throw new Error( `Asset ${controllerModel.motionController.assetUrl} missing or malformed.` );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
} ).catch( ( err ) => {
|
||||
|
||||
console.warn( err );
|
||||
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
controller.addEventListener( 'disconnected', () => {
|
||||
|
||||
controllerModel.motionController = null;
|
||||
controllerModel.remove( scene );
|
||||
scene = null;
|
||||
|
||||
} );
|
||||
|
||||
return controllerModel;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return XRControllerModelFactory;
|
||||
|
||||
} )();
|
||||
|
||||
export { XRControllerModelFactory };
|
||||
@ -17,8 +17,8 @@ THREE.LineSegmentsGeometry = function () {
|
||||
var index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ];
|
||||
|
||||
this.setIndex( index );
|
||||
this.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
|
||||
this.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
|
||||
this.setAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
|
||||
this.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
|
||||
|
||||
};
|
||||
|
||||
@ -75,8 +75,8 @@ THREE.LineSegmentsGeometry.prototype = Object.assign( Object.create( THREE.Insta
|
||||
|
||||
var instanceBuffer = new THREE.InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz
|
||||
|
||||
this.addAttribute( 'instanceStart', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
|
||||
this.addAttribute( 'instanceEnd', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
|
||||
this.setAttribute( 'instanceStart', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
|
||||
this.setAttribute( 'instanceEnd', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
|
||||
|
||||
//
|
||||
|
||||
@ -103,8 +103,8 @@ THREE.LineSegmentsGeometry.prototype = Object.assign( Object.create( THREE.Insta
|
||||
|
||||
var instanceColorBuffer = new THREE.InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb
|
||||
|
||||
this.addAttribute( 'instanceColorStart', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
|
||||
this.addAttribute( 'instanceColorEnd', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
|
||||
this.setAttribute( 'instanceColorStart', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
|
||||
this.setAttribute( 'instanceColorEnd', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
|
||||
|
||||
return this;
|
||||
|
||||
@ -308,8 +308,8 @@ THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototy
|
||||
|
||||
var instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
|
||||
|
||||
geometry.addAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
|
||||
geometry.addAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
|
||||
geometry.setAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
|
||||
geometry.setAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
|
||||
|
||||
return this;
|
||||
|
||||
|
||||
@ -45,8 +45,8 @@ THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototy
|
||||
|
||||
var instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
|
||||
|
||||
geometry.addAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
|
||||
geometry.addAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
|
||||
geometry.setAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
|
||||
geometry.setAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
|
||||
|
||||
return this;
|
||||
|
||||
|
||||
@ -14,8 +14,8 @@ THREE.LineSegmentsGeometry = function () {
|
||||
var index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ];
|
||||
|
||||
this.setIndex( index );
|
||||
this.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
|
||||
this.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
|
||||
this.setAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
|
||||
this.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
|
||||
|
||||
};
|
||||
|
||||
@ -72,8 +72,8 @@ THREE.LineSegmentsGeometry.prototype = Object.assign( Object.create( THREE.Insta
|
||||
|
||||
var instanceBuffer = new THREE.InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz
|
||||
|
||||
this.addAttribute( 'instanceStart', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
|
||||
this.addAttribute( 'instanceEnd', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
|
||||
this.setAttribute( 'instanceStart', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
|
||||
this.setAttribute( 'instanceEnd', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
|
||||
|
||||
//
|
||||
|
||||
@ -100,8 +100,8 @@ THREE.LineSegmentsGeometry.prototype = Object.assign( Object.create( THREE.Insta
|
||||
|
||||
var instanceColorBuffer = new THREE.InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb
|
||||
|
||||
this.addAttribute( 'instanceColorStart', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
|
||||
this.addAttribute( 'instanceColorEnd', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
|
||||
this.setAttribute( 'instanceColorStart', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
|
||||
this.setAttribute( 'instanceColorEnd', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
|
||||
|
||||
return this;
|
||||
|
||||
|
||||
@ -45,8 +45,8 @@ THREE.Wireframe.prototype = Object.assign( Object.create( THREE.Mesh.prototype )
|
||||
|
||||
var instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
|
||||
|
||||
geometry.addAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
|
||||
geometry.addAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
|
||||
geometry.setAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
|
||||
geometry.setAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
|
||||
|
||||
return this;
|
||||
|
||||
|
||||
3
libs/three.js/libs/chevrotain.module.min.js
vendored
Normal file
3
libs/three.js/libs/chevrotain.module.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3575
libs/three.js/libs/dat.gui.module.js
Normal file
3575
libs/three.js/libs/dat.gui.module.js
Normal file
File diff suppressed because one or more lines are too long
27
libs/three.js/libs/deflate.module.min.js
vendored
Normal file
27
libs/three.js/libs/deflate.module.min.js
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */ var mod={},n=void 0,w=!0,aa=mod; function ba(f,d){var c=f.split("."),e=aa;!(c[0]in e)&&e.execScript&&e.execScript("var "+c[0]);for(var b;c.length&&(b=c.shift());)!c.length&&d!==n?e[b]=d:e=e[b]?e[b]:e[b]={}};var C="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;function K(f,d){this.index="number"===typeof d?d:0;this.e=0;this.buffer=f instanceof(C?Uint8Array:Array)?f:new (C?Uint8Array:Array)(32768);if(2*this.buffer.length<=this.index)throw Error("invalid index");this.buffer.length<=this.index&&ca(this)}function ca(f){var d=f.buffer,c,e=d.length,b=new (C?Uint8Array:Array)(e<<1);if(C)b.set(d);else for(c=0;c<e;++c)b[c]=d[c];return f.buffer=b}
|
||||
K.prototype.b=function(f,d,c){var e=this.buffer,b=this.index,a=this.e,g=e[b],m;c&&1<d&&(f=8<d?(L[f&255]<<24|L[f>>>8&255]<<16|L[f>>>16&255]<<8|L[f>>>24&255])>>32-d:L[f]>>8-d);if(8>d+a)g=g<<d|f,a+=d;else for(m=0;m<d;++m)g=g<<1|f>>d-m-1&1,8===++a&&(a=0,e[b++]=L[g],g=0,b===e.length&&(e=ca(this)));e[b]=g;this.buffer=e;this.e=a;this.index=b};K.prototype.finish=function(){var f=this.buffer,d=this.index,c;0<this.e&&(f[d]<<=8-this.e,f[d]=L[f[d]],d++);C?c=f.subarray(0,d):(f.length=d,c=f);return c};
|
||||
var da=new (C?Uint8Array:Array)(256),M;for(M=0;256>M;++M){for(var N=M,S=N,ea=7,N=N>>>1;N;N>>>=1)S<<=1,S|=N&1,--ea;da[M]=(S<<ea&255)>>>0}var L=da;function ia(f){this.buffer=new (C?Uint16Array:Array)(2*f);this.length=0}ia.prototype.getParent=function(f){return 2*((f-2)/4|0)};ia.prototype.push=function(f,d){var c,e,b=this.buffer,a;c=this.length;b[this.length++]=d;for(b[this.length++]=f;0<c;)if(e=this.getParent(c),b[c]>b[e])a=b[c],b[c]=b[e],b[e]=a,a=b[c+1],b[c+1]=b[e+1],b[e+1]=a,c=e;else break;return this.length};
|
||||
ia.prototype.pop=function(){var f,d,c=this.buffer,e,b,a;d=c[0];f=c[1];this.length-=2;c[0]=c[this.length];c[1]=c[this.length+1];for(a=0;;){b=2*a+2;if(b>=this.length)break;b+2<this.length&&c[b+2]>c[b]&&(b+=2);if(c[b]>c[a])e=c[a],c[a]=c[b],c[b]=e,e=c[a+1],c[a+1]=c[b+1],c[b+1]=e;else break;a=b}return{index:f,value:d,length:this.length}};function ka(f,d){this.d=la;this.i=0;this.input=C&&f instanceof Array?new Uint8Array(f):f;this.c=0;d&&(d.lazy&&(this.i=d.lazy),"number"===typeof d.compressionType&&(this.d=d.compressionType),d.outputBuffer&&(this.a=C&&d.outputBuffer instanceof Array?new Uint8Array(d.outputBuffer):d.outputBuffer),"number"===typeof d.outputIndex&&(this.c=d.outputIndex));this.a||(this.a=new (C?Uint8Array:Array)(32768))}var la=2,na={NONE:0,h:1,g:la,n:3},T=[],U;
|
||||
for(U=0;288>U;U++)switch(w){case 143>=U:T.push([U+48,8]);break;case 255>=U:T.push([U-144+400,9]);break;case 279>=U:T.push([U-256+0,7]);break;case 287>=U:T.push([U-280+192,8]);break;default:throw"invalid literal: "+U;}
|
||||
ka.prototype.f=function(){var f,d,c,e,b=this.input;switch(this.d){case 0:c=0;for(e=b.length;c<e;){d=C?b.subarray(c,c+65535):b.slice(c,c+65535);c+=d.length;var a=d,g=c===e,m=n,k=n,p=n,t=n,u=n,l=this.a,h=this.c;if(C){for(l=new Uint8Array(this.a.buffer);l.length<=h+a.length+5;)l=new Uint8Array(l.length<<1);l.set(this.a)}m=g?1:0;l[h++]=m|0;k=a.length;p=~k+65536&65535;l[h++]=k&255;l[h++]=k>>>8&255;l[h++]=p&255;l[h++]=p>>>8&255;if(C)l.set(a,h),h+=a.length,l=l.subarray(0,h);else{t=0;for(u=a.length;t<u;++t)l[h++]=
|
||||
a[t];l.length=h}this.c=h;this.a=l}break;case 1:var q=new K(C?new Uint8Array(this.a.buffer):this.a,this.c);q.b(1,1,w);q.b(1,2,w);var s=oa(this,b),x,fa,z;x=0;for(fa=s.length;x<fa;x++)if(z=s[x],K.prototype.b.apply(q,T[z]),256<z)q.b(s[++x],s[++x],w),q.b(s[++x],5),q.b(s[++x],s[++x],w);else if(256===z)break;this.a=q.finish();this.c=this.a.length;break;case la:var B=new K(C?new Uint8Array(this.a.buffer):this.a,this.c),ta,J,O,P,Q,La=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],X,ua,Y,va,ga,ja=Array(19),
|
||||
wa,R,ha,y,xa;ta=la;B.b(1,1,w);B.b(ta,2,w);J=oa(this,b);X=pa(this.m,15);ua=qa(X);Y=pa(this.l,7);va=qa(Y);for(O=286;257<O&&0===X[O-1];O--);for(P=30;1<P&&0===Y[P-1];P--);var ya=O,za=P,F=new (C?Uint32Array:Array)(ya+za),r,G,v,Z,E=new (C?Uint32Array:Array)(316),D,A,H=new (C?Uint8Array:Array)(19);for(r=G=0;r<ya;r++)F[G++]=X[r];for(r=0;r<za;r++)F[G++]=Y[r];if(!C){r=0;for(Z=H.length;r<Z;++r)H[r]=0}r=D=0;for(Z=F.length;r<Z;r+=G){for(G=1;r+G<Z&&F[r+G]===F[r];++G);v=G;if(0===F[r])if(3>v)for(;0<v--;)E[D++]=0,
|
||||
H[0]++;else for(;0<v;)A=138>v?v:138,A>v-3&&A<v&&(A=v-3),10>=A?(E[D++]=17,E[D++]=A-3,H[17]++):(E[D++]=18,E[D++]=A-11,H[18]++),v-=A;else if(E[D++]=F[r],H[F[r]]++,v--,3>v)for(;0<v--;)E[D++]=F[r],H[F[r]]++;else for(;0<v;)A=6>v?v:6,A>v-3&&A<v&&(A=v-3),E[D++]=16,E[D++]=A-3,H[16]++,v-=A}f=C?E.subarray(0,D):E.slice(0,D);ga=pa(H,7);for(y=0;19>y;y++)ja[y]=ga[La[y]];for(Q=19;4<Q&&0===ja[Q-1];Q--);wa=qa(ga);B.b(O-257,5,w);B.b(P-1,5,w);B.b(Q-4,4,w);for(y=0;y<Q;y++)B.b(ja[y],3,w);y=0;for(xa=f.length;y<xa;y++)if(R=
|
||||
f[y],B.b(wa[R],ga[R],w),16<=R){y++;switch(R){case 16:ha=2;break;case 17:ha=3;break;case 18:ha=7;break;default:throw"invalid code: "+R;}B.b(f[y],ha,w)}var Aa=[ua,X],Ba=[va,Y],I,Ca,$,ma,Da,Ea,Fa,Ga;Da=Aa[0];Ea=Aa[1];Fa=Ba[0];Ga=Ba[1];I=0;for(Ca=J.length;I<Ca;++I)if($=J[I],B.b(Da[$],Ea[$],w),256<$)B.b(J[++I],J[++I],w),ma=J[++I],B.b(Fa[ma],Ga[ma],w),B.b(J[++I],J[++I],w);else if(256===$)break;this.a=B.finish();this.c=this.a.length;break;default:throw"invalid compression type";}return this.a};
|
||||
function ra(f,d){this.length=f;this.k=d}
|
||||
var sa=function(){function f(b){switch(w){case 3===b:return[257,b-3,0];case 4===b:return[258,b-4,0];case 5===b:return[259,b-5,0];case 6===b:return[260,b-6,0];case 7===b:return[261,b-7,0];case 8===b:return[262,b-8,0];case 9===b:return[263,b-9,0];case 10===b:return[264,b-10,0];case 12>=b:return[265,b-11,1];case 14>=b:return[266,b-13,1];case 16>=b:return[267,b-15,1];case 18>=b:return[268,b-17,1];case 22>=b:return[269,b-19,2];case 26>=b:return[270,b-23,2];case 30>=b:return[271,b-27,2];case 34>=b:return[272,
|
||||
b-31,2];case 42>=b:return[273,b-35,3];case 50>=b:return[274,b-43,3];case 58>=b:return[275,b-51,3];case 66>=b:return[276,b-59,3];case 82>=b:return[277,b-67,4];case 98>=b:return[278,b-83,4];case 114>=b:return[279,b-99,4];case 130>=b:return[280,b-115,4];case 162>=b:return[281,b-131,5];case 194>=b:return[282,b-163,5];case 226>=b:return[283,b-195,5];case 257>=b:return[284,b-227,5];case 258===b:return[285,b-258,0];default:throw"invalid length: "+b;}}var d=[],c,e;for(c=3;258>=c;c++)e=f(c),d[c]=e[2]<<24|
|
||||
e[1]<<16|e[0];return d}(),Ha=C?new Uint32Array(sa):sa;
|
||||
function oa(f,d){function c(b,c){var a=b.k,d=[],e=0,f;f=Ha[b.length];d[e++]=f&65535;d[e++]=f>>16&255;d[e++]=f>>24;var g;switch(w){case 1===a:g=[0,a-1,0];break;case 2===a:g=[1,a-2,0];break;case 3===a:g=[2,a-3,0];break;case 4===a:g=[3,a-4,0];break;case 6>=a:g=[4,a-5,1];break;case 8>=a:g=[5,a-7,1];break;case 12>=a:g=[6,a-9,2];break;case 16>=a:g=[7,a-13,2];break;case 24>=a:g=[8,a-17,3];break;case 32>=a:g=[9,a-25,3];break;case 48>=a:g=[10,a-33,4];break;case 64>=a:g=[11,a-49,4];break;case 96>=a:g=[12,a-
|
||||
65,5];break;case 128>=a:g=[13,a-97,5];break;case 192>=a:g=[14,a-129,6];break;case 256>=a:g=[15,a-193,6];break;case 384>=a:g=[16,a-257,7];break;case 512>=a:g=[17,a-385,7];break;case 768>=a:g=[18,a-513,8];break;case 1024>=a:g=[19,a-769,8];break;case 1536>=a:g=[20,a-1025,9];break;case 2048>=a:g=[21,a-1537,9];break;case 3072>=a:g=[22,a-2049,10];break;case 4096>=a:g=[23,a-3073,10];break;case 6144>=a:g=[24,a-4097,11];break;case 8192>=a:g=[25,a-6145,11];break;case 12288>=a:g=[26,a-8193,12];break;case 16384>=
|
||||
a:g=[27,a-12289,12];break;case 24576>=a:g=[28,a-16385,13];break;case 32768>=a:g=[29,a-24577,13];break;default:throw"invalid distance";}f=g;d[e++]=f[0];d[e++]=f[1];d[e++]=f[2];var k,m;k=0;for(m=d.length;k<m;++k)l[h++]=d[k];s[d[0]]++;x[d[3]]++;q=b.length+c-1;u=null}var e,b,a,g,m,k={},p,t,u,l=C?new Uint16Array(2*d.length):[],h=0,q=0,s=new (C?Uint32Array:Array)(286),x=new (C?Uint32Array:Array)(30),fa=f.i,z;if(!C){for(a=0;285>=a;)s[a++]=0;for(a=0;29>=a;)x[a++]=0}s[256]=1;e=0;for(b=d.length;e<b;++e){a=
|
||||
m=0;for(g=3;a<g&&e+a!==b;++a)m=m<<8|d[e+a];k[m]===n&&(k[m]=[]);p=k[m];if(!(0<q--)){for(;0<p.length&&32768<e-p[0];)p.shift();if(e+3>=b){u&&c(u,-1);a=0;for(g=b-e;a<g;++a)z=d[e+a],l[h++]=z,++s[z];break}0<p.length?(t=Ia(d,e,p),u?u.length<t.length?(z=d[e-1],l[h++]=z,++s[z],c(t,0)):c(u,-1):t.length<fa?u=t:c(t,0)):u?c(u,-1):(z=d[e],l[h++]=z,++s[z])}p.push(e)}l[h++]=256;s[256]++;f.m=s;f.l=x;return C?l.subarray(0,h):l}
|
||||
function Ia(f,d,c){var e,b,a=0,g,m,k,p,t=f.length;m=0;p=c.length;a:for(;m<p;m++){e=c[p-m-1];g=3;if(3<a){for(k=a;3<k;k--)if(f[e+k-1]!==f[d+k-1])continue a;g=a}for(;258>g&&d+g<t&&f[e+g]===f[d+g];)++g;g>a&&(b=e,a=g);if(258===g)break}return new ra(a,d-b)}
|
||||
function pa(f,d){var c=f.length,e=new ia(572),b=new (C?Uint8Array:Array)(c),a,g,m,k,p;if(!C)for(k=0;k<c;k++)b[k]=0;for(k=0;k<c;++k)0<f[k]&&e.push(k,f[k]);a=Array(e.length/2);g=new (C?Uint32Array:Array)(e.length/2);if(1===a.length)return b[e.pop().index]=1,b;k=0;for(p=e.length/2;k<p;++k)a[k]=e.pop(),g[k]=a[k].value;m=Ja(g,g.length,d);k=0;for(p=a.length;k<p;++k)b[a[k].index]=m[k];return b}
|
||||
function Ja(f,d,c){function e(a){var b=k[a][p[a]];b===d?(e(a+1),e(a+1)):--g[b];++p[a]}var b=new (C?Uint16Array:Array)(c),a=new (C?Uint8Array:Array)(c),g=new (C?Uint8Array:Array)(d),m=Array(c),k=Array(c),p=Array(c),t=(1<<c)-d,u=1<<c-1,l,h,q,s,x;b[c-1]=d;for(h=0;h<c;++h)t<u?a[h]=0:(a[h]=1,t-=u),t<<=1,b[c-2-h]=(b[c-1-h]/2|0)+d;b[0]=a[0];m[0]=Array(b[0]);k[0]=Array(b[0]);for(h=1;h<c;++h)b[h]>2*b[h-1]+a[h]&&(b[h]=2*b[h-1]+a[h]),m[h]=Array(b[h]),k[h]=Array(b[h]);for(l=0;l<d;++l)g[l]=c;for(q=0;q<b[c-1];++q)m[c-
|
||||
1][q]=f[q],k[c-1][q]=q;for(l=0;l<c;++l)p[l]=0;1===a[c-1]&&(--g[0],++p[c-1]);for(h=c-2;0<=h;--h){s=l=0;x=p[h+1];for(q=0;q<b[h];q++)s=m[h+1][x]+m[h+1][x+1],s>f[l]?(m[h][q]=s,k[h][q]=d,x+=2):(m[h][q]=f[l],k[h][q]=l,++l);p[h]=0;1===a[h]&&e(h)}return g}
|
||||
function qa(f){var d=new (C?Uint16Array:Array)(f.length),c=[],e=[],b=0,a,g,m,k;a=0;for(g=f.length;a<g;a++)c[f[a]]=(c[f[a]]|0)+1;a=1;for(g=16;a<=g;a++)e[a]=b,b+=c[a]|0,b<<=1;a=0;for(g=f.length;a<g;a++){b=e[f[a]];e[f[a]]+=1;m=d[a]=0;for(k=f[a];m<k;m++)d[a]=d[a]<<1|b&1,b>>>=1}return d};function Ka(f,d){this.input=f;this.a=new (C?Uint8Array:Array)(32768);this.d=V.g;var c={},e;if((d||!(d={}))&&"number"===typeof d.compressionType)this.d=d.compressionType;for(e in d)c[e]=d[e];c.outputBuffer=this.a;this.j=new ka(this.input,c)}var V=na;
|
||||
Ka.prototype.f=function(){var f,d,c,e,b,a,g=0;a=this.a;switch(8){case 8:f=Math.LOG2E*Math.log(32768)-8;break;default:throw Error("invalid compression method");}d=f<<4|8;a[g++]=d;switch(8){case 8:switch(this.d){case V.NONE:e=0;break;case V.h:e=1;break;case V.g:e=2;break;default:throw Error("unsupported compression type");}break;default:throw Error("invalid compression method");}c=e<<6|0;a[g++]=c|31-(256*d+c)%31;var m=this.input;if("string"===typeof m){var k=m.split(""),p,t;p=0;for(t=k.length;p<t;p++)k[p]=
|
||||
(k[p].charCodeAt(0)&255)>>>0;m=k}for(var u=1,l=0,h=m.length,q,s=0;0<h;){q=1024<h?1024:h;h-=q;do u+=m[s++],l+=u;while(--q);u%=65521;l%=65521}b=(l<<16|u)>>>0;this.j.c=g;a=this.j.f();g=a.length;C&&(a=new Uint8Array(a.buffer),a.length<=g+4&&(this.a=new Uint8Array(a.length+4),this.a.set(a),a=this.a),a=a.subarray(0,g+4));a[g++]=b>>24&255;a[g++]=b>>16&255;a[g++]=b>>8&255;a[g++]=b&255;return a};ba("Zlib.Deflate",Ka);ba("Zlib.Deflate.compress",function(f,d){return(new Ka(f,d)).f()});ba("Zlib.Deflate.prototype.compress",Ka.prototype.f);var Ma={NONE:V.NONE,FIXED:V.h,DYNAMIC:V.g},Na,Oa,W,Pa;if(Object.keys)Na=Object.keys(Ma);else for(Oa in Na=[],W=0,Ma)Na[W++]=Oa;W=0;for(Pa=Na.length;W<Pa;++W)Oa=Na[W],ba("Zlib.Deflate.CompressionType."+Oa,Ma[Oa]);
|
||||
var Deflate=mod.Zlib.Deflate;
|
||||
export { Deflate }
|
||||
28
libs/three.js/libs/gunzip.module.min.js
vendored
Normal file
28
libs/three.js/libs/gunzip.module.min.js
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */function n(e){throw e;}var q=void 0,aa={};function r(e,c){var d=e.split("."),b=aa;!(d[0]in b)&&b.execScript&&b.execScript("var "+d[0]);for(var a;d.length&&(a=d.shift());)!d.length&&c!==q?b[a]=c:b=b[a]?b[a]:b[a]={}};var u="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;new (u?Uint8Array:Array)(256);var v;for(v=0;256>v;++v)for(var w=v,ba=7,w=w>>>1;w;w>>>=1)--ba;function x(e,c,d){var b,a="number"===typeof c?c:c=0,f="number"===typeof d?d:e.length;b=-1;for(a=f&7;a--;++c)b=b>>>8^z[(b^e[c])&255];for(a=f>>3;a--;c+=8)b=b>>>8^z[(b^e[c])&255],b=b>>>8^z[(b^e[c+1])&255],b=b>>>8^z[(b^e[c+2])&255],b=b>>>8^z[(b^e[c+3])&255],b=b>>>8^z[(b^e[c+4])&255],b=b>>>8^z[(b^e[c+5])&255],b=b>>>8^z[(b^e[c+6])&255],b=b>>>8^z[(b^e[c+7])&255];return(b^4294967295)>>>0}
|
||||
var A=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,
|
||||
2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,
|
||||
2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,
|
||||
2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,
|
||||
3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,
|
||||
936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],z=u?new Uint32Array(A):A;function B(){}B.prototype.getName=function(){return this.name};B.prototype.getData=function(){return this.data};B.prototype.H=function(){return this.I};r("Zlib.GunzipMember",B);r("Zlib.GunzipMember.prototype.getName",B.prototype.getName);r("Zlib.GunzipMember.prototype.getData",B.prototype.getData);r("Zlib.GunzipMember.prototype.getMtime",B.prototype.H);function D(e){var c=e.length,d=0,b=Number.POSITIVE_INFINITY,a,f,g,k,m,p,t,h,l,y;for(h=0;h<c;++h)e[h]>d&&(d=e[h]),e[h]<b&&(b=e[h]);a=1<<d;f=new (u?Uint32Array:Array)(a);g=1;k=0;for(m=2;g<=d;){for(h=0;h<c;++h)if(e[h]===g){p=0;t=k;for(l=0;l<g;++l)p=p<<1|t&1,t>>=1;y=g<<16|h;for(l=p;l<a;l+=m)f[l]=y;++k}++g;k<<=1;m<<=1}return[f,d,b]};var E=[],F;for(F=0;288>F;F++)switch(!0){case 143>=F:E.push([F+48,8]);break;case 255>=F:E.push([F-144+400,9]);break;case 279>=F:E.push([F-256+0,7]);break;case 287>=F:E.push([F-280+192,8]);break;default:n("invalid literal: "+F)}
|
||||
var ca=function(){function e(a){switch(!0){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,
|
||||
a-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:n("invalid length: "+a)}}var c=[],d,b;for(d=3;258>=d;d++)b=e(d),c[d]=b[2]<<24|b[1]<<
|
||||
16|b[0];return c}();u&&new Uint32Array(ca);function G(e,c){this.i=[];this.j=32768;this.d=this.f=this.c=this.n=0;this.input=u?new Uint8Array(e):e;this.o=!1;this.k=H;this.z=!1;if(c||!(c={}))c.index&&(this.c=c.index),c.bufferSize&&(this.j=c.bufferSize),c.bufferType&&(this.k=c.bufferType),c.resize&&(this.z=c.resize);switch(this.k){case I:this.a=32768;this.b=new (u?Uint8Array:Array)(32768+this.j+258);break;case H:this.a=0;this.b=new (u?Uint8Array:Array)(this.j);this.e=this.F;this.q=this.B;this.l=this.D;break;default:n(Error("invalid inflate mode"))}}
|
||||
var I=0,H=1;
|
||||
G.prototype.g=function(){for(;!this.o;){var e=J(this,3);e&1&&(this.o=!0);e>>>=1;switch(e){case 0:var c=this.input,d=this.c,b=this.b,a=this.a,f=c.length,g=q,k=q,m=b.length,p=q;this.d=this.f=0;d+1>=f&&n(Error("invalid uncompressed block header: LEN"));g=c[d++]|c[d++]<<8;d+1>=f&&n(Error("invalid uncompressed block header: NLEN"));k=c[d++]|c[d++]<<8;g===~k&&n(Error("invalid uncompressed block header: length verify"));d+g>c.length&&n(Error("input buffer is broken"));switch(this.k){case I:for(;a+g>b.length;){p=
|
||||
m-a;g-=p;if(u)b.set(c.subarray(d,d+p),a),a+=p,d+=p;else for(;p--;)b[a++]=c[d++];this.a=a;b=this.e();a=this.a}break;case H:for(;a+g>b.length;)b=this.e({t:2});break;default:n(Error("invalid inflate mode"))}if(u)b.set(c.subarray(d,d+g),a),a+=g,d+=g;else for(;g--;)b[a++]=c[d++];this.c=d;this.a=a;this.b=b;break;case 1:this.l(da,ea);break;case 2:fa(this);break;default:n(Error("unknown BTYPE: "+e))}}return this.q()};
|
||||
var K=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],L=u?new Uint16Array(K):K,N=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],O=u?new Uint16Array(N):N,P=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],Q=u?new Uint8Array(P):P,R=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],ga=u?new Uint16Array(R):R,ha=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,
|
||||
13,13],U=u?new Uint8Array(ha):ha,V=new (u?Uint8Array:Array)(288),W,ia;W=0;for(ia=V.length;W<ia;++W)V[W]=143>=W?8:255>=W?9:279>=W?7:8;var da=D(V),X=new (u?Uint8Array:Array)(30),Y,ja;Y=0;for(ja=X.length;Y<ja;++Y)X[Y]=5;var ea=D(X);function J(e,c){for(var d=e.f,b=e.d,a=e.input,f=e.c,g=a.length,k;b<c;)f>=g&&n(Error("input buffer is broken")),d|=a[f++]<<b,b+=8;k=d&(1<<c)-1;e.f=d>>>c;e.d=b-c;e.c=f;return k}
|
||||
function Z(e,c){for(var d=e.f,b=e.d,a=e.input,f=e.c,g=a.length,k=c[0],m=c[1],p,t;b<m&&!(f>=g);)d|=a[f++]<<b,b+=8;p=k[d&(1<<m)-1];t=p>>>16;e.f=d>>t;e.d=b-t;e.c=f;return p&65535}
|
||||
function fa(e){function c(a,c,b){var d,e=this.w,f,g;for(g=0;g<a;)switch(d=Z(this,c),d){case 16:for(f=3+J(this,2);f--;)b[g++]=e;break;case 17:for(f=3+J(this,3);f--;)b[g++]=0;e=0;break;case 18:for(f=11+J(this,7);f--;)b[g++]=0;e=0;break;default:e=b[g++]=d}this.w=e;return b}var d=J(e,5)+257,b=J(e,5)+1,a=J(e,4)+4,f=new (u?Uint8Array:Array)(L.length),g,k,m,p;for(p=0;p<a;++p)f[L[p]]=J(e,3);if(!u){p=a;for(a=f.length;p<a;++p)f[L[p]]=0}g=D(f);k=new (u?Uint8Array:Array)(d);m=new (u?Uint8Array:Array)(b);e.w=
|
||||
0;e.l(D(c.call(e,d,g,k)),D(c.call(e,b,g,m)))}G.prototype.l=function(e,c){var d=this.b,b=this.a;this.r=e;for(var a=d.length-258,f,g,k,m;256!==(f=Z(this,e));)if(256>f)b>=a&&(this.a=b,d=this.e(),b=this.a),d[b++]=f;else{g=f-257;m=O[g];0<Q[g]&&(m+=J(this,Q[g]));f=Z(this,c);k=ga[f];0<U[f]&&(k+=J(this,U[f]));b>=a&&(this.a=b,d=this.e(),b=this.a);for(;m--;)d[b]=d[b++-k]}for(;8<=this.d;)this.d-=8,this.c--;this.a=b};
|
||||
G.prototype.D=function(e,c){var d=this.b,b=this.a;this.r=e;for(var a=d.length,f,g,k,m;256!==(f=Z(this,e));)if(256>f)b>=a&&(d=this.e(),a=d.length),d[b++]=f;else{g=f-257;m=O[g];0<Q[g]&&(m+=J(this,Q[g]));f=Z(this,c);k=ga[f];0<U[f]&&(k+=J(this,U[f]));b+m>a&&(d=this.e(),a=d.length);for(;m--;)d[b]=d[b++-k]}for(;8<=this.d;)this.d-=8,this.c--;this.a=b};
|
||||
G.prototype.e=function(){var e=new (u?Uint8Array:Array)(this.a-32768),c=this.a-32768,d,b,a=this.b;if(u)e.set(a.subarray(32768,e.length));else{d=0;for(b=e.length;d<b;++d)e[d]=a[d+32768]}this.i.push(e);this.n+=e.length;if(u)a.set(a.subarray(c,c+32768));else for(d=0;32768>d;++d)a[d]=a[c+d];this.a=32768;return a};
|
||||
G.prototype.F=function(e){var c,d=this.input.length/this.c+1|0,b,a,f,g=this.input,k=this.b;e&&("number"===typeof e.t&&(d=e.t),"number"===typeof e.A&&(d+=e.A));2>d?(b=(g.length-this.c)/this.r[2],f=258*(b/2)|0,a=f<k.length?k.length+f:k.length<<1):a=k.length*d;u?(c=new Uint8Array(a),c.set(k)):c=k;return this.b=c};
|
||||
G.prototype.q=function(){var e=0,c=this.b,d=this.i,b,a=new (u?Uint8Array:Array)(this.n+(this.a-32768)),f,g,k,m;if(0===d.length)return u?this.b.subarray(32768,this.a):this.b.slice(32768,this.a);f=0;for(g=d.length;f<g;++f){b=d[f];k=0;for(m=b.length;k<m;++k)a[e++]=b[k]}f=32768;for(g=this.a;f<g;++f)a[e++]=c[f];this.i=[];return this.buffer=a};
|
||||
G.prototype.B=function(){var e,c=this.a;u?this.z?(e=new Uint8Array(c),e.set(this.b.subarray(0,c))):e=this.b.subarray(0,c):(this.b.length>c&&(this.b.length=c),e=this.b);return this.buffer=e};function $(e){this.input=e;this.c=0;this.m=[];this.s=!1}$.prototype.G=function(){this.s||this.g();return this.m.slice()};
|
||||
$.prototype.g=function(){for(var e=this.input.length;this.c<e;){var c=new B,d=q,b=q,a=q,f=q,g=q,k=q,m=q,p=q,t=q,h=this.input,l=this.c;c.u=h[l++];c.v=h[l++];(31!==c.u||139!==c.v)&&n(Error("invalid file signature:"+c.u+","+c.v));c.p=h[l++];switch(c.p){case 8:break;default:n(Error("unknown compression method: "+c.p))}c.h=h[l++];p=h[l++]|h[l++]<<8|h[l++]<<16|h[l++]<<24;c.I=new Date(1E3*p);c.O=h[l++];c.N=h[l++];0<(c.h&4)&&(c.J=h[l++]|h[l++]<<8,l+=c.J);if(0<(c.h&8)){m=[];for(k=0;0<(g=h[l++]);)m[k++]=String.fromCharCode(g);
|
||||
c.name=m.join("")}if(0<(c.h&16)){m=[];for(k=0;0<(g=h[l++]);)m[k++]=String.fromCharCode(g);c.K=m.join("")}0<(c.h&2)&&(c.C=x(h,0,l)&65535,c.C!==(h[l++]|h[l++]<<8)&&n(Error("invalid header crc16")));d=h[h.length-4]|h[h.length-3]<<8|h[h.length-2]<<16|h[h.length-1]<<24;h.length-l-4-4<512*d&&(f=d);b=new G(h,{index:l,bufferSize:f});c.data=a=b.g();l=b.c;c.L=t=(h[l++]|h[l++]<<8|h[l++]<<16|h[l++]<<24)>>>0;x(a,q,q)!==t&&n(Error("invalid CRC-32 checksum: 0x"+x(a,q,q).toString(16)+" / 0x"+t.toString(16)));c.M=
|
||||
d=(h[l++]|h[l++]<<8|h[l++]<<16|h[l++]<<24)>>>0;(a.length&4294967295)!==d&&n(Error("invalid input size: "+(a.length&4294967295)+" / "+d));this.m.push(c);this.c=l}this.s=!0;var y=this.m,s,M,S=0,T=0,C;s=0;for(M=y.length;s<M;++s)T+=y[s].data.length;if(u){C=new Uint8Array(T);for(s=0;s<M;++s)C.set(y[s].data,S),S+=y[s].data.length}else{C=[];for(s=0;s<M;++s)C[s]=y[s].data;C=Array.prototype.concat.apply([],C)}return C};r("Zlib.Gunzip",$);r("Zlib.Gunzip.prototype.decompress",$.prototype.g);r("Zlib.Gunzip.prototype.getMembers",$.prototype.G);
|
||||
var Zlib=aa.Zlib;
|
||||
export { Zlib }
|
||||
17
libs/three.js/libs/inflate.module.min.js
vendored
Normal file
17
libs/three.js/libs/inflate.module.min.js
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */var mod={}, l=void 0,aa=mod;function r(c,d){var a=c.split("."),b=aa;!(a[0]in b)&&b.execScript&&b.execScript("var "+a[0]);for(var e;a.length&&(e=a.shift());)!a.length&&d!==l?b[e]=d:b=b[e]?b[e]:b[e]={}};var t="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;function v(c){var d=c.length,a=0,b=Number.POSITIVE_INFINITY,e,f,g,h,k,m,n,p,s,x;for(p=0;p<d;++p)c[p]>a&&(a=c[p]),c[p]<b&&(b=c[p]);e=1<<a;f=new (t?Uint32Array:Array)(e);g=1;h=0;for(k=2;g<=a;){for(p=0;p<d;++p)if(c[p]===g){m=0;n=h;for(s=0;s<g;++s)m=m<<1|n&1,n>>=1;x=g<<16|p;for(s=m;s<e;s+=k)f[s]=x;++h}++g;h<<=1;k<<=1}return[f,a,b]};function w(c,d){this.g=[];this.h=32768;this.d=this.f=this.a=this.l=0;this.input=t?new Uint8Array(c):c;this.m=!1;this.i=y;this.r=!1;if(d||!(d={}))d.index&&(this.a=d.index),d.bufferSize&&(this.h=d.bufferSize),d.bufferType&&(this.i=d.bufferType),d.resize&&(this.r=d.resize);switch(this.i){case A:this.b=32768;this.c=new (t?Uint8Array:Array)(32768+this.h+258);break;case y:this.b=0;this.c=new (t?Uint8Array:Array)(this.h);this.e=this.z;this.n=this.v;this.j=this.w;break;default:throw Error("invalid inflate mode");
|
||||
}}var A=0,y=1,B={t:A,s:y};
|
||||
w.prototype.k=function(){for(;!this.m;){var c=C(this,3);c&1&&(this.m=!0);c>>>=1;switch(c){case 0:var d=this.input,a=this.a,b=this.c,e=this.b,f=d.length,g=l,h=l,k=b.length,m=l;this.d=this.f=0;if(a+1>=f)throw Error("invalid uncompressed block header: LEN");g=d[a++]|d[a++]<<8;if(a+1>=f)throw Error("invalid uncompressed block header: NLEN");h=d[a++]|d[a++]<<8;if(g===~h)throw Error("invalid uncompressed block header: length verify");if(a+g>d.length)throw Error("input buffer is broken");switch(this.i){case A:for(;e+
|
||||
g>b.length;){m=k-e;g-=m;if(t)b.set(d.subarray(a,a+m),e),e+=m,a+=m;else for(;m--;)b[e++]=d[a++];this.b=e;b=this.e();e=this.b}break;case y:for(;e+g>b.length;)b=this.e({p:2});break;default:throw Error("invalid inflate mode");}if(t)b.set(d.subarray(a,a+g),e),e+=g,a+=g;else for(;g--;)b[e++]=d[a++];this.a=a;this.b=e;this.c=b;break;case 1:this.j(ba,ca);break;case 2:for(var n=C(this,5)+257,p=C(this,5)+1,s=C(this,4)+4,x=new (t?Uint8Array:Array)(D.length),S=l,T=l,U=l,u=l,M=l,F=l,z=l,q=l,V=l,q=0;q<s;++q)x[D[q]]=
|
||||
C(this,3);if(!t){q=s;for(s=x.length;q<s;++q)x[D[q]]=0}S=v(x);u=new (t?Uint8Array:Array)(n+p);q=0;for(V=n+p;q<V;)switch(M=E(this,S),M){case 16:for(z=3+C(this,2);z--;)u[q++]=F;break;case 17:for(z=3+C(this,3);z--;)u[q++]=0;F=0;break;case 18:for(z=11+C(this,7);z--;)u[q++]=0;F=0;break;default:F=u[q++]=M}T=t?v(u.subarray(0,n)):v(u.slice(0,n));U=t?v(u.subarray(n)):v(u.slice(n));this.j(T,U);break;default:throw Error("unknown BTYPE: "+c);}}return this.n()};
|
||||
var G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],D=t?new Uint16Array(G):G,H=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],I=t?new Uint16Array(H):H,J=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],K=t?new Uint8Array(J):J,L=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],da=t?new Uint16Array(L):L,ea=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,
|
||||
13,13],N=t?new Uint8Array(ea):ea,O=new (t?Uint8Array:Array)(288),P,fa;P=0;for(fa=O.length;P<fa;++P)O[P]=143>=P?8:255>=P?9:279>=P?7:8;var ba=v(O),Q=new (t?Uint8Array:Array)(30),R,ga;R=0;for(ga=Q.length;R<ga;++R)Q[R]=5;var ca=v(Q);function C(c,d){for(var a=c.f,b=c.d,e=c.input,f=c.a,g=e.length,h;b<d;){if(f>=g)throw Error("input buffer is broken");a|=e[f++]<<b;b+=8}h=a&(1<<d)-1;c.f=a>>>d;c.d=b-d;c.a=f;return h}
|
||||
function E(c,d){for(var a=c.f,b=c.d,e=c.input,f=c.a,g=e.length,h=d[0],k=d[1],m,n;b<k&&!(f>=g);)a|=e[f++]<<b,b+=8;m=h[a&(1<<k)-1];n=m>>>16;if(n>b)throw Error("invalid code length: "+n);c.f=a>>n;c.d=b-n;c.a=f;return m&65535}
|
||||
w.prototype.j=function(c,d){var a=this.c,b=this.b;this.o=c;for(var e=a.length-258,f,g,h,k;256!==(f=E(this,c));)if(256>f)b>=e&&(this.b=b,a=this.e(),b=this.b),a[b++]=f;else{g=f-257;k=I[g];0<K[g]&&(k+=C(this,K[g]));f=E(this,d);h=da[f];0<N[f]&&(h+=C(this,N[f]));b>=e&&(this.b=b,a=this.e(),b=this.b);for(;k--;)a[b]=a[b++-h]}for(;8<=this.d;)this.d-=8,this.a--;this.b=b};
|
||||
w.prototype.w=function(c,d){var a=this.c,b=this.b;this.o=c;for(var e=a.length,f,g,h,k;256!==(f=E(this,c));)if(256>f)b>=e&&(a=this.e(),e=a.length),a[b++]=f;else{g=f-257;k=I[g];0<K[g]&&(k+=C(this,K[g]));f=E(this,d);h=da[f];0<N[f]&&(h+=C(this,N[f]));b+k>e&&(a=this.e(),e=a.length);for(;k--;)a[b]=a[b++-h]}for(;8<=this.d;)this.d-=8,this.a--;this.b=b};
|
||||
w.prototype.e=function(){var c=new (t?Uint8Array:Array)(this.b-32768),d=this.b-32768,a,b,e=this.c;if(t)c.set(e.subarray(32768,c.length));else{a=0;for(b=c.length;a<b;++a)c[a]=e[a+32768]}this.g.push(c);this.l+=c.length;if(t)e.set(e.subarray(d,d+32768));else for(a=0;32768>a;++a)e[a]=e[d+a];this.b=32768;return e};
|
||||
w.prototype.z=function(c){var d,a=this.input.length/this.a+1|0,b,e,f,g=this.input,h=this.c;c&&("number"===typeof c.p&&(a=c.p),"number"===typeof c.u&&(a+=c.u));2>a?(b=(g.length-this.a)/this.o[2],f=258*(b/2)|0,e=f<h.length?h.length+f:h.length<<1):e=h.length*a;t?(d=new Uint8Array(e),d.set(h)):d=h;return this.c=d};
|
||||
w.prototype.n=function(){var c=0,d=this.c,a=this.g,b,e=new (t?Uint8Array:Array)(this.l+(this.b-32768)),f,g,h,k;if(0===a.length)return t?this.c.subarray(32768,this.b):this.c.slice(32768,this.b);f=0;for(g=a.length;f<g;++f){b=a[f];h=0;for(k=b.length;h<k;++h)e[c++]=b[h]}f=32768;for(g=this.b;f<g;++f)e[c++]=d[f];this.g=[];return this.buffer=e};
|
||||
w.prototype.v=function(){var c,d=this.b;t?this.r?(c=new Uint8Array(d),c.set(this.c.subarray(0,d))):c=this.c.subarray(0,d):(this.c.length>d&&(this.c.length=d),c=this.c);return this.buffer=c};function W(c,d){var a,b;this.input=c;this.a=0;if(d||!(d={}))d.index&&(this.a=d.index),d.verify&&(this.A=d.verify);a=c[this.a++];b=c[this.a++];switch(a&15){case ha:this.method=ha;break;default:throw Error("unsupported compression method");}if(0!==((a<<8)+b)%31)throw Error("invalid fcheck flag:"+((a<<8)+b)%31);if(b&32)throw Error("fdict flag is not supported");this.q=new w(c,{index:this.a,bufferSize:d.bufferSize,bufferType:d.bufferType,resize:d.resize})}
|
||||
W.prototype.k=function(){var c=this.input,d,a;d=this.q.k();this.a=this.q.a;if(this.A){a=(c[this.a++]<<24|c[this.a++]<<16|c[this.a++]<<8|c[this.a++])>>>0;var b=d;if("string"===typeof b){var e=b.split(""),f,g;f=0;for(g=e.length;f<g;f++)e[f]=(e[f].charCodeAt(0)&255)>>>0;b=e}for(var h=1,k=0,m=b.length,n,p=0;0<m;){n=1024<m?1024:m;m-=n;do h+=b[p++],k+=h;while(--n);h%=65521;k%=65521}if(a!==(k<<16|h)>>>0)throw Error("invalid adler-32 checksum");}return d};var ha=8;r("Zlib.Inflate",W);r("Zlib.Inflate.prototype.decompress",W.prototype.k);var X={ADAPTIVE:B.s,BLOCK:B.t},Y,Z,$,ia;if(Object.keys)Y=Object.keys(X);else for(Z in Y=[],$=0,X)Y[$++]=Z;$=0;for(ia=Y.length;$<ia;++$)Z=Y[$],r("Zlib.Inflate.BufferType."+Z,X[Z]);
|
||||
var Inflate=mod.Zlib.Inflate;
|
||||
export { Inflate }
|
||||
15
libs/three.js/libs/jszip.module.min.js
vendored
Normal file
15
libs/three.js/libs/jszip.module.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
113
libs/three.js/libs/meshopt_decoder.module.js
Normal file
113
libs/three.js/libs/meshopt_decoder.module.js
Normal file
File diff suppressed because one or more lines are too long
11535
libs/three.js/libs/mmdparser.module.js
Normal file
11535
libs/three.js/libs/mmdparser.module.js
Normal file
File diff suppressed because it is too large
Load Diff
397
libs/three.js/libs/motion-controllers.module.js
Normal file
397
libs/three.js/libs/motion-controllers.module.js
Normal file
@ -0,0 +1,397 @@
|
||||
/**
|
||||
* @webxr-input-profiles/motion-controllers 1.0.0 https://github.com/immersive-web/webxr-input-profiles
|
||||
*/
|
||||
|
||||
const Constants = {
|
||||
Handedness: Object.freeze({
|
||||
NONE: 'none',
|
||||
LEFT: 'left',
|
||||
RIGHT: 'right'
|
||||
}),
|
||||
|
||||
ComponentState: Object.freeze({
|
||||
DEFAULT: 'default',
|
||||
TOUCHED: 'touched',
|
||||
PRESSED: 'pressed'
|
||||
}),
|
||||
|
||||
ComponentProperty: Object.freeze({
|
||||
BUTTON: 'button',
|
||||
X_AXIS: 'xAxis',
|
||||
Y_AXIS: 'yAxis',
|
||||
STATE: 'state'
|
||||
}),
|
||||
|
||||
ComponentType: Object.freeze({
|
||||
TRIGGER: 'trigger',
|
||||
SQUEEZE: 'squeeze',
|
||||
TOUCHPAD: 'touchpad',
|
||||
THUMBSTICK: 'thumbstick',
|
||||
BUTTON: 'button'
|
||||
}),
|
||||
|
||||
ButtonTouchThreshold: 0.05,
|
||||
|
||||
AxisTouchThreshold: 0.1,
|
||||
|
||||
VisualResponseProperty: Object.freeze({
|
||||
TRANSFORM: 'transform',
|
||||
VISIBILITY: 'visibility'
|
||||
})
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Static helper function to fetch a JSON file and turn it into a JS object
|
||||
* @param {string} path - Path to JSON file to be fetched
|
||||
*/
|
||||
async function fetchJsonFile(path) {
|
||||
const response = await fetch(path);
|
||||
if (!response.ok) {
|
||||
throw new Error(response.statusText);
|
||||
} else {
|
||||
return response.json();
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchProfilesList(basePath) {
|
||||
if (!basePath) {
|
||||
throw new Error('No basePath supplied');
|
||||
}
|
||||
|
||||
const profileListFileName = 'profilesList.json';
|
||||
const profilesList = await fetchJsonFile(`${basePath}/${profileListFileName}`);
|
||||
return profilesList;
|
||||
}
|
||||
|
||||
async function fetchProfile(xrInputSource, basePath, defaultProfile = null, getAssetPath = true) {
|
||||
if (!xrInputSource) {
|
||||
throw new Error('No xrInputSource supplied');
|
||||
}
|
||||
|
||||
if (!basePath) {
|
||||
throw new Error('No basePath supplied');
|
||||
}
|
||||
|
||||
// Get the list of profiles
|
||||
const supportedProfilesList = await fetchProfilesList(basePath);
|
||||
|
||||
// Find the relative path to the first requested profile that is recognized
|
||||
let match;
|
||||
xrInputSource.profiles.some((profileId) => {
|
||||
const supportedProfile = supportedProfilesList[profileId];
|
||||
if (supportedProfile) {
|
||||
match = {
|
||||
profileId,
|
||||
profilePath: `${basePath}/${supportedProfile.path}`,
|
||||
deprecated: !!supportedProfile.deprecated
|
||||
};
|
||||
}
|
||||
return !!match;
|
||||
});
|
||||
|
||||
if (!match) {
|
||||
if (!defaultProfile) {
|
||||
throw new Error('No matching profile name found');
|
||||
}
|
||||
|
||||
const supportedProfile = supportedProfilesList[defaultProfile];
|
||||
if (!supportedProfile) {
|
||||
throw new Error(`No matching profile name found and default profile "${defaultProfile}" missing.`);
|
||||
}
|
||||
|
||||
match = {
|
||||
profileId: defaultProfile,
|
||||
profilePath: `${basePath}/${supportedProfile.path}`,
|
||||
deprecated: !!supportedProfile.deprecated
|
||||
};
|
||||
}
|
||||
|
||||
const profile = await fetchJsonFile(match.profilePath);
|
||||
|
||||
let assetPath;
|
||||
if (getAssetPath) {
|
||||
let layout;
|
||||
if (xrInputSource.handedness === 'any') {
|
||||
layout = profile.layouts[Object.keys(profile.layouts)[0]];
|
||||
} else {
|
||||
layout = profile.layouts[xrInputSource.handedness];
|
||||
}
|
||||
if (!layout) {
|
||||
throw new Error(
|
||||
`No matching handedness, ${xrInputSource.handedness}, in profile ${match.profileId}`
|
||||
);
|
||||
}
|
||||
|
||||
if (layout.assetPath) {
|
||||
assetPath = match.profilePath.replace('profile.json', layout.assetPath);
|
||||
}
|
||||
}
|
||||
|
||||
return { profile, assetPath };
|
||||
}
|
||||
|
||||
/** @constant {Object} */
|
||||
const defaultComponentValues = {
|
||||
xAxis: 0,
|
||||
yAxis: 0,
|
||||
button: 0,
|
||||
state: Constants.ComponentState.DEFAULT
|
||||
};
|
||||
|
||||
/**
|
||||
* @description Converts an X, Y coordinate from the range -1 to 1 (as reported by the Gamepad
|
||||
* API) to the range 0 to 1 (for interpolation). Also caps the X, Y values to be bounded within
|
||||
* a circle. This ensures that thumbsticks are not animated outside the bounds of their physical
|
||||
* range of motion and touchpads do not report touch locations off their physical bounds.
|
||||
* @param {number} x The original x coordinate in the range -1 to 1
|
||||
* @param {number} y The original y coordinate in the range -1 to 1
|
||||
*/
|
||||
function normalizeAxes(x = 0, y = 0) {
|
||||
let xAxis = x;
|
||||
let yAxis = y;
|
||||
|
||||
// Determine if the point is outside the bounds of the circle
|
||||
// and, if so, place it on the edge of the circle
|
||||
const hypotenuse = Math.sqrt((x * x) + (y * y));
|
||||
if (hypotenuse > 1) {
|
||||
const theta = Math.atan2(y, x);
|
||||
xAxis = Math.cos(theta);
|
||||
yAxis = Math.sin(theta);
|
||||
}
|
||||
|
||||
// Scale and move the circle so values are in the interpolation range. The circle's origin moves
|
||||
// from (0, 0) to (0.5, 0.5). The circle's radius scales from 1 to be 0.5.
|
||||
const result = {
|
||||
normalizedXAxis: (xAxis * 0.5) + 0.5,
|
||||
normalizedYAxis: (yAxis * 0.5) + 0.5
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains the description of how the 3D model should visually respond to a specific user input.
|
||||
* This is accomplished by initializing the object with the name of a node in the 3D model and
|
||||
* property that need to be modified in response to user input, the name of the nodes representing
|
||||
* the allowable range of motion, and the name of the input which triggers the change. In response
|
||||
* to the named input changing, this object computes the appropriate weighting to use for
|
||||
* interpolating between the range of motion nodes.
|
||||
*/
|
||||
class VisualResponse {
|
||||
constructor(visualResponseDescription) {
|
||||
this.componentProperty = visualResponseDescription.componentProperty;
|
||||
this.states = visualResponseDescription.states;
|
||||
this.valueNodeName = visualResponseDescription.valueNodeName;
|
||||
this.valueNodeProperty = visualResponseDescription.valueNodeProperty;
|
||||
|
||||
if (this.valueNodeProperty === Constants.VisualResponseProperty.TRANSFORM) {
|
||||
this.minNodeName = visualResponseDescription.minNodeName;
|
||||
this.maxNodeName = visualResponseDescription.maxNodeName;
|
||||
}
|
||||
|
||||
// Initializes the response's current value based on default data
|
||||
this.value = 0;
|
||||
this.updateFromComponent(defaultComponentValues);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the visual response's interpolation weight based on component state
|
||||
* @param {Object} componentValues - The component from which to update
|
||||
* @param {number} xAxis - The reported X axis value of the component
|
||||
* @param {number} yAxis - The reported Y axis value of the component
|
||||
* @param {number} button - The reported value of the component's button
|
||||
* @param {string} state - The component's active state
|
||||
*/
|
||||
updateFromComponent({
|
||||
xAxis, yAxis, button, state
|
||||
}) {
|
||||
const { normalizedXAxis, normalizedYAxis } = normalizeAxes(xAxis, yAxis);
|
||||
switch (this.componentProperty) {
|
||||
case Constants.ComponentProperty.X_AXIS:
|
||||
this.value = (this.states.includes(state)) ? normalizedXAxis : 0.5;
|
||||
break;
|
||||
case Constants.ComponentProperty.Y_AXIS:
|
||||
this.value = (this.states.includes(state)) ? normalizedYAxis : 0.5;
|
||||
break;
|
||||
case Constants.ComponentProperty.BUTTON:
|
||||
this.value = (this.states.includes(state)) ? button : 0;
|
||||
break;
|
||||
case Constants.ComponentProperty.STATE:
|
||||
if (this.valueNodeProperty === Constants.VisualResponseProperty.VISIBILITY) {
|
||||
this.value = (this.states.includes(state));
|
||||
} else {
|
||||
this.value = this.states.includes(state) ? 1.0 : 0.0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Component {
|
||||
/**
|
||||
* @param {Object} componentId - Id of the component
|
||||
* @param {Object} componentDescription - Description of the component to be created
|
||||
*/
|
||||
constructor(componentId, componentDescription) {
|
||||
if (!componentId
|
||||
|| !componentDescription
|
||||
|| !componentDescription.visualResponses
|
||||
|| !componentDescription.gamepadIndices
|
||||
|| Object.keys(componentDescription.gamepadIndices).length === 0) {
|
||||
throw new Error('Invalid arguments supplied');
|
||||
}
|
||||
|
||||
this.id = componentId;
|
||||
this.type = componentDescription.type;
|
||||
this.rootNodeName = componentDescription.rootNodeName;
|
||||
this.touchPointNodeName = componentDescription.touchPointNodeName;
|
||||
|
||||
// Build all the visual responses for this component
|
||||
this.visualResponses = {};
|
||||
Object.keys(componentDescription.visualResponses).forEach((responseName) => {
|
||||
const visualResponse = new VisualResponse(componentDescription.visualResponses[responseName]);
|
||||
this.visualResponses[responseName] = visualResponse;
|
||||
});
|
||||
|
||||
// Set default values
|
||||
this.gamepadIndices = Object.assign({}, componentDescription.gamepadIndices);
|
||||
|
||||
this.values = {
|
||||
state: Constants.ComponentState.DEFAULT,
|
||||
button: (this.gamepadIndices.button !== undefined) ? 0 : undefined,
|
||||
xAxis: (this.gamepadIndices.xAxis !== undefined) ? 0 : undefined,
|
||||
yAxis: (this.gamepadIndices.yAxis !== undefined) ? 0 : undefined
|
||||
};
|
||||
}
|
||||
|
||||
get data() {
|
||||
const data = { id: this.id, ...this.values };
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Poll for updated data based on current gamepad state
|
||||
* @param {Object} gamepad - The gamepad object from which the component data should be polled
|
||||
*/
|
||||
updateFromGamepad(gamepad) {
|
||||
// Set the state to default before processing other data sources
|
||||
this.values.state = Constants.ComponentState.DEFAULT;
|
||||
|
||||
// Get and normalize button
|
||||
if (this.gamepadIndices.button !== undefined
|
||||
&& gamepad.buttons.length > this.gamepadIndices.button) {
|
||||
const gamepadButton = gamepad.buttons[this.gamepadIndices.button];
|
||||
this.values.button = gamepadButton.value;
|
||||
this.values.button = (this.values.button < 0) ? 0 : this.values.button;
|
||||
this.values.button = (this.values.button > 1) ? 1 : this.values.button;
|
||||
|
||||
// Set the state based on the button
|
||||
if (gamepadButton.pressed || this.values.button === 1) {
|
||||
this.values.state = Constants.ComponentState.PRESSED;
|
||||
} else if (gamepadButton.touched || this.values.button > Constants.ButtonTouchThreshold) {
|
||||
this.values.state = Constants.ComponentState.TOUCHED;
|
||||
}
|
||||
}
|
||||
|
||||
// Get and normalize x axis value
|
||||
if (this.gamepadIndices.xAxis !== undefined
|
||||
&& gamepad.axes.length > this.gamepadIndices.xAxis) {
|
||||
this.values.xAxis = gamepad.axes[this.gamepadIndices.xAxis];
|
||||
this.values.xAxis = (this.values.xAxis < -1) ? -1 : this.values.xAxis;
|
||||
this.values.xAxis = (this.values.xAxis > 1) ? 1 : this.values.xAxis;
|
||||
|
||||
// If the state is still default, check if the xAxis makes it touched
|
||||
if (this.values.state === Constants.ComponentState.DEFAULT
|
||||
&& Math.abs(this.values.xAxis) > Constants.AxisTouchThreshold) {
|
||||
this.values.state = Constants.ComponentState.TOUCHED;
|
||||
}
|
||||
}
|
||||
|
||||
// Get and normalize Y axis value
|
||||
if (this.gamepadIndices.yAxis !== undefined
|
||||
&& gamepad.axes.length > this.gamepadIndices.yAxis) {
|
||||
this.values.yAxis = gamepad.axes[this.gamepadIndices.yAxis];
|
||||
this.values.yAxis = (this.values.yAxis < -1) ? -1 : this.values.yAxis;
|
||||
this.values.yAxis = (this.values.yAxis > 1) ? 1 : this.values.yAxis;
|
||||
|
||||
// If the state is still default, check if the yAxis makes it touched
|
||||
if (this.values.state === Constants.ComponentState.DEFAULT
|
||||
&& Math.abs(this.values.yAxis) > Constants.AxisTouchThreshold) {
|
||||
this.values.state = Constants.ComponentState.TOUCHED;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the visual response weights based on the current component data
|
||||
Object.values(this.visualResponses).forEach((visualResponse) => {
|
||||
visualResponse.updateFromComponent(this.values);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Builds a motion controller with components and visual responses based on the
|
||||
* supplied profile description. Data is polled from the xrInputSource's gamepad.
|
||||
* @author Nell Waliczek / https://github.com/NellWaliczek
|
||||
*/
|
||||
class MotionController {
|
||||
/**
|
||||
* @param {Object} xrInputSource - The XRInputSource to build the MotionController around
|
||||
* @param {Object} profile - The best matched profile description for the supplied xrInputSource
|
||||
* @param {Object} assetUrl
|
||||
*/
|
||||
constructor(xrInputSource, profile, assetUrl) {
|
||||
if (!xrInputSource) {
|
||||
throw new Error('No xrInputSource supplied');
|
||||
}
|
||||
|
||||
if (!profile) {
|
||||
throw new Error('No profile supplied');
|
||||
}
|
||||
|
||||
this.xrInputSource = xrInputSource;
|
||||
this.assetUrl = assetUrl;
|
||||
this.id = profile.profileId;
|
||||
|
||||
// Build child components as described in the profile description
|
||||
this.layoutDescription = profile.layouts[xrInputSource.handedness];
|
||||
this.components = {};
|
||||
Object.keys(this.layoutDescription.components).forEach((componentId) => {
|
||||
const componentDescription = this.layoutDescription.components[componentId];
|
||||
this.components[componentId] = new Component(componentId, componentDescription);
|
||||
});
|
||||
|
||||
// Initialize components based on current gamepad state
|
||||
this.updateFromGamepad();
|
||||
}
|
||||
|
||||
get gripSpace() {
|
||||
return this.xrInputSource.gripSpace;
|
||||
}
|
||||
|
||||
get targetRaySpace() {
|
||||
return this.xrInputSource.targetRaySpace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Returns a subset of component data for simplified debugging
|
||||
*/
|
||||
get data() {
|
||||
const data = [];
|
||||
Object.values(this.components).forEach((component) => {
|
||||
data.push(component.data);
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Poll for updated data based on current gamepad state
|
||||
*/
|
||||
updateFromGamepad() {
|
||||
Object.values(this.components).forEach((component) => {
|
||||
component.updateFromGamepad(this.xrInputSource.gamepad);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export { Constants, MotionController, fetchProfile, fetchProfilesList };
|
||||
119
libs/three.js/libs/opentype.module.min.js
vendored
Normal file
119
libs/three.js/libs/opentype.module.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
167
libs/three.js/libs/stats.module.js
Normal file
167
libs/three.js/libs/stats.module.js
Normal file
@ -0,0 +1,167 @@
|
||||
var Stats = function () {
|
||||
|
||||
var mode = 0;
|
||||
|
||||
var container = document.createElement( 'div' );
|
||||
container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';
|
||||
container.addEventListener( 'click', function ( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
showPanel( ++ mode % container.children.length );
|
||||
|
||||
}, false );
|
||||
|
||||
//
|
||||
|
||||
function addPanel( panel ) {
|
||||
|
||||
container.appendChild( panel.dom );
|
||||
return panel;
|
||||
|
||||
}
|
||||
|
||||
function showPanel( id ) {
|
||||
|
||||
for ( var i = 0; i < container.children.length; i ++ ) {
|
||||
|
||||
container.children[ i ].style.display = i === id ? 'block' : 'none';
|
||||
|
||||
}
|
||||
|
||||
mode = id;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;
|
||||
|
||||
var fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );
|
||||
var msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );
|
||||
|
||||
if ( self.performance && self.performance.memory ) {
|
||||
|
||||
var memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );
|
||||
|
||||
}
|
||||
|
||||
showPanel( 0 );
|
||||
|
||||
return {
|
||||
|
||||
REVISION: 16,
|
||||
|
||||
dom: container,
|
||||
|
||||
addPanel: addPanel,
|
||||
showPanel: showPanel,
|
||||
|
||||
begin: function () {
|
||||
|
||||
beginTime = ( performance || Date ).now();
|
||||
|
||||
},
|
||||
|
||||
end: function () {
|
||||
|
||||
frames ++;
|
||||
|
||||
var time = ( performance || Date ).now();
|
||||
|
||||
msPanel.update( time - beginTime, 200 );
|
||||
|
||||
if ( time >= prevTime + 1000 ) {
|
||||
|
||||
fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );
|
||||
|
||||
prevTime = time;
|
||||
frames = 0;
|
||||
|
||||
if ( memPanel ) {
|
||||
|
||||
var memory = performance.memory;
|
||||
memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return time;
|
||||
|
||||
},
|
||||
|
||||
update: function () {
|
||||
|
||||
beginTime = this.end();
|
||||
|
||||
},
|
||||
|
||||
// Backwards Compatibility
|
||||
|
||||
domElement: container,
|
||||
setMode: showPanel
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
Stats.Panel = function ( name, fg, bg ) {
|
||||
|
||||
var min = Infinity, max = 0, round = Math.round;
|
||||
var PR = round( window.devicePixelRatio || 1 );
|
||||
|
||||
var WIDTH = 80 * PR, HEIGHT = 48 * PR,
|
||||
TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
|
||||
GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
|
||||
GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;
|
||||
|
||||
var canvas = document.createElement( 'canvas' );
|
||||
canvas.width = WIDTH;
|
||||
canvas.height = HEIGHT;
|
||||
canvas.style.cssText = 'width:80px;height:48px';
|
||||
|
||||
var context = canvas.getContext( '2d' );
|
||||
context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';
|
||||
context.textBaseline = 'top';
|
||||
|
||||
context.fillStyle = bg;
|
||||
context.fillRect( 0, 0, WIDTH, HEIGHT );
|
||||
|
||||
context.fillStyle = fg;
|
||||
context.fillText( name, TEXT_X, TEXT_Y );
|
||||
context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
|
||||
|
||||
context.fillStyle = bg;
|
||||
context.globalAlpha = 0.9;
|
||||
context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
|
||||
|
||||
return {
|
||||
|
||||
dom: canvas,
|
||||
|
||||
update: function ( value, maxValue ) {
|
||||
|
||||
min = Math.min( min, value );
|
||||
max = Math.max( max, value );
|
||||
|
||||
context.fillStyle = bg;
|
||||
context.globalAlpha = 1;
|
||||
context.fillRect( 0, 0, WIDTH, GRAPH_Y );
|
||||
context.fillStyle = fg;
|
||||
context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );
|
||||
|
||||
context.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );
|
||||
|
||||
context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );
|
||||
|
||||
context.fillStyle = bg;
|
||||
context.globalAlpha = 0.9;
|
||||
context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
export default Stats;
|
||||
3
libs/three.js/libs/tween.module.min.js
vendored
Normal file
3
libs/three.js/libs/tween.module.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
115
libs/three.js/libs/zstddec.module.js
Normal file
115
libs/three.js/libs/zstddec.module.js
Normal file
File diff suppressed because one or more lines are too long
24
libs/three.js/lines/Line2.js
Normal file
24
libs/three.js/lines/Line2.js
Normal file
@ -0,0 +1,24 @@
|
||||
import { LineSegments2 } from '../lines/LineSegments2.js';
|
||||
import { LineGeometry } from '../lines/LineGeometry.js';
|
||||
import { LineMaterial } from '../lines/LineMaterial.js';
|
||||
|
||||
var Line2 = function ( geometry, material ) {
|
||||
|
||||
if ( geometry === undefined ) geometry = new LineGeometry();
|
||||
if ( material === undefined ) material = new LineMaterial( { color: Math.random() * 0xffffff } );
|
||||
|
||||
LineSegments2.call( this, geometry, material );
|
||||
|
||||
this.type = 'Line2';
|
||||
|
||||
};
|
||||
|
||||
Line2.prototype = Object.assign( Object.create( LineSegments2.prototype ), {
|
||||
|
||||
constructor: Line2,
|
||||
|
||||
isLine2: true
|
||||
|
||||
} );
|
||||
|
||||
export { Line2 };
|
||||
97
libs/three.js/lines/LineGeometry.js
Normal file
97
libs/three.js/lines/LineGeometry.js
Normal file
@ -0,0 +1,97 @@
|
||||
import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js';
|
||||
|
||||
var LineGeometry = function () {
|
||||
|
||||
LineSegmentsGeometry.call( this );
|
||||
|
||||
this.type = 'LineGeometry';
|
||||
|
||||
};
|
||||
|
||||
LineGeometry.prototype = Object.assign( Object.create( LineSegmentsGeometry.prototype ), {
|
||||
|
||||
constructor: LineGeometry,
|
||||
|
||||
isLineGeometry: true,
|
||||
|
||||
setPositions: function ( array ) {
|
||||
|
||||
// converts [ x1, y1, z1, x2, y2, z2, ... ] to pairs format
|
||||
|
||||
var length = array.length - 3;
|
||||
var points = new Float32Array( 2 * length );
|
||||
|
||||
for ( var i = 0; i < length; i += 3 ) {
|
||||
|
||||
points[ 2 * i ] = array[ i ];
|
||||
points[ 2 * i + 1 ] = array[ i + 1 ];
|
||||
points[ 2 * i + 2 ] = array[ i + 2 ];
|
||||
|
||||
points[ 2 * i + 3 ] = array[ i + 3 ];
|
||||
points[ 2 * i + 4 ] = array[ i + 4 ];
|
||||
points[ 2 * i + 5 ] = array[ i + 5 ];
|
||||
|
||||
}
|
||||
|
||||
LineSegmentsGeometry.prototype.setPositions.call( this, points );
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
setColors: function ( array ) {
|
||||
|
||||
// converts [ r1, g1, b1, r2, g2, b2, ... ] to pairs format
|
||||
|
||||
var length = array.length - 3;
|
||||
var colors = new Float32Array( 2 * length );
|
||||
|
||||
for ( var i = 0; i < length; i += 3 ) {
|
||||
|
||||
colors[ 2 * i ] = array[ i ];
|
||||
colors[ 2 * i + 1 ] = array[ i + 1 ];
|
||||
colors[ 2 * i + 2 ] = array[ i + 2 ];
|
||||
|
||||
colors[ 2 * i + 3 ] = array[ i + 3 ];
|
||||
colors[ 2 * i + 4 ] = array[ i + 4 ];
|
||||
colors[ 2 * i + 5 ] = array[ i + 5 ];
|
||||
|
||||
}
|
||||
|
||||
LineSegmentsGeometry.prototype.setColors.call( this, colors );
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
fromLine: function ( line ) {
|
||||
|
||||
var geometry = line.geometry;
|
||||
|
||||
if ( geometry.isGeometry ) {
|
||||
|
||||
this.setPositions( geometry.vertices );
|
||||
|
||||
} else if ( geometry.isBufferGeometry ) {
|
||||
|
||||
this.setPositions( geometry.attributes.position.array ); // assumes non-indexed
|
||||
|
||||
}
|
||||
|
||||
// set colors, maybe
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
copy: function ( /* source */ ) {
|
||||
|
||||
// todo
|
||||
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
export { LineGeometry };
|
||||
424
libs/three.js/lines/LineMaterial.js
Normal file
424
libs/three.js/lines/LineMaterial.js
Normal file
@ -0,0 +1,424 @@
|
||||
import {
|
||||
ShaderLib,
|
||||
ShaderMaterial,
|
||||
UniformsLib,
|
||||
UniformsUtils,
|
||||
Vector2
|
||||
} from '../build/three.module.js';
|
||||
|
||||
/**
|
||||
* parameters = {
|
||||
* color: <hex>,
|
||||
* linewidth: <float>,
|
||||
* dashed: <boolean>,
|
||||
* dashScale: <float>,
|
||||
* dashSize: <float>,
|
||||
* dashOffset: <float>,
|
||||
* gapSize: <float>,
|
||||
* resolution: <Vector2>, // to be set by renderer
|
||||
* }
|
||||
*/
|
||||
|
||||
UniformsLib.line = {
|
||||
|
||||
linewidth: { value: 1 },
|
||||
resolution: { value: new Vector2( 1, 1 ) },
|
||||
dashScale: { value: 1 },
|
||||
dashSize: { value: 1 },
|
||||
dashOffset: { value: 0 },
|
||||
gapSize: { value: 1 }, // todo FIX - maybe change to totalSize
|
||||
opacity: { value: 1 }
|
||||
|
||||
};
|
||||
|
||||
ShaderLib[ 'line' ] = {
|
||||
|
||||
uniforms: UniformsUtils.merge( [
|
||||
UniformsLib.common,
|
||||
UniformsLib.fog,
|
||||
UniformsLib.line
|
||||
] ),
|
||||
|
||||
vertexShader:
|
||||
`
|
||||
#include <common>
|
||||
#include <color_pars_vertex>
|
||||
#include <fog_pars_vertex>
|
||||
#include <logdepthbuf_pars_vertex>
|
||||
#include <clipping_planes_pars_vertex>
|
||||
|
||||
uniform float linewidth;
|
||||
uniform vec2 resolution;
|
||||
|
||||
attribute vec3 instanceStart;
|
||||
attribute vec3 instanceEnd;
|
||||
|
||||
attribute vec3 instanceColorStart;
|
||||
attribute vec3 instanceColorEnd;
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
uniform float dashScale;
|
||||
attribute float instanceDistanceStart;
|
||||
attribute float instanceDistanceEnd;
|
||||
varying float vLineDistance;
|
||||
|
||||
#endif
|
||||
|
||||
void trimSegment( const in vec4 start, inout vec4 end ) {
|
||||
|
||||
// trim end segment so it terminates between the camera plane and the near plane
|
||||
|
||||
// conservative estimate of the near plane
|
||||
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
||||
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
||||
float nearEstimate = - 0.5 * b / a;
|
||||
|
||||
float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
|
||||
|
||||
end.xyz = mix( start.xyz, end.xyz, alpha );
|
||||
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
#ifdef USE_COLOR
|
||||
|
||||
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
||||
|
||||
#endif
|
||||
|
||||
float aspect = resolution.x / resolution.y;
|
||||
|
||||
vUv = uv;
|
||||
|
||||
// camera space
|
||||
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
||||
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
||||
|
||||
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
||||
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
||||
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
||||
// perhaps there is a more elegant solution -- WestLangley
|
||||
|
||||
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
||||
|
||||
if ( perspective ) {
|
||||
|
||||
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
||||
|
||||
trimSegment( start, end );
|
||||
|
||||
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
||||
|
||||
trimSegment( end, start );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// clip space
|
||||
vec4 clipStart = projectionMatrix * start;
|
||||
vec4 clipEnd = projectionMatrix * end;
|
||||
|
||||
// ndc space
|
||||
vec2 ndcStart = clipStart.xy / clipStart.w;
|
||||
vec2 ndcEnd = clipEnd.xy / clipEnd.w;
|
||||
|
||||
// direction
|
||||
vec2 dir = ndcEnd - ndcStart;
|
||||
|
||||
// account for clip-space aspect ratio
|
||||
dir.x *= aspect;
|
||||
dir = normalize( dir );
|
||||
|
||||
// perpendicular to dir
|
||||
vec2 offset = vec2( dir.y, - dir.x );
|
||||
|
||||
// undo aspect ratio adjustment
|
||||
dir.x /= aspect;
|
||||
offset.x /= aspect;
|
||||
|
||||
// sign flip
|
||||
if ( position.x < 0.0 ) offset *= - 1.0;
|
||||
|
||||
// endcaps
|
||||
if ( position.y < 0.0 ) {
|
||||
|
||||
offset += - dir;
|
||||
|
||||
} else if ( position.y > 1.0 ) {
|
||||
|
||||
offset += dir;
|
||||
|
||||
}
|
||||
|
||||
// adjust for linewidth
|
||||
offset *= linewidth;
|
||||
|
||||
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
||||
offset /= resolution.y;
|
||||
|
||||
// select end
|
||||
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
||||
|
||||
// back to clip space
|
||||
offset *= clip.w;
|
||||
|
||||
clip.xy += offset;
|
||||
|
||||
gl_Position = clip;
|
||||
|
||||
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
||||
|
||||
#include <logdepthbuf_vertex>
|
||||
#include <clipping_planes_vertex>
|
||||
#include <fog_vertex>
|
||||
|
||||
}
|
||||
`,
|
||||
|
||||
fragmentShader:
|
||||
`
|
||||
uniform vec3 diffuse;
|
||||
uniform float opacity;
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
uniform float dashSize;
|
||||
uniform float dashOffset;
|
||||
uniform float gapSize;
|
||||
|
||||
#endif
|
||||
|
||||
varying float vLineDistance;
|
||||
|
||||
#include <common>
|
||||
#include <color_pars_fragment>
|
||||
#include <fog_pars_fragment>
|
||||
#include <logdepthbuf_pars_fragment>
|
||||
#include <clipping_planes_pars_fragment>
|
||||
|
||||
varying vec2 vUv;
|
||||
|
||||
void main() {
|
||||
|
||||
#include <clipping_planes_fragment>
|
||||
|
||||
#ifdef USE_DASH
|
||||
|
||||
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
||||
|
||||
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
||||
|
||||
#endif
|
||||
|
||||
if ( abs( vUv.y ) > 1.0 ) {
|
||||
|
||||
float a = vUv.x;
|
||||
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
||||
float len2 = a * a + b * b;
|
||||
|
||||
if ( len2 > 1.0 ) discard;
|
||||
|
||||
}
|
||||
|
||||
vec4 diffuseColor = vec4( diffuse, opacity );
|
||||
|
||||
#include <logdepthbuf_fragment>
|
||||
#include <color_fragment>
|
||||
|
||||
gl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );
|
||||
|
||||
#include <tonemapping_fragment>
|
||||
#include <encodings_fragment>
|
||||
#include <fog_fragment>
|
||||
#include <premultiplied_alpha_fragment>
|
||||
|
||||
}
|
||||
`
|
||||
};
|
||||
|
||||
var LineMaterial = function ( parameters ) {
|
||||
|
||||
ShaderMaterial.call( this, {
|
||||
|
||||
type: 'LineMaterial',
|
||||
|
||||
uniforms: UniformsUtils.clone( ShaderLib[ 'line' ].uniforms ),
|
||||
|
||||
vertexShader: ShaderLib[ 'line' ].vertexShader,
|
||||
fragmentShader: ShaderLib[ 'line' ].fragmentShader,
|
||||
|
||||
clipping: true // required for clipping support
|
||||
|
||||
} );
|
||||
|
||||
this.dashed = false;
|
||||
|
||||
Object.defineProperties( this, {
|
||||
|
||||
color: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function () {
|
||||
|
||||
return this.uniforms.diffuse.value;
|
||||
|
||||
},
|
||||
|
||||
set: function ( value ) {
|
||||
|
||||
this.uniforms.diffuse.value = value;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
linewidth: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function () {
|
||||
|
||||
return this.uniforms.linewidth.value;
|
||||
|
||||
},
|
||||
|
||||
set: function ( value ) {
|
||||
|
||||
this.uniforms.linewidth.value = value;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
dashScale: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function () {
|
||||
|
||||
return this.uniforms.dashScale.value;
|
||||
|
||||
},
|
||||
|
||||
set: function ( value ) {
|
||||
|
||||
this.uniforms.dashScale.value = value;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
dashSize: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function () {
|
||||
|
||||
return this.uniforms.dashSize.value;
|
||||
|
||||
},
|
||||
|
||||
set: function ( value ) {
|
||||
|
||||
this.uniforms.dashSize.value = value;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
dashOffset: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function () {
|
||||
|
||||
return this.uniforms.dashOffset.value;
|
||||
|
||||
},
|
||||
|
||||
set: function ( value ) {
|
||||
|
||||
this.uniforms.dashOffset.value = value;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
gapSize: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function () {
|
||||
|
||||
return this.uniforms.gapSize.value;
|
||||
|
||||
},
|
||||
|
||||
set: function ( value ) {
|
||||
|
||||
this.uniforms.gapSize.value = value;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
opacity: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function () {
|
||||
|
||||
return this.uniforms.opacity.value;
|
||||
|
||||
},
|
||||
|
||||
set: function ( value ) {
|
||||
|
||||
this.uniforms.opacity.value = value;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
resolution: {
|
||||
|
||||
enumerable: true,
|
||||
|
||||
get: function () {
|
||||
|
||||
return this.uniforms.resolution.value;
|
||||
|
||||
},
|
||||
|
||||
set: function ( value ) {
|
||||
|
||||
this.uniforms.resolution.value.copy( value );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
this.setValues( parameters );
|
||||
|
||||
};
|
||||
|
||||
LineMaterial.prototype = Object.create( ShaderMaterial.prototype );
|
||||
LineMaterial.prototype.constructor = LineMaterial;
|
||||
|
||||
LineMaterial.prototype.isLineMaterial = true;
|
||||
|
||||
export { LineMaterial };
|
||||
209
libs/three.js/lines/LineSegments2.js
Normal file
209
libs/three.js/lines/LineSegments2.js
Normal file
@ -0,0 +1,209 @@
|
||||
import {
|
||||
InstancedInterleavedBuffer,
|
||||
InterleavedBufferAttribute,
|
||||
Line3,
|
||||
MathUtils,
|
||||
Matrix4,
|
||||
Mesh,
|
||||
Vector3,
|
||||
Vector4
|
||||
} from '../build/three.module.js';
|
||||
import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js';
|
||||
import { LineMaterial } from '../lines/LineMaterial.js';
|
||||
|
||||
var LineSegments2 = function ( geometry, material ) {
|
||||
|
||||
if ( geometry === undefined ) geometry = new LineSegmentsGeometry();
|
||||
if ( material === undefined ) material = new LineMaterial( { color: Math.random() * 0xffffff } );
|
||||
|
||||
Mesh.call( this, geometry, material );
|
||||
|
||||
this.type = 'LineSegments2';
|
||||
|
||||
};
|
||||
|
||||
LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
|
||||
|
||||
constructor: LineSegments2,
|
||||
|
||||
isLineSegments2: true,
|
||||
|
||||
computeLineDistances: ( function () { // for backwards-compatability, but could be a method of LineSegmentsGeometry...
|
||||
|
||||
var start = new Vector3();
|
||||
var end = new Vector3();
|
||||
|
||||
return function computeLineDistances() {
|
||||
|
||||
var geometry = this.geometry;
|
||||
|
||||
var instanceStart = geometry.attributes.instanceStart;
|
||||
var instanceEnd = geometry.attributes.instanceEnd;
|
||||
var lineDistances = new Float32Array( 2 * instanceStart.data.count );
|
||||
|
||||
for ( var i = 0, j = 0, l = instanceStart.data.count; i < l; i ++, j += 2 ) {
|
||||
|
||||
start.fromBufferAttribute( instanceStart, i );
|
||||
end.fromBufferAttribute( instanceEnd, i );
|
||||
|
||||
lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ];
|
||||
lineDistances[ j + 1 ] = lineDistances[ j ] + start.distanceTo( end );
|
||||
|
||||
}
|
||||
|
||||
var instanceDistanceBuffer = new InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
|
||||
|
||||
geometry.setAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
|
||||
geometry.setAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
}() ),
|
||||
|
||||
raycast: ( function () {
|
||||
|
||||
var start = new Vector4();
|
||||
var end = new Vector4();
|
||||
|
||||
var ssOrigin = new Vector4();
|
||||
var ssOrigin3 = new Vector3();
|
||||
var mvMatrix = new Matrix4();
|
||||
var line = new Line3();
|
||||
var closestPoint = new Vector3();
|
||||
|
||||
return function raycast( raycaster, intersects ) {
|
||||
|
||||
if ( raycaster.camera === null ) {
|
||||
|
||||
console.error( 'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.' );
|
||||
|
||||
}
|
||||
|
||||
var threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;
|
||||
|
||||
var ray = raycaster.ray;
|
||||
var camera = raycaster.camera;
|
||||
var projectionMatrix = camera.projectionMatrix;
|
||||
|
||||
var geometry = this.geometry;
|
||||
var material = this.material;
|
||||
var resolution = material.resolution;
|
||||
var lineWidth = material.linewidth + threshold;
|
||||
|
||||
var instanceStart = geometry.attributes.instanceStart;
|
||||
var instanceEnd = geometry.attributes.instanceEnd;
|
||||
|
||||
// pick a point 1 unit out along the ray to avoid the ray origin
|
||||
// sitting at the camera origin which will cause "w" to be 0 when
|
||||
// applying the projection matrix.
|
||||
ray.at( 1, ssOrigin );
|
||||
|
||||
// ndc space [ - 1.0, 1.0 ]
|
||||
ssOrigin.w = 1;
|
||||
ssOrigin.applyMatrix4( camera.matrixWorldInverse );
|
||||
ssOrigin.applyMatrix4( projectionMatrix );
|
||||
ssOrigin.multiplyScalar( 1 / ssOrigin.w );
|
||||
|
||||
// screen space
|
||||
ssOrigin.x *= resolution.x / 2;
|
||||
ssOrigin.y *= resolution.y / 2;
|
||||
ssOrigin.z = 0;
|
||||
|
||||
ssOrigin3.copy( ssOrigin );
|
||||
|
||||
var matrixWorld = this.matrixWorld;
|
||||
mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld );
|
||||
|
||||
for ( var i = 0, l = instanceStart.count; i < l; i ++ ) {
|
||||
|
||||
start.fromBufferAttribute( instanceStart, i );
|
||||
end.fromBufferAttribute( instanceEnd, i );
|
||||
|
||||
start.w = 1;
|
||||
end.w = 1;
|
||||
|
||||
// camera space
|
||||
start.applyMatrix4( mvMatrix );
|
||||
end.applyMatrix4( mvMatrix );
|
||||
|
||||
// clip space
|
||||
start.applyMatrix4( projectionMatrix );
|
||||
end.applyMatrix4( projectionMatrix );
|
||||
|
||||
// ndc space [ - 1.0, 1.0 ]
|
||||
start.multiplyScalar( 1 / start.w );
|
||||
end.multiplyScalar( 1 / end.w );
|
||||
|
||||
// skip the segment if it's outside the camera near and far planes
|
||||
var isBehindCameraNear = start.z < - 1 && end.z < - 1;
|
||||
var isPastCameraFar = start.z > 1 && end.z > 1;
|
||||
if ( isBehindCameraNear || isPastCameraFar ) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
// screen space
|
||||
start.x *= resolution.x / 2;
|
||||
start.y *= resolution.y / 2;
|
||||
|
||||
end.x *= resolution.x / 2;
|
||||
end.y *= resolution.y / 2;
|
||||
|
||||
// create 2d segment
|
||||
line.start.copy( start );
|
||||
line.start.z = 0;
|
||||
|
||||
line.end.copy( end );
|
||||
line.end.z = 0;
|
||||
|
||||
// get closest point on ray to segment
|
||||
var param = line.closestPointToPointParameter( ssOrigin3, true );
|
||||
line.at( param, closestPoint );
|
||||
|
||||
// check if the intersection point is within clip space
|
||||
var zPos = MathUtils.lerp( start.z, end.z, param );
|
||||
var isInClipSpace = zPos >= - 1 && zPos <= 1;
|
||||
|
||||
var isInside = ssOrigin3.distanceTo( closestPoint ) < lineWidth * 0.5;
|
||||
|
||||
if ( isInClipSpace && isInside ) {
|
||||
|
||||
line.start.fromBufferAttribute( instanceStart, i );
|
||||
line.end.fromBufferAttribute( instanceEnd, i );
|
||||
|
||||
line.start.applyMatrix4( matrixWorld );
|
||||
line.end.applyMatrix4( matrixWorld );
|
||||
|
||||
var pointOnLine = new Vector3();
|
||||
var point = new Vector3();
|
||||
|
||||
ray.distanceSqToSegment( line.start, line.end, point, pointOnLine );
|
||||
|
||||
intersects.push( {
|
||||
|
||||
point: point,
|
||||
pointOnLine: pointOnLine,
|
||||
distance: ray.origin.distanceTo( point ),
|
||||
|
||||
object: this,
|
||||
face: null,
|
||||
faceIndex: i,
|
||||
uv: null,
|
||||
uv2: null,
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}() )
|
||||
|
||||
} );
|
||||
|
||||
export { LineSegments2 };
|
||||
260
libs/three.js/lines/LineSegmentsGeometry.js
Normal file
260
libs/three.js/lines/LineSegmentsGeometry.js
Normal file
@ -0,0 +1,260 @@
|
||||
import {
|
||||
Box3,
|
||||
Float32BufferAttribute,
|
||||
InstancedBufferGeometry,
|
||||
InstancedInterleavedBuffer,
|
||||
InterleavedBufferAttribute,
|
||||
Sphere,
|
||||
Vector3,
|
||||
WireframeGeometry
|
||||
} from '../build/three.module.js';
|
||||
|
||||
var LineSegmentsGeometry = function () {
|
||||
|
||||
InstancedBufferGeometry.call( this );
|
||||
|
||||
this.type = 'LineSegmentsGeometry';
|
||||
|
||||
var positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ];
|
||||
var uvs = [ - 1, 2, 1, 2, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 2, 1, - 2 ];
|
||||
var index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ];
|
||||
|
||||
this.setIndex( index );
|
||||
this.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
|
||||
this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
|
||||
|
||||
};
|
||||
|
||||
LineSegmentsGeometry.prototype = Object.assign( Object.create( InstancedBufferGeometry.prototype ), {
|
||||
|
||||
constructor: LineSegmentsGeometry,
|
||||
|
||||
isLineSegmentsGeometry: true,
|
||||
|
||||
applyMatrix4: function ( matrix ) {
|
||||
|
||||
var start = this.attributes.instanceStart;
|
||||
var end = this.attributes.instanceEnd;
|
||||
|
||||
if ( start !== undefined ) {
|
||||
|
||||
start.applyMatrix4( matrix );
|
||||
|
||||
end.applyMatrix4( matrix );
|
||||
|
||||
start.needsUpdate = true;
|
||||
|
||||
}
|
||||
|
||||
if ( this.boundingBox !== null ) {
|
||||
|
||||
this.computeBoundingBox();
|
||||
|
||||
}
|
||||
|
||||
if ( this.boundingSphere !== null ) {
|
||||
|
||||
this.computeBoundingSphere();
|
||||
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
setPositions: function ( array ) {
|
||||
|
||||
var lineSegments;
|
||||
|
||||
if ( array instanceof Float32Array ) {
|
||||
|
||||
lineSegments = array;
|
||||
|
||||
} else if ( Array.isArray( array ) ) {
|
||||
|
||||
lineSegments = new Float32Array( array );
|
||||
|
||||
}
|
||||
|
||||
var instanceBuffer = new InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz
|
||||
|
||||
this.setAttribute( 'instanceStart', new InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
|
||||
this.setAttribute( 'instanceEnd', new InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
|
||||
|
||||
//
|
||||
|
||||
this.computeBoundingBox();
|
||||
this.computeBoundingSphere();
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
setColors: function ( array ) {
|
||||
|
||||
var colors;
|
||||
|
||||
if ( array instanceof Float32Array ) {
|
||||
|
||||
colors = array;
|
||||
|
||||
} else if ( Array.isArray( array ) ) {
|
||||
|
||||
colors = new Float32Array( array );
|
||||
|
||||
}
|
||||
|
||||
var instanceColorBuffer = new InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb
|
||||
|
||||
this.setAttribute( 'instanceColorStart', new InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
|
||||
this.setAttribute( 'instanceColorEnd', new InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
fromWireframeGeometry: function ( geometry ) {
|
||||
|
||||
this.setPositions( geometry.attributes.position.array );
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
fromEdgesGeometry: function ( geometry ) {
|
||||
|
||||
this.setPositions( geometry.attributes.position.array );
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
fromMesh: function ( mesh ) {
|
||||
|
||||
this.fromWireframeGeometry( new WireframeGeometry( mesh.geometry ) );
|
||||
|
||||
// set colors, maybe
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
fromLineSegments: function ( lineSegments ) {
|
||||
|
||||
var geometry = lineSegments.geometry;
|
||||
|
||||
if ( geometry.isGeometry ) {
|
||||
|
||||
this.setPositions( geometry.vertices );
|
||||
|
||||
} else if ( geometry.isBufferGeometry ) {
|
||||
|
||||
this.setPositions( geometry.attributes.position.array ); // assumes non-indexed
|
||||
|
||||
}
|
||||
|
||||
// set colors, maybe
|
||||
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
computeBoundingBox: function () {
|
||||
|
||||
var box = new Box3();
|
||||
|
||||
return function computeBoundingBox() {
|
||||
|
||||
if ( this.boundingBox === null ) {
|
||||
|
||||
this.boundingBox = new Box3();
|
||||
|
||||
}
|
||||
|
||||
var start = this.attributes.instanceStart;
|
||||
var end = this.attributes.instanceEnd;
|
||||
|
||||
if ( start !== undefined && end !== undefined ) {
|
||||
|
||||
this.boundingBox.setFromBufferAttribute( start );
|
||||
|
||||
box.setFromBufferAttribute( end );
|
||||
|
||||
this.boundingBox.union( box );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}(),
|
||||
|
||||
computeBoundingSphere: function () {
|
||||
|
||||
var vector = new Vector3();
|
||||
|
||||
return function computeBoundingSphere() {
|
||||
|
||||
if ( this.boundingSphere === null ) {
|
||||
|
||||
this.boundingSphere = new Sphere();
|
||||
|
||||
}
|
||||
|
||||
if ( this.boundingBox === null ) {
|
||||
|
||||
this.computeBoundingBox();
|
||||
|
||||
}
|
||||
|
||||
var start = this.attributes.instanceStart;
|
||||
var end = this.attributes.instanceEnd;
|
||||
|
||||
if ( start !== undefined && end !== undefined ) {
|
||||
|
||||
var center = this.boundingSphere.center;
|
||||
|
||||
this.boundingBox.getCenter( center );
|
||||
|
||||
var maxRadiusSq = 0;
|
||||
|
||||
for ( var i = 0, il = start.count; i < il; i ++ ) {
|
||||
|
||||
vector.fromBufferAttribute( start, i );
|
||||
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );
|
||||
|
||||
vector.fromBufferAttribute( end, i );
|
||||
maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );
|
||||
|
||||
}
|
||||
|
||||
this.boundingSphere.radius = Math.sqrt( maxRadiusSq );
|
||||
|
||||
if ( isNaN( this.boundingSphere.radius ) ) {
|
||||
|
||||
console.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}(),
|
||||
|
||||
toJSON: function () {
|
||||
|
||||
// todo
|
||||
|
||||
},
|
||||
|
||||
applyMatrix: function ( matrix ) {
|
||||
|
||||
console.warn( 'THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().' );
|
||||
|
||||
return this.applyMatrix4( matrix );
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
export { LineSegmentsGeometry };
|
||||
63
libs/three.js/lines/Wireframe.js
Normal file
63
libs/three.js/lines/Wireframe.js
Normal file
@ -0,0 +1,63 @@
|
||||
import {
|
||||
InstancedInterleavedBuffer,
|
||||
InterleavedBufferAttribute,
|
||||
Mesh,
|
||||
Vector3
|
||||
} from '../build/three.module.js';
|
||||
import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js';
|
||||
import { LineMaterial } from '../lines/LineMaterial.js';
|
||||
|
||||
var Wireframe = function ( geometry, material ) {
|
||||
|
||||
Mesh.call( this );
|
||||
|
||||
this.type = 'Wireframe';
|
||||
|
||||
this.geometry = geometry !== undefined ? geometry : new LineSegmentsGeometry();
|
||||
this.material = material !== undefined ? material : new LineMaterial( { color: Math.random() * 0xffffff } );
|
||||
|
||||
};
|
||||
|
||||
Wireframe.prototype = Object.assign( Object.create( Mesh.prototype ), {
|
||||
|
||||
constructor: Wireframe,
|
||||
|
||||
isWireframe: true,
|
||||
|
||||
computeLineDistances: ( function () { // for backwards-compatability, but could be a method of LineSegmentsGeometry...
|
||||
|
||||
var start = new Vector3();
|
||||
var end = new Vector3();
|
||||
|
||||
return function computeLineDistances() {
|
||||
|
||||
var geometry = this.geometry;
|
||||
|
||||
var instanceStart = geometry.attributes.instanceStart;
|
||||
var instanceEnd = geometry.attributes.instanceEnd;
|
||||
var lineDistances = new Float32Array( 2 * instanceStart.data.count );
|
||||
|
||||
for ( var i = 0, j = 0, l = instanceStart.data.count; i < l; i ++, j += 2 ) {
|
||||
|
||||
start.fromBufferAttribute( instanceStart, i );
|
||||
end.fromBufferAttribute( instanceEnd, i );
|
||||
|
||||
lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ];
|
||||
lineDistances[ j + 1 ] = lineDistances[ j ] + start.distanceTo( end );
|
||||
|
||||
}
|
||||
|
||||
var instanceDistanceBuffer = new InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
|
||||
|
||||
geometry.setAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
|
||||
geometry.setAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
||||
}() )
|
||||
|
||||
} );
|
||||
|
||||
export { Wireframe };
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user