Skip to content

Fix(pointcloud): incorrect loading mechanism & add layer events#2673

Merged
Desplandis merged 2 commits intoiTowns:masterfrom
Desplandis:fix/pointcloud-update
Jan 28, 2026
Merged

Fix(pointcloud): incorrect loading mechanism & add layer events#2673
Desplandis merged 2 commits intoiTowns:masterfrom
Desplandis:fix/pointcloud-update

Conversation

@Desplandis
Copy link
Contributor

@Desplandis Desplandis commented Jan 19, 2026

Description

This PR fixes the current loading mechanism of pointclouds. Those were added directly visible on the scene on load and bypassed the notifyChange mechanism.

This PR also adds layer events for model load, error and dispose for end-users and debugging purpose (the events types were based on those of OGC3DTilesLayer).

Motivation and Context

This could maybe help #2665 #2666 (@ketourneau if you can rebase on this and see if it fixes at least the points pop?)

Based on #2672

@ketourneau
Copy link
Contributor

ketourneau commented Jan 20, 2026

Looks good for me, it solve #2665 but it confirm that #2666 it's not ready. There is a minor bug, probably when calculating the size of the points at certain times.

if (commonAncestor) {
return [commonAncestor];
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we want to removed that part (as you said it's never called) but an other solution might have been to try to make this part used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to remove unused (pre-mature) optimisation for now, until we manage to have a perfectly stable implementation of the point cloud update mechanism. Moreover, I do not use this code in the future priority-based mechanism.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but we might ask @jailln and @gchoqueux to agree ? Just to be sure ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for me to remove it

this.group.add(elt.obj);
elt.obj.updateMatrixWorld(true);
context.view.notifyChange(this);
this.dispatchEvent({ type: 'load-model', scene: pts, tile: elt });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently this event type is only listened in OGC3DTilesLayer.js and OGC3DTilesDebug.js.
And I don't see here any addEventListener for these... Is it really useful to add them then ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use them for debugging purpose and I think this would be a nice addition to users who want to change the material (model-load) or just if we wish to implement some sort of benchmarking.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed with @Desplandis , always useful for users to have access to such events

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I just currently don't see any use of them, we just need to be sure that they will be documented ;-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes they indeed need to be documented :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Desplandis Was this done ?

The previous implementation added the loaded and visible object
directly to the scene bypassing the notifyChange mechanism. The
updates from a common node ancestor were never triggered (no call
to notifyChange) and have also been removed.

The old mechanism directly Added the loaded object as visible into the scene and was not trigering the notify change mechanism. The preUpdate code was also removed since was never used (no notify change trigger with a node).
@Desplandis Desplandis force-pushed the fix/pointcloud-update branch from 36092d4 to e25e7f9 Compare January 28, 2026 14:57
@Desplandis Desplandis merged commit 4dedf1d into iTowns:master Jan 28, 2026
28 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants