colors fixed by asking for all available attributes from the greyhound server instead of a subset

This commit is contained in:
maartenvm 2016-02-25 12:14:03 +01:00
parent da93aa5aac
commit a6375c91db
6 changed files with 44 additions and 33 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

@ -74,29 +74,32 @@ Potree.PointCloudGreyhoundGeometryNode.prototype.getURL = function(){
}];
this.pcoGeometry.pointAttributes.attributes.forEach(function(item) {
if(material === Potree.PointColorType.RGB && item.name === Potree.PointAttributeNames.COLOR_PACKED) {
// if(material === Potree.PointColorType.RGB && item.name === Potree.PointAttributeNames.COLOR_PACKED) {
if(item.name === Potree.PointAttributeNames.COLOR_PACKED) {
schema.push({
"name": "Red",
"size": 1,
"size": 2,
"type": "unsigned"
});
schema.push({
"name": "Green",
"size": 1,
"size": 2,
"type": "unsigned"
});
schema.push({
"name": "Blue",
"size": 1,
"size": 2,
"type": "unsigned"
});
} else if(material === Potree.PointColorType.INTENSITY && item.name === Potree.PointAttributeNames.INTENSITY){
// } else if(material === Potree.PointColorType.INTENSITY && item.name === Potree.PointAttributeNames.INTENSITY){
} else if(item.name === Potree.PointAttributeNames.INTENSITY){
schema.push({
"name": "Intensity",
"size": 2,
"type": "unsigned"
});
} else if(material === Potree.PointColorType.CLASSIFICATION && item.name === Potree.PointAttributeNames.CLASSIFICATION){
// } else if(material === Potree.PointColorType.CLASSIFICATION && item.name === Potree.PointAttributeNames.CLASSIFICATION){
} else if(item.name === Potree.PointAttributeNames.CLASSIFICATION) {
schema.push({
"name": "Classification",
"size": 1,

View File

@ -88,9 +88,10 @@ Potree.GreyhoundLoader.load = function load(url, callback) {
// 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);
// globalOffset.set(min.x+0.5*extent.x, min.y+0.5*extent.y, min.z+0.5*extent.z);
globalOffset.set(min.x, min.y, min.z);
nodeOffset.set(-0.5*extent.x, -0.5*extent.y, -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);
@ -103,8 +104,8 @@ Potree.GreyhoundLoader.load = function load(url, callback) {
pgg.tightBoundingBox = tightBoundingBox;
pgg.boundingSphere = boundingBox.getBoundingSphere();
pgg.tightBoundingSphere = tightBoundingBox.getBoundingSphere();
pgg.bbOffset = nodeOffset;
pgg.offset = globalOffset;
pgg.bbOffset = globalOffset;
pgg.offset = nodeOffset;
pgg.scale = SCALE; //greyhoundInfo.scale;
pgg.loader = new Potree.GreyhoundBinaryLoader(version, boundingBox, pgg.scale);

View File

@ -45,7 +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 bbOffset = 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 ];
@ -56,7 +56,10 @@ onmessage = function(event){
var offset = 0;
console.log('number of bytes per point: ' + pointAttributes.attributes.length);
for(var i = 0; i < pointAttributes.attributes.length; i++){
// console.log(offset);
var pointAttribute = pointAttributes.attributes[i];
if(pointAttribute.name === Potree.PointAttribute.POSITION_CARTESIAN.name){
@ -91,9 +94,9 @@ onmessage = function(event){
// 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+0] = cv.getUint16(offset + j*pointAttributes.byteSize + 0) / 255;
colors[3*j+1] = cv.getUint16(offset + j*pointAttributes.byteSize + 2) / 255;
colors[3*j+2] = cv.getUint16(offset + j*pointAttributes.byteSize + 4) / 255;
}
attributeBuffers[pointAttribute.name] = { buffer: buff, attribute: pointAttribute};