Skip to content

Commit

Permalink
Update potree action
Browse files Browse the repository at this point in the history
The `load_potree_project_from_urlparam.html` has been updated to parse more urlparams, simplified the action by passing a JSON-parseable array of one potree dataset url rather than a complete potree project - which would allow for measurements, volumes, cam pos etc.
Also added a comment to https://potree.org/potree/examples/load_potree_project_from_urlparam.html which should be live once PR is merged by potree maintaining team
  • Loading branch information
jo-chemla committed Aug 29, 2024
1 parent 29866e0 commit 3320c40
Showing 1 changed file with 7 additions and 44 deletions.
51 changes: 7 additions & 44 deletions src/actions/assets/Potree.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,50 +25,14 @@ export default class Potree extends AssetActionPlugin {

get uri() {
// Docs: PR made to original potree repo to avoid relying on iconem own infrastructure
// https://github.com/potree/potree/pull/1456
// https://github.com/potree/potree/pull/1456
// would be accessible via https://potree.org/potree/examples/load_potree_project_from_urlparam.html
// Can also parse pointSize, FOV, opacity, edlEnabled, edlRadius, edlStrength, pointBudget, showBoundingBox, pointSizing, quality, position, target, background via loadSettingsFromURL
let uri = new URI("https://3d.iconem.com/tools/load_potree_project_from_urlparam.html");
uri.addQuery('fit', true);
uri.addQuery('c', 'elevation'); // rgba, elevation, intensity etc

const datasetUrl = this.component.href;
const potreeProject = {
"type": "Potree",
"version": 1.7,
"pointclouds": [
{
"url": datasetUrl,
"name": "Potree or COPC dataset",
"position": [0, 0, 0],
"rotation": [0, 0, 0, "XYZ" ],
"scale": [1, 1, 1],
"activeAttributeName": "rgba"
}
],
"settings": {
"pointBudget": 1000000,
"fov": 60,
"edlEnabled": true,
"edlStrength": 0.4,
"background": "gradient",
"edlRadius": 1.4,
"minNodeSize": 30,
"showBoundingBoxes": false
},
"measurements": [],
"volumes": [],
"cameraAnimations": [],
"profiles": [],
"annotations": [],
"objects": [],
// view can be anything since it is overwritten via url-param fit=true
"view": {
"position": [ 10, 10, 10 ],
"target": [ 0, 0, 0 ]
},
};
// uri.addQuery('potreeProjectJson', JSON.stringify(potreeProject));
console.log(potreeProject);
uri.addQuery('potreeDatasetUrl', datasetUrl); // potreeDatasetUrl or shortcut r
uri.addQuery('fit', 'true');
uri.addQuery('c', 'elevation'); // rgba, elevation, intensity etc
uri.addQuery('datasetsUrls', `["${datasetUrl}"]`);
return uri;
}

Expand All @@ -78,8 +42,7 @@ export default class Potree extends AssetActionPlugin {
uri.addQuery('c', 'rgba');
uri.addQuery('r', this.component.href);
// color type can be among rgba, elevation, color, elevation, etc
// potree_cloud_js_url = https://potree.org/potree/pointclouds/vol_total/cloud.js
// potree_darren_wiens_url = `https://mpc-copc-viewer.netlify.app/?r=${potree_cloud_js_url}&c=rgba`
// https://potree.org/potree/examples/copc.html?c=rgba&r=
return uri;
}

Expand Down

0 comments on commit 3320c40

Please sign in to comment.