maplibre-native
maplibre-native copied to clipboard
TypeScript shaders
This is based on @birkskyum's work on generating the shaders from MapLibre GL JS after the TypeScript migration.
To make the diff a bit smaller, I commented some lines in the GL JS submodule the generate-shaders.ts script to strip less white spaces.
I don't know if this works...
function glslToTs(code: string): string {
code = code
.trim() // strip whitespace at the start/end
.replace(/\s*\/\/[^\n]*\n/g, '\n') // strip double-slash comments
.replace(/\n+/g, '\n'); // collapse multi line breaks
//.replace(/\n\s+/g, '\n') // strip identation
//.replace(/\s?([+-\/*=,])\s?/g, '$1') // strip whitespace around operators
//.replace(/([;\(\),\{\}])\n(?=[^#])/g, '$1'); // strip more line breaks
@HarelM Let's see where this goes. I think we should first update the shaders to the version right before the TypeScript migration, see #304, and then look into the TypeScript stuff...
I'd love to help out, but I'm not sure I know how. Ping me on slack and we'll discuss further.
We should first update the submodule to before the TypeScript migration https://github.com/maplibre/maplibre-gl-native/issues/309
The recent removal of MapLibre GL JS from this repo, as well as the transition of the shaders to OpenGL ES 3 makes this work obsolete.