diff --git a/README.md b/README.md index 5963a886..6bfe54e3 100644 --- a/README.md +++ b/README.md @@ -102,8 +102,8 @@ Copy the converted directory into <potreeDirectory>/pointclouds/data_conve - - + + @@ -233,6 +233,37 @@ Copy the converted directory into <potreeDirectory>/pointclouds/data_conve +# VR + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
HeidentorEclepensMorro BayLionDechen Cave
+ # Showcase diff --git a/examples/ca13.html b/examples/ca13.html index 9de0e9fb..720e7e39 100644 --- a/examples/ca13.html +++ b/examples/ca13.html @@ -49,7 +49,7 @@ viewer.setPointBudget(5_000_000); viewer.loadSettingsFromURL(); - viewer.setDescription(""); + viewer.setDescription(`Point cloud courtesy of PG&E and Open Topography.`); viewer.loadGUI().then( () => { viewer.setLanguage('en'); diff --git a/examples/github.html b/examples/github.html index 7684f2a3..dbdd3cbf 100644 --- a/examples/github.html +++ b/examples/github.html @@ -45,10 +45,6 @@ - - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - + + +
- - - @@ -57,16 +53,16 @@ -
Load ProjectToolbarMatcapVirtual RealityHeidentorLion
+ - +
Load ProjectToolbarMatcapHeidentorLionLion LAS
@@ -86,16 +82,16 @@ -
Lion LASLion LAZEPTEPT BinaryEPT zstandardClipping Volume
+ - +
Lion LAZEPTEPT BinaryEPT zstandardClipping VolumeCA13
@@ -115,16 +111,16 @@ -
CA13Elevation ProfileMeasurementsMeshesMultiple Point CloudsFeatures (Sorvilier)
+ - +
Elevation ProfileMeasurementsMeshesMultiple Point CloudsFeatures (Sorvilier)Features (CA13)
@@ -144,16 +140,16 @@ -
Features (CA13)AnnotationsHierarchical AnnotationsAnimation PathShapefilesCesium CA13
+ - +
AnnotationsHierarchical AnnotationsAnimation PathShapefilesCesium CA13Cesium Retz
@@ -172,7 +168,38 @@
Cesium RetzCesium SorvilierCustom Sidebar SectionEmbedded IframeGradient ColorsCesium SorvilierCustom Sidebar SectionEmbedded IframeGradient Colors
+ +

VR

+ + + + + + +
+ + + + + + + + + + + + + + + + + + + +
HeidentorEclepensMorro BayLionDechen Cave
diff --git a/examples/page.json b/examples/page.json index 808ae434..145e3fdc 100644 --- a/examples/page.json +++ b/examples/page.json @@ -10,7 +10,6 @@ {"thumb": "thumbnails/toolbar.jpg", "label": "Toolbar", "url": "toolbar.html"}, {"thumb": "thumbnails/matcap.jpg", "label": "Matcap", "url": "matcap.html"}, - {"thumb": "thumbnails/vr.jpg", "label": "Virtual Reality", "url": "vr.html"}, {"thumb": "thumbnails/heidentor.png", "label": "Heidentor", "url": "heidentor.html"}, {"thumb": "thumbnails/lion.png", "label": "Lion", "url": "lion.html"}, {"thumb": "thumbnails/lion_las.png", "label": "Lion LAS", "url": "lion_las.html"}, @@ -41,6 +40,13 @@ {"thumb": "thumbnails/embedded_iframe.png", "label": "Embedded Iframe", "url": "embedded_iframe.html"}, {"thumb": "thumbnails/gradient_colors.png", "label": "Gradient Colors", "url": "gradient_colors.html"} ], + "VR": [ + {"thumb": "thumbnails/heidentor.jpg", "label": "Heidentor", "url": "vr_heidentor.html"}, + {"thumb": "thumbnails/eclepens.jpg", "label": "Eclepens", "url": "vr_eclepens.html"}, + {"thumb": "thumbnails/ca13.png", "label": "Morro Bay", "url": "vr_morro_bay.html"}, + {"thumb": "thumbnails/lion.png", "label": "Lion", "url": "vr_lion.html"}, + {"thumb": "thumbnails/dechen_cave.jpg", "label": "Dechen Cave", "url": "vr_dechen_cave.html"} + ], "showcase": [ {"thumb": "thumbnails/matterhorn.jpg", "label": "Matterhorn", "url": "showcase/matterhorn.html"}, {"thumb": "thumbnails/retz.jpg", "label": "Retz", "url": "showcase/retz.html"}, diff --git a/examples/vr_dechen_cave.html b/examples/vr_dechen_cave.html new file mode 100644 index 00000000..cdf5d93f --- /dev/null +++ b/examples/vr_dechen_cave.html @@ -0,0 +1,88 @@ + + + + + + + + Potree Viewer + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + diff --git a/examples/vr_eclepens.html b/examples/vr_eclepens.html new file mode 100644 index 00000000..7c67a780 --- /dev/null +++ b/examples/vr_eclepens.html @@ -0,0 +1,84 @@ + + + + + + + + Potree Viewer + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + diff --git a/examples/vr_heidentor.html b/examples/vr_heidentor.html new file mode 100644 index 00000000..2ac05b9a --- /dev/null +++ b/examples/vr_heidentor.html @@ -0,0 +1,106 @@ + + + + + + + + Potree Viewer + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+ + + + + + + diff --git a/examples/vr_lion.html b/examples/vr_lion.html new file mode 100644 index 00000000..7c10d8ae --- /dev/null +++ b/examples/vr_lion.html @@ -0,0 +1,80 @@ + + + + + + + + Potree Viewer + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + diff --git a/examples/vr_morro_bay.html b/examples/vr_morro_bay.html new file mode 100644 index 00000000..b4bcaa83 --- /dev/null +++ b/examples/vr_morro_bay.html @@ -0,0 +1,84 @@ + + + + + + + + Potree Viewer + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + + diff --git a/src/PointCloudOctree.js b/src/PointCloudOctree.js index be524382..4ddbe2b1 100644 --- a/src/PointCloudOctree.js +++ b/src/PointCloudOctree.js @@ -116,11 +116,33 @@ export class PointCloudOctree extends PointCloudTree { this.updateMatrix(); { - let attributeName = "rgba"; - if(this.pcoGeometry.pointAttributes.attributes.length > 1){ - attributeName = this.pcoGeometry.pointAttributes.attributes[1].name; + + let priorityQueue = ["rgba", "rgb", "intensity", "classification"]; + let selected = "rgba"; + + for(let attributeName of priorityQueue){ + let attribute = this.pcoGeometry.pointAttributes.attributes.find(a => a.name === attributeName); + + if(!attribute){ + continue; + } + + let min = attribute.range[0].constructor.name === "Array" ? attribute.range[0] : [attribute.range[0]]; + let max = attribute.range[1].constructor.name === "Array" ? attribute.range[1] : [attribute.range[1]]; + + let range_min = new THREE.Vector3(...min); + let range_max = new THREE.Vector3(...max); + let range = range_min.distanceTo(range_max); + + if(range === 0){ + continue; + } + + selected = attributeName; + break; } - this.material.activeAttributeName = attributeName; + + this.material.activeAttributeName = selected; } this.showBoundingBox = false; diff --git a/src/navigation/VRControls.js b/src/navigation/VRControls.js index f87dcf47..214af48f 100644 --- a/src/navigation/VRControls.js +++ b/src/navigation/VRControls.js @@ -38,9 +38,17 @@ function computeMove(vrControls, controller){ y = Math.sign(y) * (2 * y) ** 2; + let maxSize = 0; + for(let pc of viewer.scene.pointclouds){ + let size = pc.boundingBox.min.distanceTo(pc.boundingBox.max); + maxSize = Math.max(maxSize, size); + } + let multiplicator = Math.pow(maxSize, 0.5) / 2; + let scale = vrControls.node.scale.x; let moveSpeed = viewer.getMoveSpeed(); - let amount = 15 * y * (moveSpeed ** 0.5) / scale; + let amount = multiplicator * y * (moveSpeed ** 0.5) / scale; + let rotation = new THREE.Quaternion().setFromEuler(controller.rotation); let dir = new THREE.Vector3(0, 0, -1); diff --git a/src/tools/create_github_page.js b/src/tools/create_github_page.js index 1fc1868e..aec65f64 100644 --- a/src/tools/create_github_page.js +++ b/src/tools/create_github_page.js @@ -89,6 +89,7 @@ async function createGithubPage(){ let unhandledCode = ``; let exampleCode = toCode(files, settings.examples); + let vrCode = toCode(files, settings.VR); let showcaseCode = toCode(files, settings.showcase); let thirdpartyCode = toCode(files, settings.thirdparty); @@ -100,6 +101,12 @@ async function createGithubPage(){ ${exampleCode} +

VR

+ + + ${vrCode} +
+

Showcase

diff --git a/src/viewer/profile.js b/src/viewer/profile.js index ca9a8028..c523d0c0 100644 --- a/src/viewer/profile.js +++ b/src/viewer/profile.js @@ -117,7 +117,7 @@ class ProfileFakeOctree extends PointCloudTree{ this.currentBatch.geometry.computeBoundingBox(); this.currentBatch.geometry.computeBoundingSphere(); - this.currentBatch = this.createNewBatch(); + this.currentBatch = this.createNewBatch(data); updateRange = { start: 0, count: 0 diff --git a/src/viewer/viewer.js b/src/viewer/viewer.js index 36de30bd..b1ef14af 100644 --- a/src/viewer/viewer.js +++ b/src/viewer/viewer.js @@ -2039,6 +2039,8 @@ export class Viewer extends EventDispatcher{ let v = xrCamera.viewport; renderer.setViewport(v.x, v.y, v.width, v.height); + xrCamera.fov = 90; + for(let pointcloud of this.scene.pointclouds){ const {material} = pointcloud; material.useEDL = false;