EPT format updates.

This commit is contained in:
Connor Manning 2018-10-02 20:52:01 -05:00
parent b234b77776
commit c644255b14
5 changed files with 42 additions and 24 deletions

View File

@ -413,7 +413,7 @@ Potree.loadPointCloud = function (path, name, callback) {
// load pointcloud
if (!path) {
// TODO: callback? comment? Hello? Bueller? Anyone?
} else if (path.indexOf('entwine.json') > 0) {
} else if (path.indexOf('ept.json') > 0) {
Potree.EptLoader.load(path, function(geometry) {
if (!geometry) {
failed();
@ -4888,7 +4888,7 @@ Potree.EptLoader = class {
let response = await fetch(file);
let json = await response.json();
let url = file.substr(0, file.lastIndexOf('entwine.json'));
let url = file.substr(0, file.lastIndexOf('ept.json'));
let geometry = new Potree.PointCloudEptGeometry(url, json);
let root = new Potree.PointCloudEptGeometryNode(geometry);
@ -11516,6 +11516,11 @@ var toArray = function(b) {
return [b.min.x, b.min.y, b.min.z, b.max.x, b.max.y, b.max.z];
}
var findDim = function(schema, name) {
var dim = schema.find((dim) => dim.name == name);
if (!dim) throw new Error('Failed to find ' + name + ' in schema');
}
Potree.PointCloudEptGeometry = class {
constructor(url, info) {
let version = info.version;
@ -11523,9 +11528,9 @@ Potree.PointCloudEptGeometry = class {
let bounds = info.bounds;
let boundsConforming = info.boundsConforming;
let scale = info.scale || [1, 1, 1];
if (!Array.isArray(scale)) scale = [scale, scale, scale];
let offset = info.offset || [0, 0, 0];
let xyz = [find(schema, 'X'), find(schema, 'Y'), find(schema, 'Z')];
let scale = xyz.map((d) => d.scale || 1);
let offset = xyz.map((d) => d.offset || 0);
this.eptScale = toVector3(scale);
this.eptOffset = toVector3(offset);
@ -11543,7 +11548,9 @@ Potree.PointCloudEptGeometry = class {
this.tightBoundingSphere = this.tightBoundingBox.getBoundingSphere();
this.version = new Potree.Version('1.6');
this.projection = info.srs;
if (info.srs && info.srs.horizontal) {
this.projection = info.srs.authority + ':' + info.srs.horizontal;
}
this.pointAttributes = 'LAZ';
this.spacing =
(this.boundingBox.max.x - this.boundingBox.min.x) / this.ticks;
@ -11695,7 +11702,9 @@ Potree.PointCloudEptGeometryNode = class extends Potree.PointCloudTreeNode {
nodes[this.filename()] = this;
this.hasChildren = false;
let eptHierarchyFile = `${this.ept.url}h/${this.filename()}.json`;
let eptHierarchyFile =
`${this.ept.url}ept-hierarchy/${this.filename()}.json`;
let response = await fetch(eptHierarchyFile);
let hier = await response.json();

View File

@ -10,6 +10,11 @@ var toArray = function(b) {
return [b.min.x, b.min.y, b.min.z, b.max.x, b.max.y, b.max.z];
}
var findDim = function(schema, name) {
var dim = schema.find((dim) => dim.name == name);
if (!dim) throw new Error('Failed to find ' + name + ' in schema');
}
Potree.PointCloudEptGeometry = class {
constructor(url, info) {
let version = info.version;
@ -17,9 +22,9 @@ Potree.PointCloudEptGeometry = class {
let bounds = info.bounds;
let boundsConforming = info.boundsConforming;
let scale = info.scale || [1, 1, 1];
if (!Array.isArray(scale)) scale = [scale, scale, scale];
let offset = info.offset || [0, 0, 0];
let xyz = [find(schema, 'X'), find(schema, 'Y'), find(schema, 'Z')];
let scale = xyz.map((d) => d.scale || 1);
let offset = xyz.map((d) => d.offset || 0);
this.eptScale = toVector3(scale);
this.eptOffset = toVector3(offset);
@ -37,7 +42,9 @@ Potree.PointCloudEptGeometry = class {
this.tightBoundingSphere = this.tightBoundingBox.getBoundingSphere();
this.version = new Potree.Version('1.6');
this.projection = info.srs;
if (info.srs && info.srs.horizontal) {
this.projection = info.srs.authority + ':' + info.srs.horizontal;
}
this.pointAttributes = 'LAZ';
this.spacing =
(this.boundingBox.max.x - this.boundingBox.min.x) / this.ticks;
@ -189,7 +196,9 @@ Potree.PointCloudEptGeometryNode = class extends Potree.PointCloudTreeNode {
nodes[this.filename()] = this;
this.hasChildren = false;
let eptHierarchyFile = `${this.ept.url}h/${this.filename()}.json`;
let eptHierarchyFile =
`${this.ept.url}ept-hierarchy/${this.filename()}.json`;
let response = await fetch(eptHierarchyFile);
let hier = await response.json();

View File

@ -328,7 +328,7 @@ Potree.loadPointCloud = function (path, name, callback) {
// load pointcloud
if (!path) {
// TODO: callback? comment? Hello? Bueller? Anyone?
} else if (path.indexOf('entwine.json') > 0) {
} else if (path.indexOf('ept.json') > 0) {
Potree.EptLoader.load(path, function(geometry) {
if (!geometry) {
failed();

View File

@ -9,7 +9,7 @@ Potree.EptLoader = class {
let response = await fetch(file);
let json = await response.json();
let url = file.substr(0, file.lastIndexOf('entwine.json'));
let url = file.substr(0, file.lastIndexOf('ept.json'));
let geometry = new Potree.PointCloudEptGeometry(url, json);
let root = new Potree.PointCloudEptGeometryNode(geometry);

View File

@ -35,16 +35,16 @@ onmessage = function(event) {
let getExtractor = (name) => {
let offset = dimOffset(name);
switch (dimensions[name].type) {
case 'int8' : return (pos) => view.getInt8(pos + offset);
case 'int16' : return (pos) => view.getInt16(pos + offset, true);
case 'int32' : return (pos) => view.getInt32(pos + offset, true);
case 'int64' : return (pos) => view.getInt64(pos + offset, true);
case 'uint8' : return (pos) => view.getUint8(pos + offset);
case 'uint16': return (pos) => view.getUint16(pos + offset, true);
case 'uint32': return (pos) => view.getUint32(pos + offset, true);
case 'uint64': return (pos) => view.getUint64(pos + offset, true);
case 'float' : return (pos) => view.getFloat32(pos + offset, true);
case 'double': return (pos) => view.getFloat64(pos + offset, true);
case 'int8' : return (p) => view.getInt8(p + offset);
case 'int16' : return (p) => view.getInt16(p + offset, true);
case 'int32' : return (p) => view.getInt32(p + offset, true);
case 'int64' : return (p) => view.getInt64(p + offset, true);
case 'uint8' : return (p) => view.getUint8(p + offset);
case 'uint16': return (p) => view.getUint16(p + offset, true);
case 'uint32': return (p) => view.getUint32(p + offset, true);
case 'uint64': return (p) => view.getUint64(p + offset, true);
case 'float' : return (p) => view.getFloat32(p + offset, true);
case 'double': return (p) => view.getFloat64(p + offset, true);
default: throw new Error('Invalid dimension type: ' + type);
};
};