Let shapes choose lit or flat shading, and say how a renderer that cannot drape falls back

ShapeItem.lit picks the renderer's fixed light or a flat colour; omitted,
extruded shapes and boxes are lit and the rest flat, as they were. The
Cesium draw port lights unclamped colour and image fills by it; clamped
shapes still drape unlit. A new reference scene, shapes-lit, draws a lit
and a flat box and square.

LineItem.mode now says a renderer that cannot drape at all draws draped
lines and clamped shapes as overlay, and clampState() says overlay. The
Cesium port says overlay when its context has no depth textures, which
only a WebGL 1 context can lack.
This commit is contained in:
Sameh Khamis committed 2026-11-08 13:11:25 -08:00
1 parent 8fe8b8e14d
commit e15cfb3e32
6 files changed
+87 -9

No files matched your search

+14 -2
View File
@@ -228,7 +228,11 @@ export interface LineItem {
/** ECEF positions, or packed `x, y, z` triples. */
positions: Ecef[] | Float64Array;
widthPx: number;
/** `3d`: straight in space; `geodesic`: along the ellipsoid; `draped`: on the surface. */
/**
* `3d`: straight in space; `geodesic`: along the ellipsoid; `draped`: on
* the surface. Where the renderer cannot drape at all, it draws `draped` lines
* and clamped shapes as in `overlay`, and `clampState()` says `overlay`.
*/
mode: '3d' | 'geodesic' | 'draped';
clampTo?: ClampTarget;
style: LineStyle;
@@ -322,6 +326,13 @@ export interface ShapeItem {
classifyVolume?: boolean;
/** Pull toward the eye, metres, to win depth against coplanar surfaces. */
depthBias?: number;
/**
* Shaded by the renderer's fixed light (true) or flat colour (false).
* Omitted: lit for extruded shapes and boxes, flat otherwise. A renderer
* may draw clamped shapes, which drape on the surface, flat whatever it
* says.
*/
lit?: boolean;
animate?: Pulse;
meta?: Meta;
show?: boolean;
@@ -560,7 +571,8 @@ export interface DrawPort {
* shapes) are draped onto the 3D tiles now (`draped`), or drawn over them
* and hidden past the ellipsoid's horizon (`overlay`), the fallback a
* renderer uses where it cannot drape. Without tiles in the base it is
* `draped`: clamping to terrain or the ellipsoid always drapes.
* `draped`: clamping to terrain or the ellipsoid always drapes, on a
* renderer that can drape at all (one that cannot is always `overlay`).
*/
clampState(): 'draped' | 'overlay';
/** Fires when `clampState()` changes (not on subscribing). */