[Feat] Use the MapLibre CustomRenderMethod instead of private properties
Target Use Case
Motivation: https://github.com/maplibre/maplibre-gl-js/issues/3080
Proposal
To use the new return values (https://github.com/maplibre/maplibre-gl-js/pull/3136/files) to clean up the synchronization code.
This new API exposes the matrix? that's great. It would be even nicer if deck.gl could supply a matrix (would enable advanced use cases like first person views, stereoscopic rendering etc).
These are exposed now:
type CustomRenderMethodInput = {
/**
* This value represents the distance from the camera to the far clipping plane.
* It is used in the calculation of the projection matrix to determine which objects are visible.
* farz should be larger than nearZ.
*/
farZ: number;
/**
* This value represents the distance from the camera to the near clipping plane.
* It is used in the calculation of the projection matrix to determine which objects are visible.
* nearZ should be smaller than farZ.
*/
nearZ: number;
/** field of view of camera **/
fov: number;
/**
* model view projection matrix
* represents the matrix converting from world space to clip space
* https://learnopengl.com/Getting-started/Coordinate-Systems
* **/
modelViewProjectionMatrix: mat4;
/**
* projection matrix
* represents the matrix converting from view space to clip space
* https://learnopengl.com/Getting-started/Coordinate-Systems
*/
projectionMatrix: mat4;
}
That's an intersting idea - feel free to make a feature request for it in the maplibre-gl-js repo with these use-cases and which exact matrix is in question, we've recently tried to clean up the naming (modelViewProjectionMatrix / projectionMatrix).
Just realized, this was actually only included in the newly released 4.5.1 version. Release notes here