fixed #330; some refactoring and perf improvements
This commit is contained in:
parent
79e5029c65
commit
47211fe4dc
@ -768,6 +768,11 @@ Potree.PointCloudOctree = class extends Potree.PointCloudTree{
|
||||
gl.uniform1f(uniforms["maxSize"], this.material.maxSize);
|
||||
gl.uniform1f(uniforms["octreeSize"], this.pcoGeometry.boundingBox.getSize().x);
|
||||
|
||||
if(uniforms["clipBoxes[0]"]){
|
||||
gl.uniform1f(uniforms["clipBoxCount"], pickMaterial.uniforms.clipBoxCount.value);
|
||||
gl.uniformMatrix4fv(uniforms["clipBoxes[0]"], false, pickMaterial.uniforms.clipBoxes.value);
|
||||
}
|
||||
|
||||
{
|
||||
let apPosition = gl.getAttribLocation(program, "position");
|
||||
let apNormal = gl.getAttribLocation(program, "normal");
|
||||
|
||||
@ -35,7 +35,7 @@ Potree.LASExporter = class LASExporter{
|
||||
// system identifier o:26 l:32
|
||||
|
||||
// generating software o:58 l:32
|
||||
setString("potree 1.4", 58, buffer);
|
||||
setString("Potree 1.5", 58, buffer);
|
||||
|
||||
// file creation day of year o:90 l:2
|
||||
// file creation year o:92 l:2
|
||||
|
||||
@ -153,7 +153,6 @@ Potree.PointCloudMaterial = class PointCloudMaterial extends THREE.RawShaderMate
|
||||
gradient: { type: "t", value: this.gradientTexture },
|
||||
classificationLUT: { type: "t", value: this.classificationTexture },
|
||||
clipBoxes: { type: "Matrix4fv", value: [] },
|
||||
clipBoxPositions: { type: "fv", value: null },
|
||||
depthMap: { type: "t", value: null },
|
||||
diffuse: { type: "fv", value: [1,1,1]},
|
||||
transition: { type: "f", value: 0.5 },
|
||||
@ -311,16 +310,11 @@ Potree.PointCloudMaterial = class PointCloudMaterial extends THREE.RawShaderMate
|
||||
}
|
||||
|
||||
this.uniforms.clipBoxes.value = new Float32Array(this.numClipBoxes * 16);
|
||||
this.uniforms.clipBoxPositions.value = new Float32Array(this.numClipBoxes * 3);
|
||||
|
||||
for(let i = 0; i < this.numClipBoxes; i++){
|
||||
let box = clipBoxes[i];
|
||||
|
||||
this.uniforms.clipBoxes.value.set(box.inverse.elements, 16*i);
|
||||
|
||||
this.uniforms.clipBoxPositions.value[3*i+0] = box.position.x;
|
||||
this.uniforms.clipBoxPositions.value[3*i+1] = box.position.y;
|
||||
this.uniforms.clipBoxPositions.value[3*i+2] = box.position.z;
|
||||
}
|
||||
}
|
||||
|
||||
@ -669,17 +663,19 @@ Potree.PointCloudMaterial = class PointCloudMaterial extends THREE.RawShaderMate
|
||||
}
|
||||
|
||||
set intensityRange(value){
|
||||
this.uniforms.intensityRange.value = value;
|
||||
|
||||
if(value.length !== 2){
|
||||
return;
|
||||
}else if(this.uniforms.heightMax.value[0] !== value[0]){
|
||||
return;
|
||||
}else if(this.uniforms.heightMax.value[1] !== value[1]){
|
||||
if(!(value instanceof Array && value.length === 2)){
|
||||
return;
|
||||
}
|
||||
|
||||
this.uniforms.heightMax.value = value;
|
||||
if(value[0] === this.uniforms.intensityRange.value[0] &&
|
||||
value[1] === this.uniforms.intensityRange.value[1]){
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.uniforms.intensityRange.value = value;
|
||||
|
||||
this.dispatchEvent({
|
||||
type: "material_property_changed",
|
||||
target: this
|
||||
|
||||
@ -33,7 +33,6 @@ uniform float far;
|
||||
|
||||
#if defined use_clip_box
|
||||
uniform mat4 clipBoxes[max_clip_boxes];
|
||||
uniform vec3 clipBoxPositions[max_clip_boxes];
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<div id="profile_window" style="
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
left: 15%; top: 55%; bottom: 5px;
|
||||
width: 84%;
|
||||
left: 15%; top: 55%; height: 44%;
|
||||
margin: 5px;
|
||||
border: 1px solid black;
|
||||
display: none; box-sizing: border-box; z-index:10000">
|
||||
|
||||
@ -602,9 +602,9 @@ Potree.ProfileWindow = class ProfileWindow extends THREE.EventDispatcher{
|
||||
material.rgbContrast = pointcloud.material.rgbContrast;
|
||||
material.rgbBrightness = pointcloud.material.rgbBrightness;
|
||||
material.intensityRange = pointcloud.material.intensityRange;
|
||||
material.intensityGamma = pointcloud.material.rgbGamma;
|
||||
material.intensityContrast = pointcloud.material.rgbContrast;
|
||||
material.intensityBrightness = pointcloud.material.rgbBrightness;
|
||||
material.intensityGamma = pointcloud.material.intensityGamma;
|
||||
material.intensityContrast = pointcloud.material.intensityContrast;
|
||||
material.intensityBrightness = pointcloud.material.intensityBrightness;
|
||||
}
|
||||
|
||||
this.renderer.setSize(width, height);
|
||||
@ -709,6 +709,10 @@ Potree.ProfileWindowController = class ProfileWindowController{
|
||||
|
||||
recompute(){
|
||||
|
||||
if(!this.profile){
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.scheduledRecomputeTime !== null && this.scheduledRecomputeTime > new Date().getTime()){
|
||||
return;
|
||||
}else{
|
||||
|
||||
@ -281,6 +281,8 @@ function initAppearance(){
|
||||
function initNavigation(){
|
||||
|
||||
let elNavigation = $("#navigation");
|
||||
let sldMoveSpeed = $("#sldMoveSpeed");
|
||||
let lblMoveSpeed = $('#lblMoveSpeed');
|
||||
|
||||
elNavigation.append(createToolIcon(
|
||||
Potree.resourcePath + "/icons/earth_controls_1.png",
|
||||
@ -334,7 +336,7 @@ function initNavigation(){
|
||||
return Math.pow((value - speedRange.x) / speedRange.y, 1 / 4);
|
||||
};
|
||||
|
||||
$( "#sldMoveSpeed" ).slider({
|
||||
sldMoveSpeed.slider({
|
||||
value: toExpSpeed( viewer.getMoveSpeed() ),
|
||||
min: 0,
|
||||
max: 1,
|
||||
@ -343,11 +345,11 @@ function initNavigation(){
|
||||
});
|
||||
|
||||
viewer.addEventListener("move_speed_changed", function(event){
|
||||
$('#lblMoveSpeed')[0].innerHTML = viewer.getMoveSpeed().toFixed(1);
|
||||
$( "#sldMoveSpeed" ).slider({value: toExpSpeed(viewer.getMoveSpeed())});
|
||||
lblMoveSpeed.html(viewer.getMoveSpeed().toFixed(1));
|
||||
sldMoveSpeed.slider({value: toExpSpeed(viewer.getMoveSpeed())});
|
||||
});
|
||||
|
||||
$('#lblMoveSpeed')[0].innerHTML = viewer.getMoveSpeed().toFixed(1);
|
||||
lblMoveSpeed.html(viewer.getMoveSpeed().toFixed(1));
|
||||
}
|
||||
|
||||
function initAnnotationDetails(){
|
||||
@ -1642,8 +1644,8 @@ function initSceneList(){
|
||||
|
||||
inputVis.click(function(event){
|
||||
viewer.scene.pointclouds[i].visible = event.target.checked;
|
||||
if(viewer.profileWindow){
|
||||
viewer.profileWindow.redraw();
|
||||
if(viewer.profileWindowController){
|
||||
viewer.profileWindowController.recompute();
|
||||
}
|
||||
});
|
||||
|
||||
@ -1692,8 +1694,9 @@ function initSceneList(){
|
||||
slide: function( event, ui ) {
|
||||
let min = (ui.values[0] == 0) ? 0 : parseInt(Math.pow(2, 16 * ui.values[0]));
|
||||
let max = parseInt(Math.pow(2, 16 * ui.values[1]));
|
||||
pcMaterial.intensityRange[0] = min;
|
||||
pcMaterial.intensityRange[1] = max;
|
||||
pcMaterial.intensityRange = [min, max];
|
||||
//pcMaterial.intensityRange[0] = min;
|
||||
//pcMaterial.intensityRange[1] = max;
|
||||
viewer.dispatchEvent({"type": "intensity_range_changed" + i, "viewer": viewer});
|
||||
}
|
||||
});
|
||||
@ -1997,27 +2000,34 @@ function initSceneList(){
|
||||
$("#optMaterial" + i).val(viewer.toMaterialName(pcMaterial.pointColorType)).selectmenu("refresh");
|
||||
});
|
||||
|
||||
scenePanel.i18n();
|
||||
};
|
||||
|
||||
let buildSceneList = () => {
|
||||
scenelist.empty();
|
||||
|
||||
for(let i = 0; i < viewer.scene.pointclouds.length; i++) {
|
||||
initUIElements(i);
|
||||
}
|
||||
};
|
||||
|
||||
buildSceneList();
|
||||
|
||||
for(let i = 0; i < viewer.scene.pointclouds.length; i++) {
|
||||
initUIElements(i);
|
||||
}
|
||||
//for(let i = 0; i < viewer.scene.pointclouds.length; i++) {
|
||||
// initUIElements(i);
|
||||
//}
|
||||
|
||||
viewer.addEventListener("scene_changed", (e) => {
|
||||
scenelist.empty();
|
||||
buildSceneList();
|
||||
|
||||
for(let i = 0; i < viewer.scene.pointclouds.length; i++) {
|
||||
initUIElements(i);
|
||||
if(e.oldScene){
|
||||
e.oldScene.removeEventListener("pointcloud_added", buildSceneList);
|
||||
}
|
||||
e.scene.addEventListener("pointcloud_added", buildSceneList);
|
||||
});
|
||||
|
||||
viewer.addEventListener("pointcloud_loaded", function(event){
|
||||
scenelist.empty();
|
||||
|
||||
for(let i = 0; i < viewer.scene.pointclouds.length; i++) {
|
||||
initUIElements(i);
|
||||
}
|
||||
});
|
||||
viewer.scene.addEventListener("pointcloud_added", buildSceneList);
|
||||
|
||||
|
||||
let lastPos = new THREE.Vector3();
|
||||
let lastTarget = new THREE.Vector3();
|
||||
|
||||
@ -233,6 +233,10 @@ Potree.Scene = class extends THREE.EventDispatcher{
|
||||
while(this.profiles.length > 0){
|
||||
this.removeProfile(this.profiles[0]);
|
||||
}
|
||||
|
||||
while(this.volumes.length > 0){
|
||||
this.removeVolume(this.volumes[0]);
|
||||
}
|
||||
}
|
||||
|
||||
initialize(){
|
||||
@ -1161,7 +1165,8 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
||||
containment: $(document.body)
|
||||
});
|
||||
$("#profile_window").resizable({
|
||||
containment: $(document.body)
|
||||
containment: $(document.body),
|
||||
handles: "n, e, s, w"
|
||||
});
|
||||
|
||||
if(callback){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user