From 889a7d2f344d2b8f9da384e4cf0cea69c41ee2c0 Mon Sep 17 00:00:00 2001 From: m-schuetz Date: Sat, 9 Nov 2019 19:09:19 +0100 Subject: [PATCH] fixing bugs and updating examples --- examples/ca13.html | 14 ++++---- examples/github.html | 50 +++++++++++------------------ examples/heidentor.html | 2 +- examples/page.json | 7 ++-- src/loader/LasLazLoader.js | 2 +- src/loader/ept/BinaryLoader.js | 2 +- src/loader/ept/LaszipLoader.js | 2 +- src/materials/PointCloudMaterial.js | 20 ++++++------ src/viewer/profile.js | 1 - src/viewer/sidebar.js | 10 ++++-- 10 files changed, 49 insertions(+), 61 deletions(-) diff --git a/examples/ca13.html b/examples/ca13.html index 30357ddd..6b052bb8 100644 --- a/examples/ca13.html +++ b/examples/ca13.html @@ -63,14 +63,14 @@ viewer.scene.addPointCloud(e.pointcloud); e.pointcloud.position.z = 0; let material = e.pointcloud.material; - material.size = 1; - material.pointSizeType = Potree.PointSizeType.FIXED; - material.activeAttributeName = "classification"; + material.size = 0.8; + material.pointSizeType = Potree.PointSizeType.ADAPTIVE; + material.activeAttributeName = "RGBA"; - viewer.scene.view.position.set(694991.9150582966, 3916274.3733733483, 76.41774609890476); - viewer.scene.view.lookAt(694878.4097257275, 3916332.0674868184, 14.497470898558227); - - //viewer.fitToScreen(); + viewer.scene.view.setView( + [694517.403, 3899262.595, 10642.698], + [694878.410, 3916332.067, 14.497], + ); }); diff --git a/examples/github.html b/examples/github.html index ab636d39..c6a049e5 100644 --- a/examples/github.html +++ b/examples/github.html @@ -51,13 +51,13 @@ - + - ToolbarBasic ViewerHeidentorLionLion LASLion LAZ + ToolbarBasic ViewerHeidentorLionLion LASEPT @@ -80,19 +80,15 @@ - - + + - CA13Clipping VolumeElevation ProfileMeasurementsMeshesLines + CA13Clipping VolumeElevation ProfileMeasurementsMeshesMultiple Point Clouds - - - - @@ -112,16 +108,16 @@ - - - - Multiple Point CloudsFeatures (Sorvilier)Features (CA13)AnnotationsHierarchical AnnotationsAnimation Path - - + - + + + + Features (Sorvilier)Features (CA13)AnnotationsHierarchical AnnotationsAnimation PathShapefiles + + @@ -141,26 +137,18 @@ - - - - ShapefilesCesium CA13Cesium RetzCesium SorvilierCustom Sidebar SectionEmbedded Iframe - - + - - - - - - - - - Gradient ColorsAnimated LightLight CA13 + Cesium CA13Cesium RetzCesium SorvilierCustom Sidebar SectionEmbedded IframeGradient Colors + + + + + \ No newline at end of file diff --git a/examples/heidentor.html b/examples/heidentor.html index eaf491b9..6c6d1968 100644 --- a/examples/heidentor.html +++ b/examples/heidentor.html @@ -59,7 +59,7 @@ viewer.setMinNodeSize(0); viewer.loadSettingsFromURL(); - viewer.setDescription(""); + viewer.setDescription(`Heidentor point cloud courtesy of Ludwig Boltzmann Institute - Archeological Prospection and Virtual Archeology (26M points)`); viewer.loadGUI(() => { viewer.setLanguage('en'); diff --git a/examples/page.json b/examples/page.json index 0b25c0f8..7b7510c3 100644 --- a/examples/page.json +++ b/examples/page.json @@ -12,14 +12,13 @@ {"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"}, - {"thumb": "thumbnails/lion_las.png", "label": "Lion LAZ", "url": "lion_laz.html"}, + {"thumb": "thumbnails/lion_las.png", "label": "EPT", "url": "ept.html"}, {"thumb": "thumbnails/ca13.png", "label": "CA13", "url": "ca13.html"}, {"thumb": "thumbnails/clipping_volume.png", "label": "Clipping Volume", "url": "clipping_volume.html"}, {"thumb": "thumbnails/elevation_profile.png", "label": "Elevation Profile", "url": "elevation_profile.html"}, {"thumb": "thumbnails/measurements.png", "label": "Measurements", "url": "measurements.html"}, {"thumb": "thumbnails/meshes.png", "label": "Meshes", "url": "meshes.html"}, - {"thumb": "thumbnails/lines.png", "label": "Lines", "url": "lines.html"}, {"thumb": "thumbnails/multiple_point_clouds.png", "label": "Multiple Point Clouds", "url": "multiple_pointclouds.html"}, {"thumb": "thumbnails/features_sorvilier.png", "label": "Features (Sorvilier)", "url": "features_sorvilier.html"}, @@ -34,9 +33,7 @@ {"thumb": "thumbnails/cesium_sorvilier.png", "label": "Cesium Sorvilier", "url": "cesium_sorvilier.html"}, {"thumb": "thumbnails/custom_sidebar_section.png", "label": "Custom Sidebar Section", "url": "custom_sidebar_section.html"}, {"thumb": "thumbnails/embedded_iframe.png", "label": "Embedded Iframe", "url": "embedded_iframe.html"}, - {"thumb": "thumbnails/gradient_colors.png", "label": "Gradient Colors", "url": "gradient_colors.html"}, - {"thumb": "thumbnails/light_animated.png", "label": "Animated Light", "url": "light_animated.html"}, - {"thumb": "thumbnails/light_ca13.png", "label": "Light CA13", "url": "light_ca13.html"} + {"thumb": "thumbnails/gradient_colors.png", "label": "Gradient Colors", "url": "gradient_colors.html"} ], "showcase": [ {"thumb": "thumbnails/chiller.jpg", "label": "Chiller", "url": "showcase/chiller.html"}, diff --git a/src/loader/LasLazLoader.js b/src/loader/LasLazLoader.js index 71d6a249..afa0371a 100644 --- a/src/loader/LasLazLoader.js +++ b/src/loader/LasLazLoader.js @@ -143,7 +143,7 @@ export class LasLazBatcher{ let indices = new Uint8Array(e.data.indices); geometry.addAttribute('position', new THREE.BufferAttribute(positions, 3)); - geometry.addAttribute('RGBA', new THREE.BufferAttribute(colors, 4, true)); + geometry.addAttribute('color', new THREE.BufferAttribute(colors, 4, true)); geometry.addAttribute('intensity', new THREE.BufferAttribute(intensities, 1)); geometry.addAttribute('classification', new THREE.BufferAttribute(classifications, 1)); geometry.addAttribute('return number', new THREE.BufferAttribute(returnNumbers, 1)); diff --git a/src/loader/ept/BinaryLoader.js b/src/loader/ept/BinaryLoader.js index 54b3ebba..ef038ed4 100644 --- a/src/loader/ept/BinaryLoader.js +++ b/src/loader/ept/BinaryLoader.js @@ -53,7 +53,7 @@ export class EptBinaryLoader { if (e.data.color) { let color = new Uint8Array(e.data.color); - g.addAttribute('RGBA', new THREE.BufferAttribute(color, 4, true)); + g.addAttribute('color', new THREE.BufferAttribute(color, 4, true)); } if (e.data.intensity) { let intensity = new Float32Array(e.data.intensity); diff --git a/src/loader/ept/LaszipLoader.js b/src/loader/ept/LaszipLoader.js index 9442ba09..d9039397 100644 --- a/src/loader/ept/LaszipLoader.js +++ b/src/loader/ept/LaszipLoader.js @@ -122,7 +122,7 @@ export class EptLazBatcher { g.addAttribute('position', new THREE.BufferAttribute(positions, 3)); - g.addAttribute('RGBA', + g.addAttribute('color', new THREE.BufferAttribute(colors, 4, true)); g.addAttribute('intensity', new THREE.BufferAttribute(intensities, 1)); diff --git a/src/materials/PointCloudMaterial.js b/src/materials/PointCloudMaterial.js index ebe45e36..738dfcdf 100644 --- a/src/materials/PointCloudMaterial.js +++ b/src/materials/PointCloudMaterial.js @@ -117,7 +117,7 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial { intensityRange: { type: "fv", value: [Infinity, -Infinity] }, intensity_gbc: { type: "fv", value: [1, 0, 0]}, - rgb_gbc: { type: "fv", value: [1, 0, 0]}, + uRGB_gbc: { type: "fv", value: [1, 0, 0]}, // intensityGamma: { type: "f", value: 1 }, // intensityContrast: { type: "f", value: 0 }, // intensityBrightness:{ type: "f", value: 0 }, @@ -784,12 +784,12 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial { } get rgbGamma () { - return this.uniforms.rgb_gbc.value[0]; + return this.uniforms.uRGB_gbc.value[0]; } set rgbGamma (value) { - if (this.uniforms.rgb_gbc.value[0] !== value) { - this.uniforms.rgb_gbc.value[0] = value; + if (this.uniforms.uRGB_gbc.value[0] !== value) { + this.uniforms.uRGB_gbc.value[0] = value; this.dispatchEvent({ type: 'material_property_changed', target: this @@ -798,12 +798,12 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial { } get rgbContrast () { - return this.uniforms.rgb_gbc.value[2]; + return this.uniforms.uRGB_gbc.value[2]; } set rgbContrast (value) { - if (this.uniforms.rgb_gbc.value[2] !== value) { - this.uniforms.rgb_gbc.value[2] = value; + if (this.uniforms.uRGB_gbc.value[2] !== value) { + this.uniforms.uRGB_gbc.value[2] = value; this.dispatchEvent({ type: 'material_property_changed', target: this @@ -812,12 +812,12 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial { } get rgbBrightness () { - return this.uniforms.rgb_gbc.value[1]; + return this.uniforms.uRGB_gbc.value[1]; } set rgbBrightness (value) { - if (this.uniforms.rgb_gbc.value[1] !== value) { - this.uniforms.rgb_gbc.value[1] = value; + if (this.uniforms.uRGB_gbc.value[1] !== value) { + this.uniforms.uRGB_gbc.value[1] = value; this.dispatchEvent({ type: 'material_property_changed', target: this diff --git a/src/viewer/profile.js b/src/viewer/profile.js index eb505925..518bd5ca 100644 --- a/src/viewer/profile.js +++ b/src/viewer/profile.js @@ -168,7 +168,6 @@ class ProfilePointCloudEntry{ this.currentBatch.geometry.drawRange.count++; } - //for(let attribute of Object.values(this.currentBatch.geometry.attributes)){ for(let key of Object.keys(this.currentBatch.geometry.attributes)){ let attribute = this.currentBatch.geometry.attributes[key]; attribute.updateRange.offset = updateRange.start; diff --git a/src/viewer/sidebar.js b/src/viewer/sidebar.js index bae6f2a4..f374c4a9 100644 --- a/src/viewer/sidebar.js +++ b/src/viewer/sidebar.js @@ -21,6 +21,8 @@ export class Sidebar{ this.measuringTool = viewer.measuringTool; this.profileTool = viewer.profileTool; this.volumeTool = viewer.volumeTool; + + this.dom = $("#sidebar_root"); } createToolIcon(icon, title, callback){ @@ -1291,7 +1293,9 @@ export class Sidebar{ initAppearance(){ - $('#sldPointBudget').slider({ + const sldPointBudget = this.dom.find('#sldPointBudget'); + + sldPointBudget.slider({ value: this.viewer.getPointBudget(), min: 100 * 1000, max: 10 * 1000 * 1000, @@ -1299,7 +1303,7 @@ export class Sidebar{ slide: (event, ui) => { this.viewer.setPointBudget(ui.value); } }); - $('#sldFOV').slider({ + this.dom.find('#sldFOV').slider({ value: this.viewer.getFOV(), min: 20, max: 100, @@ -1333,7 +1337,7 @@ export class Sidebar{ this.viewer.addEventListener('point_budget_changed', (event) => { $('#lblPointBudget')[0].innerHTML = Utils.addCommas(this.viewer.getPointBudget()); - $('#sldPointBudget').slider({value: this.viewer.getPointBudget()}); + sldPointBudget.slider({value: this.viewer.getPointBudget()}); }); this.viewer.addEventListener('fov_changed', (event) => {