Skip to content

Commit

Permalink
implement classification invert; fix color attribute; add min size sl…
Browse files Browse the repository at this point in the history
…ider
  • Loading branch information
potree committed Dec 30, 2019
1 parent eefae8a commit b3dd091
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 65 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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;
Expand Down
Binary file modified docs/sponsors/vevey.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/lang/en/translation.json
Expand Up @@ -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",
Expand Down
24 changes: 3 additions & 21 deletions src/PotreeRenderer.js
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions src/materials/PointCloudMaterial.js
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/modules/OrientedImages/OrientedImageControls.js
Expand Up @@ -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);
Expand Down
83 changes: 45 additions & 38 deletions src/modules/OrientedImages/OrientedImages.js
Expand Up @@ -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,
Expand Down Expand Up @@ -155,6 +155,9 @@ export class OrientedImageLoader{
imageParams.push(params);
}

// debug
//return [imageParams[50]];

return imageParams;
}

Expand Down Expand Up @@ -320,55 +323,57 @@ export class OrientedImageLoader{
//console.log(tEnd - tStart);
};

const onMouseClick = (evt) => {
const moveToImage = (image) => {
console.log("move to image " + image.params.id);

if(orientedImageControls.hasSomethingCaptured()){
return;
}
const mesh = image.mesh;
const newCamPos = new THREE.Vector3(
image.params.x,
image.params.y,
image.params.z
);
const newCamTarget = mesh.position.clone();

if(hoveredElement){
console.log("move to image " + hoveredElement.params.id);
viewer.scene.view.setView(newCamPos, newCamTarget, 500, () => {
orientedImageControls.capture(image.params);
});

const mesh = hoveredElement.mesh;
const newCamPos = new THREE.Vector3(
hoveredElement.params.x,
hoveredElement.params.y,
hoveredElement.params.z
);
const newCamTarget = mesh.position.clone();
if(image.texture === null){

viewer.scene.view.setView(newCamPos, newCamTarget, 500, () => {
orientedImageControls.capture(hoveredElement.params);
});
const target = image;

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) => {
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()){
return;
}

if(hoveredElement){
moveToImage(hoveredElement);
}
};
viewer.renderer.domElement.addEventListener( 'mousemove', onMouseMove, false );
Expand Down Expand Up @@ -410,6 +415,8 @@ export class OrientedImageLoader{
images.imageParams = imageParams;
images.images = orientedImages;

Potree.debug.moveToImage = moveToImage;

return images;
}
}
Expand Down
28 changes: 26 additions & 2 deletions src/viewer/PropertyPanels/PropertiesPanel.js
Expand Up @@ -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 -->
Expand Down Expand Up @@ -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];

Expand Down Expand Up @@ -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');
Expand Down
7 changes: 6 additions & 1 deletion src/viewer/sidebar.js
Expand Up @@ -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);
Expand Down

0 comments on commit b3dd091

Please sign in to comment.