Repository navigation
feat(core): add position preprojection support - #10740
Conversation
|
This comment has been minimized.
This comment has been minimized.
9796020 to
652227d
Compare
fce7860 to
27230f7
Compare
ibgreen
left a comment
There was a problem hiding this comment.
Just some notes from a linear readthrough, in case they are helpful
| const position: [number, number, number] = [input[0], input[1], input[2] ?? 0]; | ||
| if (this.props.modelMatrix) { | ||
| // Transform the local copy in place without allocating a matrix for each vertex. | ||
| vec3.transformMat4(position, position, this.props.modelMatrix); |
There was a problem hiding this comment.
Not ideal but perhaps unavoidable to do modelMatrix mults on CPU...
| } | ||
|
|
||
| if (viewport.projectionMode === PROJECTION_MODE.EXTERNAL) { | ||
| if (coordinateSystem === 'cartesian') { |
There was a problem hiding this comment.
This is a bit confusing to me. I would naively have expected that coordinateSystem would specify something like external rather than requiring users to match several constants.
There was a problem hiding this comment.
This use case is not specified by the user. Each layer is exposed to two world coordinate systems on CPU:
- world space (fromCrs, used by layer.props.data)
- preprojected world space (toCrs, packed into attributes, input to project shader module)
When a composite layer (aggregation layer, tiled layer) passes processed coordinates into sublayers, it needs a way to mark it as already preprojected, to skip another transform. catesian was used here because that's what MVTLayer uses to signal preprojected web-mercator coordinates (note: not common space).
| type TesselatorOptions<GeometryT, ExtraOptionsT> = ExtraOptionsT & { | ||
| attributes?: Record<string, any>; | ||
| getGeometry?: AccessorFunction<any, GeometryT>; | ||
| /** Transforms each position after input-space subdivision, before tessellation. */ |
There was a problem hiding this comment.
We now have optimized tesselation in math.gl, a faster version of earcut. Perhaps coordinate support could be included there.
| GLOBE: 2, | ||
|
|
||
| /** CPU-preprojected XY in common space; Z uses the viewport's distance scale. */ | ||
| CUSTOM_GEOSPATIAL: 3, |
There was a problem hiding this comment.
Stacked callers use removed mode When PR #10741 adds
CustomProjectionViewport, its projectionMode still returns PROJECTION_MODE.EXTERNAL. This rename removes that member, so the viewport returns undefined instead of the custom projection mode. Contour handling in PR #10743 and scale handling in PR #10745 also compare against the removed member, leaving those projection paths unable to recognize the custom mode. Update those stacked callers along with this rename.
c939175 to
17b6ac0
Compare
… Cartesian projection
17b6ac0 to
5c4198f
Compare
For #10739 (PR 1 of 6)
Add the core infrastructure for application-defined coordinate projections.
Changed list