Repository navigation
feat(geo-layers): honor normalized terrain and 3D tile colors - #11166
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bcb40271bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
[Medium impact] The changes appear safe to merge. SummaryAdds support for normalized application colors in terrain and 3D tiles while preserving built-in defaults and tile-provided colors.
No new actionable issues found. The earlier color-refresh and helper-comment findings are addressed. Reviews (3) · Last reviewed commit: "fix(geo-layers): type byte defaults and ..." · Reviewed by Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bcb4027. Configure here.
chrisgervang
left a comment
There was a problem hiding this comment.
Reviewed 861bb9a after merge; follow-ups below. One P1 in the docs, outside the diff. Terrain and Tile3D colors are converted once at the sublayer boundary, and the toggle fixes from the earlier threads hold on master.
P1: docs/api-reference/geo-layers/tile-3d-layer.md still says getPointColor components are "in the 0-255 range" (line 288) and _getMeshColor returns values "in the 0-255 range" (line 320). The guide in using-layers.md#normalized-colors lists both as following normalizedColors. Could we qualify both entries with a link to that section?
Labels: P1 settle before this is merged, P2 can follow, Non-blocking optional.
Generated by Claude Code
| test('Tile3DLayer converts normalized mesh colors at the sublayer boundary', () => { | ||
| const layer = new Tile3DLayer({_getMeshColor: () => [1, 0.5, 0]}); | ||
| layer.context = {normalizedColors: true} as typeof layer.context; | ||
| const tileHeader = { | ||
| id: 'normalized-mesh-tile', | ||
| type: TILE_TYPE.MESH, | ||
| content: { | ||
| attributes: {positions: {value: new Float32Array([0, 0, 0]), size: 3}}, | ||
| indices: {value: new Uint16Array([0]), size: 1}, | ||
| cartographicOrigin: [0, 0, 0], | ||
| coordinateSystem: 'lnglat' | ||
| } | ||
| }; | ||
|
|
||
| // @ts-expect-error Calling the private sublayer factory for test-only validation. | ||
| const normalized = layer._makeSimpleMeshLayer(tileHeader); | ||
| expect(normalized.props.getColor).toEqual([255, 128, 0, 255]); | ||
|
|
||
| layer.context.normalizedColors = false; | ||
| // @ts-expect-error Calling the private sublayer factory for test-only validation. | ||
| const legacy = layer._makeSimpleMeshLayer(tileHeader); | ||
| expect(legacy.props.getColor).toEqual([1, 0.5, 0]); | ||
| }); |
There was a problem hiding this comment.
P2: This covers mesh colors only. The point-cloud toggle fix from the earlier thread and the TerrainLayer fallback color have no test, so a regression in either still passes CI.
Could we add a point-cloud case that toggles normalizedColors with a function getPointColor?
Generated by Claude Code
| import {type Color, _packNormalizedColor as packNormalizedColor} from '@deck.gl/core'; | ||
|
|
||
| /** Pack normalized plain arrays into bytes and pass through typed array inputs. */ | ||
| export function toByteColor(color: Color): Color { |
There was a problem hiding this comment.
Non-blocking: This is the third copy of toByteColor (also in aggregation-layers and fill-style). CompositeLayer.getSubLayerColorAccessor from #11160 already packs constants and accessor results. Could these layers use it?
Generated by Claude Code

For #11146. Pack application-supplied TerrainLayer and Tile3DLayer plain-array colors at the byte-encoded sublayer boundary. Preserve tile-supplied colors and built-in defaults. Cached Tile3DLayer sublayers refresh when the Deck option changes.
Validation
Note
Low Risk
Low risk change that transforms normalized color inputs to byte values across sublayer boundaries without altering core data-loading or tile-processing logic.
Overview
Converts application-supplied normalized colors (0–1 range) to byte colors (0–255) at the sublayer boundary for
TerrainLayerandTile3DLayer. This ensures that fallback terrain colors, point cloud colors (getPointColor), and mesh colors (_getMeshColor) properly honor deck.gl'snormalizedColorsmode while preserving tile-supplied data and default values.Tile3DLayerandTerrainLayeralso track changes tonormalizedColorsin update triggers, invalidating and re-rendering cached sublayers whenever the normalization setting toggles.Reviewed by Cursor Bugbot for commit 861bb9a. Bugbot is set up for automated code reviews on this repo. Configure here.