megaplot icon indicating copy to clipboard operation
megaplot copied to clipboard

Refactor GLSL code into .glsl files

Open jimbojw opened this issue 3 years ago • 1 comments

Currently, the GLSL code for Megaplot is in large template strings in files under src/lib/shaders. As such, code support tooling such as syntax highlighting rarely works.

Instead, it would be better to have GLSL source code live in files with a .glsl extension. These could be loaded directly in TypeScript via the webpack-glsl-loader plugin, or by some other method.

jimbojw avatar Sep 19 '22 17:09 jimbojw

Complicating matters: a good amount of the GLSL code for Megaplot is generated (see src/lib/attribute-mapper.ts for example). Any solution should account for these generated fragments.

The generated code currently is generated in the browser on the fly, but it could be generated via a pre-processing step. See util/generate-code.ts for an example of current code generation.

jimbojw avatar Mar 14 '23 20:03 jimbojw