new format loader fixes
This commit is contained in:
parent
b8eff2fe66
commit
deee81a6a1
@ -18,7 +18,7 @@ Reference: [Potree: Rendering Large Point Clouds in Web Browsers](https://www.cg
|
||||
|
||||
### Build and Run
|
||||
|
||||
Make sure you have [node.js](http://nodejs.org/) installed
|
||||
Install [node.js](http://nodejs.org/)
|
||||
|
||||
Install all dependencies, as specified in package.json:
|
||||
|
||||
@ -26,14 +26,14 @@ Install all dependencies, as specified in package.json:
|
||||
npm install
|
||||
```
|
||||
|
||||
Use the `npm run build` command to
|
||||
Use `npm run build` to create ./build/potree.
|
||||
|
||||
Use the `npm start` command to
|
||||
|
||||
* create ./build/potree
|
||||
* watch for changes to the source code and automatically create a new build on change
|
||||
* start a web server at localhost:1234.
|
||||
|
||||
Use `npm start` to start a development server with automatic reloading whenever code changes.
|
||||
|
||||
Go to http://localhost:1234/examples/ to test the examples.
|
||||
|
||||
### Convert
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="http://potree.org/potree/examples/vr.html" target="_blank">
|
||||
<img src="examples/thumbnails/vr.jpg" width="100%" />
|
||||
<a href="http://potree.org/potree/examples/viewer.html" target="_blank">
|
||||
<img src="examples/thumbnails/viewer.png" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/oriented_images.html" target="_blank">
|
||||
@ -28,7 +28,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Virtual Reality</th><th>Oriented Images</th><th>Geopackage</th><th>Classifications</th><th>Camera Animation</th><th>Load Project</th>
|
||||
<th>Basic Viewer</th><th>Oriented Images</th><th>Geopackage</th><th>Classifications</th><th>Camera Animation</th><th>Load Project</th>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<a href="http://potree.org/potree/examples/toolbar.html" target="_blank">
|
||||
@ -39,8 +39,8 @@
|
||||
<img src="examples/thumbnails/matcap.jpg" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/viewer.html" target="_blank">
|
||||
<img src="examples/thumbnails/viewer.png" width="100%" />
|
||||
<a href="http://potree.org/potree/examples/vr.html" target="_blank">
|
||||
<img src="examples/thumbnails/vr.jpg" width="100%" />
|
||||
</a>
|
||||
</td><td>
|
||||
<a href="http://potree.org/potree/examples/heidentor.html" target="_blank">
|
||||
@ -57,7 +57,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Toolbar</th><th>Matcap</th><th>Basic Viewer</th><th>Heidentor</th><th>Lion</th><th>Lion LAS</th>
|
||||
<th>Toolbar</th><th>Matcap</th><th>Virtual Reality</th><th>Heidentor</th><th>Lion</th><th>Lion LAS</th>
|
||||
</tr><tr>
|
||||
<td>
|
||||
<a href="http://potree.org/potree/examples/lion_laz.html" target="_blank">
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"examples": [
|
||||
{"thumb": "thumbnails/vr.jpg", "label": "Virtual Reality", "url": "vr.html"},
|
||||
{"thumb": "thumbnails/viewer.png", "label": "Basic Viewer", "url": "viewer.html"},
|
||||
{"thumb": "thumbnails/oriented_images.jpg", "label": "Oriented Images", "url": "oriented_images.html"},
|
||||
{"thumb": "thumbnails/geopackage.jpg", "label": "Geopackage", "url": "geopackage.html"},
|
||||
{"thumb": "thumbnails/classifications.jpg", "label": "Classifications", "url": "classifications.html"},
|
||||
@ -9,7 +9,7 @@
|
||||
{"thumb": "thumbnails/toolbar.jpg", "label": "Toolbar", "url": "toolbar.html"},
|
||||
|
||||
{"thumb": "thumbnails/matcap.jpg", "label": "Matcap", "url": "matcap.html"},
|
||||
{"thumb": "thumbnails/viewer.png", "label": "Basic Viewer", "url": "viewer.html"},
|
||||
{"thumb": "thumbnails/vr.jpg", "label": "Virtual Reality", "url": "vr.html"},
|
||||
{"thumb": "thumbnails/heidentor.png", "label": "Heidentor", "url": "heidentor.html"},
|
||||
{"thumb": "thumbnails/lion.png", "label": "Lion", "url": "lion.html"},
|
||||
{"thumb": "thumbnails/lion_las.png", "label": "Lion LAS", "url": "lion_las.html"},
|
||||
|
||||
@ -696,7 +696,6 @@ export class Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let world = node.sceneNode.matrixWorld;
|
||||
worldView.multiplyMatrices(view, world);
|
||||
|
||||
@ -714,13 +713,18 @@ export class Renderer {
|
||||
shader.setUniform("uDebug", false);
|
||||
}
|
||||
|
||||
let isLeaf = false;
|
||||
if(node instanceof PointCloudOctreeNode){
|
||||
isLeaf = Object.keys(node.children).length === 0;
|
||||
}else if(node instanceof PointCloudArena4DNode){
|
||||
isLeaf = node.geometryNode.isLeaf;
|
||||
}
|
||||
shader.setUniform("uIsLeafNode", isLeaf);
|
||||
// let isLeaf = false;
|
||||
// if(node instanceof PointCloudOctreeNode){
|
||||
// isLeaf = Object.keys(node.children).length === 0;
|
||||
// }else if(node instanceof PointCloudArena4DNode){
|
||||
// isLeaf = node.geometryNode.isLeaf;
|
||||
// }
|
||||
// shader.setUniform("uIsLeafNode", isLeaf);
|
||||
|
||||
// let isLeaf = node.children.filter(n => n != null).length === 0;
|
||||
// if(!isLeaf){
|
||||
// continue;
|
||||
// }
|
||||
|
||||
|
||||
// TODO consider passing matrices in an array to avoid uniformMatrix4fv overhead
|
||||
|
||||
@ -17,59 +17,63 @@ export class NodeLoader{
|
||||
let byteOffset = node.byteOffset;
|
||||
let byteSize = node.byteSize;
|
||||
|
||||
let response = await fetch(this.url, {
|
||||
headers: {
|
||||
'content-type': 'multipart/byteranges',
|
||||
'Range': `bytes=${byteOffset}-${byteOffset + byteSize}`,
|
||||
},
|
||||
});
|
||||
try{
|
||||
let response = await fetch(this.url, {
|
||||
headers: {
|
||||
'content-type': 'multipart/byteranges',
|
||||
'Range': `bytes=${byteOffset}-${byteOffset + byteSize}`,
|
||||
},
|
||||
});
|
||||
|
||||
let workerPath = Potree.scriptPath + '/workers/OctreeDecoderWorker.js';
|
||||
let worker = Potree.workerPool.getWorker(workerPath);
|
||||
let workerPath = Potree.scriptPath + '/workers/OctreeDecoderWorker.js';
|
||||
let worker = Potree.workerPool.getWorker(workerPath);
|
||||
|
||||
worker.onmessage = function (e) {
|
||||
worker.onmessage = function (e) {
|
||||
|
||||
let data = e.data;
|
||||
let buffers = data.attributeBuffers;
|
||||
let data = e.data;
|
||||
let buffers = data.attributeBuffers;
|
||||
|
||||
Potree.workerPool.returnWorker(workerPath, worker);
|
||||
Potree.workerPool.returnWorker(workerPath, worker);
|
||||
|
||||
|
||||
let geometry = new THREE.BufferGeometry();
|
||||
|
||||
for(let property in buffers){
|
||||
let geometry = new THREE.BufferGeometry();
|
||||
|
||||
for(let property in buffers){
|
||||
|
||||
let buffer = buffers[property].buffer;
|
||||
let buffer = buffers[property].buffer;
|
||||
|
||||
if(property === "POSITION_CARTESIAN"){
|
||||
geometry.addAttribute('position', new THREE.BufferAttribute(new Float32Array(buffer), 3));
|
||||
}else if(property === "RGBA"){
|
||||
geometry.addAttribute('rgba', new THREE.BufferAttribute(new Uint8Array(buffer), 4, true));
|
||||
}
|
||||
|
||||
if(property === "POSITION_CARTESIAN"){
|
||||
geometry.addAttribute('position', new THREE.BufferAttribute(new Float32Array(buffer), 3));
|
||||
}else if(property === "RGBA"){
|
||||
geometry.addAttribute('rgba', new THREE.BufferAttribute(new Uint8Array(buffer), 4, true));
|
||||
}
|
||||
// indices ??
|
||||
|
||||
}
|
||||
// indices ??
|
||||
node.geometry = geometry;
|
||||
node.loaded = true;
|
||||
node.loading = false;
|
||||
Potree.numNodesLoading--;
|
||||
};
|
||||
|
||||
node.geometry = geometry;
|
||||
node.loaded = true;
|
||||
node.loading = false;
|
||||
Potree.numNodesLoading--;
|
||||
};
|
||||
let buffer = await response.arrayBuffer();
|
||||
|
||||
let buffer = await response.arrayBuffer();
|
||||
let pointAttributes = node.octreeGeometry.pointAttributes;
|
||||
let scale = node.octreeGeometry.scale;
|
||||
|
||||
let pointAttributes = node.octreeGeometry.pointAttributes;
|
||||
let scale = node.octreeGeometry.scale;
|
||||
|
||||
let message = {
|
||||
buffer: buffer,
|
||||
pointAttributes: pointAttributes,
|
||||
scale: scale,
|
||||
min: node.boundingBox.min,
|
||||
};
|
||||
|
||||
worker.postMessage(message, [message.buffer]);
|
||||
let message = {
|
||||
buffer: buffer,
|
||||
pointAttributes: pointAttributes,
|
||||
scale: scale,
|
||||
min: node.boundingBox.min,
|
||||
};
|
||||
|
||||
worker.postMessage(message, [message.buffer]);
|
||||
}catch(e){
|
||||
console.log(`failed to load ${node.name}`);
|
||||
console.log(`trying again!`);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user