maplibre-native icon indicating copy to clipboard operation
maplibre-native copied to clipboard

TypeScript shaders

Open wipfli opened this issue 2 years ago • 3 comments

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

wipfli avatar Jun 07 '22 12:06 wipfli

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

wipfli avatar Jun 07 '22 12:06 wipfli

I'd love to help out, but I'm not sure I know how. Ping me on slack and we'll discuss further.

HarelM avatar Jun 08 '22 03:06 HarelM

We should first update the submodule to before the TypeScript migration https://github.com/maplibre/maplibre-gl-native/issues/309

wipfli avatar Jul 18 '22 15:07 wipfli

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.

birkskyum avatar Apr 18 '23 09:04 birkskyum