PAIR-code / megaplot

Apache License 2.0
19 stars 5 forks source link

Refactor GLSL code into .glsl files #51

Open jimbojw opened 1 year ago

jimbojw commented 1 year ago

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 commented 1 year ago

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.