deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

[Feat] Use the MapLibre CustomRenderMethod instead of private properties

Open birkskyum opened this issue 1 year ago • 3 comments

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.

birkskyum avatar Jul 16 '24 19:07 birkskyum

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).

ibgreen avatar Jul 16 '24 19:07 ibgreen

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).

birkskyum avatar Jul 16 '24 20:07 birkskyum

Just realized, this was actually only included in the newly released 4.5.1 version. Release notes here

birkskyum avatar Aug 02 '24 11:08 birkskyum