Loading data from greyhound, colors are still a bit off
This commit is contained in:
parent
e8a22bff88
commit
da93aa5aac
File diff suppressed because one or more lines are too long
14
build/potree/potree.min.js
vendored
14
build/potree/potree.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -116,6 +116,8 @@ Potree.PointCloudGreyhoundGeometryNode.prototype.getURL = function(){
|
||||
//
|
||||
// }
|
||||
|
||||
// console.log(JSON.stringify(schema));
|
||||
|
||||
var bb = this.boundingBox;
|
||||
var offset = this.pcoGeometry.offset;
|
||||
//var boundsString = (bb.min.x-offset.x) + ',' + (bb.min.y-offset.y) + ',' + (bb.min.z-offset.z) + ',' + (bb.max.x-offset.x) + ',' + (bb.max.y-offset.y) + ',' + (bb.max.z-offset.z);
|
||||
|
||||
@ -109,6 +109,7 @@ Potree.GreyhoundBinaryLoader.prototype.parse = function(node, buffer){
|
||||
min: [ node.boundingBox.min.x, node.boundingBox.min.y, node.boundingBox.min.z ],
|
||||
max: [ node.boundingBox.max.x, node.boundingBox.max.y, node.boundingBox.max.z ],
|
||||
offset: [node.pcoGeometry.offset.x, node.pcoGeometry.offset.y, node.pcoGeometry.offset.z],
|
||||
bbOffset: [node.pcoGeometry.bbOffset.x, node.pcoGeometry.bbOffset.y, node.pcoGeometry.bbOffset.z],
|
||||
scale: this.scale
|
||||
};
|
||||
ww.postMessage(message, [message.buffer]);
|
||||
|
||||
@ -78,9 +78,19 @@ Potree.GreyhoundLoader.load = function load(url, callback) {
|
||||
var boundingBox = new THREE.Box3(min, max);
|
||||
var tightBoundingBox = boundingBox.clone();
|
||||
|
||||
var offset = new THREE.Vector3(0,0,0);
|
||||
var nodeOffset = new THREE.Vector3(0,0,0);
|
||||
var globalOffset = new THREE.Vector3(0,0,0);
|
||||
|
||||
offset.set(-min.x, -min.y, -min.z);
|
||||
var extent = {'x': max.x - min.x, 'y': max.y - min.y, 'z': max.z - min.z};
|
||||
|
||||
// x = 1000 - 1200
|
||||
// min.x = 1000
|
||||
// extent.x = 200
|
||||
// min.x+0.5*extent.x = 1100
|
||||
|
||||
globalOffset.set(min.x+0.5*extent.x, min.y+0.5*extent.y, min.z+0.5*extent.z);
|
||||
|
||||
nodeOffset.set(-0.5*extent.x, -0.5*extent.y, -0.5*extent.z);
|
||||
|
||||
// boundingBox.min.add(offset);
|
||||
// boundingBox.max.add(offset);
|
||||
@ -93,7 +103,8 @@ Potree.GreyhoundLoader.load = function load(url, callback) {
|
||||
pgg.tightBoundingBox = tightBoundingBox;
|
||||
pgg.boundingSphere = boundingBox.getBoundingSphere();
|
||||
pgg.tightBoundingSphere = tightBoundingBox.getBoundingSphere();
|
||||
pgg.offset = offset;
|
||||
pgg.bbOffset = nodeOffset;
|
||||
pgg.offset = globalOffset;
|
||||
pgg.scale = SCALE; //greyhoundInfo.scale;
|
||||
|
||||
pgg.loader = new Potree.GreyhoundBinaryLoader(version, boundingBox, pgg.scale);
|
||||
|
||||
@ -45,6 +45,7 @@ onmessage = function(event){
|
||||
var min = event.data.min;
|
||||
var max = event.data.max;
|
||||
var nodeOffset = event.data.offset;
|
||||
var nodeOffset = event.data.bbOffset;
|
||||
var scale = event.data.scale;
|
||||
var tightBoxMin = [ Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY];
|
||||
var tightBoxMax = [ Number.NEGATIVE_INFINITY , Number.NEGATIVE_INFINITY , Number.NEGATIVE_INFINITY ];
|
||||
@ -63,10 +64,10 @@ onmessage = function(event){
|
||||
var buff = new ArrayBuffer(numPoints*4*3);
|
||||
var positions = new Float32Array(buff);
|
||||
|
||||
for(var j = 0; j < numPoints; j++){
|
||||
positions[3*j+0] = (cv.getUint32(offset + j*pointAttributes.byteSize+0) - min[0]) / extent.x;
|
||||
positions[3*j+1] = (cv.getUint32(offset + j*pointAttributes.byteSize+4) - min[1]) / extent.y;
|
||||
positions[3*j+2] = (cv.getUint32(offset + j*pointAttributes.byteSize+8) - min[2]) / extent.z;
|
||||
for (var j = 0; j < numPoints; j++) {
|
||||
positions[3*j+0] = (cv.getUint32(offset + j*pointAttributes.byteSize+0) - nodeOffset[0]);
|
||||
positions[3*j+1] = (cv.getUint32(offset + j*pointAttributes.byteSize+4) - nodeOffset[1]);
|
||||
positions[3*j+2] = (cv.getUint32(offset + j*pointAttributes.byteSize+8) - nodeOffset[2]);
|
||||
|
||||
tightBoxMin[0] = Math.min(tightBoxMin[0], positions[3*j+0]);
|
||||
tightBoxMin[1] = Math.min(tightBoxMin[1], positions[3*j+1]);
|
||||
@ -86,9 +87,13 @@ onmessage = function(event){
|
||||
var colors = new Float32Array(buff);
|
||||
|
||||
for(var j = 0; j < numPoints; j++){
|
||||
// console.log(cv.getUint8(offset + j*pointAttributes.byteSize + 0));
|
||||
// console.log(cv.getUint8(offset + j*pointAttributes.byteSize + 1));
|
||||
// console.log(cv.getUint8(offset + j*pointAttributes.byteSize + 2));
|
||||
|
||||
colors[3*j+0] = cv.getUint8(offset + j*pointAttributes.byteSize + 0) / 255;
|
||||
colors[3*j+1] = cv.getUint8(offset + j*pointAttributes.byteSize + 1) / 255;
|
||||
colors[3*j+2] = cv.getUint8(offset + j*pointAttributes.byteSize + 2) / 255;
|
||||
colors[3*j+2] = cv.getUint8(offset + j*pointAttributes.byteSize + 2) / 255;
|
||||
}
|
||||
|
||||
attributeBuffers[pointAttribute.name] = { buffer: buff, attribute: pointAttribute};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user