3DTilesRendererJS icon indicating copy to clipboard operation
3DTilesRendererJS copied to clipboard

Controls: Remove / loosen dependency on TilesRenderer

Open gkjohnson opened this issue 9 months ago • 2 comments

The TilesRenderer is currently used to determine the transform and ellipsoid for the tile set - the controls should generally be useful for non 3d tiles data, though, that rely on a globe. As an alternative to the the tiles renderer the Environment / GlobeControls could take an ellipsoid with transform / object root to define the globe position:

controls.setEllipsoid( ellipsoid, matrixWorld );

// or

controls.setEllipsoid( ellipsoid, object );

Instead of tracking the tiles renderer itself of GlobeControls, we can keep a reference to the object representing the transform and ellipsoid:

this.tilesRenderer = tilesRenderer;

// to

this.ellipsoidFrame = tilesRenderer.group; 
this.ellipsoid = tilesRenderer.ellipsoid; 

gkjohnson avatar Apr 15 '25 01:04 gkjohnson

Great initiative. In my situation, I use the GlobeControls in scenes that do not necessarily have a TilesetRenderer, so I expose a fake implementation. The only thing that is "missing" from the point of view of the controls are the events when tiles are added/removed, but this does not seem to have a noticeable effect. I do inject a proper ellipsoid, though (typically the WGS84 ellipsoid in 99.999% of cases).

sguimmara avatar Apr 15 '25 12:04 sguimmara

The only thing that is "missing" from the point of view of the controls are the events when tiles are added/removed, but this does not seem to have a noticeable effect

Yeah the only reason these callbacks were added were to make sure that when zooming in without moving the mouse that you were zooming into tiles that may have changed due to the camera position changing. But realistically this is probably not a huge deal and can probably be removed even when a tiles renderer is present. We can revisit re-adding these kinds of events if there turn out to be issues.

gkjohnson avatar Apr 15 '25 23:04 gkjohnson