diff --git a/README.md b/README.md index 9ededa49..f28e60c5 100644 --- a/README.md +++ b/README.md @@ -285,7 +285,7 @@ We would like to thank our sponsors for their financial contributions that keep   -   +     diff --git a/docs/sponsors/vevey.png b/docs/sponsors/vevey.png index ebca0439..301abc9e 100644 Binary files a/docs/sponsors/vevey.png and b/docs/sponsors/vevey.png differ diff --git a/resources/lang/en/translation.json b/resources/lang/en/translation.json index 4fca318a..c08b7769 100644 --- a/resources/lang/en/translation.json +++ b/resources/lang/en/translation.json @@ -49,6 +49,7 @@ "appearance": { "nb_max_pts": "Point budget", "point_size": "Point size", + "min_point_size": "Minimum size", "point_opacity": "Opacity", "field_view": "Field of view", "point_size_type": "Point sizing", diff --git a/src/PotreeRenderer.js b/src/PotreeRenderer.js index fa3bc356..7eea0db0 100644 --- a/src/PotreeRenderer.js +++ b/src/PotreeRenderer.js @@ -1222,28 +1222,10 @@ export class Renderer { //gl.uniformMatrix4fv(lClipSpheres, false, material.uniforms.clipSpheres.value); } - //if(Potree.Features.WEBGL2.isSupported()){ - // let buffer = new ArrayBuffer(12); - // let bufferf32 = new Float32Array(buffer); - // bufferf32[0] = material.size; - // bufferf32[1] = material.uniforms.minSize.value; - // bufferf32[2] = material.uniforms.maxSize.value; - - // let block = shader.uniformBlocks["ubo_point"]; - - // gl.bindBufferBase(gl.UNIFORM_BUFFER, 0, block.buffer); - - // gl.bindBuffer(gl.UNIFORM_BUFFER, block.buffer); - // gl.bufferSubData(gl.UNIFORM_BUFFER, 0, buffer); - // gl.bindBuffer(gl.UNIFORM_BUFFER, null); - // - //}else{ - shader.setUniform1f("size", material.size); - shader.setUniform1f("maxSize", material.uniforms.maxSize.value); - shader.setUniform1f("minSize", material.uniforms.minSize.value); - //} - + shader.setUniform1f("size", material.size); + shader.setUniform1f("maxSize", material.uniforms.maxSize.value); + shader.setUniform1f("minSize", material.uniforms.minSize.value); // uniform float uPCIndex diff --git a/src/materials/PointCloudMaterial.js b/src/materials/PointCloudMaterial.js index 738dfcdf..18e06c6d 100644 --- a/src/materials/PointCloudMaterial.js +++ b/src/materials/PointCloudMaterial.js @@ -673,6 +673,25 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial { } } + get minSize(){ + return this.uniforms.minSize.value; + } + + set minSize(value){ + if (this.uniforms.minSize.value !== value) { + this.uniforms.minSize.value = value; + + this.dispatchEvent({ + type: 'point_size_changed', + target: this + }); + this.dispatchEvent({ + type: 'material_property_changed', + target: this + }); + } + } + get elevationRange () { return this.uniforms.elevationRange.value; } diff --git a/src/modules/OrientedImages/OrientedImageControls.js b/src/modules/OrientedImages/OrientedImageControls.js index 3c713424..1eec67d9 100644 --- a/src/modules/OrientedImages/OrientedImageControls.js +++ b/src/modules/OrientedImages/OrientedImageControls.js @@ -124,9 +124,9 @@ export class OrientedImageControls extends EventDispatcher{ } update (delta) { - const view = this.scene.view; + // const view = this.scene.view; - let prevTotal = this.shearCam.projectionMatrix.elements.reduce( (a, i) => a + i, 0); + // let prevTotal = this.shearCam.projectionMatrix.elements.reduce( (a, i) => a + i, 0); //const progression = Math.min(1, this.fadeFactor * delta); //const attenuation = Math.max(0, 1 - this.fadeFactor * delta); diff --git a/src/modules/OrientedImages/OrientedImages.js b/src/modules/OrientedImages/OrientedImages.js index 7b052250..0cc53e62 100644 --- a/src/modules/OrientedImages/OrientedImages.js +++ b/src/modules/OrientedImages/OrientedImages.js @@ -100,7 +100,7 @@ export class OrientedImageLoader{ const f = parseFloat(doc.getElementsByTagName("f")[0].textContent); let a = (height / 2) / f; - let fov = 2 * THREE.Math.radToDeg(Math.atan(a)) + let fov = 2 * THREE.Math.radToDeg(Math.atan(a)); const params = { path: path, @@ -155,6 +155,9 @@ export class OrientedImageLoader{ imageParams.push(params); } + // debug + //return [imageParams[50]]; + return imageParams; } @@ -320,6 +323,49 @@ export class OrientedImageLoader{ //console.log(tEnd - tStart); }; + const moveToImage = (image) => { + console.log("move to image " + image.params.id); + + const mesh = image.mesh; + const newCamPos = new THREE.Vector3( + image.params.x, + image.params.y, + image.params.z + ); + const newCamTarget = mesh.position.clone(); + + viewer.scene.view.setView(newCamPos, newCamTarget, 500, () => { + orientedImageControls.capture(image.params); + }); + + if(image.texture === null){ + + const target = image; + + const tmpImagePath = `${Potree.resourcePath}/images/loading.jpg`; + new THREE.TextureLoader().load(tmpImagePath, + (texture) => { + if(target.texture === null){ + target.texture = texture; + target.mesh.material.uniforms.tColor.value = texture; + mesh.material.needsUpdate = true; + } + } + ); + + const imagePath = `${imageParamsPath}/../${target.params.id}`; + new THREE.TextureLoader().load(imagePath, + (texture) => { + target.texture = texture; + target.mesh.material.uniforms.tColor.value = texture; + mesh.material.needsUpdate = true; + } + ); + + + } + }; + const onMouseClick = (evt) => { if(orientedImageControls.hasSomethingCaptured()){ @@ -327,48 +373,7 @@ export class OrientedImageLoader{ } if(hoveredElement){ - console.log("move to image " + hoveredElement.params.id); - - const mesh = hoveredElement.mesh; - const newCamPos = new THREE.Vector3( - hoveredElement.params.x, - hoveredElement.params.y, - hoveredElement.params.z - ); - const newCamTarget = mesh.position.clone(); - - viewer.scene.view.setView(newCamPos, newCamTarget, 500, () => { - orientedImageControls.capture(hoveredElement.params); - }); - - if(hoveredElement.texture === null){ - - const target = hoveredElement; - - const tmpImagePath = `${Potree.resourcePath}/images/loading.jpg`; - new THREE.TextureLoader().load(tmpImagePath, - (texture) => { - if(target.texture === null){ - target.texture = texture; - target.mesh.material.uniforms.tColor.value = texture; - mesh.material.needsUpdate = true; - } - } - ); - - const imagePath = `${imageParamsPath}/../${target.params.id}`; - new THREE.TextureLoader().load(imagePath, - (texture) => { - target.texture = texture; - target.mesh.material.uniforms.tColor.value = texture; - mesh.material.needsUpdate = true; - } - ); - - - } - - + moveToImage(hoveredElement); } }; viewer.renderer.domElement.addEventListener( 'mousemove', onMouseMove, false ); @@ -410,6 +415,8 @@ export class OrientedImageLoader{ images.imageParams = imageParams; images.images = orientedImages; + Potree.debug.moveToImage = moveToImage; + return images; } } diff --git a/src/viewer/PropertyPanels/PropertiesPanel.js b/src/viewer/PropertyPanels/PropertiesPanel.js index 68553e12..402a3e11 100644 --- a/src/viewer/PropertyPanels/PropertiesPanel.js +++ b/src/viewer/PropertyPanels/PropertiesPanel.js @@ -85,7 +85,10 @@ export class PropertiesPanel{