implement classification invert; fix color attribute; add min size slider

This commit is contained in:
m-schuetz 2019-12-30 16:37:27 +01:00
parent eefae8a62f
commit b3dd0919f7
9 changed files with 108 additions and 70 deletions

View File

@ -285,7 +285,7 @@ We would like to thank our sponsors for their financial contributions that keep
<img src="docs/sponsors/helimap.gif" height="60"/> &nbsp;
</a>
<a href="http://www.vevey.ch/">
<img src="docs/sponsors/vevey.png" height="70"/> &nbsp;
<img src="docs/sponsors/vevey.png" height="60"/> &nbsp;
</a>
<a href="https://www.yverdon-les-bains.ch/">
<img src="docs/sponsors/Logo-YLB.png" height="60"/> &nbsp;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -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",

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -85,7 +85,10 @@ export class PropertiesPanel{
<ul class="pv-menu-list">
<li>
<span data-i18n="appearance.point_size"></span>:<span id="lblPointSize"></span> <div id="sldPointSize"></div>
<span data-i18n="appearance.point_size"></span>:&nbsp;<span id="lblPointSize"></span> <div id="sldPointSize"></div>
</li>
<li>
<span data-i18n="appearance.min_point_size"></span>:&nbsp;<span id="lblMinPointSize"></span> <div id="sldMinPointSize"></div>
</li>
<!-- SIZE TYPE -->
@ -260,6 +263,27 @@ export class PropertiesPanel{
update();
}
{ // MINIMUM POINT SIZE
let sldMinPointSize = panel.find(`#sldMinPointSize`);
let lblMinPointSize = panel.find(`#lblMinPointSize`);
sldMinPointSize.slider({
value: material.size,
min: 0,
max: 3,
step: 0.01,
slide: function (event, ui) { material.minSize = ui.value; }
});
let update = (e) => {
lblMinPointSize.html(material.minSize.toFixed(2));
sldMinPointSize.slider({value: material.minSize});
};
this.addVolatileListener(material, "point_size_changed", update);
update();
}
{ // POINT SIZING
let strSizeType = Object.keys(PointSizeType)[material.pointSizeType];
@ -461,7 +485,7 @@ export class PropertiesPanel{
blockElevation.css('display', 'block');
} else if (selectedValue === 'RGBA') {
blockRGB.css('display', 'block');
} else if (selectedValue === 'Color') {
} else if (selectedValue === 'color') {
blockColor.css('display', 'block');
} else if (selectedValue === 'intensity') {
blockIntensity.css('display', 'block');

View File

@ -1194,7 +1194,12 @@ export class Sidebar{
let elInput = element.find('input');
elInput.click( () => {
// TODO
const classifications = this.viewer.classifications;
for(let key of Object.keys(classifications)){
let value = classifications[key];
this.viewer.setClassificationVisibility(key, !value.visible);
}
});
elClassificationList.append(element);