add vscode config; address some eslint suggestions

This commit is contained in:
m-schuetz 2018-01-06 17:48:45 +01:00
parent d0a7cb8b8e
commit ae2e13d463
18 changed files with 267 additions and 255 deletions

View File

@ -1,48 +1,53 @@
{
"extends": "happiness",
"globals": {
"THREE": false,
"TWEEN": false,
"$": false,
"XMLHttpRequest": false,
"requestAnimationFrame": false,
"Blob": false,
"i18n": false,
"URL": false,
"Stats": false,
"ProgressBar": false,
"d3": false,
"btoa": false,
"alert": false,
"ol": false,
"proj4": false,
"shapefile": false,
"Worker": false,
"Image": false,
"LASFile": false,
"LASDecoder": false,
"BinaryHeap": false,
"Potree": true,
"initSidebar": true,
"HoverMenu": true,
"HoverMenuItem": true,
"LRU": true,
"viewer": true
},
"rules": {
"no-lone-blocks": "off",
"space-before-function-paren": "off",
"space-before-blocks": "off",
"indent": "off",
"no-trailing-spaces": "off",
"keyword-spacing": "off",
"no-multiple-empty-lines" : "off",
"key-spacing": "off",
"spaced-comment": "off",
"quotes": "off",
"space-in-parens": "off"
},
"parserOptions": {
"ecmaVersion": 6
}
"extends": "happiness",
"globals": {
"THREE": false,
"TWEEN": false,
"$": false,
"XMLHttpRequest": false,
"requestAnimationFrame": false,
"Blob": false,
"i18n": false,
"URL": false,
"Stats": false,
"ProgressBar": false,
"d3": false,
"btoa": false,
"alert": false,
"ol": false,
"proj4": false,
"shapefile": false,
"Worker": false,
"Image": false,
"LASFile": false,
"LASDecoder": false,
"BinaryHeap": false,
"performance": false,
"Potree": true,
"initSidebar": true,
"HoverMenu": true,
"HoverMenuItem": true,
"LRU": true,
"viewer": true
},
"rules": {
"no-lone-blocks": "off",
"space-before-function-paren": "off",
"space-before-blocks": "off",
"indent": "off",
"no-trailing-spaces": "off",
"keyword-spacing": "off",
"no-multiple-empty-lines" : "off",
"key-spacing": "off",
"spaced-comment": "off",
"quotes": "off",
"space-in-parens": "off",
"padded-blocks": "off",
"comma-dangle": "off",
"object-property-newline": "off",
"eol-last": "off"
},
"parserOptions": {
"ecmaVersion": 6
}
}

12
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
"workbench.editor.enablePreview": false,
"files.associations": {
"*.vs": "cpp",
"*.fs": "cpp"
},
"editor.fontSize": 16,
"editor.autoIndent": false,
"editor.detectIndentation": false,
"editor.renderWhitespace": "all",
"editor.insertSpaces": false,
}

View File

@ -84,9 +84,8 @@ Potree.PointCloudOctree = class extends Potree.PointCloudTree {
this.updateMatrixWorld(true);
box = Potree.utils.computeTransformedBoundingBox(box, this.matrixWorld);
let bWidth = box.max.z - box.min.z;
let bMin = box.min.z; // - 0.2 * bWidth;
let bMax = box.max.z; // + 0.2 * bWidth;
let bMin = box.min.z;
let bMax = box.max.z;
this.material.heightMin = bMin;
this.material.heightMax = bMax;
}

View File

@ -78,8 +78,6 @@ Potree.resolveQueries = function (gl) {
for (let name in Potree.timerQueries) {
let queries = Potree.timerQueries[name];
let sum = 0;
let n = 0;
let remainingQueries = [];
for(let query of queries){
@ -95,17 +93,11 @@ Potree.resolveQueries = function (gl) {
resolved.set(name, []);
}
resolved.get(name).push(miliseconds);
//sum += miliseconds;
//n++;
}else{
remainingQueries.push(query);
}
}
//let mean = sum / n;
//console.log(`mean: ${mean.toFixed(3)}, samples: ${n}`);
if (remainingQueries.length === 0) {
delete Potree.timerQueries[name];
}else{
@ -179,7 +171,7 @@ Potree.toMaterialName = function(materialID) {
return 'Normal';
} else if (materialID === Potree.PointColorType.PHONG) {
return 'Phong';
} else if (materialID === Potree.PointColorType.POINT_INDEX) {
} else if (materialID === Potree.PointColorType.POINT_INDEX) {
return 'Index';
} else if (materialID === Potree.PointColorType.RGB_HEIGHT) {
return 'RGB and Elevation';
@ -210,7 +202,7 @@ Potree.getMeasurementIcon = function(measurement){
} else if (measurement instanceof Potree.PolygonClipVolume) {
return `${Potree.resourcePath}/icons/clip-polygon.svg`;
}
}
};
Potree.Points = class Points {
constructor () {
@ -393,7 +385,7 @@ Potree.updateVisibilityStructures = function(pointclouds, camera, renderer) {
'camObjPositions': camObjPositions,
'priorityQueue': priorityQueue
};
}
};
Potree.getDEMWorkerInstance = function () {
if (!Potree.DEMWorkerInstance) {

View File

@ -115,8 +115,8 @@ Potree.ProfileRequest = class ProfileRequest {
Potree.getLRU().touch(node);
this.highestLevelServed = Math.max(node.getLevel(), this.highestLevelServed);
let doTraverse = (node.level % node.pcoGeometry.hierarchyStepSize) === 0 && node.hasChildren;
doTraverse = doTraverse || node.getLevel() === 0;
let doTraverse = (node.level % node.pcoGeometry.hierarchyStepSize) === 0 && node.hasChildren;
doTraverse = doTraverse || node.getLevel() === 0;
if (doTraverse) {
this.traverse(node);
}

View File

@ -1,19 +1,18 @@
THREE.OrthographicCamera.prototype.zoomTo = function( node, factor ){
THREE.OrthographicCamera.prototype.zoomTo = function( node, factor = 1){
if ( !node.geometry && !node.boundingBox) {
return;
}
var _factor = factor || 1;
// TODO
let minWS = new THREE.Vector4(node.boundingBox.min.x, node.boundingBox.min.y, node.boundingBox.min.z, 1);
let minVS = minWS.applyMatrix4(this.matrixWorldInverse);
//let minWS = new THREE.Vector4(node.boundingBox.min.x, node.boundingBox.min.y, node.boundingBox.min.z, 1);
//let minVS = minWS.applyMatrix4(this.matrixWorldInverse);
let right = node.boundingBox.max.x;
let bottom = node.boundingBox.min.y;
let top = node.boundingBox.max.y;
//let right = node.boundingBox.max.x;
//let bottom = node.boundingBox.min.y;
//let top = node.boundingBox.max.y;
this.updateProjectionMatrix();
};

View File

@ -1,108 +1,108 @@
Potree.GreyhoundBinaryLoader = function (version, boundingBox, scale) {
if (typeof (version) === 'string') {
this.version = new Potree.Version(version);
} else {
this.version = version;
}
this.boundingBox = boundingBox;
this.scale = scale;
};
Potree.GreyhoundBinaryLoader.prototype.networkToNative = function (val) {
return ((val & 0x00FF) << 24) |
((val & 0xFF00) << 8) |
((val >> 8) & 0xFF00) |
((val >> 24) & 0x00FF);
}
Potree.GreyhoundBinaryLoader.prototype.load = function (node) {
if (node.loaded) return;
let scope = this;
let url = node.getURL();
Potree.GreyhoundBinaryLoader = class{
let xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'arraybuffer';
xhr.overrideMimeType('text/plain; charset=x-user-defined');
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200 || xhr.status === 0) {
let buffer = xhr.response;
scope.parse(node, buffer);
} else {
console.log(
'Failed to load file! HTTP status:', xhr.status,
'file:', url);
}
constructor(version, boundingBox, scale){
if (typeof (version) === 'string') {
this.version = new Potree.Version(version);
} else {
this.version = version;
}
};
try {
xhr.send(null);
} catch (e) {
console.log('error loading point cloud: ' + e);
this.boundingBox = boundingBox;
this.scale = scale;
}
};
Potree.GreyhoundBinaryLoader.prototype.parse = function (node, buffer) {
let NUM_POINTS_BYTES = 4;
load(node){
if (node.loaded) return;
let view = new DataView(
buffer, buffer.byteLength - NUM_POINTS_BYTES, NUM_POINTS_BYTES);
let numPoints = view.getUint32(0, true);
let pointAttributes = node.pcoGeometry.pointAttributes;
let scope = this;
let url = node.getURL();
node.numPoints = numPoints;
let xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'arraybuffer';
xhr.overrideMimeType('text/plain; charset=x-user-defined');
let workerPath = Potree.scriptPath + '/workers/GreyhoundBinaryDecoderWorker.js';
let worker = Potree.workerPool.getWorker(workerPath);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (xhr.status === 200 || xhr.status === 0) {
let buffer = xhr.response;
scope.parse(node, buffer);
} else {
console.log(
'Failed to load file! HTTP status:', xhr.status,
'file:', url);
}
}
};
worker.onmessage = function (e) {
try {
xhr.send(null);
} catch (e) {
console.log('error loading point cloud: ' + e);
}
}
let data = e.data;
let iAttributes = pointAttributes.attributes
.map(pa => Potree.toInterleavedBufferAttribute(pa))
.filter(ia => ia != null);
iAttributes.push(new Potree.InterleavedBufferAttribute("index", 4, 4, "UNSIGNED_BYTE", true));
let iBuffer = new Potree.InterleavedBuffer(data.data, iAttributes, numPoints);
parse(node, buffer){
let NUM_POINTS_BYTES = 4;
let tightBoundingBox = new THREE.Box3(
new THREE.Vector3().fromArray(data.tightBoundingBox.min),
new THREE.Vector3().fromArray(data.tightBoundingBox.max)
);
let view = new DataView(
buffer, buffer.byteLength - NUM_POINTS_BYTES, NUM_POINTS_BYTES);
let numPoints = view.getUint32(0, true);
let pointAttributes = node.pcoGeometry.pointAttributes;
Potree.workerPool.returnWorker(workerPath, worker);
node.numPoints = numPoints;
tightBoundingBox.max.sub(tightBoundingBox.min);
tightBoundingBox.min.set(0, 0, 0);
let workerPath = Potree.scriptPath + '/workers/GreyhoundBinaryDecoderWorker.js';
let worker = Potree.workerPool.getWorker(workerPath);
node.numPoints = iBuffer.numElements;
node.buffer = iBuffer;
node.mean = new THREE.Vector3(...data.mean);
node.tightBoundingBox = tightBoundingBox;
node.loaded = true;
node.loading = false;
node.pcoGeometry.numNodesLoading--;
};
worker.onmessage = function (e) {
let bb = node.boundingBox;
let nodeOffset = node.pcoGeometry.boundingBox.getCenter().sub(node.boundingBox.min);
let data = e.data;
let iAttributes = pointAttributes.attributes
.map(pa => Potree.toInterleavedBufferAttribute(pa))
.filter(ia => ia != null);
iAttributes.push(new Potree.InterleavedBufferAttribute("index", 4, 4, "UNSIGNED_BYTE", true));
let iBuffer = new Potree.InterleavedBuffer(data.data, iAttributes, numPoints);
let message = {
buffer: buffer,
pointAttributes: pointAttributes,
version: this.version.version,
schema: node.pcoGeometry.schema,
min: [bb.min.x, bb.min.y, bb.min.z],
max: [bb.max.x, bb.max.y, bb.max.z],
offset: nodeOffset.toArray(),
scale: this.scale,
normalize: node.pcoGeometry.normalize
};
let tightBoundingBox = new THREE.Box3(
new THREE.Vector3().fromArray(data.tightBoundingBox.min),
new THREE.Vector3().fromArray(data.tightBoundingBox.max)
);
worker.postMessage(message, [message.buffer]);
};
Potree.workerPool.returnWorker(workerPath, worker);
tightBoundingBox.max.sub(tightBoundingBox.min);
tightBoundingBox.min.set(0, 0, 0);
node.numPoints = iBuffer.numElements;
node.buffer = iBuffer;
node.mean = new THREE.Vector3(...data.mean);
node.tightBoundingBox = tightBoundingBox;
node.loaded = true;
node.loading = false;
node.pcoGeometry.numNodesLoading--;
};
let bb = node.boundingBox;
let nodeOffset = node.pcoGeometry.boundingBox.getCenter().sub(node.boundingBox.min);
let message = {
buffer: buffer,
pointAttributes: pointAttributes,
version: this.version.version,
schema: node.pcoGeometry.schema,
min: [bb.min.x, bb.min.y, bb.min.z],
max: [bb.max.x, bb.max.y, bb.max.z],
offset: nodeOffset.toArray(),
scale: this.scale,
normalize: node.pcoGeometry.normalize
};
worker.postMessage(message, [message.buffer]);
}
}

View File

@ -44,8 +44,6 @@ Potree.EyeDomeLightingMaterial = class EyeDomeLightingMaterial extends THREE.Sha
updateShaderSource() {
let PC = Potree.PointColorType;
let vs = this.getDefines() + Potree.Shaders['edl.vs'];
let fs = this.getDefines() + Potree.Shaders['edl.fs'];

View File

@ -228,32 +228,32 @@ Potree.PointCloudMaterial = class PointCloudMaterial extends THREE.RawShaderMate
screenHeight: { type: "f", value: 1.0 },
near: { type: "f", value: 0.1 },
far: { type: "f", value: 1.0 },
uColor: { type: "c", value: new THREE.Color( 0xffffff ) },
uOpacity: { type: "f", value: 1.0 },
size: { type: "f", value: pointSize },
minSize: { type: "f", value: minSize },
maxSize: { type: "f", value: maxSize },
uColor: { type: "c", value: new THREE.Color( 0xffffff ) },
uOpacity: { type: "f", value: 1.0 },
size: { type: "f", value: pointSize },
minSize: { type: "f", value: minSize },
maxSize: { type: "f", value: maxSize },
octreeSize: { type: "f", value: 0 },
bbSize: { type: "fv", value: [0,0,0] },
elevationRange: { type: "2fv", value: [0,0] },
bbSize: { type: "fv", value: [0, 0, 0] },
elevationRange: { type: "2fv", value: [0, 0] },
clipBoxCount: { type: "f", value: 0 },
clipPolygonCount: { type: "i", value: 0 },
visibleNodes: { type: "t", value: this.visibleNodesTexture },
pcIndex: { type: "f", value: 0 },
gradient: { type: "t", value: this.gradientTexture },
classificationLUT: { type: "t", value: this.classificationTexture },
pcIndex: { type: "f", value: 0 },
gradient: { type: "t", value: this.gradientTexture },
classificationLUT: { type: "t", value: this.classificationTexture },
clipBoxes: { type: "Matrix4fv", value: [] },
clipPolygons: { type: "3fv", value: [] },
clipPolygonVCount: { type: "iv", value: [] },
clipPolygonVP: { type: "Matrix4fv", value: [] },
toModel: { type: "Matrix4f", value: [] },
diffuse: { type: "fv", value: [1,1,1]},
transition: { type: "f", value: 0.5 },
intensityRange: { type: "fv", value: [0, 65000] },
intensityGamma: { type: "f", value: 1 },
diffuse: { type: "fv", value: [1, 1, 1] },
transition: { type: "f", value: 0.5 },
intensityRange: { type: "fv", value: [0, 65000] },
intensityGamma: { type: "f", value: 1 },
intensityContrast: { type: "f", value: 0 },
intensityBrightness:{ type: "f", value: 0 },
rgbGamma: { type: "f", value: 1 },
rgbGamma: { type: "f", value: 1 },
rgbContrast: { type: "f", value: 0 },
rgbBrightness: { type: "f", value: 0 },
wRGB: { type: "f", value: 1 },
@ -263,14 +263,14 @@ Potree.PointCloudMaterial = class PointCloudMaterial extends THREE.RawShaderMate
wReturnNumber: { type: "f", value: 0 },
wSourceID: { type: "f", value: 0 },
useOrthographicCamera: { type: "b", value: false },
clipMode: { type: "i", value: 1},
uSnapshot: { type: "tv", value: []},
uSnapshotDepth: { type: "tv", value: []},
uSnapView: { type: "Matrix4fv", value: []},
uSnapProj: { type: "Matrix4fv", value: []},
uSnapProjInv: { type: "Matrix4fv", value: []},
uSnapViewInv: { type: "Matrix4fv", value: []},
uShadowColor: { type: "3fv", value: [0, 0, 0]}
clipMode: { type: "i", value: 1 },
uSnapshot: { type: "tv", value: [] },
uSnapshotDepth: { type: "tv", value: [] },
uSnapView: { type: "Matrix4fv", value: [] },
uSnapProj: { type: "Matrix4fv", value: [] },
uSnapProjInv: { type: "Matrix4fv", value: [] },
uSnapViewInv: { type: "Matrix4fv", value: [] },
uShadowColor: { type: "3fv", value: [0, 0, 0] }
};
this.classification = Potree.Classification.DEFAULT;
@ -445,7 +445,7 @@ Potree.PointCloudMaterial = class PointCloudMaterial extends THREE.RawShaderMate
let poly = clipPolygons[i];
this.uniforms.clipPolygonVCount.value[i] = poly.count;
this.uniforms.clipPolygonVP.value.set(poly.view.elements, 16*i);
this.uniforms.clipPolygonVP.value.set(poly.view.elements, 16 * i);
for(let j = 0; j < poly.count; j++) {
this.uniforms.clipPolygons.value[i * 24 + (j * 3 + 0)] = poly.polygon[j].x;
this.uniforms.clipPolygons.value[i * 24 + (j * 3 + 1)] = poly.polygon[j].y;

View File

@ -238,7 +238,7 @@ Potree.InputHandler = class InputHandler extends THREE.EventDispatcher {
e.preventDefault();
let consumed = false;
let consume = () => consumed = true;
let consume = () => { return consumed = true; };
if (this.hoveredElements.length === 0) {
for (let inputListener of this.inputListeners) {
inputListener.dispatchEvent({
@ -290,7 +290,7 @@ Potree.InputHandler = class InputHandler extends THREE.EventDispatcher {
let consumed = false;
let consume = () => {consumed = true};
let consume = () => { return consumed = true; };
if (this.hoveredElements.length === 0) {
for (let inputListener of this.inputListeners) {
inputListener.dispatchEvent({

View File

@ -68,7 +68,7 @@ Potree.ClipVolume = class extends THREE.Object3D{
planeFrameGeometry.vertices.push(new THREE.Vector3(0.5, -0.5, 0.0));
}
this.dimension = new THREE.Vector3(1,1,1);
this.dimension = new THREE.Vector3(1, 1, 1);
this.material = new THREE.MeshBasicMaterial( {
color: 0x00ff00,
transparent: true,
@ -109,7 +109,7 @@ Potree.ClipVolume = class extends THREE.Object3D{
shaft.name = name + "_shaft";
let headGeometry = new THREE.CylinderGeometry(0, 0.04, 0.1, 10, 1, false);
let headMaterial = material;
let headMaterial = material;
let head = new THREE.Mesh(headGeometry, headMaterial);
head.name = name + "_head";
head.position.y = 1;
@ -126,8 +126,8 @@ Potree.ClipVolume = class extends THREE.Object3D{
this.arrowY = createArrow("arrow_y", new THREE.Vector3(0, 1, 0), 0x00FF00);
this.arrowZ = createArrow("arrow_z", new THREE.Vector3(0, 0, 1), 0x0000FF);
this.arrowX.rotation.z = -Math.PI/2;
this.arrowZ.rotation.x = Math.PI/2;
this.arrowX.rotation.z = -Math.PI / 2;
this.arrowZ.rotation.x = Math.PI / 2;
this.arrowX.visible = false;
this.arrowY.visible = false;
@ -198,22 +198,22 @@ Potree.ClipVolume = class extends THREE.Object3D{
if(!cs || !axis || !dir) return;
if(axis == "x") {
if(cs == "local") {
if(axis === "x") {
if(cs === "local") {
this.position.add(this.localX.clone().multiplyScalar(dir * this.clipOffset));
} else if(cs == "global") {
} else if(cs === "global") {
this.position.x = this.position.x + dir * this.clipOffset;
}
}else if(axis == "y") {
if(cs == "local") {
}else if(axis === "y") {
if(cs === "local") {
this.position.add(this.localY.clone().multiplyScalar(dir * this.clipOffset));
} else if(cs == "global") {
} else if(cs === "global") {
this.position.y = this.position.y + dir * this.clipOffset;
}
}else if(axis == "z") {
if(cs == "local") {
}else if(axis === "z") {
if(cs === "local") {
this.position.add(this.localZ.clone().multiplyScalar(dir * this.clipOffset));
} else if(cs == "global") {
} else if(cs === "global") {
this.position.z = this.position.z + dir * this.clipOffset;
}
}
@ -228,26 +228,26 @@ Potree.ClipVolume = class extends THREE.Object3D{
if(!cs || !axis || !dir) return;
if(cs == "local") {
if(axis == "x") {
this.rotateOnAxis(new THREE.Vector3(1, 0, 0), dir * this.clipRotOffset * Math.PI/180);
} else if(axis == "y") {
this.rotateOnAxis(new THREE.Vector3(0, 1, 0), dir * this.clipRotOffset * Math.PI/180);
} else if(axis == "z") {
this.rotateOnAxis(new THREE.Vector3(0, 0, 1), dir * this.clipRotOffset * Math.PI/180);
if(cs === "local") {
if(axis === "x") {
this.rotateOnAxis(new THREE.Vector3(1, 0, 0), dir * this.clipRotOffset * Math.PI / 180);
} else if(axis === "y") {
this.rotateOnAxis(new THREE.Vector3(0, 1, 0), dir * this.clipRotOffset * Math.PI / 180);
} else if(axis === "z") {
this.rotateOnAxis(new THREE.Vector3(0, 0, 1), dir * this.clipRotOffset * Math.PI / 180);
}
} else if(cs == "global") {
} else if(cs === "global") {
let rotaxis = new THREE.Vector4(1, 0, 0, 0);
if(axis == "y") {
if(axis === "y") {
rotaxis = new THREE.Vector4(0, 1, 0, 0);
} else if(axis == "z") {
} else if(axis === "z") {
rotaxis = new THREE.Vector4(0, 0, 1, 0);
}
this.updateMatrixWorld();
let invM = new THREE.Matrix4().getInverse(this.matrixWorld);
rotaxis = rotaxis.applyMatrix4(invM).normalize();
rotaxis = new THREE.Vector3(rotaxis.x, rotaxis.y, rotaxis.z);
this.rotateOnAxis(rotaxis, dir * this.clipRotOffset * Math.PI/180);
this.rotateOnAxis(rotaxis, dir * this.clipRotOffset * Math.PI / 180);
}
this.updateLocalSystem();

View File

@ -49,7 +49,7 @@ Potree.MeasuringTool = class MeasuringTool extends THREE.EventDispatcher {
measure: measure
});
measure.showDistances = (args.showDistances == null) ? true : args.showDistances;
measure.showDistances = (args.showDistances === null) ? true : args.showDistances;
measure.showArea = args.showArea || false;
measure.showAngles = args.showAngles || false;
measure.showCoordinates = args.showCoordinates || false;

View File

@ -9,7 +9,7 @@ Potree.PointCloudSM = class PointCloudSM{
this.shader = new Potree.Shader(this.gl, "shadow_map", Potree.Shaders['pointcloud_sm.vs'], Potree.Shaders['pointcloud_sm.fs']);
this.lightPos = new THREE.Vector3();
this.target = new THREE.WebGLRenderTarget(4*1024, 4*1024, {
this.target = new THREE.WebGLRenderTarget(4 * 1024, 4 * 1024, {
minFilter: THREE.LinearFilter,
magFilter: THREE.LinearFilter,
format: THREE.RGBAFormat,
@ -33,10 +33,10 @@ Potree.PointCloudSM = class PointCloudSM{
const border = 0;
const srcFormat = gl.RGB;
const srcType = gl.UNSIGNED_BYTE;
const pixel = new Uint8Array(3*width);
const pixel = new Uint8Array(3 * width);
gl.texImage2D(gl.TEXTURE_2D, level, internalFormat,
width, height, border, srcFormat, srcType,
pixel);
width, height, border, srcFormat, srcType,
pixel);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
@ -84,7 +84,7 @@ Potree.PointCloudSM = class PointCloudSM{
let visibilityTextureData = octree.computeVisibilityTextureData(nodes);
gl.bindTexture(gl.TEXTURE_2D, this.vnTexture);
let vnData = new Uint8Array(3*2048);
let vnData = new Uint8Array(3 * 2048);
vnData.set(visibilityTextureData.data);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, 2048, 1, 0, gl.RGB, gl.UNSIGNED_BYTE, vnData);
gl.bindTexture(gl.TEXTURE_2D, null);

View File

@ -58,7 +58,6 @@ Potree.PolygonClipVolume = class extends THREE.Object3D{
if(camera.isPerspectiveCamera) {
posWorld.unproject(camera);
var dir = posWorld.clone().sub(camera.position).normalize();
var distance = -camera.position.z / dir.z;
posWorld = camera.position.clone().add( dir.multiplyScalar(1));
} else {
posWorld.unproject(camera);
@ -69,7 +68,7 @@ Potree.PolygonClipVolume = class extends THREE.Object3D{
let width = e.viewer.scaleFactor * e.viewer.renderArea.clientWidth;
let height = e.viewer.scaleFactor * e.viewer.renderArea.clientHeight;
let aspect = width / height;
pos.y = pos.y * 1/aspect;
pos.y = pos.y * 1 / aspect;
pos.z = -pos.z;
marker.position.copy(pos);
};
@ -111,7 +110,7 @@ Potree.PolygonClipVolume = class extends THREE.Object3D{
if(this.markers.length > 0) {
this.remove(this.markers[this.markers.length - 1]);
this.markers.splice(this.markers.length - 1, 1);
this.markersPosWorld.splice(this.markersPosWorld.length -1, 1);
this.markersPosWorld.splice(this.markersPosWorld.length - 1, 1);
}
}

View File

@ -154,9 +154,18 @@ Potree.Volume = class extends THREE.Object3D {
}
set clip (value) {
this._clip = value;
this.update();
if(this._clip !== value){
this._clip = value;
this.update();
this.dispatchEvent({
type: "clip_changed",
object: this
});
}
}
get modifieable () {

View File

@ -25,4 +25,4 @@ Potree.toInterleavedBufferAttribute = function toInterleavedBufferAttribute(poin
}
return att;
}
};

View File

@ -70,7 +70,7 @@ class DistancePanel extends MeasurePanel{
let removeIconPath = Potree.resourcePath + '/icons/remove.svg';
this.elContent = $(`
<div class="measurement_content">
<div class="measurement_content selectable">
<span class="coordinates_table_container"></span>
<br>
<table id="distances_table" class="measurement_value_table"></table>
@ -84,9 +84,9 @@ class DistancePanel extends MeasurePanel{
</div>
`);
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update);
this.update();
}
@ -133,7 +133,7 @@ class PointPanel extends MeasurePanel{
let removeIconPath = Potree.resourcePath + '/icons/remove.svg';
this.elContent = $(`
<div class="measurement_content">
<div class="measurement_content selectable">
<span class="coordinates_table_container"></span>
<br>
<span class="attributes_table_container"></span>
@ -147,9 +147,9 @@ class PointPanel extends MeasurePanel{
</div>
`);
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update);
this.update();
}
@ -172,7 +172,7 @@ class AreaPanel extends MeasurePanel{
let removeIconPath = Potree.resourcePath + '/icons/remove.svg';
this.elContent = $(`
<div class="measurement_content">
<div class="measurement_content selectable">
<span class="coordinates_table_container"></span>
<br>
<span style="font-weight: bold">Area: </span>
@ -187,9 +187,9 @@ class AreaPanel extends MeasurePanel{
</div>
`);
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update);
this.update();
}
@ -211,7 +211,7 @@ class AnglePanel extends MeasurePanel{
let removeIconPath = Potree.resourcePath + '/icons/remove.svg';
this.elContent = $(`
<div class="measurement_content">
<div class="measurement_content selectable">
<span class="coordinates_table_container"></span>
<br>
<table class="measurement_value_table">
@ -236,9 +236,9 @@ class AnglePanel extends MeasurePanel{
</div>
`);
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update);
this.update();
}
@ -271,7 +271,7 @@ class HeightPanel extends MeasurePanel{
let removeIconPath = Potree.resourcePath + '/icons/remove.svg';
this.elContent = $(`
<div class="measurement_content">
<div class="measurement_content selectable">
<span class="coordinates_table_container"></span>
<br>
<span id="height_label">Height: </span><br>
@ -285,9 +285,9 @@ class HeightPanel extends MeasurePanel{
</div>
`);
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update);
this.update();
}
@ -320,7 +320,7 @@ class VolumePanel extends MeasurePanel{
let removeIconPath = Potree.resourcePath + '/icons/remove.svg';
this.elContent = $(`
<div class="measurement_content">
<div class="measurement_content selectable">
<span class="coordinates_table_container"></span>
<table class="measurement_value_table">
@ -378,6 +378,7 @@ class VolumePanel extends MeasurePanel{
this.propertiesPanel.addVolatileListener(measurement, "position_changed", this._update);
this.propertiesPanel.addVolatileListener(measurement, "orientation_changed", this._update);
this.propertiesPanel.addVolatileListener(measurement, "scale_changed", this._update);
this.propertiesPanel.addVolatileListener(measurement, "clip_changed", this._update);
this.update();
}
@ -420,6 +421,9 @@ class VolumePanel extends MeasurePanel{
let volume = this.measurement.getVolume();
elVolume.html(Potree.utils.addCommas(volume.toFixed(2)));
}
this.elCheckClip.prop("checked", this.measurement.clip);
}
}
@ -430,7 +434,7 @@ class ProfilePanel extends MeasurePanel{
let removeIconPath = Potree.resourcePath + '/icons/remove.svg';
this.elContent = $(`
<div class="measurement_content">
<div class="measurement_content selectable">
<span class="coordinates_table_container"></span>
<br>
<span style="display:flex">
@ -510,9 +514,9 @@ class ProfilePanel extends MeasurePanel{
this.propertiesPanel.viewer.profileWindowController.setProfile(measurement);
});
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update)
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update);
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update);
this.update();
}

View File

@ -160,11 +160,11 @@ Potree.Scene = class extends THREE.EventDispatcher{
this.clipVolumes = [];
this.polygonClipVolumes = [];
this.fpControls;
this.orbitControls;
this.earthControls;
this.geoControls;
this.inputHandler;
this.fpControls = null;
this.orbitControls = null;
this.earthControls = null;
this.geoControls = null;
this.inputHandler = null;
this.view = new Potree.View();
@ -577,11 +577,6 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
1, 0,
-1000, 1000
);
//let sg = new THREE.SphereGeometry(0.1, 32, 32);
//let sm = new THREE.MeshNormalMaterial();
//var s = new THREE.Mesh(sg, sm);
//this.overlay.add(s);
}
this.pRenderer = new Potree.Renderer(this.renderer);