fixed 'toOrigin' option for large coordinates

This commit is contained in:
mschuetz 2014-08-25 16:28:49 +02:00
parent 971ba6c5f6
commit 4c5fd092a3
5 changed files with 20 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -152,9 +152,9 @@ Potree.LasLazBatcher = function(node, url){
var fPositions = new Float32Array(positions);
for(var i = 0; i < numPoints; i++){
fPositions[3*i+0] += node.pcoGeometry.offset.x;
fPositions[3*i+1] += node.pcoGeometry.offset.y;
fPositions[3*i+2] += node.pcoGeometry.offset.z;
//fPositions[3*i+0] += node.pcoGeometry.offset.x;
//fPositions[3*i+1] += node.pcoGeometry.offset.y;
//fPositions[3*i+2] += node.pcoGeometry.offset.z;
classifications_f[i] = classifications[i];
@ -188,7 +188,8 @@ Potree.LasLazBatcher = function(node, url){
scale: lasBuffer.scale,
offset: lasBuffer.offset,
mins: [node.pcoGeometry.boundingBox.min.x, node.pcoGeometry.boundingBox.min.y, node.pcoGeometry.boundingBox.min.z],
maxs: [node.pcoGeometry.boundingBox.max.x, node.pcoGeometry.boundingBox.max.y, node.pcoGeometry.boundingBox.max.z]
maxs: [node.pcoGeometry.boundingBox.max.x, node.pcoGeometry.boundingBox.max.y, node.pcoGeometry.boundingBox.max.z],
bbOffset: [node.pcoGeometry.offset.x, node.pcoGeometry.offset.y, node.pcoGeometry.offset.z]
};
ww.postMessage(message, [message.buffer]);
}

View File

@ -62,6 +62,7 @@ onmessage = function(event){
var offset = event.data.offset;
var mins = event.data.mins;
var maxs = event.data.maxs;
var bbOffset = event.data.bbOffset;
var temp = new ArrayBuffer(4);
var tempUint8 = new Uint8Array(temp);
@ -108,9 +109,9 @@ onmessage = function(event){
//positions[3*i+1] = y * scale[1] + offset[1] - mins[1];
//positions[3*i+2] = z * scale[2] + offset[2] - mins[2];
positions[3*i+0] = x * scale[0] + offset[0];
positions[3*i+1] = y * scale[1] + offset[1];
positions[3*i+2] = z * scale[2] + offset[2];
positions[3*i+0] = x * scale[0] + offset[0] + bbOffset[0];
positions[3*i+1] = y * scale[1] + offset[1] + bbOffset[1];
positions[3*i+2] = z * scale[2] + offset[2] + bbOffset[2];
// INTENSITY
tempUint8[0] = bufferView[i*pointSize+12];