reverted offset handling

This commit is contained in:
mschuetz 2014-11-12 17:25:09 +01:00
parent 9a6d1ee690
commit 7c1e2dd623
5 changed files with 22 additions and 22 deletions

View File

@ -175,9 +175,9 @@ POCLoader.load = function load(url, params) {
var offset = new THREE.Vector3(0,0,0);
if(toOrigin){
offset.set(min.x, min.y, min.z);
boundingBox.min.sub(offset);
boundingBox.max.sub(offset);
offset.set(-min.x, -min.y, -min.z);
boundingBox.min.add(offset);
boundingBox.max.add(offset);
}
pco.boundingBox = boundingBox;
pco.offset = offset;
@ -1638,7 +1638,7 @@ Potree.PointCloudOctree = function(geometry, material){
this.material = material;
this.visiblePointsTarget = 2*1000*1000;
this.level = 0;
this.position.add(geometry.offset);
this.position.sub(geometry.offset);
this.updateMatrix();
this.LODDistance = 20;
@ -2245,9 +2245,9 @@ Potree.PointCloudOctreeGeometryNode.prototype.load = function(){
Y = Y + dy;
Z = Z + dz;
x = X * scale.x - offset.x;
y = Y * scale.y - offset.y;
z = Z * scale.z - offset.z;
x = X * scale.x + offset.x;
y = Y * scale.y + offset.y;
z = Z * scale.z + offset.z;
r = br.read(8);
g = br.read(8);
@ -2292,9 +2292,9 @@ Potree.PointCloudOctreeGeometryNode.prototype.load = function(){
var uiView = new Uint8Array(buffer);
for(var i = 0; i < numPoints; i++){
positions[3*i+0] = fView[4*i+0] - node.pcoGeometry.offset.x;
positions[3*i+1] = fView[4*i+1] - node.pcoGeometry.offset.y;
positions[3*i+2] = fView[4*i+2] - node.pcoGeometry.offset.z;
positions[3*i+0] = fView[4*i+0] + node.pcoGeometry.offset.x;
positions[3*i+1] = fView[4*i+1] + node.pcoGeometry.offset.y;
positions[3*i+2] = fView[4*i+2] + node.pcoGeometry.offset.z;
color.setRGB(uiView[16*i+12], uiView[16*i+13], uiView[16*i+14]);
colors[3*i+0] = color.r / 255;

File diff suppressed because one or more lines are too long

View File

@ -66,7 +66,7 @@ Potree.PointCloudOctree = function(geometry, material){
this.material = material;
this.visiblePointsTarget = 2*1000*1000;
this.level = 0;
this.position.add(geometry.offset);
this.position.sub(geometry.offset);
this.updateMatrix();
this.LODDistance = 20;

View File

@ -101,9 +101,9 @@ Potree.PointCloudOctreeGeometryNode.prototype.load = function(){
Y = Y + dy;
Z = Z + dz;
x = X * scale.x - offset.x;
y = Y * scale.y - offset.y;
z = Z * scale.z - offset.z;
x = X * scale.x + offset.x;
y = Y * scale.y + offset.y;
z = Z * scale.z + offset.z;
r = br.read(8);
g = br.read(8);
@ -148,9 +148,9 @@ Potree.PointCloudOctreeGeometryNode.prototype.load = function(){
var uiView = new Uint8Array(buffer);
for(var i = 0; i < numPoints; i++){
positions[3*i+0] = fView[4*i+0] - node.pcoGeometry.offset.x;
positions[3*i+1] = fView[4*i+1] - node.pcoGeometry.offset.y;
positions[3*i+2] = fView[4*i+2] - node.pcoGeometry.offset.z;
positions[3*i+0] = fView[4*i+0] + node.pcoGeometry.offset.x;
positions[3*i+1] = fView[4*i+1] + node.pcoGeometry.offset.y;
positions[3*i+2] = fView[4*i+2] + node.pcoGeometry.offset.z;
color.setRGB(uiView[16*i+12], uiView[16*i+13], uiView[16*i+14]);
colors[3*i+0] = color.r / 255;

View File

@ -45,9 +45,9 @@ POCLoader.load = function load(url, params) {
var offset = new THREE.Vector3(0,0,0);
if(toOrigin){
offset.set(min.x, min.y, min.z);
boundingBox.min.sub(offset);
boundingBox.max.sub(offset);
offset.set(-min.x, -min.y, -min.z);
boundingBox.min.add(offset);
boundingBox.max.add(offset);
}
pco.boundingBox = boundingBox;
pco.offset = offset;