Vector draping API: how should a collection select which 3D Tiles it drapes onto?
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
Follow-up from #13653, which adds `heightReference` to `BufferPolylineCollection` and `BufferPolygonCollection`:
```js
const parks = new Cesium.BufferPolygonCollection({
heightReference: Cesium.HeightReference.CLAMP_TO_3D_TILE,
});
scene.primitives.add(parks);
```
### Current behavior
`heightReference` selects a *kind of surface*, not a specific target:
- `CLAMP_TO_TERRAIN` — the globe
- `CLAMP_TO_3D_TILE` — every 3D Tiles content and `Model` in the scene
- `CLAMP_TO_GROUND` — both
Any model whose rectangle intersects the collection gets the vectors draped onto it. With OSM Buildings and a photogrammetry tileset both loaded, the same polygons appear on both. There is no way to opt out.
### The gap
There is no per-target selection. Two shapes seem plausible:
**A. Opt-out on the target**
```js
tileset.clampVectors = false;
```
Minimal, backward compatible, coarse.
**B. Whitelist on the target**
```js
tileset.vectorCollections = [parks];
```
More expressive, but needs conflict semantics: if a collection asks to drape and the target does not list it, who wins?
### Questions
1. Is per-target selection needed for 1.145, or is "all 3D Tiles" acceptable to start?
2. If needed, opt-out or whitelist?
3. Should the property live on `Cesium3DTileset`, on `Model`, or both?
Happy to implement whichever shape we land on the change is small on our side (one condition in `updateVectorLookup`, one filter in `requestTileDataForRectangle`).
Contributor guide
Assessment
This issue has not been assessed yet.