-
-
Notifications
You must be signed in to change notification settings - Fork 925
Description
I am currently in the process of making the MapLibre-project at my job functional in earlier browser versions. In our project we have a CustomLayer, in which I am passing the defaultProjectionData from its render-function to a glsl shader.
The fallbackMatrix and mainMatrix are typed as mat4, implying they are Float32Array, but in reality they are Float64Array being cast to any to circumvent the types of gl-matrix (see #326 (comment)).
Currently gl.uniformMatrix4fv accepts any Iterable returning numbers, but chrome <68 only accepted Float32Array or Array<number>, causing the CustomLayer to fail when trying to set the uniform.
as #326 (comment) mentioned:
It might be good to consider making a 64bit version/extend glmatrix to play better with Typescript for things like this..
which I agree with. It would be cool if gl-matrix had mat<Float64Array>! Else we could maybe add type annotations in the jsdoc?
The fallbackMatrix and mainMatrix are only 2 examples of this cast, it happens at multiple occasions throughout the codebase.